First import
authorAndrey Paskal <apaskal@gmail.com>
Fri, 19 Dec 2008 12:37:54 +0000 (15:37 +0300)
committerAndrey Paskal <apaskal@gmail.com>
Fri, 19 Dec 2008 12:37:54 +0000 (15:37 +0300)
630 files changed:
Makefile [new file with mode: 0644]
README [new file with mode: 0644]
VERSION [new file with mode: 0644]
applications/ananas-cfg.dtd [new file with mode: 0644]
applications/money/money.cfg [new file with mode: 0644]
applications/money/money.rc [new file with mode: 0644]
build/altlinux/altlinux.spec [new file with mode: 0644]
build/fedora/fedora.spec [new file with mode: 0644]
build/icons/a-system.ico [new file with mode: 0644]
build/icons/a-system.png [new file with mode: 0644]
build/icons/ananas-16x16.png [new file with mode: 0644]
build/icons/ananas-32x32.png [new file with mode: 0644]
build/icons/ananas-designer.ico [new file with mode: 0644]
build/icons/ananas-designer.png [new file with mode: 0644]
build/icons/manual.ico [new file with mode: 0644]
build/mandriva/mandriva.spec [new file with mode: 0644]
build/menus/kde/README [new file with mode: 0644]
build/menus/kde/ananas [new file with mode: 0644]
build/menus/kde/ananas-designer [new file with mode: 0644]
build/menus/kde/ananas-designer.desktop [new file with mode: 0644]
build/menus/kde/ananas.desktop [new file with mode: 0644]
build/win32/AnanasInstall.iss [new file with mode: 0644]
build/win32/AnanasUpgrade.iss [new file with mode: 0644]
build/win32/setuplogo.bmp [new file with mode: 0644]
icons/a-system.ico [new file with mode: 0644]
icons/a-system.png [new file with mode: 0644]
icons/ananas-16x16.png [new file with mode: 0644]
icons/ananas-32x32.png [new file with mode: 0644]
icons/ananas-designer.ico [new file with mode: 0644]
icons/ananas_splach.cdr [new file with mode: 0644]
icons/lit.png [new file with mode: 0644]
icons/manual.ico [new file with mode: 0644]
src/admin/admin.pro [new file with mode: 0644]
src/admin/admin.qrc [new file with mode: 0644]
src/admin/atreeitems.cpp [new file with mode: 0644]
src/admin/atreeitems.h [new file with mode: 0644]
src/admin/deditpermissions.cpp [new file with mode: 0644]
src/admin/deditpermissions.h [new file with mode: 0644]
src/admin/deditpermissions.ui [new file with mode: 0644]
src/admin/deditrole.cpp [new file with mode: 0644]
src/admin/deditrole.h [new file with mode: 0644]
src/admin/deditrole.ui [new file with mode: 0644]
src/admin/dedituser.cpp [new file with mode: 0644]
src/admin/dedituser.h [new file with mode: 0644]
src/admin/dedituser.ui [new file with mode: 0644]
src/admin/dselectrole.cpp [new file with mode: 0644]
src/admin/dselectrole.h [new file with mode: 0644]
src/admin/dselectrole.ui [new file with mode: 0644]
src/admin/dselectuser.cpp [new file with mode: 0644]
src/admin/dselectuser.h [new file with mode: 0644]
src/admin/dselectuser.ui [new file with mode: 0644]
src/admin/images/administrator-splash-en.png [new file with mode: 0644]
src/admin/images/administrator-splash-ru.png [new file with mode: 0644]
src/admin/images/cat.png [new file with mode: 0644]
src/admin/images/cat_g.png [new file with mode: 0644]
src/admin/images/doc.png [new file with mode: 0644]
src/admin/images/doc_g.png [new file with mode: 0644]
src/admin/images/journ.png [new file with mode: 0644]
src/admin/images/journ_g.png [new file with mode: 0644]
src/admin/images/metadata.png [new file with mode: 0644]
src/admin/images/reg.png [new file with mode: 0644]
src/admin/images/reg_g.png [new file with mode: 0644]
src/admin/images/regs.png [new file with mode: 0644]
src/admin/images/report.png [new file with mode: 0644]
src/admin/images/report_g.png [new file with mode: 0644]
src/admin/images/role.png [new file with mode: 0644]
src/admin/images/user.png [new file with mode: 0644]
src/admin/images/users.png [new file with mode: 0644]
src/admin/main.cpp [new file with mode: 0644]
src/admin/mainform.cpp [new file with mode: 0644]
src/admin/mainform.h [new file with mode: 0644]
src/admin/mainform.ui [new file with mode: 0644]
src/admin/mdtree.cpp [new file with mode: 0644]
src/admin/mdtree.h [new file with mode: 0644]
src/admin/rolesform.cpp [new file with mode: 0644]
src/admin/rolesform.h [new file with mode: 0644]
src/admin/rolesform.ui [new file with mode: 0644]
src/admin/usersform.cpp [new file with mode: 0644]
src/admin/usersform.h [new file with mode: 0644]
src/admin/usersform.ui [new file with mode: 0644]
src/ananas.pri [new file with mode: 0644]
src/ananas/ananas.pro [new file with mode: 0644]
src/ananas/ananas.qrc [new file with mode: 0644]
src/ananas/bkground.jpg [new file with mode: 0644]
src/ananas/images/a-system.png [new file with mode: 0644]
src/ananas/images/cat.png [new file with mode: 0644]
src/ananas/images/d_document_turned.png [new file with mode: 0644]
src/ananas/images/document_turned.png [new file with mode: 0644]
src/ananas/images/editdelete.png [new file with mode: 0644]
src/ananas/images/editdelete2.png [new file with mode: 0644]
src/ananas/images/engine-splash-en.png [new file with mode: 0644]
src/ananas/images/engine-splash-ru.png [new file with mode: 0644]
src/ananas/images/field.png [new file with mode: 0644]
src/ananas/images/field2.png [new file with mode: 0644]
src/ananas/images/group.png [new file with mode: 0644]
src/ananas/images/group2.png [new file with mode: 0644]
src/ananas/images/lib_database.png [new file with mode: 0644]
src/ananas/images/lib_dbgroup.png [new file with mode: 0644]
src/ananas/images/msg_error.png [new file with mode: 0644]
src/ananas/images/msg_fatal.png [new file with mode: 0644]
src/ananas/images/msg_info.png [new file with mode: 0644]
src/ananas/images/msg_warning.png [new file with mode: 0644]
src/ananas/images/object_markdeleted.png [new file with mode: 0644]
src/ananas/images/t_cat_e.png [new file with mode: 0644]
src/ananas/images/t_cat_ed.png [new file with mode: 0644]
src/ananas/images/t_cat_g.png [new file with mode: 0644]
src/ananas/images/t_cat_gd.png [new file with mode: 0644]
src/ananas/images/t_doc.png [new file with mode: 0644]
src/ananas/images/t_doc_d.png [new file with mode: 0644]
src/ananas/images/t_doc_m.png [new file with mode: 0644]
src/ananas/images/t_doc_t.png [new file with mode: 0644]
src/ananas/images/t_doc_tm.png [new file with mode: 0644]
src/ananas/images/t_doc_to.png [new file with mode: 0644]
src/ananas/images/t_doc_tom.png [new file with mode: 0644]
src/ananas/main.cpp [new file with mode: 0644]
src/ananas/mainform.cpp [new file with mode: 0644]
src/ananas/mainform.h [new file with mode: 0644]
src/ananas/report.sxw [new file with mode: 0644]
src/ananas/report.tpl [new file with mode: 0644]
src/designer/actiontree.cpp [new file with mode: 0644]
src/designer/actiontree.h [new file with mode: 0644]
src/designer/aliaseditor.cpp [new file with mode: 0644]
src/designer/aliaseditor.h [new file with mode: 0644]
src/designer/atreeitems.cpp [new file with mode: 0644]
src/designer/atreeitems.h [new file with mode: 0644]
src/designer/cfgform.cpp [new file with mode: 0644]
src/designer/cfgform.h [new file with mode: 0644]
src/designer/cfgform.ui [new file with mode: 0644]
src/designer/deditaction.cpp [new file with mode: 0644]
src/designer/deditaction.h [new file with mode: 0644]
src/designer/deditaction.ui [new file with mode: 0644]
src/designer/deditareg.cpp [new file with mode: 0644]
src/designer/deditareg.h [new file with mode: 0644]
src/designer/deditareg.ui [new file with mode: 0644]
src/designer/deditcat.cpp [new file with mode: 0644]
src/designer/deditcat.h [new file with mode: 0644]
src/designer/deditcat.ui [new file with mode: 0644]
src/designer/deditcfg.cpp [new file with mode: 0644]
src/designer/deditcfg.h [new file with mode: 0644]
src/designer/deditcfg.ui [new file with mode: 0644]
src/designer/deditcolumns.cpp [new file with mode: 0644]
src/designer/deditcolumns.h [new file with mode: 0644]
src/designer/deditcolumns.ui [new file with mode: 0644]
src/designer/deditcommand.cpp [new file with mode: 0644]
src/designer/deditcommand.h [new file with mode: 0644]
src/designer/deditcommand.ui [new file with mode: 0644]
src/designer/deditdialog.cpp [new file with mode: 0644]
src/designer/deditdialog.h [new file with mode: 0644]
src/designer/deditdialog.ui [new file with mode: 0644]
src/designer/deditdoc.cpp [new file with mode: 0644]
src/designer/deditdoc.h [new file with mode: 0644]
src/designer/deditdoc.ui [new file with mode: 0644]
src/designer/deditfield.cpp [new file with mode: 0644]
src/designer/deditfield.h [new file with mode: 0644]
src/designer/deditfield.ui [new file with mode: 0644]
src/designer/deditimagecollection.cpp [new file with mode: 0644]
src/designer/deditimagecollection.h [new file with mode: 0644]
src/designer/deditimagecollection.ui [new file with mode: 0644]
src/designer/deditireg.cpp [new file with mode: 0644]
src/designer/deditireg.h [new file with mode: 0644]
src/designer/deditireg.ui [new file with mode: 0644]
src/designer/deditjournal.cpp [new file with mode: 0644]
src/designer/deditjournal.h [new file with mode: 0644]
src/designer/deditjournal.ui [new file with mode: 0644]
src/designer/deditlang.cpp [new file with mode: 0644]
src/designer/deditlang.h [new file with mode: 0644]
src/designer/deditlang.ui [new file with mode: 0644]
src/designer/deditreport.cpp [new file with mode: 0644]
src/designer/deditreport.h [new file with mode: 0644]
src/designer/deditreport.ui [new file with mode: 0644]
src/designer/deditrole.cpp [new file with mode: 0644]
src/designer/deditrole.h [new file with mode: 0644]
src/designer/deditrole.ui [new file with mode: 0644]
src/designer/dedittoolbar.cpp [new file with mode: 0644]
src/designer/dedittoolbar.h [new file with mode: 0644]
src/designer/dedittoolbar.ui [new file with mode: 0644]
src/designer/deditwebform.cpp [new file with mode: 0644]
src/designer/deditwebform.h [new file with mode: 0644]
src/designer/deditwebform.ui [new file with mode: 0644]
src/designer/designer.pro [new file with mode: 0644]
src/designer/designer.qrc [new file with mode: 0644]
src/designer/embed.cpp [new file with mode: 0644]
src/designer/embed.h [new file with mode: 0644]
src/designer/formdesigner.cpp [new file with mode: 0644]
src/designer/formdesigner.h [new file with mode: 0644]
src/designer/formdesigner/designer.qrc [new file with mode: 0644]
src/designer/formdesigner/formwindowsettings.cpp [new file with mode: 0644]
src/designer/formdesigner/formwindowsettings.h [new file with mode: 0644]
src/designer/formdesigner/formwindowsettings.ui [new file with mode: 0644]
src/designer/formdesigner/images/designer.png [new file with mode: 0644]
src/designer/formdesigner/images/mdi.png [new file with mode: 0644]
src/designer/formdesigner/images/sdi.png [new file with mode: 0644]
src/designer/formdesigner/images/workbench.png [new file with mode: 0644]
src/designer/formdesigner/newform.cpp [new file with mode: 0644]
src/designer/formdesigner/newform.h [new file with mode: 0644]
src/designer/formdesigner/newform.ui [new file with mode: 0644]
src/designer/formdesigner/plugindialog.cpp [new file with mode: 0644]
src/designer/formdesigner/plugindialog.h [new file with mode: 0644]
src/designer/formdesigner/plugindialog.ui [new file with mode: 0644]
src/designer/formdesigner/private/formscriptrunner_p.h [new file with mode: 0644]
src/designer/formdesigner/private/pluginmanager_p.h [new file with mode: 0644]
src/designer/formdesigner/private/qdesigner_formbuilder_p.h [new file with mode: 0644]
src/designer/formdesigner/private/qdesigner_integration_p.h [new file with mode: 0644]
src/designer/formdesigner/private/qtundo_p.h [new file with mode: 0644]
src/designer/formdesigner/private/shared_global_p.h [new file with mode: 0644]
src/designer/formdesigner/private/sheet_delegate_p.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_actioneditor.cpp [new file with mode: 0644]
src/designer/formdesigner/qdesigner_actioneditor.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_actions.cpp [new file with mode: 0644]
src/designer/formdesigner/qdesigner_actions.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_formwindow.cpp [new file with mode: 0644]
src/designer/formdesigner/qdesigner_formwindow.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_objectinspector.cpp [new file with mode: 0644]
src/designer/formdesigner/qdesigner_objectinspector.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_pch.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_propertyeditor.cpp [new file with mode: 0644]
src/designer/formdesigner/qdesigner_propertyeditor.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_resourceeditor.cpp [new file with mode: 0644]
src/designer/formdesigner/qdesigner_resourceeditor.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_settings.cpp [new file with mode: 0644]
src/designer/formdesigner/qdesigner_settings.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_signalsloteditor.cpp [new file with mode: 0644]
src/designer/formdesigner/qdesigner_signalsloteditor.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_toolwindow.cpp [new file with mode: 0644]
src/designer/formdesigner/qdesigner_toolwindow.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_widgetbox.cpp [new file with mode: 0644]
src/designer/formdesigner/qdesigner_widgetbox.h [new file with mode: 0644]
src/designer/formdesigner/qdesigner_workbench.cpp [new file with mode: 0644]
src/designer/formdesigner/qdesigner_workbench.h [new file with mode: 0644]
src/designer/formdesigner/qrc_designer.cpp [new file with mode: 0644]
src/designer/formdesigner/qtdesigner.pri [new file with mode: 0644]
src/designer/formdesigner/qtdesigner.pro [new file with mode: 0644]
src/designer/formdesigner/saveformastemplate.cpp [new file with mode: 0644]
src/designer/formdesigner/saveformastemplate.h [new file with mode: 0644]
src/designer/formdesigner/saveformastemplate.ui [new file with mode: 0644]
src/designer/formdesigner/templates/forms/Dialog_with_Buttons_Bottom.ui [new file with mode: 0644]
src/designer/formdesigner/templates/forms/Dialog_with_Buttons_Right.ui [new file with mode: 0644]
src/designer/formdesigner/templates/forms/Main_Window.ui [new file with mode: 0644]
src/designer/formdesigner/templates/forms/Widget.ui [new file with mode: 0644]
src/designer/images/a-system.png [new file with mode: 0644]
src/designer/images/action_g.png [new file with mode: 0644]
src/designer/images/actions.png [new file with mode: 0644]
src/designer/images/arrow_down.png [new file with mode: 0644]
src/designer/images/arrow_left.png [new file with mode: 0644]
src/designer/images/arrow_right.png [new file with mode: 0644]
src/designer/images/arrow_up.png [new file with mode: 0644]
src/designer/images/cat.png [new file with mode: 0644]
src/designer/images/cat_g.png [new file with mode: 0644]
src/designer/images/columns.png [new file with mode: 0644]
src/designer/images/d_editdelete.png [new file with mode: 0644]
src/designer/images/designer-splash-en.png [new file with mode: 0644]
src/designer/images/designer-splash-ru.png [new file with mode: 0644]
src/designer/images/dimensions.png [new file with mode: 0644]
src/designer/images/doc.png [new file with mode: 0644]
src/designer/images/doc_g.png [new file with mode: 0644]
src/designer/images/doc_h.png [new file with mode: 0644]
src/designer/images/editcopy.png [new file with mode: 0644]
src/designer/images/editcut.png [new file with mode: 0644]
src/designer/images/editdelete.png [new file with mode: 0644]
src/designer/images/editedit.png [new file with mode: 0644]
src/designer/images/editpaste.png [new file with mode: 0644]
src/designer/images/editrename.png [new file with mode: 0644]
src/designer/images/editsep.png [new file with mode: 0644]
src/designer/images/element.png [new file with mode: 0644]
src/designer/images/field.png [new file with mode: 0644]
src/designer/images/filenew.png [new file with mode: 0644]
src/designer/images/fileopen.png [new file with mode: 0644]
src/designer/images/filesave.png [new file with mode: 0644]
src/designer/images/form.png [new file with mode: 0644]
src/designer/images/form_g.png [new file with mode: 0644]
src/designer/images/function.png [new file with mode: 0644]
src/designer/images/group.png [new file with mode: 0644]
src/designer/images/help.png [new file with mode: 0644]
src/designer/images/hi22-action-project_open.png [new file with mode: 0644]
src/designer/images/hi22-action-run.png [new file with mode: 0644]
src/designer/images/information.png [new file with mode: 0644]
src/designer/images/journ.png [new file with mode: 0644]
src/designer/images/journ_g.png [new file with mode: 0644]
src/designer/images/m_menu.png [new file with mode: 0644]
src/designer/images/msg_error.png [new file with mode: 0644]
src/designer/images/msg_fatal.png [new file with mode: 0644]
src/designer/images/msg_info.png [new file with mode: 0644]
src/designer/images/msg_warning.png [new file with mode: 0644]
src/designer/images/object.png [new file with mode: 0644]
src/designer/images/p_menus.png [new file with mode: 0644]
src/designer/images/play.png [new file with mode: 0644]
src/designer/images/playprev.png [new file with mode: 0644]
src/designer/images/print.png [new file with mode: 0644]
src/designer/images/project.png [new file with mode: 0644]
src/designer/images/qsa.png [new file with mode: 0644]
src/designer/images/redo.png [new file with mode: 0644]
src/designer/images/reg.png [new file with mode: 0644]
src/designer/images/reg_g.png [new file with mode: 0644]
src/designer/images/regs.png [new file with mode: 0644]
src/designer/images/regs_g.png [new file with mode: 0644]
src/designer/images/report.png [new file with mode: 0644]
src/designer/images/report_g.png [new file with mode: 0644]
src/designer/images/resourses.png [new file with mode: 0644]
src/designer/images/script.png [new file with mode: 0644]
src/designer/images/scriptnew.png [new file with mode: 0644]
src/designer/images/scriptobject.png [new file with mode: 0644]
src/designer/images/searchfind.png [new file with mode: 0644]
src/designer/images/separator.png [new file with mode: 0644]
src/designer/images/submenu.png [new file with mode: 0644]
src/designer/images/table.png [new file with mode: 0644]
src/designer/images/table_g.png [new file with mode: 0644]
src/designer/images/toolbar.png [new file with mode: 0644]
src/designer/images/undo.png [new file with mode: 0644]
src/designer/images/webform.png [new file with mode: 0644]
src/designer/images/webform_g.png [new file with mode: 0644]
src/designer/interfacetree.cpp [new file with mode: 0644]
src/designer/interfacetree.h [new file with mode: 0644]
src/designer/main.cpp [new file with mode: 0644]
src/designer/mainform.cpp [new file with mode: 0644]
src/designer/mainform.h [new file with mode: 0644]
src/designer/mainform.ui [new file with mode: 0644]
src/designer/mdtree.cpp [new file with mode: 0644]
src/designer/mdtree.h [new file with mode: 0644]
src/designer/pixmappreview.h [new file with mode: 0644]
src/designer/roleeditor.cpp [new file with mode: 0644]
src/designer/roleeditor.h [new file with mode: 0644]
src/designer/templates/inputform.tpl [new file with mode: 0644]
src/designer/templates/inputform.ui.tpl [new file with mode: 0644]
src/designer/templates/inputformcat.tpl [new file with mode: 0644]
src/designer/templates/inputformcat.ui.tpl [new file with mode: 0644]
src/designer/templates/inputformdoc.tpl [new file with mode: 0644]
src/designer/templates/inputformdoc.ui.tpl [new file with mode: 0644]
src/designer/templates/inputformjourn.tpl [new file with mode: 0644]
src/designer/templates/inputformjourn.ui.tpl [new file with mode: 0644]
src/designer/templates/inputformrep.tpl [new file with mode: 0644]
src/designer/templates/inputformrep.ui.tpl [new file with mode: 0644]
src/extensions/README [new file with mode: 0644]
src/extensions/example/aextexample.cpp [new file with mode: 0644]
src/extensions/example/aextexample.h [new file with mode: 0644]
src/extensions/example/example.pro [new file with mode: 0644]
src/extensions/extensions.pro [new file with mode: 0644]
src/extensions/meta/aext_meta.cpp [new file with mode: 0644]
src/extensions/meta/aext_meta.h [new file with mode: 0644]
src/extensions/meta/meta.pro [new file with mode: 0644]
src/extensions/te/README [new file with mode: 0644]
src/extensions/te/aextte.cpp [new file with mode: 0644]
src/extensions/te/aextte.h [new file with mode: 0644]
src/extensions/te/te.pro [new file with mode: 0644]
src/extensions/text/aexttext.cpp [new file with mode: 0644]
src/extensions/text/aexttext.h [new file with mode: 0644]
src/extensions/text/text.pro [new file with mode: 0644]
src/extensions/xml/aextxml.cpp [new file with mode: 0644]
src/extensions/xml/aextxml.h [new file with mode: 0644]
src/extensions/xml/xml.pro [new file with mode: 0644]
src/lib/acfg.cpp [new file with mode: 0644]
src/lib/acfg.h [new file with mode: 0644]
src/lib/acfgrc.cpp [new file with mode: 0644]
src/lib/acfgrc.h [new file with mode: 0644]
src/lib/acmanifest.cpp [new file with mode: 0644]
src/lib/acmanifest.h [new file with mode: 0644]
src/lib/acontainer.cpp [new file with mode: 0644]
src/lib/acontainer.h [new file with mode: 0644]
src/lib/adataexchange.cpp [new file with mode: 0644]
src/lib/adataexchange.h [new file with mode: 0644]
src/lib/adatafield.cpp [new file with mode: 0644]
src/lib/adatafield.h [new file with mode: 0644]
src/lib/aextension.cpp [new file with mode: 0644]
src/lib/aextension.h [new file with mode: 0644]
src/lib/aextensionfactory.cpp [new file with mode: 0644]
src/lib/aextensionfactory.h [new file with mode: 0644]
src/lib/aextensioninterface_p.h [new file with mode: 0644]
src/lib/aextensionplugin.cpp [new file with mode: 0644]
src/lib/aextensionplugin.h [new file with mode: 0644]
src/lib/afilter.cpp [new file with mode: 0644]
src/lib/afilter.h [new file with mode: 0644]
src/lib/alog.cpp [new file with mode: 0644]
src/lib/alog.h [new file with mode: 0644]
src/lib/amenubar.cpp [new file with mode: 0644]
src/lib/amenubar.h [new file with mode: 0644]
src/lib/amoney.cpp [new file with mode: 0644]
src/lib/amoney.h [new file with mode: 0644]
src/lib/ananas.cpp [new file with mode: 0644]
src/lib/ananas.h [new file with mode: 0644]
src/lib/ananasglobal.h [new file with mode: 0644]
src/lib/arole.cpp [new file with mode: 0644]
src/lib/arole.h [new file with mode: 0644]
src/lib/aservice.cpp [new file with mode: 0644]
src/lib/aservice.h [new file with mode: 0644]
src/lib/asqlfield.cpp [new file with mode: 0644]
src/lib/asqlfield.h [new file with mode: 0644]
src/lib/asqltable.cpp [new file with mode: 0644]
src/lib/asqltable.h [new file with mode: 0644]
src/lib/atests.cpp [new file with mode: 0644]
src/lib/atests.h [new file with mode: 0644]
src/lib/atime.cpp [new file with mode: 0644]
src/lib/atime.h [new file with mode: 0644]
src/lib/auser.cpp [new file with mode: 0644]
src/lib/auser.h [new file with mode: 0644]
src/lib/dialogs/awindowslist.cpp [new file with mode: 0644]
src/lib/dialogs/awindowslist.h [new file with mode: 0644]
src/lib/dialogs/deditrc.cpp [new file with mode: 0644]
src/lib/dialogs/deditrc.h [new file with mode: 0644]
src/lib/dialogs/deditrc.ui [new file with mode: 0644]
src/lib/dialogs/dhelpcfgform.cpp [new file with mode: 0644]
src/lib/dialogs/dhelpcfgform.h [new file with mode: 0644]
src/lib/dialogs/dhelpcfgform.ui [new file with mode: 0644]
src/lib/dialogs/dialogs.pri [new file with mode: 0644]
src/lib/dialogs/dimportdb.cpp [new file with mode: 0644]
src/lib/dialogs/dimportdb.h [new file with mode: 0644]
src/lib/dialogs/dlogin.cpp [new file with mode: 0644]
src/lib/dialogs/dlogin.h [new file with mode: 0644]
src/lib/dialogs/dlogin.ui [new file with mode: 0644]
src/lib/dialogs/dselectdb.cpp [new file with mode: 0644]
src/lib/dialogs/dselectdb.h [new file with mode: 0644]
src/lib/dialogs/dselectdb.ui [new file with mode: 0644]
src/lib/dialogs/messageswindow.cpp [new file with mode: 0644]
src/lib/dialogs/messageswindow.h [new file with mode: 0644]
src/lib/images/lib_database.png [new file with mode: 0644]
src/lib/images/lib_dbgroup.png [new file with mode: 0644]
src/lib/images/print.png [new file with mode: 0644]
src/lib/lib.pri [new file with mode: 0644]
src/lib/lib.pro [new file with mode: 0644]
src/lib/lib.qrc [new file with mode: 0644]
src/lib/metadata/ametadata.cpp [new file with mode: 0644]
src/lib/metadata/ametadata.h [new file with mode: 0644]
src/lib/metadata/ametadataio.cpp [new file with mode: 0644]
src/lib/metadata/ametadataio.h [new file with mode: 0644]
src/lib/metadata/ametadataioxml.cpp [new file with mode: 0644]
src/lib/metadata/ametadataioxml.h [new file with mode: 0644]
src/lib/metadata/ametadocument.cpp [new file with mode: 0644]
src/lib/metadata/ametadocument.h [new file with mode: 0644]
src/lib/metadata/ametafield.cpp [new file with mode: 0644]
src/lib/metadata/ametafield.h [new file with mode: 0644]
src/lib/metadata/ametaform.cpp [new file with mode: 0644]
src/lib/metadata/ametaform.h [new file with mode: 0644]
src/lib/metadata/ametaobject.cpp [new file with mode: 0644]
src/lib/metadata/ametaobject.h [new file with mode: 0644]
src/lib/metadata/ametaobjectgroup.cpp [new file with mode: 0644]
src/lib/metadata/ametaobjectgroup.h [new file with mode: 0644]
src/lib/metadata/metadata.pri [new file with mode: 0644]
src/lib/objects/aaregister.cpp [new file with mode: 0644]
src/lib/objects/aaregister.h [new file with mode: 0644]
src/lib/objects/acatalogue.cpp [new file with mode: 0644]
src/lib/objects/acatalogue.h [new file with mode: 0644]
src/lib/objects/adocjournal.cpp [new file with mode: 0644]
src/lib/objects/adocjournal.h [new file with mode: 0644]
src/lib/objects/adocument.cpp [new file with mode: 0644]
src/lib/objects/adocument.h [new file with mode: 0644]
src/lib/objects/airegister.cpp [new file with mode: 0644]
src/lib/objects/airegister.h [new file with mode: 0644]
src/lib/objects/aobject.cpp [new file with mode: 0644]
src/lib/objects/aobject.h [new file with mode: 0644]
src/lib/objects/aobjectlist.cpp [new file with mode: 0644]
src/lib/objects/aobjectlist.h [new file with mode: 0644]
src/lib/objects/objects.pri [new file with mode: 0644]
src/lib/rclistviewitem.cpp [new file with mode: 0644]
src/lib/rclistviewitem.h [new file with mode: 0644]
src/lib/report/acalctemplate.cpp [new file with mode: 0644]
src/lib/report/acalctemplate.h [new file with mode: 0644]
src/lib/report/aootemplate.cpp [new file with mode: 0644]
src/lib/report/aootemplate.h [new file with mode: 0644]
src/lib/report/areport.cpp [new file with mode: 0644]
src/lib/report/areport.h [new file with mode: 0644]
src/lib/report/atemplate.cpp [new file with mode: 0644]
src/lib/report/atemplate.h [new file with mode: 0644]
src/lib/report/itemplate.cpp [new file with mode: 0644]
src/lib/report/itemplate.h [new file with mode: 0644]
src/lib/report/report.pri [new file with mode: 0644]
src/lib/sys/aapplication.cpp [new file with mode: 0644]
src/lib/sys/aapplication.h [new file with mode: 0644]
src/lib/sys/adatabase.cpp [new file with mode: 0644]
src/lib/sys/adatabase.h [new file with mode: 0644]
src/lib/sys/sys.pri [new file with mode: 0644]
src/lib/widgets/awidget.cpp [new file with mode: 0644]
src/lib/widgets/awidget.h [new file with mode: 0644]
src/lib/widgets/widgets.pri [new file with mode: 0644]
src/plugins/README [new file with mode: 0644]
src/plugins/actionbutton/actionbutton.pri [new file with mode: 0644]
src/plugins/actionbutton/eactionbutton.cpp [new file with mode: 0644]
src/plugins/actionbutton/eactionbutton.h [new file with mode: 0644]
src/plugins/actionbutton/eactionbutton.ui [new file with mode: 0644]
src/plugins/actionbutton/wactionbutton.cpp [new file with mode: 0644]
src/plugins/actionbutton/wactionbutton.h [new file with mode: 0644]
src/plugins/actionbutton/wactionbutton_plugin.cpp [new file with mode: 0644]
src/plugins/actionbutton/wactionbutton_plugin.h [new file with mode: 0644]
src/plugins/actionbutton/wactionbutton_taskmenu.cpp [new file with mode: 0644]
src/plugins/actionbutton/wactionbutton_taskmenu.h [new file with mode: 0644]
src/plugins/aform.cpp [new file with mode: 0644]
src/plugins/aform.h [new file with mode: 0644]
src/plugins/atoolbar.cpp [new file with mode: 0644]
src/plugins/atoolbar.h [new file with mode: 0644]
src/plugins/awidgets_plugin.cpp [new file with mode: 0644]
src/plugins/awidgets_plugin.h [new file with mode: 0644]
src/plugins/catalogue/catalogform.cpp [new file with mode: 0644]
src/plugins/catalogue/catalogform.h [new file with mode: 0644]
src/plugins/catalogue/catalogform.ui [new file with mode: 0644]
src/plugins/catalogue/catalogformwidgets.cpp [new file with mode: 0644]
src/plugins/catalogue/catalogformwidgets.h [new file with mode: 0644]
src/plugins/catalogue/catalogue.pri [new file with mode: 0644]
src/plugins/catalogue/ecatalogue.cpp [new file with mode: 0644]
src/plugins/catalogue/ecatalogue.h [new file with mode: 0644]
src/plugins/catalogue/ecatalogue.ui [new file with mode: 0644]
src/plugins/catalogue/wcatalogue.cpp [new file with mode: 0644]
src/plugins/catalogue/wcatalogue.h [new file with mode: 0644]
src/plugins/catalogue/wcatalogue_plugin.cpp [new file with mode: 0644]
src/plugins/catalogue/wcatalogue_plugin.h [new file with mode: 0644]
src/plugins/catalogue/wcatalogue_taskmenu.cpp [new file with mode: 0644]
src/plugins/catalogue/wcatalogue_taskmenu.h [new file with mode: 0644]
src/plugins/combobox/acombobox.cpp [new file with mode: 0644]
src/plugins/combobox/acombobox.h [new file with mode: 0644]
src/plugins/combobox/acombobox_plugin.cpp [new file with mode: 0644]
src/plugins/combobox/acombobox_plugin.h [new file with mode: 0644]
src/plugins/combobox/combobox.pri [new file with mode: 0644]
src/plugins/dbfield/dbfield.pri [new file with mode: 0644]
src/plugins/dbfield/edbfield.cpp [new file with mode: 0644]
src/plugins/dbfield/edbfield.h [new file with mode: 0644]
src/plugins/dbfield/edbfield.ui [new file with mode: 0644]
src/plugins/dbfield/wdbfield.cpp [new file with mode: 0644]
src/plugins/dbfield/wdbfield.h [new file with mode: 0644]
src/plugins/dbfield/wdbfield_plugin.cpp [new file with mode: 0644]
src/plugins/dbfield/wdbfield_plugin.h [new file with mode: 0644]
src/plugins/dbfield/wdbfield_taskmenu.cpp [new file with mode: 0644]
src/plugins/dbfield/wdbfield_taskmenu.h [new file with mode: 0644]
src/plugins/dbtable/dbtable.pri [new file with mode: 0644]
src/plugins/dbtable/edbtable.cpp [new file with mode: 0644]
src/plugins/dbtable/edbtable.h [new file with mode: 0644]
src/plugins/dbtable/edbtable.ui [new file with mode: 0644]
src/plugins/dbtable/wdbtable.cpp [new file with mode: 0644]
src/plugins/dbtable/wdbtable.h [new file with mode: 0644]
src/plugins/dbtable/wdbtable_plugin.cpp [new file with mode: 0644]
src/plugins/dbtable/wdbtable_plugin.h [new file with mode: 0644]
src/plugins/dbtable/wdbtable_taskmenu.cpp [new file with mode: 0644]
src/plugins/dbtable/wdbtable_taskmenu.h [new file with mode: 0644]
src/plugins/document/document.pri [new file with mode: 0644]
src/plugins/document/edocument.cpp [new file with mode: 0644]
src/plugins/document/edocument.h [new file with mode: 0644]
src/plugins/document/edocument.ui [new file with mode: 0644]
src/plugins/document/eselectdoctype.cpp [new file with mode: 0644]
src/plugins/document/eselectdoctype.h [new file with mode: 0644]
src/plugins/document/eselectdoctype.ui [new file with mode: 0644]
src/plugins/document/wdocument.cpp [new file with mode: 0644]
src/plugins/document/wdocument.h [new file with mode: 0644]
src/plugins/document/wdocument_plugin.cpp [new file with mode: 0644]
src/plugins/document/wdocument_plugin.h [new file with mode: 0644]
src/plugins/document/wdocument_taskmenu.cpp [new file with mode: 0644]
src/plugins/document/wdocument_taskmenu.h [new file with mode: 0644]
src/plugins/eaddobj.cpp [new file with mode: 0644]
src/plugins/eaddobj.h [new file with mode: 0644]
src/plugins/eaddobj.ui [new file with mode: 0644]
src/plugins/engine.cpp [new file with mode: 0644]
src/plugins/engine.h [new file with mode: 0644]
src/plugins/field/addfdialog.cpp [new file with mode: 0644]
src/plugins/field/addfdialog.h [new file with mode: 0644]
src/plugins/field/addfdialog.ui [new file with mode: 0644]
src/plugins/field/efield.cpp [new file with mode: 0644]
src/plugins/field/efield.h [new file with mode: 0644]
src/plugins/field/efield.ui [new file with mode: 0644]
src/plugins/field/field.pri [new file with mode: 0644]
src/plugins/field/wcatalogeditor.cpp [new file with mode: 0644]
src/plugins/field/wcatalogeditor.h [new file with mode: 0644]
src/plugins/field/wdateedit.cpp [new file with mode: 0644]
src/plugins/field/wdateedit.h [new file with mode: 0644]
src/plugins/field/wfield.cpp [new file with mode: 0644]
src/plugins/field/wfield.h [new file with mode: 0644]
src/plugins/field/wfield_plugin.cpp [new file with mode: 0644]
src/plugins/field/wfield_plugin.h [new file with mode: 0644]
src/plugins/field/wfield_taskmenu.cpp [new file with mode: 0644]
src/plugins/field/wfield_taskmenu.h [new file with mode: 0644]
src/plugins/grouptree/grouptree.pri [new file with mode: 0644]
src/plugins/grouptree/wgrouptree.cpp [new file with mode: 0644]
src/plugins/grouptree/wgrouptree.h [new file with mode: 0644]
src/plugins/grouptree/wgrouptree_plugin.cpp [new file with mode: 0644]
src/plugins/grouptree/wgrouptree_plugin.h [new file with mode: 0644]
src/plugins/images/acombobox.png [new file with mode: 0644]
src/plugins/images/doc_copy.png [new file with mode: 0644]
src/plugins/images/doc_delete.png [new file with mode: 0644]
src/plugins/images/doc_edit.png [new file with mode: 0644]
src/plugins/images/doc_new.png [new file with mode: 0644]
src/plugins/images/doc_view.png [new file with mode: 0644]
src/plugins/images/wactionbutton.png [new file with mode: 0644]
src/plugins/images/wcatalogue.png [new file with mode: 0644]
src/plugins/images/wdbfield.png [new file with mode: 0644]
src/plugins/images/wdbtable.png [new file with mode: 0644]
src/plugins/images/wdocument.png [new file with mode: 0644]
src/plugins/images/wfield.png [new file with mode: 0644]
src/plugins/images/wgrouptree.png [new file with mode: 0644]
src/plugins/images/wjournal.png [new file with mode: 0644]
src/plugins/images/wreport.png [new file with mode: 0644]
src/plugins/images/wtable.png [new file with mode: 0644]
src/plugins/journal/ejournal.cpp [new file with mode: 0644]
src/plugins/journal/ejournal.h [new file with mode: 0644]
src/plugins/journal/ejournal.ui [new file with mode: 0644]
src/plugins/journal/journal.pri [new file with mode: 0644]
src/plugins/journal/wjournal.cpp [new file with mode: 0644]
src/plugins/journal/wjournal.h [new file with mode: 0644]
src/plugins/journal/wjournal_plugin.cpp [new file with mode: 0644]
src/plugins/journal/wjournal_plugin.h [new file with mode: 0644]
src/plugins/journal/wjournal_taskmenu.cpp [new file with mode: 0644]
src/plugins/journal/wjournal_taskmenu.h [new file with mode: 0644]
src/plugins/plugins.pri [new file with mode: 0644]
src/plugins/plugins.pro [new file with mode: 0644]
src/plugins/plugins.qrc [new file with mode: 0644]
src/plugins/qwidgetplugin.h [new file with mode: 0644]
src/plugins/report/ereport.cpp [new file with mode: 0644]
src/plugins/report/ereport.h [new file with mode: 0644]
src/plugins/report/ereport.ui [new file with mode: 0644]
src/plugins/report/report.pri [new file with mode: 0644]
src/plugins/report/wreport.cpp [new file with mode: 0644]
src/plugins/report/wreport.h [new file with mode: 0644]
src/plugins/report/wreport_plugin.cpp [new file with mode: 0644]
src/plugins/report/wreport_plugin.h [new file with mode: 0644]
src/plugins/report/wreport_taskmenu.cpp [new file with mode: 0644]
src/plugins/report/wreport_taskmenu.h [new file with mode: 0644]
src/plugins/table/etable.cpp [new file with mode: 0644]
src/plugins/table/etable.h [new file with mode: 0644]
src/plugins/table/etable.ui [new file with mode: 0644]
src/plugins/table/table.pri [new file with mode: 0644]
src/plugins/table/wtable.cpp [new file with mode: 0644]
src/plugins/table/wtable.h [new file with mode: 0644]
src/plugins/table/wtable_plugin.cpp [new file with mode: 0644]
src/plugins/table/wtable_plugin.h [new file with mode: 0644]
src/src.pro [new file with mode: 0644]
src/test/main.cpp [new file with mode: 0644]
src/test/test.h [new file with mode: 0644]
src/test/test.pro [new file with mode: 0644]
src/test/testametadata.cpp [new file with mode: 0644]
src/test/testametadata.h [new file with mode: 0644]
translations/ananas-designer-en.ts [new file with mode: 0644]
translations/ananas-designer-ru.ts [new file with mode: 0644]
translations/ananas-engine-en.ts [new file with mode: 0644]
translations/ananas-engine-ru.ts [new file with mode: 0644]
translations/ananas-lib-en.ts [new file with mode: 0644]
translations/ananas-lib-ru.ts [new file with mode: 0644]
translations/ananas-plugins-en.ts [new file with mode: 0644]
translations/ananas-plugins-ru.ts [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..3376b79
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,66 @@
+NAME    = ananas4
+VERSION = $(shell cat VERSION)
+NAMEV  = $(NAME)-$(VERSION)
+MAKE = make
+QMAKE = qmake
+MAKEFILE = Makefile
+LIBDIR = $(INSTALL_ROOT)/usr/lib
+BINDIR = $(INSTALL_ROOT)/usr/bin
+DOCDIR = $(INSTALL_ROOT)/usr/share/doc/$(NAMEV)
+INCLUDEDIR = $(INSTALL_ROOT)/usr/include/ananas
+
+log = ~/.ananas/tests.log
+#BINDIR =      /usr/bin
+#MANDIR =      /usr/man/man8
+#VARDIR =      /usr/share/$(NAME)
+TAR    =       $(HOME)/tmp/$(NAMEV)
+TARGET =       i586
+
+
+first: all
+
+all: Makefile
+       cd src && $(QMAKE) && $(MAKE)
+clean:
+       rm -fr rpm
+       rm -f $(NAME).spec
+       rm -fr *~
+       rm -f translations/*.qm
+       cd src && $(QMAKE) && $(MAKE) clean
+
+tr:
+       lrelease translations/*.ts
+       
+install:
+       find src doc -name Makefile -delete
+       $(QMAKE) src/src.pro -o src/$(MAKEFILE)
+       cd src && $(MAKE) install LIBDIR=$(LIBDIR) BINDIR=$(BINDIR) INCLUDEDIR=$(INCLUDEDIR) && cd ../doc && $(QMAKE) doc.pro -o $(MAKEFILE) && $(MAKE) install DOCDIR=$(DOCDIR)
+       
+uninstall:
+       cd src && $(MAKE) uninstall
+
+tgz:   dummy
+       mkdir -p rpm
+       mkdir -p $(TAR)
+       cp -r -f * $(TAR)
+#      cd $(TAR) && make clean
+#      cd $(TAR) && find src doc -name Makefile -delete
+       cd $(HOME)/tmp && tar cf - "$(NAMEV)/" | bzip2 -f9 > "$(HOME)/RPM/SOURCES/$(NAMEV).tar.bz2"     
+       rm -f -r $(TAR)
+srpm:  tgz
+       if [ -e /etc/altlinux-release ] ; then\
+           iconv -f UTF-8 -t KOI8-R $(NAME).spec.in |\
+           sed s/ru_RU.UTF8/ru_RU.KOI8-R/>$(NAME).spec;\
+       else \
+           cp $(NAME).spec.in $(NAME).spec; \
+       fi
+       rpmbuild --target=$(TARGET) -bs $(NAME).spec
+       mv -f $(HOME)/RPM/SRPMS/$(NAME)* rpm
+rpm:   srpm
+       rpmbuild --target=$(TARGET) -bb $(NAME).spec
+       mv -f $(HOME)/RPM/RPMS/$(TARGET)/$(NAME)* rpm
+       
+tests: all
+       ./tests.begin -log=$(log)
+
+dummy:
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..1a13849
--- /dev/null
+++ b/README
@@ -0,0 +1,122 @@
+_Об Ананасе_
+
+Ананас - программная платформа автоматизации учета для Linux и Windows.
+Ананас является программным обеспечением автоматизации учета,
+предназначенным для использования на небольших и средних
+предприятиях. Ананас позволяет автоматизировать основные
+учетные операции. Ананас умеет работать на операционных
+системамах Windows и GNU/Linux.
+
+Программное обеспечение распространяется на условиях
+открытой лицензии, позволяющих копировать Ананас бесплатно
+и также бесплатно использовать его для ведения
+автоматизированного учета на любом количестве рабочих мест. 
+
+Получить исходники Ананаса можно с сайта http://ananas.lrn.ru
+Там же можно скачать rpm для Alt Linux или Fedora Core.
+
+Ниже описывается процесс сборки из исходных кодов.
+Чтобы все собралось, необходимо наличие в системе Qt и QSA (Qt Script for Applications)
+
+_Компиляция_
+
+Сборка стандартная 
+Распаковываем архив в каталоге /usr/src или в другом каталоге, сделав после
+распаковки симлинк в /usr/src,
+и переходим в каталог проекта
+cd /usr/src/ananas-engine-qt
+
+Запускаем
+make
+и, если собралось без ошибок,
+make install 
+
+После успешного выполнения компиляции в некоторых подкаталогах появятся 
+исполняемые файлы готовые к запуску.
+Первым делом необходимо запустить Анана.Дизайнер... 
+смотри раздел _Использование_ ниже
+
+_Использование_
+
+И так сказу после успешной компиляции запускаем Ананас.Дизайнер
+cd /usr/src/ananas-engine/src/designer
+./ananas-designer
+
+
+В нем нужно выбрать конфигурацию (в диалоге выбора конфигурации
+есть возможность задать параметры доступа к серверу баз данных)
+и создать базу данных на сервере, воспользовавшись пунктом меню
+"Бизнес схема" -> "Сохранить".
+Иногда этот процесс занимает довольно продолжительное время,
+поэтому лучше не нажимать кнопочку "Сохранить" несколько раз подряд.
+
+Теперь ваш Ананас готов к работе.
+Сначала, стоит еще немного времени уделить Ананас.Дизайнеру 
+В нем есть много интересного ;)
+Чтобы увидеть дерево бизнес схемы, воспользуйтесь меню
+"Бизнес схема" -> "Открыть"
+Откроется окно с объектами бизнес схемы, организованными в виде дерева.
+
+Во-первых, вы можете менять бизнес схему по своему усмотрению. 
+Добавлять/удалять документы, поля документов, табличные части документов.
+Работать с другими объектами.
+После изменения бизнес схемы ее можно сохранить, а также обновить структуру 
+базы данных тем же способом, которым мы ее создали выше.
+
+Двойной щелчек по корню дерева откроет доступ к параметрам бизнес схемы и...
+- Внимание!-  редактору глобального модуля Ananas.Script - месту, где определяются
+общедоступные функции на встроенном в Ананас интерпретируемом языке 
+программирования.
+Сдесь можно увидеть определение функций
+on_systemstart()
+on_systemstop()
+Это зарезервированные названия функций, через которые осуществляется
+обработка события запуска Ананаса и события выхода из Ананаса соответственно.
+
+Уже сейчас есть возможность создавать/настраивать экранные формы (диалоги) 
+документов, и определять обработку событий нажатия на кнопки диалога.
+Для того, чтобы форма работала, нужно определить обработчики событий.
+Что осуществляется на закладке "Модуль" редактора свойств диалога.
+
+Вдоволь набаловавшись с Ананас.Дизайнером, можно пойти и проверить, как работает
+то, что мы "наконфигурировали" :)
+Для этого нужно запустить сам Ананас
+cd /usr/src/ananas-engine/src/engine
+./ananas-engine
+И выбрать именно ту бизнес схему, с которой мы работали 
+в Ананас.Дизайнере
+
+Во время запуска Ананаса отработает код функции
+on_systemstart(), упомянутой выше.
+Вот пожалуй и все, что хотелось сказать об использовании.
+
+
+_Использование с PostgreSQL_
+
+Для работы системы с сервером postgres необходимо:
+
+1. Перед началом работы надо установить сервер postgres из вашего 
+дистрибутива. Желательна версия больше 7.3
+
+2. Настроить сервер БД для работы с TCP/IP соединением. Для этого из под 
+пользователя root в файле postgresql.conf вашей системы (например, для 
+ALT Linux Master 2.2 он находтится в каталоге /var/lib/pgsql/data) нужно 
+прописать строку:
+
+tcpip_socket=true
+
+или найти и раскоментировать соответствующий параметр. Порт 5432 
+используется postgres по умолчанию, но при необходимости его можно 
+изменить, добавив или изменив параметр:
+
+port=5432
+
+Затем следует перезапустить сервер БД командой:
+
+service postgresql restart
+
+
+
+
+
+
diff --git a/VERSION b/VERSION
new file mode 100644 (file)
index 0000000..b0bb878
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.9.5
diff --git a/applications/ananas-cfg.dtd b/applications/ananas-cfg.dtd
new file mode 100644 (file)
index 0000000..a53fb76
--- /dev/null
@@ -0,0 +1,150 @@
+<!--
+ DTD for Ananas v.0.4 configuration metadata
+ Author: Andrey Paskal <app@linux.ru.net>,
+        Valery Grazdankin <vg@leaderit.ru>
+ Copyright (C) 2003-2004 Andrey Paskal, Valery Grazdankin
+ Licensed under the GPL, version 2
+
+-->
+
+<!-- Top-level element -->
+<!ELEMENT ananas_configuration (info,metadata,languages,image_collection,actions,interface)>
+
+<!-- Info -->
+<!ELEMENT info (name?|author?|date?|mdate?|lastid)*>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT author (#PCDATA)>
+<!ELEMENT copyright (#PCDATA)>
+<!ELEMENT date (#PCDATA)>
+<!ELEMENT mdate (#PCDATA)>
+<!ELEMENT remark (#PCDATA)>
+<!ELEMENT lastid (#PCDATA)>
+
+<!-- Metadata -->
+<!ELEMENT metadata (globals,catalogues,documents,registers,journals)>
+
+<!ELEMENT globals (sourcecode+)>
+
+<!ELEMENT catalogues (catalog+)>
+
+<!ELEMENT documents (document+)>
+
+<!ELEMENT registers (iregisters, aregisters)>
+
+<!ELEMENT iregisters (iregister+)>
+
+<!ELEMENT aregisters (aregister+)>
+
+<!ELEMENT journals (journal)>
+<!ELEMENT journal (columns,forms,description)>
+<!ATTLIST journal
+       id      CDATA #REQUIRED
+       name    CDATA #REQUIRED
+       type    CDATA #REQUIRED
+>
+
+<!ELEMENT columns (used_docs)>
+<!ELEMENT used_docs (#CDATA)>
+
+<!ELEMENT sourcecode (#CDATA)>
+<!ATTLIST sourcecode
+       name            CDATA
+       id              CDATA #REQUIRED
+>
+
+<!ELEMENT catalog (element, groups, forms)>
+<!ATTLIST catalog
+       name            CDATA #REQUIRED
+       id              CDATA #REQUIRED
+>
+
+<!ELEMENT element (field*)>
+
+<!ELEMENT groups (field*)>
+
+<!ELEMENT forms (description|sourcecode|defaultmod|dialogform)>
+
+<!ATTLIST forms
+       type            CDATA #REQUIRED
+       name            CDATA #REQUIRED
+       id              CDATA #REQUIRED
+       readonly        CDATA
+       
+>
+
+<!ELEMENT description (#CDATA)>
+<!ELEMENT defaulmod (#CDATA)>
+<!ELEMENT dialogform (#CDATA)>
+
+<!ELEMENT document (header,table*)>
+<!ATTLIST document
+       name            CDATA #REQUIRED
+       id              CDATA #REQUIRED
+>
+
+<!ELEMENT iregister (field+)>
+<!ATTLIST iregister
+       name            CDATA #REQUIRED
+       id              CDATA #REQUIRED
+       no_unconduct    CDATA
+>
+
+<!ELEMENT aregister (field+)>
+<!ATTLIST aregister
+       name            CDATA #REQUIRED
+       id              CDATA #REQUIRED
+>
+
+<!ELEMENT header (field+)>
+
+<!ELEMENT table (field+)>
+<!ATTLIST table
+       name            CDATA #REQUIRED
+       id              CDATA #REQUIRED
+>
+
+<!ELEMENT field (description)>
+<!ATTLIST field
+       name            CDATA #REQUIRED
+       id              CDATA #REQUIRED
+       type            CDATA #REQUIRED
+       sum             CDATA #REQUIRED
+       plus            CDATA #REQUIRED
+       nz              CDATA #REQUIRED
+       sort            CDATA #REQUIRED
+>
+
+
+<!ELEMENT actions (action+|actiongroup+)>
+<!ELEMENT actiongroup (action+)>
+<!ATTLIST actiongroup
+       name            CDATA #REQUIRED
+       id              CDATA #REQUIRED
+>
+<!ELEMENT action (description|sourcecode|activ_picture|passiv_picture|objectid|argument)>
+<!ATTLIST action
+       name            CDATA #REQUIRED
+       id              CDATA #REQUIRED
+       type            CDATA #REQUIRED
+>
+
+<!ELEMENT activ_picture (#CDATA)>
+<!ELEMENT passiv_picture (#CDATA)>
+<!ELEMENT objectid (#CDATA)>
+<!ELEMENT argument (#CDATA)>
+
+<!ELEMENT interface (submenu+|separator+|command+)>
+<!ELEMENT submenu (submenu+|separator+|command+)>
+<!ATTLIST submenu
+       name            CDATA #REQUIRED
+       id              CDATA #REQUIRED
+>
+<!ATTLIST separator
+       id              CDATA #REQUIRED
+>
+
+<!ELEMENT command (description|menutext|key|comaction+)>
+<!ELEMENT description (#CDATA)>
+<!ELEMENT menutext (#CDATA)>
+<!ELEMENT key (#CDATA)>
+<!ELEMENT comaction (#CDATA)>
diff --git a/applications/money/money.cfg b/applications/money/money.cfg
new file mode 100644 (file)
index 0000000..f6ef05c
--- /dev/null
@@ -0,0 +1,170 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE ananas_configuration SYSTEM 'ananas-cfg.dtd'>
+<ananas_configuration>
+    <info>
+        <name>Ananas-money</name>
+        <lastid>130</lastid>
+        <author>Valery Grazdankin</author>
+        <date>2007-01-11</date>
+        <remark></remark>
+    </info>
+    <interface>
+        <toolbars/>
+        <mainmenu>
+            <submenu id="114" name="Справочники" >
+                <command id="115" name="Типы оплаты" >
+                    <description id="116" />
+                    <menutext id="117" >Платежи</menutext>
+                    <key id="118" />
+                </command>
+            </submenu>
+        </mainmenu>
+        <popupmenus/>
+    </interface>
+    <metadata>
+        <globals>
+            <sourcecode id="101" >
+function on_systemstart()
+{
+    debug("system started");
+    d = MetaData.documents();
+//    i = MetaData.info;
+    System.println( d.name );
+    System.println( MetaData.test() );
+    debug( MetaData.test() );
+//    System.println( MetaData.info.name );
+    
+}
+</sourcecode>
+        </globals>
+        <catalogues>
+            <catalogue id="102" name="Статьи расходов" >
+                <element>
+                    <string_view stdf="0" id="104" >
+                        <svfunction id="105" />
+                        <fieldid id="106" >0</fieldid>
+                    </string_view>
+                    <field sum="0" plus="0" type="N 6 0 *" id="110" nz="0" name="Код" sort="0" >
+                        <description id="111" />
+                    </field>
+                    <field sum="0" plus="0" type="C 40 0 *" id="112" nz="0" name="Наименование" sort="0" >
+                        <description id="113" />
+                    </field>
+                </element>
+                <group>
+                    <string_view stdf="0" id="107" >
+                        <svfunction id="108" />
+                        <fieldid id="109" >0</fieldid>
+                    </string_view>
+                </group>
+                <forms>
+                    <form readonly="0" type="0" id="126" name="Список" >
+                        <description id="127" />
+                        <sourcecode id="128" />
+                        <defaultmod id="129" >0</defaultmod>
+                        <dialogform id="130" >&lt;ui version="4.0" >
+ &lt;class>Catalogue&lt;/class>
+ &lt;widget class="wCatalogue" name="Catalogue" >
+  &lt;property name="geometry" >
+   &lt;rect>
+    &lt;x>0&lt;/x>
+    &lt;y>0&lt;/y>
+    &lt;width>500&lt;/width>
+    &lt;height>381&lt;/height>
+   &lt;/rect>
+  &lt;/property>
+  &lt;property name="Id" >
+   &lt;number>0&lt;/number>
+  &lt;/property>
+  &lt;property name="Name" stdset="0" >
+   &lt;string/>
+  &lt;/property>
+  &lt;property name="caption" stdset="0" >
+   &lt;string>Статьи расходов&lt;/string>
+  &lt;/property>
+  &lt;widget class="QPushButton" name="pushButton" >
+   &lt;property name="geometry" >
+    &lt;rect>
+     &lt;x>20&lt;/x>
+     &lt;y>330&lt;/y>
+     &lt;width>83&lt;/width>
+     &lt;height>28&lt;/height>
+    &lt;/rect>
+   &lt;/property>
+   &lt;property name="text" >
+    &lt;string>OK&lt;/string>
+   &lt;/property>
+  &lt;/widget>
+  &lt;widget class="QPushButton" name="pushButton_2" >
+   &lt;property name="geometry" >
+    &lt;rect>
+     &lt;x>20&lt;/x>
+     &lt;y>290&lt;/y>
+     &lt;width>83&lt;/width>
+     &lt;height>28&lt;/height>
+    &lt;/rect>
+   &lt;/property>
+   &lt;property name="text" >
+    &lt;string>Жми&lt;/string>
+   &lt;/property>
+  &lt;/widget>
+  &lt;widget class="QRadioButton" name="radioButton" >
+   &lt;property name="geometry" >
+    &lt;rect>
+     &lt;x>20&lt;/x>
+     &lt;y>250&lt;/y>
+     &lt;width>101&lt;/width>
+     &lt;height>24&lt;/height>
+    &lt;/rect>
+   &lt;/property>
+   &lt;property name="text" >
+    &lt;string>RadioButton&lt;/string>
+   &lt;/property>
+  &lt;/widget>
+ &lt;/widget>
+ &lt;layoutdefault spacing="5" margin="5" />
+ &lt;pixmapfunction>qPixmapFromMimeSource&lt;/pixmapfunction>
+ &lt;customwidgets>
+  &lt;customwidget>
+   &lt;class>wCatalogue&lt;/class>
+   &lt;extends>QWidget&lt;/extends>
+   &lt;header>wcatalogue.h&lt;/header>
+   &lt;container>1&lt;/container>
+  &lt;/customwidget>
+ &lt;/customwidgets>
+ &lt;includes>
+  &lt;include location="local" >wcatalogue.h&lt;/include>
+ &lt;/includes>
+ &lt;resources/>
+ &lt;connections/>
+&lt;/ui>
+</dialogform>
+                    </form>
+                </forms>
+                <webforms/>
+                <description id="103" />
+            </catalogue>
+        </catalogues>
+        <documents/>
+        <journals/>
+        <registers>
+            <iregisters/>
+            <aregisters/>
+        </registers>
+        <reports/>
+    </metadata>
+    <actions>
+        <actiongroup id="119" name="Справочники" >
+            <action type="0" id="120" name="New Action" >
+                <description id="121" />
+                <argument id="122" />
+                <actiontype id="123" >2</actiontype>
+                <objectid id="124" >102</objectid>
+                <formid id="125" >0</formid>
+            </action>
+        </actiongroup>
+    </actions>
+    <languages/>
+    <roles/>
+    <image_collection/>
+</ananas_configuration>
diff --git a/applications/money/money.rc b/applications/money/money.rc
new file mode 100644 (file)
index 0000000..6906350
--- /dev/null
@@ -0,0 +1,9 @@
+dbpass=111111
+workdir=/usr/share/ananas4/applications/money/
+dbhost=localhost
+dbtitle=Ananas-money
+dbtype=mysql
+dbuser=root
+dbname=ananas_money
+configfile=/usr/share/ananas4/applications/money/money.cfg
+dbport=0
diff --git a/build/altlinux/altlinux.spec b/build/altlinux/altlinux.spec
new file mode 100644 (file)
index 0000000..989610c
--- /dev/null
@@ -0,0 +1,407 @@
+# ananas project
+# Spec file for building rpm and rpms under ALT Linux and Fedora
+# $Id: altlinux.spec,v 1.1 2008/11/27 20:20:54 leader Exp $
+# $Name:  $
+#
+
+%define ShortName ananas
+%define _qtdir %(echo $QTDIR)
+#%define OSDISTR %(OSVENDOR=REDHAT; echo $OSVENDOR)
+%define OSDISTR %(if [ -e /etc/altlinux-release ] ; then OSVENDOR=ALT; fi ; echo $OSVENDOR )
+
+Name: ananas
+Version: 0.9.5
+Release: %(if [ -e /etc/altlinux-release ] ; then echo "alt2"; else echo f`grep -o "[0-9|\.]\+" /etc/redhat-release` ; fi)
+Buildroot: %{_tmppath}/%{name}-%{version}-root
+
+Summary: Runtime and development environment of Finance Applications
+Summary(ru_RU.KOI8-R): Среда разработки и исполнения прикладных решений автоматизации оперативного, бухгалтерского и других видов учета.
+
+License: GPL
+Url: http://ananas.lrn.ru/
+Vendor:        Project Ananas
+
+Group(ru): %(if [ -e /etc/altlinux-release ] ; then echo "Офис"; else echo "Приложения/Повышение уровня производительности"; fi)
+Group: %(if [ -e /etc/altlinux-release ] ; then echo "Office"; else echo "Applications/Productivity"; fi)
+
+Source:                %name-%version.tar.bz2
+
+
+#Requires:       %(if [ -e /etc/altlinux-release ] ; then echo "MySQL-server >= 4.1 "; else echo "mysql-server >= 4.1 "; fi)
+Requires:       %(if [ -e /etc/altlinux-release ] ; then echo "MySQL-client"; else echo "mysql"; fi)
+#Requires:       %(if [ -e /etc/altlinux-release ] ; then echo "MySQL-client >= 4.1 "; else echo "mysql >= 4.1 "; fi)
+Requires:       %(if [ -e /etc/altlinux-release ] ; then echo "libpq3"; else echo "postgresql"; fi)
+Requires:       %(if [ -e /etc/altlinux-release ] ; then echo "libqt3 >= 3.2"; else echo "qt >= 3.2.0"; fi)
+Requires:       %(if [ -e /etc/altlinux-release ] ; then echo "libqt3-qsa >= 3.2"; else echo "qt-qsa >= 1.1"; fi)
+#Requires:       %(if [ -e /etc/altlinux-release ] ; then echo "qt3-designer >= 3.2"; else echo "qt-designer >= 3.2" ;fi)
+#Requires: tradeequip
+Requires: libqt3-qdataschema
+
+BuildRequires:  gcc-c++ libstdc++-devel
+#BuildRequires:  tradeequip-devel 
+#tradeequip
+
+#BuildRequires:  %(if [ -e /etc/altlinux-release ] ; then echo "libMySQL-devel >= 4.1"; else echo "mysql-devel >= 4.1"; fi)
+BuildRequires:  %(if [ -e /etc/altlinux-release ] ; then echo "libMySQL-devel"; else echo "mysql-devel"; fi)
+BuildRequires:  %(if [ -e /etc/altlinux-release ] ; then echo "libqt3-devel"; else echo "qt-devel"; fi)
+BuildRequires:  %(if [ -e /etc/altlinux-release ] ; then echo "libqt3-qsa-devel"; else echo "qt-qsa-devel"; fi)
+#BuildRequires:  %(if [ -e /etc/altlinux-release ] ; then echo "libqt3-mysql"; else echo "qt-MySQL"; fi)
+#BuildRequires:  %(if [ -e /etc/altlinux-release ] ; then echo "libqt3-postgresql"; else echo "qt-PostgreSQL"; fi)
+#BuildRequires:  %(if [ -e /etc/altlinux-release ] ; then echo "libqt3-sqlite"; else echo "sqlite-devel"; fi)
+BuildRequires: libqt3-qdataschema-devel
+
+
+%description -l ru_RU.KOI8-R
+Платформа Ананас предназначена для автомматизации малых и средних предприятий.
+Обеспечивает автоматизацию ведения оперативного и бухгалтерского учета.
+Платформа позволяет создавать приложения, поддерживающие многопользовательский
+режим работы, сопровождается документацией на русском языке
+имеет русифицированный графический интерфейс пользователя. Для ее
+использования необходимо иметь установленную систему X Window System,
+графическую среду KDE и сервер баз данных с поддержкой транзакций MySQL.
+Пакет ananas необходимо установить, если вы собираетесь использовать
+прикладное решение на платформе Ананас.
+
+Разработчики
+---------------
+Валерий Гражданкин <vg at leaderit dot ru>
+Андрей Паскаль <app at lrn dot ru>
+Андрей Стрельников <avsone at yandex dot ru>
+Павел Миколайчук <Pashik at bk dot ru>
+Александр Ковалёв <cibfx at bk dot ru>
+Григорий Панов <gr1313 at mail dot ru>
+
+%description
+Ananas is  an Accounting Application Framework for Small Businesses.
+
+Developers
+---------------
+Valery Grazhdankin <vg at leaderit dot ru>
+Andrey Paskal <app at lrn dot ru>
+Andrey Strelnikov <avsone at yandex dot ru>
+Pavel Mikolaychuk <Pashik at bk dot ru>
+Alexander Kovalyov <cibfx at bk dot ru>
+Grigory Panov <gr1313 at mail dot ru>
+
+
+%package -n ananas-devel
+Summary(ru_RU.KOI8-R): Статические библиотеки и файлы определений на языке Cи.
+Summary:       Ananas development library. Static libs and C header files.
+Group(ru_RU.KOI8-R):   Разработка/Библиотеки
+Group:         Development/Other
+
+%description -l ru_RU.KOI8-R -n ananas-devel
+Статические библиотеки и файлы определений на языке C++.
+ananas-devel необходимо установить, если вы планируете использовать библиотеки
+Ананаса в своей C/C++ программе. Если вы планируете использовать прикладное
+решение на платформе Ананас, то пакет не нужно устанавливать.
+
+Разработчики
+---------------
+Валерий Гражданкин <vg at leaderit dot ru>
+Андрей Паскаль <app at lrn dot ru>
+Андрей Стрельников <avsone at yandex dot ru>
+Павел Миколайчук <Pashik at bk dot ru>
+Александр Ковалёв <cibfx at bk dot ru>
+Григорий Панов <gr1313 at mail dot ru>
+
+%description -n ananas-devel
+Ananas development library. Static libs and C header files.
+
+Developers
+---------------
+Valery Grazhdankin <vg at leaderit dot ru>
+Andrey Paskal <app at lrn dot ru>
+Andrey Strelnikov <avsone at yandex dot ru>
+Pavel Mikolaychuk <Pashik at bk dot ru>
+Alexander Kovalyov <cibfx at bk dot ru>
+Grigory Panov <gr1313 at mail dot ru>
+
+%package -n ananas-inventory
+Summary(ru_RU.KOI8-R): Прикладная настройка для ведения простого складского учета.
+Summary:       Scripts, Documents and Reports templates of Inventory system.
+Group:         Office
+Group(ru_RU.KOI8-R):   Приложения/Учет и Финансы
+
+Requires: ananas >= %version
+Requires: zip
+Requires: unzip
+
+%description -l ru_RU.KOI8-R -n ananas-inventory
+Прикладная настройка для ведения простого складского учета.
+
+Разработчики
+---------------
+Валерий Гражданкин <vg at leaderit dot ru>
+Андрей Паскаль <app at lrn dot ru>
+Андрей Стрельников <avsone at yandex dot ru>
+Павел Миколайчук <Pashik at bk dot ru>
+Александр Ковалёв <cibfx at bk dot ru>
+Григорий Панов <gr1313 at mail dot ru>
+
+%description -n ananas-inventory
+Scripts, Documents and Reports templates of Inventory Accounting system.
+
+Developers
+---------------
+Valery Grazhdankin <vg at leaderit dot ru>
+Andrey Paskal <app at lrn dot ru>
+Andrey Strelnikov <avsone at yandex dot ru>
+Pavel Mikolaychuk <Pashik at bk dot ru>
+Alexander Kovalyov <cibfx at bk dot ru>
+Grigory Panov <gr1313 at mail dot ru>
+
+%package -n ananas-extensions
+Summary(ru_RU.KOI8-R): Набор плагинов для Ананаса.
+Summary:       Ananas plugins collection.
+Group:         Office
+Group(ru_RU.KOI8-R):   Приложения/Учет и Финансы
+
+Requires: ananas >= %version
+
+%description -l ru_RU.KOI8-R -n ananas-extensions
+Набор плагинов для Ананаса.
+
+Разработчики
+---------------
+Валерий Гражданкин <vg at leaderit dot ru>
+Андрей Паскаль <app at lrn dot ru>
+Андрей Стрельников <avsone at yandex dot ru>
+Павел Миколайчук <Pashik at bk dot ru>
+Александр Ковалёв <cibfx at bk dot ru>
+Григорий Панов <gr1313 at mail dot ru>
+
+%description -n ananas-extensions
+Ananas plugins collection.
+
+Developers
+---------------
+Valery Grazhdankin <vg at leaderit dot ru>
+Andrey Paskal <app at lrn dot ru>
+Andrey Strelnikov <avsone at yandex dot ru>
+Pavel Mikolaychuk <Pashik at bk dot ru>
+Alexander Kovalyov <cibfx at bk dot ru>
+Grigory Panov <gr1313 at mail dot ru>
+
+
+%prep
+%setup
+
+%build
+#export QTDIR=/usr/lib/qt3
+export PATH=${PATH}:$QTDIR/bin
+./configure
+make
+make tr
+
+%install
+export PATH=${PATH}:$QTDIR/bin
+
+if [ -e /etc/altlinux-release ] ; then
+
+# пока libMySQL >=4.1 нет в Sisyphus, чтобы не пересобирать MySQL-devel :-(
+%set_verify_elf_method textrel=relaxed
+
+       make install INSTALL_ROOT="$RPM_BUILD_ROOT" LIBDIR=%_libdir BINDIR=%_bindir DOCDIR=%_docdir/%name-%version INCLUDEDIR=%_includedir/ananas
+       %__mkdir_p %buildroot%_sysconfdir/ananas
+       %__mkdir_p %buildroot%_datadir/ananas/translations
+       %__mkdir_p %buildroot%_datadir/ananas/templates
+       %__mkdir_p %buildroot%_datadir/ananas/inventory
+       %__mkdir_p %buildroot%_datadir/pixmaps
+       %__mkdir_p %buildroot%_menudir
+       %__mkdir_p %buildroot%_datadir/applications/kde
+
+else
+
+       rm -f `find src doc -name Makefile`
+       qmake src/src.pro -o src/Makefile
+       cd src && make install INSTALL_ROOT="$RPM_BUILD_ROOT" LIBDIR=%_libdir BINDIR=%_bindir INCLUDEDIR=%_includedir/ananas && cd ../doc && qmake doc.pro -o Makefile && make install INSTALL_ROOT="$RPM_BUILD_ROOT" DOCDIR=%_docdir/%name-%version
+
+       mkdir -p %buildroot%_sysconfdir/ananas
+       mkdir -p %buildroot%_datadir/ananas/translations
+       mkdir -p %buildroot%_datadir/ananas/templates
+       mkdir -p %buildroot%_datadir/ananas/inventory
+       mkdir -p %buildroot%_datadir/applications/kde
+       mkdir -p %buildroot%_datadir/pixmaps
+       mkdir -p %buildroot/usr/lib/menu
+fi
+
+#clear debug info
+strip %buildroot%_bindir/ananas
+strip %buildroot%_bindir/ananas-designer
+strip %buildroot%_libdir/libananas.so*
+strip %buildroot%_libdir/ananas/qt3plugins/designer/libananasplugin.so
+strip %buildroot%_libdir/ananas/qt3plugins/sqldrivers/libqsqlmysqlu.so
+strip %buildroot%_libdir/ananas/*.so
+
+cp -f %_builddir/%name-%version/translations/*.qm %buildroot%_datadir/ananas/translations
+cp -f %_builddir/%name-%version/src/designer/templates/*.* %buildroot%_datadir/ananas/templates
+
+cp -f %_builddir/%name-%version/applications/inventory/inventory.cfg %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory.rc %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory.sql %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/inventory-demo.cfg %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory-demo.rc %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory-demo.sql %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/inventory_pgsql.sql %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/inventory_grouprc %buildroot%_sysconfdir/ananas
+cp -f %_builddir/%name-%version/applications/inventory/templ_*.odt %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/templ_*.ods %buildroot%_datadir/ananas/inventory
+
+
+cp -f %_builddir/%name-%version/build/kde/images/*.png %buildroot%_datadir/pixmaps/
+
+#if [ -e /etc/altlinux-release ] ; then
+
+       cp -f %_builddir/%name-%version/build/kde/ananas %buildroot/usr/lib/menu
+       cp -f %_builddir/%name-%version/build/kde/ananas-designer %buildroot/usr/lib/menu
+
+#else
+
+       cp -f %_builddir/%name-%version/build/kde/ananas.desktop %buildroot%_datadir/applications/kde
+       cp -f %_builddir/%name-%version/build/kde/ananas-designer.desktop %buildroot%_datadir/applications/kde
+#fi
+
+%post
+ln -fs  %_libdir/ananas/qt3plugins/designer/libananasplugin.so %_libdir/libananasplugin.so
+
+#starts mysql server 
+[ -e /etc/init.d/mysqld ] && /etc/init.d/mysqld status|grep -v pid > /dev/null && /etc/init.d/mysqld start > /dev/null || :
+#creates system base for mysql
+mysqlshow -u root| grep ananas_system > /dev/null || mysqladmin -u root create ananas_system || :
+#touch %buildroot%_sysconfdir/ananas/groupsrc
+
+if [ -e /etc/altlinux-release ] ; then
+       rm -f %_datadir/applications/kde/ananas.desktop
+       rm -f %_datadir/applications/kde/ananas-designer.desktop
+       %update_menus
+else
+       rm -f /usr/lib/menu/ananas
+       rm -f /usr/lib/menu/ananas-designer
+fi
+
+
+%post -n ananas-inventory
+#cat %_datadir/ananas/inventory/groupsrc >> %_sysconfdir/ananas/groupsrc
+#starts mysql server 
+[ -e /etc/init.d/mysqld ] && /etc/init.d/mysqld status|grep -v pid > /dev/null && /etc/init.d/mysqld start > /dev/null || :
+#creates databases
+mysql -u root -e "create database ananas_inventory character set utf8" > /dev/null 2>&1 && mysql -u root ananas_inventory < %_datadir/ananas/inventory/inventory.sql || :
+mysql -u root -e "create database ananas_inventory_demo character set utf8" > /dev/null 2>&1 && mysql -u root ananas_inventory_demo < %_datadir/ananas/inventory/inventory-demo.sql || :
+
+%postun
+
+if [ -e /etc/altlinux-release ] ; then
+%clean_menus
+fi
+rm -f %_datadir/ananas/translations/*.qm
+rm -f %_datadir/ananas/templates/*.*
+
+rmdir --ignore-fail-on-non-empty %_datadir/ananas/translations
+rmdir --ignore-fail-on-non-empty %_datadir/ananas/templates
+rmdir --ignore-fail-on-non-empty %_datadir/ananas
+
+%postun -n ananas-extensions
+rmdir --ignore-fail-on-non-empty %_libdir/ananas
+rmdir --ignore-fail-on-non-empty %_datadir/ananas
+
+
+%postun -n ananas-inventory
+rm -f %_sysconfdir/ananas/inventory.*
+rm -f %_sysconfdir/ananas/inventory-demo.*
+rm -f %_sysconfdir/ananas/inventory_grouprc
+rmdir --ignore-fail-on-non-empty %_sysconfdir/ananas
+rm -f %_datadir/ananas/inventory/templ_*.odt
+rm -f %_datadir/ananas/inventory/templ_*.ods
+rmdir --ignore-fail-on-non-empty %_datadir/ananas/inventory
+rmdir --ignore-fail-on-non-empty %_datadir/ananas
+
+
+%clean
+
+%files
+%_bindir/ananas
+%_bindir/ananas-designer
+%_libdir/libananas.so*
+%_libdir/ananas/qt3plugins/designer/libananasplugin.so
+%_libdir/ananas/qt3plugins/sqldrivers/libqsqlmysqlu.so
+%_docdir/%name-%version/ananas-*.sxw
+%_datadir/ananas/translations/*.qm
+%_datadir/ananas/templates/*.*
+%_datadir/pixmaps/*.png
+# files menu for ALT
+/usr/lib/menu/ananas
+/usr/lib/menu/ananas-designer
+# files desktop for Fedora
+%_datadir/applications/kde/ananas.desktop
+%_datadir/applications/kde/ananas-designer.desktop
+
+
+%files -n ananas-devel
+%_includedir/ananas/*.h
+%_docdir/%name-%version/*.tex
+
+%files -n ananas-inventory
+%_sysconfdir/ananas/inventory.*
+%_sysconfdir/ananas/inventory-demo.*
+
+%_datadir/ananas/inventory/inventory.sql
+%_datadir/ananas/inventory/inventory-demo.sql
+%_datadir/ananas/inventory/inventory_pgsql.sql
+
+%_datadir/ananas/inventory/templ_*.odt
+%_datadir/ananas/inventory/templ_*.ods
+%_sysconfdir/ananas/inventory_grouprc
+
+%files -n ananas-extensions
+%_libdir/ananas/*.so
+
+%changelog
+* Sun Dec 30 2007 Andrey Paskal 0.9.5
+  + Please look at ChangeLog file of Ananas Project
+
+* Fri Sep 08 2006 Andrey Paskal
+  + Meta extention has been added
+  
+* Sun Jul 02 2006 Valery Grazdankin <leader@altlinux.ru> 0.9.3-alt2
+  + Trade equipment extension added 
+
+* Tue Jun 20 2006 Grigory Panov <gr1313 at mail dot ru> 0.9.3-alt1
+  + Added extensions
+  
+* Mon Mar 27 2006 Valery Grazdankin <leader@altlinux.ru> 0.9.3-alt1
+  - Automatic generated cvs build
+
+* Tue Feb 21 2006 Valery Grazdankin <leader@altlinux.ru> 0.9.2-alt1
+  + Add ananas extensions plugin system.
+
+* Thu Jan 05 2006 Grigory Panov <gr1313 at mail dot ru> 0.9.1-alt1
+  + Merge with st05 branch
+
+* Wed Jun 06 2005 Valery Grazdankin <leader@altlinux.ru> 0.4.2-alt1
+  + Files list was changed in the inventory package
+
+* Fri May 06 2005 Valery Grazdankin <leader@altlinux.ru> 0.4.2-alt1
+  + Added support some configuration files
+
+* Thu May 05 2005 Andrey Paskal <app at lrn dot ru> 0.4.2-alt1
+  + rpm build procedure was changed. After install ananas-inventory.*rpm
+  we can immediately to work with "Deport accouning" configuration ,
+  by running ananas-engine.
+  + Debugged (by gr) report procession in OpenOffice format under Linux.
+
+* Sat Mar 19 2005 Grigory Panov <gr1313 at mail dot ru> 0.4.2-alt1
+  + Added template in OpenOffice format for ananas-inventory
+  + Added section for remove files and directories after deinstallation
+  + Added ananas-engine-qt requires to ananas-inventory package
+
+* Tue Mar 15 2005 Valery Grazdankin <leader@altlinux.ru> 0.4.2-alt1
+  + File name ananasrc changed to groupsrc
+  + groupsrc have Unix file format now
+
+* Sun Nov 21 2004 Valery Grazdankin <leader@altlinux.ru> 0.4.2-alt1
+  + Correct installation procedure
+
+* Fri Nov 05 2004 Valery Grazdankin <leader@altlinux.ru> 0.4.2-alt1
+  + Added spec file for build ALT Linux packages.
+  + win32 version build completed. Ananas - is multitarget application now
diff --git a/build/fedora/fedora.spec b/build/fedora/fedora.spec
new file mode 100644 (file)
index 0000000..00ccf30
--- /dev/null
@@ -0,0 +1,231 @@
+# ananas project
+# Spec file for building single rpm package of Ananas for Fedora Linux
+# $Id: fedora.spec,v 1.1 2008/11/27 20:20:54 leader Exp $
+# $Name:  $
+#
+
+%define ShortName ananas
+%define _qtdir %(echo $QTDIR)
+
+Name: ananas
+Version: 0.9.5
+Release: %( echo f`grep -o "[0-9|\.]\+" /etc/redhat-release`)
+Buildroot: %{_tmppath}/%{name}-%{version}-root
+
+Summary: Runtime and development environment of Finance Applications.
+Summary(ru_RU.UTF8):   Среда разработки и исполнения прикладных решений автоматизации оперативного, бухгалтерского и других видов учета.
+
+License: GPL
+Url: http://ananas.lrn.ru/
+Vendor:        Project Ananas
+Group: Applications/Productivity
+
+Source:        %name-%version.tar.bz2
+
+Requires: mysql-server >= 4.1
+Requires: mysql >= 4.1
+Requires: qt >= 3.2.0
+Requires: qt-qsa >= 1.1
+Requires: bluecurve.so
+Requires: zip
+Requires: unzip
+
+
+BuildRequires:  gcc-c++ libstdc++-devel
+BuildRequires:  mysql-devel
+BuildRequires:  qt-devel
+BuildRequires:  qt-qsa-devel
+
+
+%description -l ru_RU.UTF8
+Платформа Ананас предназначена для автомматизации малых и средних предприятий.
+Обеспечивает автоматизацию ведения оперативного и бухгалтерского учета.
+Платформа позволяет создавать приложения, поддерживающие многопользовательский
+режим работы, сопровождается документацией на русском языке
+имеет русифицированный графический интерфейс пользователя. Для ее
+использования необходимо иметь установленную систему X Window System,
+графическую среду KDE и сервер баз данных с поддержкой транзакций MySQL.
+Пакет ananas необходимо установить, если вы собираетесь использовать
+прикладное решение на платформе Ананас.
+
+Разработчики
+---------------
+Валерий Гражданкин <vg at leaderit dot ru>
+Андрей Паскаль <app at lrn dot ru>
+Андрей Стрельников <avsone at yandex dot ru>
+Павел Миколайчук <Pashik at bk dot ru>
+Александр Ковалёв <cibfx at bk dot ru>
+Григорий Панов <gr1313 at mail dot ru>
+
+%description
+Ananas is  an Accounting Application Framework for Small Businesses.
+
+Developers
+---------------
+Valery Grazhdankin <vg at leaderit dot ru>
+Andrey Paskal <app at lrn dot ru>
+Andrey Strelnikov <avsone at yandex dot ru>
+Pavel Mikolaychuk <Pashik at bk dot ru>
+Alexander Kovalyov <cibfx at bk dot ru>
+Grigory Panov <gr1313 at mail dot ru>
+
+
+%prep
+%setup
+
+%build
+export PATH=${PATH}:$QTDIR/bin
+./configure
+make
+make tr
+
+%install
+export PATH=${PATH}:$QTDIR/bin
+
+
+rm -f `find src doc -name Makefile`
+qmake src/src.pro -o src/Makefile
+cd src && make install \
+       INSTALL_ROOT="$RPM_BUILD_ROOT" \
+       LIBDIR=%_libdir BINDIR=%_bindir \
+       INCLUDEDIR=%_includedir/ananas && \
+       cd ../doc && qmake doc.pro -o Makefile && make install INSTALL_ROOT="$RPM_BUILD_ROOT" DOCDIR=%_docdir/%name-%version
+
+mkdir -p %buildroot%_sysconfdir/ananas
+mkdir -p %buildroot%_datadir/ananas/translations
+mkdir -p %buildroot%_datadir/ananas/templates
+mkdir -p %buildroot%_datadir/ananas/inventory
+mkdir -p %buildroot%_datadir/applications/kde
+mkdir -p %buildroot%_datadir/pixmaps
+mkdir -p %buildroot/usr/lib/menu
+
+#clear debug info
+strip %buildroot%_bindir/ananas
+strip %buildroot%_bindir/ananas-designer
+strip %buildroot%_libdir/libananas.so*
+strip %buildroot%_libdir/ananas/qt3plugins/designer/libananasplugin.so
+strip %buildroot%_libdir/ananas/qt3plugins/sqldrivers/libqsqlmysqlu.so
+strip %buildroot%_libdir/ananas/*.so
+
+mv %buildroot%_libdir/ananas/qt3plugins/designer/libananasplugin.so %buildroot%_libdir/
+ln -fs  ../../../libananasplugin.so  %buildroot%_libdir/ananas/qt3plugins/designer/libananasplugin.so
+
+cp -f %_builddir/%name-%version/translations/*.qm %buildroot%_datadir/ananas/translations
+cp -f %_builddir/%name-%version/src/designer/templates/*.* %buildroot%_datadir/ananas/templates
+
+cp -f %_builddir/%name-%version/applications/inventory/inventory.cfg %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory.rc %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory.sql %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/inventory-demo.cfg %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory-demo.rc %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory-demo.sql %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/inventory_pgsql.sql %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/inventory_grouprc %buildroot%_sysconfdir/ananas
+cp -f %_builddir/%name-%version/applications/inventory/templ_*.odt %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/templ_*.ods %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/build/kde/images/*.png %buildroot%_datadir/pixmaps/
+cp -f %_builddir/%name-%version/build/kde/ananas.desktop %buildroot%_datadir/applications/kde
+cp -f %_builddir/%name-%version/build/kde/ananas-designer.desktop %buildroot%_datadir/applications/kde
+cp -f %_builddir/%name-%version/build/fedora/qtrc %buildroot%_datadir/ananas/
+
+%post
+
+# Fedora 8 does not provides %_libdir/qt-3.3/etc/settings/qtrc
+# So we install them manualy
+if ! [ -e %_libdir/qt-3.3/etc/settings/qtrc ]; then
+       if ! [ -e %_libdir/qt-3.3/etc/settings ] ;then 
+               mkdir -p %_libdir/qt-3.3/etc/settings
+       fi
+       cp %_datadir/ananas/qtrc %_libdir/qt-3.3/etc/settings/
+fi
+
+#starts mysql server 
+[ -e /etc/init.d/mysqld ] && /etc/init.d/mysqld status|grep -v pid > /dev/null && /etc/init.d/mysqld start > /dev/null || :
+#creates system base for mysql
+mysqlshow -u root| grep ananas_system > /dev/null || mysqladmin -u root create ananas_system || :
+#touch %buildroot%_sysconfdir/ananas/groupsrc
+
+rm -f /usr/lib/menu/ananas
+rm -f /usr/lib/menu/ananas-designer
+
+
+##%post -n ananas-inventory
+#starts mysql server 
+[ -e /etc/init.d/mysqld ] && /etc/init.d/mysqld status|grep -v pid > /dev/null && /etc/init.d/mysqld start > /dev/null || :
+#creates databases
+mysql -u root -e "create database ananas_inventory character set utf8" > /dev/null 2>&1 && mysql -u root ananas_inventory < %_datadir/ananas/inventory/inventory.sql || :
+mysql -u root -e "create database ananas_inventory_demo character set utf8" > /dev/null 2>&1 && mysql -u root ananas_inventory_demo < %_datadir/ananas/inventory/inventory-demo.sql || :
+
+%postun
+# Если %_libdir/qt-3.3/etc/settings/qtrc не принадлежит ни одному пакету,
+# значит это мы его поставили и должны удалить при деинсталляции.
+rpm -qf %_libdir/qt-3.3/etc/settings/qtrc > /dev/null 2>&1 || rm  -f %_libdir/qt-3.3/etc/settings/qtrc \
+&& rmdir  %_libdir/qt-3.3/etc/settings 2>/dev/null && rmdir --ignore-fail-on-non-empty %_libdir/qt-3.3/etc
+
+rm -f %_datadir/ananas/translations/*.qm
+rm -f %_datadir/ananas/templates/*.*
+
+rmdir --ignore-fail-on-non-empty %_datadir/ananas/translations
+rmdir --ignore-fail-on-non-empty %_datadir/ananas/templates
+rmdir --ignore-fail-on-non-empty %_datadir/ananas
+
+##%postun -n ananas-extensions
+rmdir --ignore-fail-on-non-empty %_libdir/ananas
+rmdir --ignore-fail-on-non-empty %_datadir/ananas
+
+
+##%postun -n ananas-inventory
+rm -f %_sysconfdir/ananas/inventory.*
+rm -f %_sysconfdir/ananas/inventory-demo.*
+rm -f %_sysconfdir/ananas/inventory_grouprc
+rmdir --ignore-fail-on-non-empty %_sysconfdir/ananas
+rm -f %_datadir/ananas/inventory/templ_*.odt
+rm -f %_datadir/ananas/inventory/templ_*.ods
+rmdir --ignore-fail-on-non-empty %_datadir/ananas/inventory
+rmdir --ignore-fail-on-non-empty %_datadir/ananas
+
+
+%clean
+
+%files
+%_bindir/ananas
+%_bindir/ananas-designer
+%_libdir/libananas.so*
+%_libdir/libananasplugin.so
+%_libdir/ananas/qt3plugins/designer/libananasplugin.so
+%_libdir/ananas/qt3plugins/sqldrivers/libqsqlmysqlu.so
+%_docdir/%name-%version/ananas-*.sxw
+%_datadir/ananas/translations/*.qm
+%_datadir/ananas/templates/*.*
+%_datadir/pixmaps/*.png
+# files menu for ALT
+##/usr/lib/menu/ananas
+##/usr/lib/menu/ananas-designer
+# files desktop for Fedora
+%_datadir/applications/kde/ananas.desktop
+%_datadir/applications/kde/ananas-designer.desktop
+%_datadir/ananas/qtrc
+
+##%files -n ananas-devel
+%_includedir/ananas/*.h
+%_docdir/%name-%version/*.tex
+
+##%files -n ananas-inventory
+%_sysconfdir/ananas/inventory.*
+%_sysconfdir/ananas/inventory-demo.*
+
+%_datadir/ananas/inventory/inventory.sql
+%_datadir/ananas/inventory/inventory-demo.sql
+%_datadir/ananas/inventory/inventory_pgsql.sql
+
+%_datadir/ananas/inventory/templ_*.odt
+%_datadir/ananas/inventory/templ_*.ods
+%_sysconfdir/ananas/inventory_grouprc
+
+##%files -n ananas-extensions
+%_libdir/ananas/*.so
+
+%changelog
+* Sun Dec 30 2007 Andrey Paskal 0.9.5
+  + Please look at ChangeLog file of Ananas Project
+
diff --git a/build/icons/a-system.ico b/build/icons/a-system.ico
new file mode 100644 (file)
index 0000000..f8fcdbd
Binary files /dev/null and b/build/icons/a-system.ico differ
diff --git a/build/icons/a-system.png b/build/icons/a-system.png
new file mode 100644 (file)
index 0000000..6638dff
Binary files /dev/null and b/build/icons/a-system.png differ
diff --git a/build/icons/ananas-16x16.png b/build/icons/ananas-16x16.png
new file mode 100644 (file)
index 0000000..80b93a5
Binary files /dev/null and b/build/icons/ananas-16x16.png differ
diff --git a/build/icons/ananas-32x32.png b/build/icons/ananas-32x32.png
new file mode 100644 (file)
index 0000000..2e79aae
Binary files /dev/null and b/build/icons/ananas-32x32.png differ
diff --git a/build/icons/ananas-designer.ico b/build/icons/ananas-designer.ico
new file mode 100644 (file)
index 0000000..9e815ab
Binary files /dev/null and b/build/icons/ananas-designer.ico differ
diff --git a/build/icons/ananas-designer.png b/build/icons/ananas-designer.png
new file mode 100644 (file)
index 0000000..1debdfa
Binary files /dev/null and b/build/icons/ananas-designer.png differ
diff --git a/build/icons/manual.ico b/build/icons/manual.ico
new file mode 100644 (file)
index 0000000..8e91fe5
Binary files /dev/null and b/build/icons/manual.ico differ
diff --git a/build/mandriva/mandriva.spec b/build/mandriva/mandriva.spec
new file mode 100644 (file)
index 0000000..947b24e
--- /dev/null
@@ -0,0 +1,219 @@
+# ananas project
+# Spec file for building single rpm package of Ananas for Mandriva 2008 Linux
+# $Id: ananas.spec.mandriva,v 1.0 2008/02/18 
+# $Name:  $
+# Created by Victor Abrosimov from Ananas spec file for Fedora Linux
+#
+
+%define ShortName ananas
+%define _qtdir %(echo $QTDIR)
+%define rel 5
+%define release %mkrel %rel
+
+Name: ananas
+Version: 0.9.5
+Release: %{release}
+Buildroot: %{_tmppath}/%{name}-%{version}-root
+
+Summary: Runtime and development environment of Finance Applications.
+Summary(ru_RU.UTF8):   Среда разработки и исполнения прикладных решений автоматизации оперативного, бухгалтерского и других видов учета.
+
+License: GPL
+Url: http://ananas.lrn.ru/
+Vendor:        Project Ananas
+Group: Applications/Productivity
+
+Source:        %name-%version.tar.bz2
+Requires: MySQL-server >= 4.1
+Requires: MySQL-client >= 4.1
+#Requires: postgresql TODO: Для postrges нужен код создающий БД при установке или первом запуске Ананаса
+Requires: libqt3 >= 3.2
+Requires: qsa >= 1.1
+Requires: zip
+Requires: unzip
+
+
+BuildRequires:  gcc-c++ libstdc++-devel
+BuildRequires:  libmysql-devel
+BuildRequires:  libqt3-devel
+BuildRequires:  qsa-devel
+BuildRequires:  postgresql-devel
+BuildRequires:  libpq-devel
+BuildRequires:  postgresql8.2-devel
+
+
+%description -l ru_RU.UTF8
+Платформа Ананас предназначена для автомматизации малых и средних предприятий.
+Обеспечивает автоматизацию ведения оперативного и бухгалтерского учета.
+Платформа позволяет создавать приложения, поддерживающие многопользовательский
+режим работы, сопровождается документацией на русском языке
+имеет русифицированный графический интерфейс пользователя. Для ее
+использования необходимо иметь установленную систему X Window System,
+графическую среду KDE и сервер баз данных с поддержкой транзакций MySQL.
+Пакет ananas необходимо установить, если вы собираетесь использовать
+прикладное решение на платформе Ананас.
+
+Разработчики
+---------------
+Валерий Гражданкин <vg at leaderit dot ru>
+Андрей Паскаль <app at lrn dot ru>
+Андрей Стрельников <avsone at yandex dot ru>
+Павел Миколайчук <Pashik at bk dot ru>
+Александр Ковалёв <cibfx at bk dot ru>
+Григорий Панов <gr1313 at mail dot ru>
+
+%description
+Ananas is  an Accounting Application Framework for Small Businesses.
+
+Developers
+---------------
+Valery Grazhdankin <vg at leaderit dot ru>
+Andrey Paskal <app at lrn dot ru>
+Andrey Strelnikov <avsone at yandex dot ru>
+Pavel Mikolaychuk <Pashik at bk dot ru>
+Alexander Kovalyov <cibfx at bk dot ru>
+Grigory Panov <gr1313 at mail dot ru>
+
+
+%prep
+%setup
+
+%build
+export PATH=${PATH}:$QTDIR/bin
+./configure
+make
+make tr
+
+%install
+export PATH=${PATH}:$QTDIR/bin
+
+
+rm -f `find src doc -name Makefile`
+qmake src/src.pro -o src/Makefile
+cd src && make install \
+       INSTALL_ROOT="$RPM_BUILD_ROOT" \
+       LIBDIR=%_libdir BINDIR=%_bindir \
+       INCLUDEDIR=%_includedir/ananas && \
+       cd ../doc && qmake doc.pro -o Makefile && make install INSTALL_ROOT="$RPM_BUILD_ROOT" DOCDIR=%_docdir/%name-%version
+
+mkdir -p %buildroot%_sysconfdir/ananas
+mkdir -p %buildroot%_datadir/ananas/translations
+mkdir -p %buildroot%_datadir/ananas/templates
+mkdir -p %buildroot%_datadir/ananas/inventory
+mkdir -p %buildroot%_datadir/applications/kde
+mkdir -p %buildroot%_datadir/pixmaps
+mkdir -p %buildroot/usr/lib/menu
+
+#clear debug info
+strip %buildroot%_bindir/ananas
+strip %buildroot%_bindir/ananas-designer
+strip %buildroot%_libdir/libananas.so*
+strip %buildroot%_libdir/ananas/qt3plugins/designer/libananasplugin.so
+strip %buildroot%_libdir/ananas/qt3plugins/sqldrivers/libqsqlmysqlu.so
+strip %buildroot%_libdir/ananas/*.so
+
+mv %buildroot%_libdir/ananas/qt3plugins/designer/libananasplugin.so %buildroot%_libdir/
+ln -fs  ../../../libananasplugin.so  %buildroot%_libdir/ananas/qt3plugins/designer/libananasplugin.so
+
+cp -f %_builddir/%name-%version/translations/*.qm %buildroot%_datadir/ananas/translations
+cp -f %_builddir/%name-%version/src/designer/templates/*.* %buildroot%_datadir/ananas/templates
+
+cp -f %_builddir/%name-%version/applications/inventory/inventory.cfg %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory.rc %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory.sql %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/inventory-demo.cfg %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory-demo.rc %buildroot%_sysconfdir/ananas/
+cp -f %_builddir/%name-%version/applications/inventory/inventory-demo.sql %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/inventory_pgsql.sql %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/inventory_grouprc %buildroot%_sysconfdir/ananas
+cp -f %_builddir/%name-%version/applications/inventory/templ_*.odt %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/applications/inventory/templ_*.ods %buildroot%_datadir/ananas/inventory
+cp -f %_builddir/%name-%version/build/kde/images/*.png %buildroot%_datadir/pixmaps/
+cp -f %_builddir/%name-%version/build/kde/ananas.desktop %buildroot%_datadir/applications/kde
+cp -f %_builddir/%name-%version/build/kde/ananas-designer.desktop %buildroot%_datadir/applications/kde
+cp -f %_builddir/%name-%version/build/fedora/qtrc %buildroot%_datadir/ananas/
+
+%post
+
+#starts mysql server 
+[ -e /etc/init.d/mysqld ] && /etc/init.d/mysqld status|grep -v pid > /dev/null && /etc/init.d/mysqld start > /dev/null || :
+#creates system base for mysql
+mysqlshow -u root| grep ananas_system > /dev/null || mysqladmin -u root create ananas_system || :
+#touch %buildroot%_sysconfdir/ananas/groupsrc
+
+rm -f /usr/lib/menu/ananas
+rm -f /usr/lib/menu/ananas-designer
+
+
+#starts mysql server 
+[ -e /etc/init.d/mysqld ] && /etc/init.d/mysqld status|grep -v pid > /dev/null && /etc/init.d/mysqld start > /dev/null || :
+#creates databases
+mysql -u root -e "create database ananas_inventory character set utf8" > /dev/null 2>&1 && mysql -u root ananas_inventory < %_datadir/ananas/inventory/inventory.sql || :
+mysql -u root -e "create database ananas_inventory_demo character set utf8" > /dev/null 2>&1 && mysql -u root ananas_inventory_demo < %_datadir/ananas/inventory/inventory-demo.sql || :
+
+%postun
+
+rm -f %_datadir/ananas/translations/*.qm
+rm -f %_datadir/ananas/templates/*.*
+
+rmdir --ignore-fail-on-non-empty %_datadir/ananas/translations
+rmdir --ignore-fail-on-non-empty %_datadir/ananas/templates
+rmdir --ignore-fail-on-non-empty %_datadir/ananas
+
+##%postun -n ananas-extensions
+rmdir --ignore-fail-on-non-empty %_libdir/ananas
+rmdir --ignore-fail-on-non-empty %_datadir/ananas
+
+
+##%postun -n ananas-inventory
+rm -f %_sysconfdir/ananas/inventory.*
+rm -f %_sysconfdir/ananas/inventory-demo.*
+rm -f %_sysconfdir/ananas/inventory_grouprc
+rmdir --ignore-fail-on-non-empty %_sysconfdir/ananas
+rm -f %_datadir/ananas/inventory/templ_*.odt
+rm -f %_datadir/ananas/inventory/templ_*.ods
+rmdir --ignore-fail-on-non-empty %_datadir/ananas/inventory
+rmdir --ignore-fail-on-non-empty %_datadir/ananas
+
+
+%clean
+
+%files
+%_bindir/ananas
+%_bindir/ananas-designer
+%_libdir/libananas.so*
+%_libdir/libananasplugin.so
+%_libdir/ananas/qt3plugins/designer/libananasplugin.so
+%_libdir/ananas/qt3plugins/sqldrivers/libqsqlmysqlu.so
+%_docdir/%name-%version/ananas-*.sxw
+%_datadir/ananas/translations/*.qm
+%_datadir/ananas/templates/*.*
+%_datadir/pixmaps/*.png
+# files desktop for Fedora
+%_datadir/applications/kde/ananas.desktop
+%_datadir/applications/kde/ananas-designer.desktop
+%_datadir/ananas/qtrc
+
+##%files -n ananas-devel
+%_includedir/ananas/*.h
+%_docdir/%name-%version/*.tex
+
+##%files -n ananas-inventory
+%_sysconfdir/ananas/inventory.*
+%_sysconfdir/ananas/inventory-demo.*
+
+%_datadir/ananas/inventory/inventory.sql
+%_datadir/ananas/inventory/inventory-demo.sql
+%_datadir/ananas/inventory/inventory_pgsql.sql
+
+%_datadir/ananas/inventory/templ_*.odt
+%_datadir/ananas/inventory/templ_*.ods
+%_sysconfdir/ananas/inventory_grouprc
+
+##%files -n ananas-extensions
+%_libdir/ananas/*.so
+
+%changelog
+* Sun Dec 30 2007 Andrey Paskal 0.9.5
+  + Please look at ChangeLog file of Ananas Project
+
diff --git a/build/menus/kde/README b/build/menus/kde/README
new file mode 100644 (file)
index 0000000..b406cec
--- /dev/null
@@ -0,0 +1,4 @@
+Каталог предназначен для файлов и скриптов, обеспечивающих
+интеграцию Ананаса со средой KDE
+хотя бы на уровне включения Ананаса после его установки
+в меню запуска KDE.
diff --git a/build/menus/kde/ananas b/build/menus/kde/ananas
new file mode 100644 (file)
index 0000000..6d0047d
--- /dev/null
@@ -0,0 +1,5 @@
+?package(ananas):command="ananas"\
+needs="x11" section="Office" title="Ananas.Inventory"\
+longtitle="Inventory management and accounting system" \
+icon="ananas-32x32.png"\
+extra_opt="\\nName[ru]=Ананас.Оперативный учет\\nComment[ru]=Складской и бухгалтерсий учет"
diff --git a/build/menus/kde/ananas-designer b/build/menus/kde/ananas-designer
new file mode 100644 (file)
index 0000000..32100fe
--- /dev/null
@@ -0,0 +1,6 @@
+?package(ananas):command="ananas-designer"\
+needs="x11" section="Applications/Development/Development environments"\
+title="Ananas.Designer"\
+longtitle="Design and develop Ananas applications"\
+icon="ananas-designer.png"\
+extra_opt="\\nName[ru]=Ананас.Дизайнер\\nComment[ru]=Разработка и настройка бизнес схем для Ананаса"
diff --git a/build/menus/kde/ananas-designer.desktop b/build/menus/kde/ananas-designer.desktop
new file mode 100644 (file)
index 0000000..3444fe0
--- /dev/null
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Дизайнер для Ананаса
+Name[ru]=Дизайнер для Ананаса
+Comment=Design and develop Ananas applications
+Comment[ru]=Разработка и настройка бизнес схем для Ананаса
+Exec=ananas-designer
+Icon=ananas-designer.png
+Terminal=false
+Type=Application
+Categories=Application;Development;X-Red-Hat;
diff --git a/build/menus/kde/ananas.desktop b/build/menus/kde/ananas.desktop
new file mode 100644 (file)
index 0000000..94fae8f
--- /dev/null
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Ананас.Оперативный учет
+Name[ru]=Ананас.Оперативный учет
+Comment=Inventory management and accounting system
+Comment[ru]=Складской и бухгалтерсий учет
+Exec=ananas
+Icon=ananas-32x32.png
+Terminal=false
+Type=Application
+Categories=Application;Office;X-Fedora;
diff --git a/build/win32/AnanasInstall.iss b/build/win32/AnanasInstall.iss
new file mode 100644 (file)
index 0000000..2560b1f
--- /dev/null
@@ -0,0 +1,247 @@
+; Inno Setup Installation Script.\r
+; Version 5+ of Inno Setup required\r
+; (c) Leader InfoTech, 2004\r
+; (c) Valery Grazdankin ( leader ), 2004\r
+; (c) patched by Andrey Paskal, 2005\r
+; (c) patched by Grigory Panov, 2005-2007\r
+\r
+[Languages]\r
+Name: Russian; MessagesFile: "compiler:languages\Russian.isl"\r
+Name: English; MessagesFile: "compiler:default.isl"\r
+\r
+[Setup]\r
+SourceDir=..\..\\r
+AppName=Ananas\r
+AppVersion=0.9.5\r
+AppVerName=Ananas 0.9.5\r
+\r
+AppPublisher=Ananas Team\r
+AppPublisherURL=http://ananas.lrn.ru, http://www.leaderit.ru/page=ananas\r
+AppSupportURL=http://ananas.lrn.ru, http://www.leaderit.ru/page=ananas\r
+AppUpdatesURL=http://ananas.lrn.ru, http://www.leaderit.ru/page=ananas\r
+DefaultDirName={pf}\Ananas\r
+DefaultGroupName=Ananas\r
+AppCopyright=Copyright c 2002-2007 Leader InfoTech, Ananas Team\r
+DisableProgramGroupPage=yes\r
+AllowNoIcons=yes\r
+LicenseFile=COPYING.RU.cp1251\r
+InfoBeforeFile=build\win32\secondstep.txt\r
+Compression=lzma\r
+SolidCompression=yes\r
+OutputDir=.\\r
+OutputBaseFilename=Ananas-Setup-0.9.5\r
+\r
+[Components]\r
+Name: "designer"; Description: "Äèçàéíåð"; Types: full compact custom\r
+Name: "runtime"; Description: "Àíàíàñ"; Types: full compact custom\r
+;Name: "webengine"; Description: "Âåá ñëóæáà"; Types: full compact custom\r
+Name: "doc"; Description: "Äîêóìåíòàöèÿ"; Types: full custom\r
+;Name: "doc\user"; Description: "Ðóêîâîäñòâî ïîëüçîâàòåëÿ"; Types: full custom\r
+;Name: "doc\designer"; Description: "Îïèñàíèå äèçàéíåðà"; Types: full custom\r
+;Name: "doc\script"; Description: "Îïèñàíèå âñòðîåííîãî ÿçûêà"; Types: full custom\r
+;Name: "sources"; Description: "Source code"; Types: full custom\r
+;;Name: "sqlservers"; Description: "Database SQL servers"; Types: full custom\r
+;;Name: "sqlservers\mysql"; Description: "MySQL Database servers"; Types: full custom\r
+;;Name: "sqlservers\postgres"; Description: "PostgreSQL Database servers"; Types: full custom\r
+;Name: "acrobat"; Description: "Ïðîãðàììà ïðîñìîòðà äîêóìåíòàöèè Acrobat Reader 6.0"; Types: full custom\r
+Name: "applications"; Description: "Áèçíåñ-ñõåìû ïðîåêòà Àíàíàñ"; Types: full custom\r
+\r
+Name: "applications\inventory"; Description: "Îïåðàòèâíûé ó÷åò"; Types: full compact custom\r
+Name: "applications\inventory_demo"; Description: "Îïåðàòèâíûé ó÷åò. Äåìî."; Types: full custom\r
+Name: "extensions"; Description: "Ðàñøèðåíèÿ (ïëàãèíû)"; Types: full custom \r
+Name: "extensions\text"; Description: "Äëÿ ðàáîòû ñ òåêñòîâûìè ôàéëàìè"; Types: full custom\r
+Name: "extensions\xml"; Description: "Äëÿ ðàáîòû ñ XML"; Types: full custom\r
+Name: "extensions\meta"; Description: "Äëÿ äîñòóïà ê ìåòàäàííûì"; Types: full custom\r
+Name: "extensions\sql"; Description: "Äëÿ âûïîëíåíèÿ SQL çàïðîñîâ â îò÷åòàõ"; Types: full custom\r
+Name: "extensions\service"; Description: "Äëÿ äîñòóïà ê ðàçëè÷íûì ñëóæåáíûì ôóíêöèÿì"; Types: full custom\r
+Name: "extensions\dateservice"; Description: "Äëÿ ðàáîòû ñ äàòàìè"; Types: full custom\r
+Name: "extensions\minicalc"; Description: "Êàëüêóëÿòîð"; Types: full custom\r
+Name: "mysql"; Description: "Ñåðâåð áàç äàííûõ MySQL"; Types: full compact custom; Flags: fixed\r
+Name: "office"; Description: "Ïîäñèñòåìà îò÷åòîâ"; Types: full compact custom; Flags: fixed\r
+Name: "office\ooo"; Description: "Èñïîëüçîâàòü OpenOffice.org";  Types: full compact custom; Flags: exclusive;\r
+Name: "office\mso"; Description: "Èñïîëüçîâàòü Microsoft Office"; Types: full compact custom; Flags: exclusive;\r
+\r
+[Tasks]\r
+Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";\r
+Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}";\r
+\r
+[Files]\r
+Source: "build\win32\setuplogo.bmp"; DestDir: {tmp}; Flags: dontcopy\r
+;Source: "doc\*"; DestDir: "{app}\doc"; Components: doc; Flags: ignoreversion\r
+Source: "src\designer\ananas-designer.exe"; DestDir: "{app}"; Components: designer; Flags: ignoreversion\r
+;Source: "src\designer\testwrite.cfg"; DestDir: "{app}\applications\test"; Flags: ignoreversion\r
+Source: "src\ananas\ananas.exe"; DestDir: "{app}"; Components: runtime; Flags: ignoreversion\r
+;Source: "src\administrator\ananas-administrator.exe"; DestDir: "{app}"; Flags: ignoreversion\r
+Source: "src\plugins\ananasplugin.dll"; DestDir: "{app}\designer"; Flags: ignoreversion\r
+;Source: "src\plugins\rcplugin.dll"; DestDir: "{app}\designer"; Flags: ignoreversion\r
+;Source: "src\webengine\ananas-webengine.exe"; DestDir: "{app}"; Flags: ignoreversion\r
+;Source: "src\ananas\bkground.jpg"; DestDir: "{app}"; Flags: ignoreversion\r
+;Source: "src\designer\my.rc"; DestDir: "{app}"; Flags: ignoreversion\r
+Source: "src\lib\ananas.dll"; DestDir: "{app}"; Flags: ignoreversion\r
+Source: "COPYING.RU.cp1251"; DestDir: "{app}"; Flags: ignoreversion\r
+Source: "build\win32\README.CP1251"; DestDir: "{app}"; Flags: ignoreversion\r
+Source: "translations\*.qm"; DestDir: "{app}\translations"; Flags: ignoreversion\r
+Source: "src\designer\templates\*.*"; DestDir: "{app}\templates"; Components: designer; Flags: ignoreversion\r
+;Source: "src\webengine\tpl\*.*"; DestDir: "{app}\tpl"; Flags: ignoreversion\r
+;;;Source: "*"; Excludes:"*.exe,*.dll,*.lib,*.~*,.qmake.cache,*.tds,*.obj,CVS\*,tmp\*"; DestDir: "{app}\sources"; Flags: ignoreversion recursesubdirs\r
+;Source: "c:\mysql\*"; DestDir: "{app}\mysql\"; Flags: ignoreversion recursesubdirs\r
+\r
+Source: "applications\inventory\*.*"; DestDir: "{app}\applications\inventory"; Components: applications; Flags: ignoreversion\r
+\r
+Source: "src\extensions\aexttext.dll"; DestDir: "{app}\extensions"; Components: extensions\text; Flags: ignoreversion;\r
+Source: "src\extensions\aexttext.lib"; DestDir: "{app}\extensions"; Components: extensions\text; Flags: ignoreversion;\r
+Source: "src\extensions\aextxml.dll"; DestDir: "{app}\extensions"; Components: extensions\xml; Flags: ignoreversion;\r
+Source: "src\extensions\aextxml.lib"; DestDir: "{app}\extensions"; Components: extensions\xml; Flags: ignoreversion;\r
+Source: "src\extensions\aext_meta.dll"; DestDir: "{app}\extensions"; Components: extensions\meta; Flags: ignoreversion;\r
+Source: "src\extensions\aext_meta.lib"; DestDir: "{app}\extensions"; Components: extensions\meta; Flags: ignoreversion;\r
+Source: "src\extensions\aextsql.dll"; DestDir: "{app}\extensions"; Components: extensions\sql; Flags: ignoreversion;\r
+Source: "src\extensions\aextsql.lib"; DestDir: "{app}\extensions"; Components: extensions\sql; Flags: ignoreversion;\r
+Source: "src\extensions\aextservice.dll"; DestDir: "{app}\extensions"; Components: extensions\service; Flags: ignoreversion;\r
+Source: "src\extensions\aextservice.lib"; DestDir: "{app}\extensions"; Components: extensions\service; Flags: ignoreversion;\r
+Source: "src\extensions\aextdateservice.dll"; DestDir: "{app}\extensions"; Components: extensions\dateservice; Flags: ignoreversion;\r
+Source: "src\extensions\aextdateservice.lib"; DestDir: "{app}\extensions"; Components: extensions\dateservice; Flags: ignoreversion;\r
+Source: "src\extensions\aextminicalc.dll"; DestDir: "{app}\extensions"; Components: extensions\minicalc; Flags: ignoreversion;\r
+Source: "src\extensions\aextminicalc.lib"; DestDir: "{app}\extensions"; Components: extensions\minicalc; Flags: ignoreversion;\r
+Source: "c:\Qt\lib\qtmtnc321.dll"; DestDir: "{app}"; Flags: ignoreversion\r
+Source: "c:\Qt\lib\qsa110.dll"; DestDir: "{app}"; Flags: ignoreversion\r
+Source: "c:\Qt\plugins\designer\qseditorplugin.dll"; DestDir: "{app}\designer"; Flags: ignoreversion\r
+\r
+Source: "c:\Qt\plugins\sqldrivers\*.dll"; DestDir: "{app}\sqldrivers"; Flags: ignoreversion\r
+;if qsqlmysqlu exist in c:\Qt\3.2.1noncommercial\plugins\sqldrivers, replaced it with src\plugins\mysql\r
+Source: "src\plugins\mysql\qsqlmysqlu.dll"; DestDir: "{app}\sqldrivers"; Flags: ignoreversion\r
+\r
+Source: "..\MySQL\MySQL Server 4.1\bin\libmysql.dll"; DestDir: "{app}"; Flags: ignoreversion\r
+;Source: "c:\qt\3.2.1noncommercial\bin\pq.dll"; DestDir: "{app}"; Flags: ignoreversion\r
+;Source: "c:\qt\3.2.1noncommercial\bin\cc3250.dll"; DestDir: "{app}"; Flags: ignoreversion\r
+;Source: "c:\qt\3.2.1noncommercial\bin\cc3250mt.dll"; DestDir: "{app}"; Flags: ignoreversion\r
+Source: "c:\Borland\bcc55\Bin\cc3250.dll"; DestDir: "{app}"; Flags: ignoreversion\r
+Source: "c:\Borland\bcc55\Bin\cc3250mt.dll"; DestDir: "{app}"; Flags: ignoreversion\r
+;Source: "c:\qt\bin\linguist.exe"; DestDir: "{app}"; Flags: ignoreversion\r
+\r
+Source: "icons\a-system.ico"; DestDir: "{app}"; Flags: ignoreversion;\r
+Source: "icons\ananas-designer.ico"; DestDir: "{app}"; Flags: ignoreversion;\r
+Source: "icons\manual.ico"; DestDir: "{app}"; Flags: ignoreversion;\r
+\r
+Source: "build\win32\makerc.bat"; DestDir: "{app}"; Flags: ignoreversion;\r
+Source: "build\win32\makemysqlini.bat"; DestDir: "{app}"; Flags: ignoreversion;\r
+Source: "applications\inventory\wininstall.bat"; DestDir: "{app}"; Components: applications\inventory; Flags: ignoreversion;\r
+Source: "applications\inventory\demowininstall.bat"; DestDir: "{app}"; Components: applications\inventory_demo; Flags: ignoreversion;\r
+\r
+\r
+Source: "..\MySQL\*"; DestDir: {app}; Flags: ignoreversion recursesubdirs; Components:  mysql\r
+\r
+Source: "..\7-zip\7z.exe"; DestDir: {app}; Flags: ignoreversion recursesubdirs;\r
+Source: "..\7-zip\Codecs\copy.dll"; DestDir: "{app}\Codecs"; Flags: ignoreversion recursesubdirs;\r
+Source: "..\7-zip\Codecs\deflate.dll"; DestDir: "{app}\Codecs"; Flags: ignoreversion recursesubdirs;\r
+Source: "..\7-zip\Formats\zip.dll"; DestDir: "{app}\Formats"; Flags: ignoreversion recursesubdirs;\r
+\r
+Source: "..\doc\*.pdf"; DestDir: "{app}\doc"; Flags: ignoreversion recursesubdirs; Components: doc\r
+\r
+; NOTE: Don't use "Flags: ignoreversion" on any shared system files\r
+[INI]\r
+Filename: "{app}\lit.url"; Section: "InternetShortcut"; Key: "URL"; String: "http://ananas.lrn.ru"\r
+\r
+[Icons]\r
+Name: "{group}\Àíàíàñ.Îïåðàòèâíûé ó÷åò"; Components: runtime; Filename: "{app}\ananas.exe"; IconFilename: "{app}\a-system.ico"\r
+Name: "{group}\Àíàíàñ.Äèçàéíåð"; Components: designer; Filename: "{app}\ananas-designer.exe"; IconFilename: "{app}\ananas-designer.ico"\r
+Name: "{group}\Àíàíàñ.Ðóêîâîäñòâî ïîëüçîâàòåëÿ"; Components: doc; Filename: "{app}\doc\ananas-inventory-user-manual.pdf"; IconFilename: "{app}\manual.ico"\r
+Name: "{group}\Àíàíàñ.Ðóêîâîäñòâî ïðîãðàììèñòà"; Components: doc; Filename: "{app}\doc\ananas-designer-quick-start.pdf"; IconFilename: "{app}\manual.ico"\r
+Name: "{group}\{cm:UninstallProgram,Ananas}"; Filename: "{uninstallexe}"; AfterInstall: ananasAfterInstall\r
+Name: "{userdesktop}\Àíàíàñ.Îïåðàòèâíûé ó÷åò"; Components: runtime; Filename: "{app}\ananas.exe"; Tasks: desktopicon; IconFilename: "{app}\a-system.ico"\r
+Name: "{userdesktop}\Àíàíàñ.Äèçàéíåð"; Components: designer; Filename: "{app}\ananas-designer.exe"; Tasks: desktopicon; IconFilename: "{app}\ananas-designer.ico"\r
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Ananas"; Filename: "{app}\ananas.exe"; Tasks: quicklaunchicon; IconFilename: "{app}\a-system.ico"\r
+Name: "{group}\Àíàíàñ â èíòåðíåòå"; Filename: "{app}\lit.url"\r
+\r
+[Registry]\r
+Root: HKLM; Subkey: "Software\ananasgroup"; Flags: uninsdeletekeyifempty\r
+Root: HKLM; Subkey: "Software\ananasgroup\ananas"; Flags: uninsdeletekey\r
+Root: HKCU; Subkey: "Software\ananasgroup"; Flags: uninsdeletekeyifempty\r
+Root: HKCU; Subkey: "Software\ananasgroup\ananas"; Flags: uninsdeletekey\r
+Root: HKLM; Subkey: "Software\ananasgroup\ananas\groups"; ValueType: string; ValueName: "0"; ValueData: "Áèçíåñ-ñõåìû ïðîåêòà Àíàíàñ"\r
+Root: HKLM; Subkey: "Software\ananasgroup\ananas\groups\0"; Components: applications\inventory; ValueType: string; ValueName: "0"; ValueData: "{app}\applications\inventory\inventorywin.rc"\r
+Root: HKCU; Subkey: "Software\ananasgroup\ananas\groups"; ValueType: string; ValueName: "0"; ValueData: "Áèçíåñ-ñõåìû ïðîåêòà Àíàíàñ"\r
+Root: HKCU; Subkey: "Software\ananasgroup\ananas\groups\0"; Components: applications\inventory; ValueType: string; ValueName: "0"; ValueData: "{app}\applications\inventory\inventorywin.rc"\r
+Root: HKLM; Subkey: "Software\ananasgroup\ananas\groups\0"; Components: applications\inventory_demo; ValueType: string; ValueName: "1"; ValueData: "{app}\applications\inventory\inventory-demowin.rc"\r
+Root: HKCU; Subkey: "Software\ananasgroup\ananas\groups\0"; Components: applications\inventory_demo; ValueType: string; ValueName: "1"; ValueData: "{app}\applications\inventory\inventory-demowin.rc"\r
+Root: HKCU; Subkey: "Software\ananasgroup\ananas\config\variables"; Components: office\mso; ValueType: string; ValueName: "defaultOffice";  ValueData: "MSO"\r
+Root: HKCU; Subkey: "Software\ananasgroup\ananas\config\variables"; Components: office\ooo; ValueType: string; ValueName: "defaultOffice";  ValueData: "OOO"\r
+\r
+\r
+[Run]\r
+Filename: "{app}\ananas.exe"; Components: runtime; Description: "{cm:LaunchProgram,Àíàíàñ.Îïåðàòèâíûé ó÷åò}"; Flags: nowait postinstall skipifsilent\r
+FileName: "{app}\MySQL Server 4.1\bin\mysqld-nt.exe"; Parameters: "--install MySQLAnanas ""--defaults-file={app}\mysqls~1.1\my.ini"" "; Components:  mysql; Flags: runhidden; StatusMsg: "Óñòàíîâêà MySQL..."\r
+FileName: "net"; Parameters: "start MySQLAnanas"; Components:  mysql; Flags: shellexec runhidden\r
+\r
+;FileName: "{app}\MySQL Server 4.1\bin\mysqladmin.exe"; Parameters: "-u root create ananas_system"; Components:  mysql; Flags: runhidden; StatusMsg: "Óñòàíîâêà MySQL... Ñîçäàíèå ÁÄ ananas_system"\r
+\r
+FileName: "{app}\MySQL Server 4.1\bin\mysqladmin.exe"; Parameters: "-u root create ananas_inventory"; Components:  mysql applications\inventory; Flags: runhidden; StatusMsg: "Ñîçäàíèå ÁÄ ananas_inventory"\r
+FileName: "{app}\wininstall.bat"; Components: applications\inventory; Parameters: """{app}\MySQL Server 4.1\bin"" ""{app}\applications\inventory\""";  Flags: shellexec runhidden;\r
+FileName: "{app}\makerc.bat"; Components: applications\inventory; Parameters: """{app}\applications\inventory""  ""{app}\applications\inventory\inventory.cfg""  ""{app}\applications\inventory\inventorywin.rc""";  Flags: shellexec runhidden;\r
+\r
+FileName: "{app}\MySQL Server 4.1\bin\mysqladmin.exe"; Parameters: "-u root create ananas_inventory_demo"; Components:  mysql applications\inventory_demo; Flags: runhidden; StatusMsg: "Ñîçäàíèå ÁÄ ananas_inventory_demo"\r
+FileName: "{app}\demowininstall.bat"; Components: applications\inventory_demo; Parameters: """{app}\MySQL Server 4.1\bin"" ""{app}\applications\inventory\""";  Flags: shellexec runhidden;\r
+FileName: "{app}\makerc.bat"; Components: applications\inventory_demo; Parameters: """{app}\applications\inventory""  ""{app}\applications\inventory\inventory-demo.cfg""  ""{app}\applications\inventory\inventory-demowin.rc""";  Flags: shellexec runhidden;\r
+\r
+\r
+FileName: "{app}\makemysqlini.bat"; Parameters: """{app}\MySQL Server 4.1\""  ""{app}\MySQL Server 4.1\Data\""  ""{app}\MySQL Server 4.1/my.ini""";  Flags: shellexec runhidden;\r
+\r
+\r
+[UninstallRun]\r
+FileName: "net";  Parameters: "stop MySQLAnanas"; Components:  mysql; Flags: runhidden; StatusMsg: "Îñòàíîâêà MySQL..."\r
+FileName: "{app}\MySQL Server 4.1\bin\mysqld-nt.exe"; Parameters: "--remove MySQLAnanas"; Components:  mysql; Flags: runhidden; StatusMsg: "Óäàëåíèå MySQL..."\r
+\r
+[UninstallDelete]\r
+Type: files; Name: "{app}\lit.url"\r
+Type: files; Name: "{app}\ananasplugin.dll"\r
+Type: filesandordirs; Name: "{app}\MySQL"; Components:  mysql\r
+\r
+[Code]\r
+//\r
+procedure InitializeWizard();\r
+var\r
+  SplashImage: TBitmapImage;\r
+  SplashForm: TForm;\r
+  SplashFileName: String;\r
+begin\r
+\r
+  SplashFileName := ExpandConstant('{tmp}\setuplogo.bmp');\r
+  ExtractTemporaryFile(ExtractFileName(SplashFileName));\r
+\r
+  SplashForm := TForm.create(nil);\r
+  with SplashForm do\r
+  begin\r
+    BorderStyle := bsNone;\r
+    Position := poScreenCenter;\r
+    // Adjust the height and width of the SplashForm\r
+    // to the size of our splash image\r
+    ClientWidth := 400;\r
+    ClientHeight := 244;\r
+  end;\r
+\r
+  SplashImage := TBitmapImage.Create(SplashForm);\r
+  with SplashImage do\r
+  begin\r
+    Bitmap.LoadFromFile(SplashFileName);\r
+    Stretch := true;\r
+    Align := alClient;\r
+    Parent := SplashForm;\r
+  end;\r
+\r
+  with SplashForm do\r
+  begin\r
+     Show;\r
+     Repaint;\r
+     Sleep(1000);\r
+     Close;\r
+     Free;\r
+  end;\r
+end;\r
+\r
+\r
+procedure ananasAfterInstall();\r
+begin\r
+  { copy files }\r
+  FileCopy( ExpandConstant('{app}\designer\ananasplugin.dll'), ExpandConstant('{app}\ananasplugin.dll'), false);\r
+  \r
+end;\r
+\r
diff --git a/build/win32/AnanasUpgrade.iss b/build/win32/AnanasUpgrade.iss
new file mode 100644 (file)
index 0000000..00db3cf
--- /dev/null
@@ -0,0 +1,135 @@
+; Inno Setup Installation Script.
+; Version 5+ of Inno Setup required
+; (c) Leader InfoTech, 2004
+; (c) Valery Grazdankin ( leader ), 2004
+; (c) patched by Andrey Paskal, 2005
+; (c) patched by Grigory Panov, 2005
+; (c) patched by Alexey Chernov, 2006
+
+[Languages]
+Name: Russian; MessagesFile: "compiler:languages\Russian.isl"
+Name: English; MessagesFile: "compiler:default.isl"
+
+[Setup]
+SourceDir=..\..\
+AppName=Îáíîâëåíèÿ Ananas
+AppVersion=0.9.3
+AppVerName=Îáíîâëåíèå Ananas 0.9.3
+AppPublisher=Ananas Team
+AppPublisherURL=http://ananas.lrn.ru, http://www.leaderit.ru/page=ananas
+AppSupportURL=http://ananas.lrn.ru, http://www.leaderit.ru/page=ananas
+AppUpdatesURL=http://ananas.lrn.ru, http://www.leaderit.ru/page=ananas
+DefaultDirName={pf}\Ananas
+DefaultGroupName=Ananas
+DirExistsWarning=No
+AppCopyright=Copyright c 2002-2006 Leader InfoTech, Ananas Project Team
+DisableProgramGroupPage=yes
+AllowNoIcons=yes
+LicenseFile=COPYING.RU.cp1251
+Compression=lzma
+SolidCompression=yes
+OutputDir=.\
+OutputBaseFilename=Ananas-Update-0.9.3
+
+[Files]
+Source: "build\win32\setuplogo.bmp"; DestDir: {tmp}; Flags: dontcopy
+Source: "src\designer\ananas-designer.exe"; DestDir: "{app}";
+Source: "src\ananas\ananas.exe"; DestDir: "{app}";
+Source: "src\plugins\ananasplugin.dll"; DestDir: "{app}\designer"; Flags: ignoreversion
+Source: "src\plugins\ananasplugin.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "src\lib\ananas.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "COPYING.RU.cp1251"; DestDir: "{app}";DestName:"License.txt" ; Flags: ignoreversion
+Source: "translations\*.qm"; DestDir: "{app}\translations"; Flags: ignoreversion
+Source: "c:\Qt\3.2.1noncommercial\lib\qsa110.dll"; DestDir: "{app}"; Flags: ignoreversion
+
+[Code]
+//
+var
+ananas_path:string;
+  function InitializeSetup(): Boolean;
+  begin
+    if RegKeyExists(HKLM,'Software\ananasgroup\ananas')=false
+    then
+    begin
+      Result := MsgBox('Íå íàéäåíà óñòàíîâëåííàÿ âåðñèÿ Ananas. Ïðîäîëæèòü?', mbConfirmation, MB_YESNO) = idYes;
+      if Result = False
+      then
+        MsgBox('Óñòàíîâêà îòìåíåíà', mbInformation, MB_OK);
+    end
+    else
+      Result:=True;
+  end;
+procedure InitializeWizard();
+var
+  SplashImage: TBitmapImage;
+  SplashForm: TForm;
+  SplashFileName: String;
+  uninsPath:string;
+  
+  ErrorCode:integer;
+  
+begin
+{  if RegValueExists(HKLM,'Software\ananasgroup\ananas','UninstallString')=true
+  then
+  begin
+  if MsgBox('Íàéäåíà óñòàíîâëåííàÿ âåðñèÿ Ananas. Óäàëèòü?', mbConfirmation, MB_YESNO)= idYes then
+    begin
+      RegQueryStringValue(HKLM,'Software\ananasgroup\ananas', 'UninstallString',UninsPath);
+      if not InstExec(ExpandConstant(UninsPath), '', '', True, False, SW_SHOWNORMAL, ErrorCode)
+        then
+      MsgBox('Script.NextButtonClick:' #13#13 'The file could not be executed. ' + SysErrorMessage(ErrorCode) + '.', mbError, MB_OK);
+    end;
+  end;  }
+  
+ { if RegKeyExists(HKLM,'Software\ananasgroup\ananas')=false
+  then
+  if MsgBox('Íå íàéäåíà óñòàíîâëåííàÿ âåðñèÿ Ananas. Ïðîäîëæèòü?', mbConfirmation, MB_YESNO)= idYes then
+  else ; }
+    
+  SplashFileName := ExpandConstant('{tmp}\setuplogo.bmp');
+  ExtractTemporaryFile(ExtractFileName(SplashFileName));
+  SplashForm := TForm.create(nil);
+  with SplashForm do
+  begin
+    BorderStyle := bsNone;
+    Position := poScreenCenter;
+    // Adjust the height and width of the SplashForm
+    // to the size of our splash image
+    ClientWidth := 400;
+    ClientHeight := 244;
+  end;
+  SplashImage := TBitmapImage.Create(SplashForm);
+  with SplashImage do
+  begin
+    Bitmap.LoadFromFile(SplashFileName);
+    Stretch := true;
+    Align := alClient;
+    Parent := SplashForm;
+  end;
+  with SplashForm do
+  begin
+     Show;
+     Repaint;
+     Sleep(1000);
+     Close;
+     Free;
+  end;
+end;
+Procedure CurPageChanged(CurPage: Integer);
+begin
+  Case CurPage of wpFinished:
+  begin
+    if FileExists(WizardDirValue+'\unins001.exe')
+    then
+      DeleteFile(WizardDirValue+'\unins001.exe');
+    if FileExists(WizardDirValue+'\unins001.dat')
+    then
+      DeleteFile(WizardDirValue+'\unins001.dat');
+  end;
+  end;
+end;
+//procedure ananasAfterInstall();
+//begin
+  { copy files }
+//  FileCopy( WizardDirValue+'\designer\ananasplugin.dll', WizardDirValue+'\ananasplugin.dll', false);
+//end;
diff --git a/build/win32/setuplogo.bmp b/build/win32/setuplogo.bmp
new file mode 100644 (file)
index 0000000..a0053c6
Binary files /dev/null and b/build/win32/setuplogo.bmp differ
diff --git a/icons/a-system.ico b/icons/a-system.ico
new file mode 100644 (file)
index 0000000..f8fcdbd
Binary files /dev/null and b/icons/a-system.ico differ
diff --git a/icons/a-system.png b/icons/a-system.png
new file mode 100644 (file)
index 0000000..6638dff
Binary files /dev/null and b/icons/a-system.png differ
diff --git a/icons/ananas-16x16.png b/icons/ananas-16x16.png
new file mode 100644 (file)
index 0000000..80b93a5
Binary files /dev/null and b/icons/ananas-16x16.png differ
diff --git a/icons/ananas-32x32.png b/icons/ananas-32x32.png
new file mode 100644 (file)
index 0000000..2e79aae
Binary files /dev/null and b/icons/ananas-32x32.png differ
diff --git a/icons/ananas-designer.ico b/icons/ananas-designer.ico
new file mode 100644 (file)
index 0000000..9e815ab
Binary files /dev/null and b/icons/ananas-designer.ico differ
diff --git a/icons/ananas_splach.cdr b/icons/ananas_splach.cdr
new file mode 100644 (file)
index 0000000..919f597
Binary files /dev/null and b/icons/ananas_splach.cdr differ
diff --git a/icons/lit.png b/icons/lit.png
new file mode 100644 (file)
index 0000000..f389f0a
Binary files /dev/null and b/icons/lit.png differ
diff --git a/icons/manual.ico b/icons/manual.ico
new file mode 100644 (file)
index 0000000..8e91fe5
Binary files /dev/null and b/icons/manual.ico differ
diff --git a/src/admin/admin.pro b/src/admin/admin.pro
new file mode 100644 (file)
index 0000000..6276148
--- /dev/null
@@ -0,0 +1,59 @@
+#project for Administrator application from Ananas automation accounting system
+TARGET = ananas4-administrator
+include ( ../lib/lib.pri )
+include ( ../plugins/plugins.pri )
+include ( ../ananas.pri )
+
+
+TEMPLATE       = app
+LANGUAGE       = C++
+DESTDIR = ../../bin
+
+LIBS   += -L../../lib -lananas4 
+LIBS    += -L../../lib/designer -lananasplugin4 -lqt4-qdataschema -L$(QTDIR)/lib -lqsa
+
+INCLUDEPATH    += ../lib ../lib/tmp/ui ../lib/.ui
+
+HEADERS        += atreeitems.h \
+       mdtree.h \
+       mainform.h \
+       usersform.h \
+       rolesform.h \
+       deditpermissions.h \
+       dselectuser.h \
+       deditrole.h \
+       dedituser.h \
+       dselectrole.h
+
+SOURCES        += main.cpp \
+       atreeitems.cpp \
+       mdtree.cpp \
+       mainform.cpp \
+       usersform.cpp \
+       rolesform.cpp \
+       deditpermissions.cpp \
+       dselectuser.cpp \
+       deditrole.cpp \
+       dedituser.cpp \
+       dselectrole.cpp
+       
+
+FORMS  = \ 
+       mainform.ui \
+       usersform.ui \
+       rolesform.ui \
+       deditpermissions.ui \
+       dselectuser.ui \
+       deditrole.ui \
+       dedituser.ui \
+       dselectrole.ui
+
+RESOURCES +=admin.qrc
+
+
+
+       
+TRANSLATIONS = \
+    ../../translations/ananas-administrator-en.ts \
+    ../../translations/ananas-administrator-ru.ts 
+       
diff --git a/src/admin/admin.qrc b/src/admin/admin.qrc
new file mode 100644 (file)
index 0000000..50d84f8
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE RCC><RCC version="1.1">
+    <qresource prefix="/">
+       <file>../../icons/a-system.png</file>
+       <file>images/administrator-splash-en.png</file>
+       <file>images/administrator-splash-ru.png</file>
+       <file>images/cat.png</file>
+       <file>images/cat_g.png</file>
+       <file>images/doc.png</file>
+       <file>images/doc_g.png</file>
+       <file>images/journ.png</file>
+       <file>images/journ_g.png</file>
+       <file>images/reg_g.png</file>
+       <file>images/reg.png</file>
+       <file>images/user.png</file>
+       <file>images/users.png</file>
+       <file>images/metadata.png</file>
+       <file>images/role.png</file>
+       <file>images/regs.png</file>
+       <file>images/report.png</file>
+       <file>images/report_g.png</file>
+    </qresource>
+</RCC>
\ No newline at end of file
diff --git a/src/admin/atreeitems.cpp b/src/admin/atreeitems.cpp
new file mode 100644 (file)
index 0000000..d91b055
--- /dev/null
@@ -0,0 +1,157 @@
+/****************************************************************************
+** $Id: atreeitems.cpp,v 1.2 2008/12/05 21:11:54 leader Exp $
+**
+** Header file of the Ananas visual tree object
+** of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru>, Yoshkar-Ola.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+//#include <qlistview.h>
+//#include <qheader.h>
+//#include <qpopupmenu.h>
+#include <qlabel.h>
+#include <qcursor.h>
+
+#include "atreeitems.h"
+
+ananasListViewItem::ananasListViewItem( Q3ListView *parent, aCfg * cfgmd, aCfgItem cfgobj,
+                                                                                const QString &name )
+: Q3ListViewItem( parent )
+{
+       obj = cfgobj;
+       md = cfgmd;
+       if ( name.isNull() ) setText( 0, md->attr( obj, mda_name ) );
+       else setText( 0, name );
+       id = md->id(obj);
+}
+
+ananasListViewItem::ananasListViewItem( ananasListViewItem *parent, ananasListViewItem *after,
+                                                                                aCfg * cfgmd, aCfgItem cfgobj, const QString &name )
+: Q3ListViewItem( parent, after )
+{
+       obj = cfgobj;
+       md = cfgmd;
+       if ( name.isNull() ) setText( 0, md->attr( obj, mda_name ) );
+       else setText( 0, name );
+       id = md->id(obj);
+}
+
+ananasListViewItem::ananasListViewItem( Q3ListView *parent, Q3ListViewItem *after, aCfg * cfgmd, aCfgItem cfgobj, const QString &name )
+: Q3ListViewItem( parent, after )
+{
+       obj = cfgobj;
+       md = cfgmd;
+       if ( name.isNull() ) setText( 0, md->attr( obj, mda_name ) );
+       else setText( 0, name );
+       id = md->id(obj);
+}
+
+void
+ananasListViewItem::clearTree()
+{
+       QListViewItem   *item, *nextitem;
+
+       // clear tree
+       item = firstChild();
+       while( item )
+       {
+               nextitem = item->nextSibling();
+               delete item;
+               item = nextitem;
+       }
+}
+
+/*
+void
+ananasListViewItem::moveItem ( QListViewItem * after )
+{
+CHECK_POINT
+       aCfgItem temp = obj, temp2 = ((ananasListViewItem*)after)->obj;
+       QListViewItem::moveItem( after );
+       obj = temp;
+       ((ananasListViewItem*)after)->obj = temp2;
+}
+*/
+
+ananasListViewItem *
+ananasListViewItem::previousSibling()
+{
+       if ( !this ) return 0;
+       QListViewItem *parent, *item;
+       parent = this->parent();
+       item = parent->firstChild();
+       while ( item )
+               if ( (ananasListViewItem *)item->nextSibling() == this )
+                       return (ananasListViewItem *) item;
+               else item = item->nextSibling();
+       return 0;
+}
+
+ananasListViewItem*
+ananasListViewItem::nextSibling()
+{
+       return (ananasListViewItem *)QListViewItem::nextSibling();
+}
+
+
+
+
+ananasListViewItem*
+ananasListViewItem::getLastChild()
+{
+       QListViewItem *item, *nextitem;
+       item = firstChild();
+       while( item )
+       {
+               nextitem = item->nextSibling();
+               if ( nextitem )
+                       item = nextitem;
+               else
+                       return (ananasListViewItem*) item;
+       }
+       return 0;
+};
+
+
+ananasTreeView::ananasTreeView ( QWidget *parent, aCfg *cfgmd )
+:Q3ListView ( parent )
+{
+       md = cfgmd;
+       addColumn( "" );
+       header()->hide();
+       setSorting ( -1 );
+       setSelectionMode( Single );
+};
+
+
+void
+ananasTreeView::ContextMenuAdd( QPopupMenu * m )
+{
+       //m->insertSeparator();
+};
+
+
+
+
diff --git a/src/admin/atreeitems.h b/src/admin/atreeitems.h
new file mode 100644 (file)
index 0000000..1d8dc15
--- /dev/null
@@ -0,0 +1,88 @@
+/****************************************************************************
+** $Id: atreeitems.h,v 1.2 2008/12/05 21:11:54 leader Exp $
+**
+** Header file of the Ananas visual tree object
+** of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru>, Yoshkar-Ola.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ATREEITEMS_H
+#define ATREEITEMS_H
+#include <Qt3Support>
+//#include <qpopupmenu.h>
+#include <qlistview.h>
+//#include <qintdict.h>
+#include "acfg.h"
+
+#define QListView Q3ListView
+#define QListViewItem Q3ListViewItem
+#define QPopupMenu Q3PopupMenu
+#define QHeader Q3Header
+
+class QWidget;
+
+class ananasListViewItem : public Q3ListViewItem
+{
+public:
+       int id;
+       aCfgItem obj;
+       QWidget *editor;
+       aCfg *md;
+
+       ananasListViewItem( Q3ListView *parent, aCfg * cfgmd, aCfgItem cfgobj, const QString &name = QString::null );
+       ananasListViewItem( Q3ListView *parent, Q3ListViewItem *after, aCfg * cfgmd, aCfgItem cfgobj, const QString &name = QString::null );
+       ananasListViewItem( ananasListViewItem *parent, ananasListViewItem *after, aCfg * cfgmd,
+                                               aCfgItem cfgobj, const QString &name = QString::null );
+
+       void clearTree();
+//     void moveUp ();
+//     void moveDown ();
+
+       ananasListViewItem *previousSibling();
+       ananasListViewItem *nextSibling();
+//     ananasListViewItem *getLastChild( QListViewItem * parent );
+       ananasListViewItem *getLastChild();
+protected:
+//     virtual void okRename( int col );
+};
+
+class ananasTreeView
+: public Q3ListView
+{
+    Q_OBJECT
+public:
+    aCfg *md;
+
+       ananasTreeView( QWidget *parent, aCfg *cfgmd );
+
+       void ContextMenuAdd(  QPopupMenu * m );
+//     void deleteItem();
+//     void moveUpItem ();
+//     void moveDownItem ();
+//     void renameItem();
+};
+
+
+#endif
diff --git a/src/admin/deditpermissions.cpp b/src/admin/deditpermissions.cpp
new file mode 100644 (file)
index 0000000..9693997
--- /dev/null
@@ -0,0 +1,82 @@
+#include "deditpermissions.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+//#include "deditpermissions.ui.h"
+/*
+ *  Constructs a dEditPermissions as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+dEditPermissions::dEditPermissions(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+    
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditPermissions::~dEditPermissions()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditPermissions::languageChange()
+{
+    retranslateUi(this);
+}
+
+
+void dEditPermissions::setData( int pm )
+{
+    int r,i;
+    r = 1;
+    QCheckBox *c;
+    for (i=1;i<=7;i++)
+    {
+       c = (QCheckBox*) child( (const char*) QString("checkBox%1").arg(i),"QCheckBox");
+       if ( c ) {
+         c->setChecked( (pm & r ) !=0 );  
+       }
+       r = r << 1;
+    }
+}
+
+
+int dEditPermissions::getData()
+{
+    int r,i, res=0;
+    r = 1;
+    QCheckBox *c;
+    for (i=1;i<=7;i++)
+    {
+       c = (QCheckBox*) child( (const char*) QString("checkBox%1").arg(i),"QCheckBox");
+       if ( c ) {
+         if (c->isChecked()) res |= r;  
+       }
+       r = r << 1;
+    }
+    return res;
+}
+
+
+void dEditPermissions::setAll( bool v )
+{
+    int i;
+    QCheckBox *c;
+    for (i=1;i<=7;i++)
+    {
+       c = (QCheckBox*) child( (const char*) QString("checkBox%1").arg(i),"QCheckBox");
+       if ( c ) c->setChecked( v );  
+    }
+}
diff --git a/src/admin/deditpermissions.h b/src/admin/deditpermissions.h
new file mode 100644 (file)
index 0000000..61274d1
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef DEDITPERMISSIONS_H
+#define DEDITPERMISSIONS_H
+
+#include <ui_deditpermissions.h>
+//#include <qvariant.h>
+
+class dEditPermissions : public QDialog, public Ui::dEditPermissions
+{
+    Q_OBJECT
+
+public:
+    dEditPermissions(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~dEditPermissions();
+
+public slots:
+    virtual void setData( int pm );
+    virtual int getData();
+    void setAll( bool b );
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // DEDITPERMISSIONS_H
diff --git a/src/admin/deditpermissions.ui b/src/admin/deditpermissions.ui
new file mode 100644 (file)
index 0000000..d7c05d4
--- /dev/null
@@ -0,0 +1,218 @@
+<ui version="4.0" >
+ <class>dEditPermissions</class>
+ <widget class="QDialog" name="dEditPermissions" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>331</width>
+    <height>204</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Edit permissions</string>
+  </property>
+  <layout class="QGridLayout" >
+   <item rowspan="2" row="0" column="0" >
+    <widget class="Q3ButtonGroup" name="buttonGroup1" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="title" >
+      <string>Permissions</string>
+     </property>
+     <widget class="QCheckBox" name="checkBox7" >
+      <property name="geometry" >
+       <rect>
+        <x>10</x>
+        <y>140</y>
+        <width>84</width>
+        <height>23</height>
+       </rect>
+      </property>
+      <property name="text" >
+       <string>turn off</string>
+      </property>
+     </widget>
+     <widget class="QCheckBox" name="checkBoxAll" >
+      <property name="geometry" >
+       <rect>
+        <x>10</x>
+        <y>160</y>
+        <width>84</width>
+        <height>23</height>
+       </rect>
+      </property>
+      <property name="text" >
+       <string>all</string>
+      </property>
+     </widget>
+     <widget class="QCheckBox" name="checkBox1" >
+      <property name="geometry" >
+       <rect>
+        <x>10</x>
+        <y>20</y>
+        <width>73</width>
+        <height>23</height>
+       </rect>
+      </property>
+      <property name="text" >
+       <string>view</string>
+      </property>
+     </widget>
+     <widget class="QCheckBox" name="checkBox2" >
+      <property name="geometry" >
+       <rect>
+        <x>10</x>
+        <y>40</y>
+        <width>73</width>
+        <height>23</height>
+       </rect>
+      </property>
+      <property name="text" >
+       <string>update</string>
+      </property>
+     </widget>
+     <widget class="QCheckBox" name="checkBox3" >
+      <property name="geometry" >
+       <rect>
+        <x>10</x>
+        <y>60</y>
+        <width>73</width>
+        <height>23</height>
+       </rect>
+      </property>
+      <property name="text" >
+       <string>insert</string>
+      </property>
+     </widget>
+     <widget class="QCheckBox" name="checkBox4" >
+      <property name="geometry" >
+       <rect>
+        <x>10</x>
+        <y>80</y>
+        <width>73</width>
+        <height>23</height>
+       </rect>
+      </property>
+      <property name="text" >
+       <string>delete</string>
+      </property>
+     </widget>
+     <widget class="QCheckBox" name="checkBox5" >
+      <property name="geometry" >
+       <rect>
+        <x>10</x>
+        <y>100</y>
+        <width>73</width>
+        <height>23</height>
+       </rect>
+      </property>
+      <property name="text" >
+       <string>execute</string>
+      </property>
+     </widget>
+     <widget class="QCheckBox" name="checkBox6" >
+      <property name="geometry" >
+       <rect>
+        <x>10</x>
+        <y>120</y>
+        <width>73</width>
+        <height>23</height>
+       </rect>
+      </property>
+      <property name="text" >
+       <string>turn on</string>
+      </property>
+     </widget>
+    </widget>
+   </item>
+   <item row="0" column="1" >
+    <layout class="QVBoxLayout" >
+     <item>
+      <widget class="QPushButton" name="pushButton1" >
+       <property name="text" >
+        <string>Ok</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButton2" >
+       <property name="text" >
+        <string>Cancel</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item row="1" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>51</width>
+       <height>114</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3ButtonGroup</class>
+   <extends>Q3GroupBox</extends>
+   <header>Qt3Support/Q3ButtonGroup</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >acfg.h</include>
+  <include location="global" >qmap.h</include>
+ </includes>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>pushButton1</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditPermissions</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>190</x>
+     <y>30</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>pushButton2</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditPermissions</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>190</x>
+     <y>67</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/admin/deditrole.cpp b/src/admin/deditrole.cpp
new file mode 100644 (file)
index 0000000..679bd5c
--- /dev/null
@@ -0,0 +1,50 @@
+#include "deditrole.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a dEditRole as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+dEditRole::dEditRole(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditRole::~dEditRole()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditRole::languageChange()
+{
+    retranslateUi(this);
+}
+
+
+void
+dEditRole::setData( const QString &s )
+{
+       lineEdit1->setText(s);
+}
+
+
+QString 
+dEditRole::getData()
+{
+       return lineEdit1->text();
+}
diff --git a/src/admin/deditrole.h b/src/admin/deditrole.h
new file mode 100644 (file)
index 0000000..2d94e37
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef DEDITROLE_H
+#define DEDITROLE_H
+
+#include "ui_deditrole.h"
+
+class dEditRole : public QDialog, public Ui::dEditRole
+{
+    Q_OBJECT
+
+public:
+    dEditRole(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~dEditRole();
+
+    virtual void setData( const QString & s );
+    virtual QString getData();
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // DEDITROLE_H
diff --git a/src/admin/deditrole.ui b/src/admin/deditrole.ui
new file mode 100644 (file)
index 0000000..1283988
--- /dev/null
@@ -0,0 +1,72 @@
+<ui version="4.0" stdsetdef="1" >
+  <author></author>
+  <comment></comment>
+  <exportmacro></exportmacro>
+  <class>dEditRole</class>
+  <widget class="QDialog" name="dEditRole" >
+    <property name="geometry" >
+      <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>394</width>
+        <height>99</height>
+      </rect>
+    </property>
+    <property name="windowTitle" >
+      <string>Role name</string>
+    </property>
+    <layout class="QGridLayout" >
+      <item row="0" column="1" >
+        <layout class="QVBoxLayout" >
+          <item>
+            <widget class="QPushButton" name="bOk" >
+              <property name="text" >
+                <string>Ok</string>
+              </property>
+            </widget>
+          </item>
+          <item>
+            <widget class="QPushButton" name="bCancel" >
+              <property name="text" >
+                <string>Cancel</string>
+              </property>
+            </widget>
+          </item>
+        </layout>
+      </item>
+      <item row="0" column="0" >
+        <layout class="QVBoxLayout" >
+          <item>
+            <widget class="QLabel" name="textLabel1" >
+              <property name="text" >
+                <string>Role name</string>
+              </property>
+              <property name="wordWrap" >
+                <bool>false</bool>
+              </property>
+            </widget>
+          </item>
+          <item>
+            <widget class="QLineEdit" name="lineEdit1" />
+          </item>
+        </layout>
+      </item>
+    </layout>
+  </widget>
+  <layoutdefault spacing="6" margin="11" />
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+  <connections>
+    <connection>
+      <sender>bOk</sender>
+      <signal>clicked()</signal>
+      <receiver>dEditRole</receiver>
+      <slot>accept()</slot>
+    </connection>
+    <connection>
+      <sender>bCancel</sender>
+      <signal>clicked()</signal>
+      <receiver>dEditRole</receiver>
+      <slot>reject()</slot>
+    </connection>
+  </connections>
+</ui>
diff --git a/src/admin/dedituser.cpp b/src/admin/dedituser.cpp
new file mode 100644 (file)
index 0000000..8c86bae
--- /dev/null
@@ -0,0 +1,90 @@
+#include "dedituser.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a dEditUser as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+dEditUser::dEditUser(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditUser::~dEditUser()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditUser::languageChange()
+{
+    retranslateUi(this);
+}
+
+
+bool 
+dEditUser::check( const QString &login )
+{
+    if(usr->sysValue("login").toString()==login)
+    {
+  return false; 
+     }
+    return true;
+}
+
+
+aUser * dEditUser::getData()
+{
+    return usr;
+  
+}
+
+
+void dEditUser::setData( aUser *user, bool isNew )
+{
+    usr = user;
+    newUser = isNew;
+    //usr->Select();
+    if(!isNew)
+    {
+ lineEdit1->setText(usr->sysValue("login").toString());
+ lineEdit2->setText(usr->sysValue("password").toString());
+ lineEdit3->setText(usr->sysValue("fname").toString());
+ lineEdit4->setText(usr->sysValue("lname").toString());
+}
+}
+
+
+void dEditUser::onOk()
+{
+    if(check(lineEdit1->text()))
+    {
+ if(newUser)
+ {
+    usr->New(lineEdit1->text(), lineEdit2->text(),lineEdit3->text(),lineEdit4->text());
+ }
+ else
+ {
+ usr->setSysValue("login",lineEdit1->text());
+ usr->setSysValue("password",lineEdit2->text());
+  usr->setSysValue("fname",lineEdit3->text());
+  usr->setSysValue("lname",lineEdit4->text());
+  usr->Update();
+}
+ this->accept();
+   }
+}
diff --git a/src/admin/dedituser.h b/src/admin/dedituser.h
new file mode 100644 (file)
index 0000000..e7ecd4e
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef DEDITUSER_H
+#define DEDITUSER_H
+#include "ui_dedituser.h"
+
+class dEditUser : public QDialog, public Ui::dEditUser
+{
+    Q_OBJECT
+
+public:
+    dEditUser(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~dEditUser();
+
+    virtual aUser * getData();
+
+public slots:
+    virtual bool check( const QString & login );
+    virtual void setData( aUser * user, bool isNew );
+    virtual void onOk();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    aUser *usr;
+    bool newUser;
+
+};
+
+#endif // DEDITUSER_H
diff --git a/src/admin/dedituser.ui b/src/admin/dedituser.ui
new file mode 100644 (file)
index 0000000..b7a15f6
--- /dev/null
@@ -0,0 +1,135 @@
+<ui version="4.0" stdsetdef="1" >
+  <author></author>
+  <comment></comment>
+  <exportmacro></exportmacro>
+  <class>dEditUser</class>
+  <widget class="QDialog" name="dEditUser" >
+    <property name="geometry" >
+      <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>414</width>
+        <height>246</height>
+      </rect>
+    </property>
+    <property name="windowTitle" >
+      <string>User</string>
+    </property>
+    <layout class="QGridLayout" >
+      <item row="0" column="0" >
+        <layout class="QVBoxLayout" >
+          <item>
+            <widget class="QLabel" name="textLabel1" >
+              <property name="text" >
+                <string>Login</string>
+              </property>
+              <property name="wordWrap" >
+                <bool>false</bool>
+              </property>
+            </widget>
+          </item>
+          <item>
+            <widget class="QLineEdit" name="lineEdit1" />
+          </item>
+          <item>
+            <widget class="QLabel" name="textLabel2" >
+              <property name="text" >
+                <string>Password</string>
+              </property>
+              <property name="wordWrap" >
+                <bool>false</bool>
+              </property>
+            </widget>
+          </item>
+          <item>
+            <widget class="QLineEdit" name="lineEdit2" >
+              <property name="echoMode" >
+                <enum>QLineEdit::Password</enum>
+              </property>
+            </widget>
+          </item>
+          <item>
+            <widget class="QLabel" name="textLabel3" >
+              <property name="text" >
+                <string>First name</string>
+              </property>
+              <property name="wordWrap" >
+                <bool>false</bool>
+              </property>
+            </widget>
+          </item>
+          <item>
+            <widget class="QLineEdit" name="lineEdit3" />
+          </item>
+          <item>
+            <widget class="QLabel" name="textLabel4" >
+              <property name="text" >
+                <string>Last Name</string>
+              </property>
+              <property name="wordWrap" >
+                <bool>false</bool>
+              </property>
+            </widget>
+          </item>
+          <item>
+            <widget class="QLineEdit" name="lineEdit4" />
+          </item>
+        </layout>
+      </item>
+      <item row="0" column="1" >
+        <layout class="QVBoxLayout" >
+          <item>
+            <widget class="QPushButton" name="pushButton1" >
+              <property name="text" >
+                <string>Ok</string>
+              </property>
+            </widget>
+          </item>
+          <item>
+            <widget class="QPushButton" name="pushButton2" >
+              <property name="text" >
+                <string>Cancel</string>
+              </property>
+            </widget>
+          </item>
+          <item>
+            <spacer name="spacer1" >
+              <property name="sizeHint" >
+                <size>
+                  <width>20</width>
+                  <height>141</height>
+                </size>
+              </property>
+              <property name="sizeType" >
+                <enum>QSizePolicy::Expanding</enum>
+              </property>
+              <property name="orientation" >
+                <enum>Qt::Vertical</enum>
+              </property>
+            </spacer>
+          </item>
+        </layout>
+      </item>
+    </layout>
+  </widget>
+  <layoutdefault spacing="6" margin="11" />
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+  <includes>
+    <include location="local" >auser.h</include>
+    <include location="local" >mdtree.h</include>
+  </includes>
+  <connections>
+    <connection>
+      <sender>pushButton1</sender>
+      <signal>clicked()</signal>
+      <receiver>dEditUser</receiver>
+      <slot>onOk()</slot>
+    </connection>
+    <connection>
+      <sender>pushButton2</sender>
+      <signal>clicked()</signal>
+      <receiver>dEditUser</receiver>
+      <slot>reject()</slot>
+    </connection>
+  </connections>
+</ui>
diff --git a/src/admin/dselectrole.cpp b/src/admin/dselectrole.cpp
new file mode 100644 (file)
index 0000000..3bfd312
--- /dev/null
@@ -0,0 +1,80 @@
+#include "dselectrole.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a dSelectRole as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+dSelectRole::dSelectRole(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dSelectRole::~dSelectRole()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dSelectRole::languageChange()
+{
+    retranslateUi(this);
+}
+
+void
+dSelectRole::setData( aUser *user )
+{
+ usr = user;
+ listBox1->clear();
+ listId.clear();
+ Q3ValueList<aRole*> list = user->getRoles(false);
+ Q3ValueList<aRole*>::iterator it;
+ for ( it = list.begin(); it != list.end(); ++it )
+ {
+  listBox1->insertItem( (*it)->sysValue("name").toString() );
+  listId.append((*it)->sysValue("id").toString());
+  delete (*it);
+ }
+// delete list;
+}
+
+
+void
+dSelectRole::onSelect()
+{
+ if(listBox1->currentItem()!=-1)
+ {
+  printf("add role\n");
+  //emit( addRole(listId[listBox1->currentItem()].toULongLong()) );
+  roleId =  listId[listBox1->currentItem()].toULongLong();
+   usr->addRole(roleId);
+  listBox1->removeItem(listBox1->currentItem());
+  accept();
+ // new aListViewItem(p_item,
+ }
+ else
+ {
+  printf("not selected\n");
+ }
+}
+
+
+Q_ULLONG dSelectRole::getData()
+{
+    return roleId;
+}
diff --git a/src/admin/dselectrole.h b/src/admin/dselectrole.h
new file mode 100644 (file)
index 0000000..63a0652
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef DSELECTROLE_H
+#define DSELECTROLE_H
+
+#include "ui_dselectrole.h"
+
+class dSelectRole : public QDialog, public Ui::dSelectRole
+{
+    Q_OBJECT
+
+public:
+    dSelectRole(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~dSelectRole();
+
+public slots:
+    virtual void setData( aUser * user );
+    virtual void onSelect();
+    virtual Q_ULLONG getData();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    Q_ULLONG roleId;
+    aUser *usr;
+    QStringList listId;
+
+};
+
+#endif // DSELECTROLE_H
diff --git a/src/admin/dselectrole.ui b/src/admin/dselectrole.ui
new file mode 100644 (file)
index 0000000..567fbb3
--- /dev/null
@@ -0,0 +1,71 @@
+<ui version="4.0" stdsetdef="1" >
+  <author></author>
+  <comment></comment>
+  <exportmacro></exportmacro>
+  <class>dSelectRole</class>
+  <widget class="QDialog" name="dSelectRole" >
+    <property name="geometry" >
+      <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>445</width>
+        <height>312</height>
+      </rect>
+    </property>
+    <property name="windowTitle" >
+      <string>Select role</string>
+    </property>
+    <layout class="QGridLayout" >
+      <item row="0" column="0" >
+        <widget class="Q3ListBox" name="listBox1" >
+          <item>
+            <property name="text" >
+              <string>New Item</string>
+            </property>
+          </item>
+        </widget>
+      </item>
+      <item row="0" column="1" >
+        <layout class="QVBoxLayout" >
+          <item>
+            <widget class="QPushButton" name="bSelect" >
+              <property name="text" >
+                <string>Select</string>
+              </property>
+            </widget>
+          </item>
+          <item>
+            <spacer name="spacer2" >
+              <property name="sizeHint" >
+                <size>
+                  <width>20</width>
+                  <height>201</height>
+                </size>
+              </property>
+              <property name="sizeType" >
+                <enum>QSizePolicy::Expanding</enum>
+              </property>
+              <property name="orientation" >
+                <enum>Qt::Vertical</enum>
+              </property>
+            </spacer>
+          </item>
+        </layout>
+      </item>
+    </layout>
+  </widget>
+  <layoutdefault spacing="6" margin="11" />
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+  <includes>
+    <include location="local" >auser.h</include>
+    <include location="local" >arole.h</include>
+  </includes>
+  <connections>
+    <connection>
+      <sender>bSelect</sender>
+      <signal>clicked()</signal>
+      <receiver>dSelectRole</receiver>
+      <slot>onSelect()</slot>
+    </connection>
+  </connections>
+</ui>
diff --git a/src/admin/dselectuser.cpp b/src/admin/dselectuser.cpp
new file mode 100644 (file)
index 0000000..a1d7917
--- /dev/null
@@ -0,0 +1,89 @@
+#include "dselectuser.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a dSelectUser as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+dSelectUser::dSelectUser(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dSelectUser::~dSelectUser()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dSelectUser::languageChange()
+{
+    retranslateUi(this);
+}
+
+void 
+dSelectUser::setData( aRole *i )
+{
+ Q_ULLONG id = i->sysValue("id").toULongLong();
+ listBox1->clear();
+ listId.clear();
+ role = i;
+ aUser *user = new aUser(i->db);
+ user->Select();
+ if(user->First())
+ {
+  do
+  {
+   if(!user->hasRole(id))
+   {
+    listBox1->insertItem(user->sysValue("login").toString());
+    listId.append(user->sysValue("id").toString());
+   }
+  }while(user->Next());
+ }
+
+}
+
+
+Q_ULLONG
+dSelectUser::getData( )
+{
+    return userId;
+}
+
+
+void dSelectUser::onSelect()
+{
+ if(listBox1->currentItem()!=-1)
+ {
+  printf("add user\n");
+  //emit( addRole(listId[listBox1->currentItem()].toULongLong()) );
+  userId =  listId[listBox1->currentItem()].toULongLong();
+printf("addUser()\n");
+  role->addUser(userId);
+  printf("user added\n");
+  listBox1->removeItem(listBox1->currentItem());
+  accept();
+ // new aListViewItem(p_item,
+ }
+ else
+ {
+  printf("not selected\n");
+ }
+}
diff --git a/src/admin/dselectuser.h b/src/admin/dselectuser.h
new file mode 100644 (file)
index 0000000..e4c7f3d
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef DSELECTUSER_H
+#define DSELECTUSER_H
+
+#include "ui_dselectuser.h"
+
+class dSelectUser : public QDialog, public Ui::dSelectUser
+{
+    Q_OBJECT
+
+public:
+    dSelectUser(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~dSelectUser();
+
+public slots:
+    virtual void setData( aRole * i );
+    virtual Q_ULLONG getData();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    Q_ULLONG userId;
+    QStringList listId;
+    aRole *role;
+
+private slots:
+    virtual void onSelect();
+
+};
+
+#endif // DSELECTUSER_H
diff --git a/src/admin/dselectuser.ui b/src/admin/dselectuser.ui
new file mode 100644 (file)
index 0000000..9e7cd99
--- /dev/null
@@ -0,0 +1,75 @@
+<ui version="4.0" stdsetdef="1" >
+  <author></author>
+  <comment></comment>
+  <exportmacro></exportmacro>
+  <class>dSelectUser</class>
+  <widget class="QDialog" name="dSelectUser" >
+    <property name="geometry" >
+      <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>602</width>
+        <height>348</height>
+      </rect>
+    </property>
+    <property name="windowTitle" >
+      <string>Select user</string>
+    </property>
+    <layout class="QGridLayout" >
+      <item row="0" column="0" >
+        <widget class="Q3ListBox" name="listBox1" >
+          <item>
+            <property name="text" >
+              <string>New Item</string>
+            </property>
+          </item>
+        </widget>
+      </item>
+      <item row="0" column="1" >
+        <layout class="QVBoxLayout" >
+          <item>
+            <layout class="QVBoxLayout" >
+              <item>
+                <widget class="QPushButton" name="bSelect" >
+                  <property name="text" >
+                    <string>Select</string>
+                  </property>
+                </widget>
+              </item>
+            </layout>
+          </item>
+          <item>
+            <spacer name="spacer2" >
+              <property name="sizeHint" >
+                <size>
+                  <width>20</width>
+                  <height>200</height>
+                </size>
+              </property>
+              <property name="sizeType" >
+                <enum>QSizePolicy::Expanding</enum>
+              </property>
+              <property name="orientation" >
+                <enum>Qt::Vertical</enum>
+              </property>
+            </spacer>
+          </item>
+        </layout>
+      </item>
+    </layout>
+  </widget>
+  <layoutdefault spacing="6" margin="11" />
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+  <includes>
+    <include location="local" >mdtree.h</include>
+    <include location="local" >arole.h</include>
+  </includes>
+  <connections>
+    <connection>
+      <sender>bSelect</sender>
+      <signal>clicked()</signal>
+      <receiver>dSelectUser</receiver>
+      <slot>onSelect()</slot>
+    </connection>
+  </connections>
+</ui>
diff --git a/src/admin/images/administrator-splash-en.png b/src/admin/images/administrator-splash-en.png
new file mode 100644 (file)
index 0000000..5f1d49b
Binary files /dev/null and b/src/admin/images/administrator-splash-en.png differ
diff --git a/src/admin/images/administrator-splash-ru.png b/src/admin/images/administrator-splash-ru.png
new file mode 100644 (file)
index 0000000..63d2009
Binary files /dev/null and b/src/admin/images/administrator-splash-ru.png differ
diff --git a/src/admin/images/cat.png b/src/admin/images/cat.png
new file mode 100644 (file)
index 0000000..3c1ae0f
Binary files /dev/null and b/src/admin/images/cat.png differ
diff --git a/src/admin/images/cat_g.png b/src/admin/images/cat_g.png
new file mode 100644 (file)
index 0000000..9e6bc8e
Binary files /dev/null and b/src/admin/images/cat_g.png differ
diff --git a/src/admin/images/doc.png b/src/admin/images/doc.png
new file mode 100644 (file)
index 0000000..61334f2
Binary files /dev/null and b/src/admin/images/doc.png differ
diff --git a/src/admin/images/doc_g.png b/src/admin/images/doc_g.png
new file mode 100644 (file)
index 0000000..fa0639b
Binary files /dev/null and b/src/admin/images/doc_g.png differ
diff --git a/src/admin/images/journ.png b/src/admin/images/journ.png
new file mode 100644 (file)
index 0000000..4d92109
Binary files /dev/null and b/src/admin/images/journ.png differ
diff --git a/src/admin/images/journ_g.png b/src/admin/images/journ_g.png
new file mode 100644 (file)
index 0000000..8739e8d
Binary files /dev/null and b/src/admin/images/journ_g.png differ
diff --git a/src/admin/images/metadata.png b/src/admin/images/metadata.png
new file mode 100644 (file)
index 0000000..b5c8949
Binary files /dev/null and b/src/admin/images/metadata.png differ
diff --git a/src/admin/images/reg.png b/src/admin/images/reg.png
new file mode 100644 (file)
index 0000000..bab93ce
Binary files /dev/null and b/src/admin/images/reg.png differ
diff --git a/src/admin/images/reg_g.png b/src/admin/images/reg_g.png
new file mode 100644 (file)
index 0000000..da52b84
Binary files /dev/null and b/src/admin/images/reg_g.png differ
diff --git a/src/admin/images/regs.png b/src/admin/images/regs.png
new file mode 100644 (file)
index 0000000..cbc4419
Binary files /dev/null and b/src/admin/images/regs.png differ
diff --git a/src/admin/images/report.png b/src/admin/images/report.png
new file mode 100644 (file)
index 0000000..0c4bb0c
Binary files /dev/null and b/src/admin/images/report.png differ
diff --git a/src/admin/images/report_g.png b/src/admin/images/report_g.png
new file mode 100644 (file)
index 0000000..04a49b1
Binary files /dev/null and b/src/admin/images/report_g.png differ
diff --git a/src/admin/images/role.png b/src/admin/images/role.png
new file mode 100644 (file)
index 0000000..eb4da7f
Binary files /dev/null and b/src/admin/images/role.png differ
diff --git a/src/admin/images/user.png b/src/admin/images/user.png
new file mode 100644 (file)
index 0000000..ccb0df5
Binary files /dev/null and b/src/admin/images/user.png differ
diff --git a/src/admin/images/users.png b/src/admin/images/users.png
new file mode 100644 (file)
index 0000000..211f7a9
Binary files /dev/null and b/src/admin/images/users.png differ
diff --git a/src/admin/main.cpp b/src/admin/main.cpp
new file mode 100644 (file)
index 0000000..db9ae79
--- /dev/null
@@ -0,0 +1,165 @@
+/****************************************************************************
+** $Id: main.cpp,v 1.4 2008/12/05 21:11:54 leader Exp $
+**
+** Main file of Ananas Administrator application
+**
+** Created : 20040823
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru>, Yoshkar-Ola.
+**
+** This file is part of the Engine application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <aapplication.h>
+#include <qmessagebox.h>
+#include <qtranslator.h>
+#include <qsplashscreen.h>
+#include <qtextcodec.h>
+#include "mainform.h"
+#include "ananas.h"
+
+//QApplication *application = 0;
+//MainForm *mainform = 0;
+//QTranslator *translator = 0, tr_app(0), tr_lib(0), tr_plugins(0);
+QString lang="en", 
+       rcfile="", 
+       username="", 
+       userpassword="";
+
+int setTranslator(QString lang)
+{
+        QString langdir;
+#ifdef _Windows
+       langdir = qApp->applicationDirPath()+"/";
+#else
+       langdir = "/usr/share/ananas/translations/";
+#endif
+//     tr_app.load( langdir+"ananas-administrator-"+lang+".qm",".");
+//     tr_lib.load( langdir+"ananas-lib-"+lang+".qm",".");
+//     tr_plugins.load( langdir+"ananas-plugins-"+lang+".qm",".");
+       return 0;
+}
+
+int 
+parseCommandLine( int argc, char **argv )
+{
+       QString param, name, value;
+       int i;
+       char *s, locale[50]="en";
+
+       strncpy( locale, QTextCodec::locale(), sizeof( locale ) );
+       s = strchr( locale, '_' );
+       if ( s ) {
+           *s = 0;
+       }
+        lang = locale;
+        setTranslator( lang );
+//     printf("locale=%s\n", locale ); 
+       QString str_ru=QString::null, str_en=QString::null;
+       bool lang_setted = false;
+       bool help_setted = false;
+       for ( i=1; i<argc; i++)
+       {
+           param = argv[i];
+           name = param.section("=",0,0).lower();
+           value = param.section("=",1);
+           if (param == "--help")
+           {
+                   str_ru = "Использование: ananas-administrator [--help] [--lang=<LANG>] [--rc=<RC_PATH>]\n";
+                   str_ru+= "LANG=ru|en\n";
+                   str_ru+= "RC_PATH=путь к *.rc файлу описания бизнес схемы\n";
+                           
+                   str_en = "Usage: ananas-administrator [--help] [--lang=<LANG>] [--rc=<RC_PATH>]\n";
+                   str_en+= "LANG=ru|en\n";
+                   str_en+= "RC_PATH=path to *.rc file of paticular business scheme\n";
+                   help_setted = true;
+                           
+           }
+           if (name == "--lang") {
+               lang = value;
+               lang_setted = true;
+               setTranslator( lang );
+           }
+           if (name == "--rc") rcfile = value;
+       }
+       if(help_setted)
+       {
+               if(lang == "ru")
+               {
+                       printf("%s",(const char*)str_ru.local8Bit());
+               }
+               else
+               {
+                       printf("%s",str_en.ascii());
+               }
+               return 1;
+       }
+       return 0;
+}
+
+int main( int argc, char ** argv )
+{
+
+       AApplication a( argc, argv, AApplication::Administrator );
+       //dSelectDB dselectdb;
+       int rc = 1;
+       bool ok;
+       QPixmap pixmap;
+
+       QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF8") );
+       qApp->addLibraryPath( qApp->applicationDirPath() );
+       if ( parseCommandLine( argc, argv ) ) return 1;
+//     qApp->installTranslator( &tr_app );
+//     qApp->installTranslator( &tr_lib );
+//     qApp->installTranslator( &tr_plugins );
+       pixmap = QPixmap(":/images/administrator-splash-"+lang+".png" );
+       if ( pixmap.isNull() )
+#ifdef _Windows
+       pixmap = QPixmap( qApp->applicationDirPath()+"/administrator-splash-"+lang+".png" );
+#else
+       pixmap = QPixmap( "/usr/share/ananas/administrator/locale/administrator-splash-"+lang+".png" );
+#endif
+       if ( pixmap.isNull() ) pixmap = QPixmap(":/images/administrator-splash-en.png" );
+       QSplashScreen *splash = new QSplashScreen( pixmap );
+       if ( ananas_login( rcfile, username, userpassword, 0, AApplication::Administrator ) ){
+               splash->show();
+               splash->message( QObject::tr("Init application"), Qt::AlignBottom, Qt::white );
+               MainForm *w = new MainForm( 0, "MainForm");
+               //mainform = w;
+//             mainformws = mainform->ws;
+//             mainformwl = mainform->wl;
+               qApp->setMainWidget( w );
+               w->rcfile = rcfile;
+//             printf( "rcfile = %s\n", rcfile.ascii() );
+               w->show();
+               ok = w->init();
+               splash->clear();
+                       splash->finish( w );
+                       delete splash;
+               if ( ok ) {
+                       a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
+                       rc = a.exec();
+               } else {
+                       QMessageBox::critical(0, "error","Error init Ananas engine");
+               }
+               ananas_logout();
+               return rc;
+       } else return 0;
+}
diff --git a/src/admin/mainform.cpp b/src/admin/mainform.cpp
new file mode 100644 (file)
index 0000000..c981cad
--- /dev/null
@@ -0,0 +1,131 @@
+#include "mainform.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a MainForm as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+MainForm::MainForm(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : QMainWindow(parent, fl)
+{
+    setupUi(this);
+    setObjectName( name );
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+MainForm::~MainForm()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void MainForm::languageChange()
+{
+    retranslateUi(this);
+}
+
+#include "usersform.h"
+#include "rolesform.h"
+
+void MainForm::fileNew()
+{
+
+}
+
+
+void MainForm::fileOpen()
+{
+
+}
+
+
+void MainForm::fileSave()
+{
+
+}
+
+
+void MainForm::fileSaveAs()
+{
+
+}
+
+
+void MainForm::filePrint()
+{
+
+}
+
+
+void MainForm::fileExit()
+{
+ close();
+}
+
+
+/*!
+ * Users functions.
+ */
+void MainForm::adminUsers()
+{
+
+
+    if( usersForm ) usersForm->show();//->isHidden())
+    else {
+        usersForm = new UsersForm( this );
+//        usersForm->init(db);
+//        usersForm->createTree();
+        ws->addSubWindow( usersForm );
+        usersForm->show();
+    }
+}
+
+
+
+bool MainForm::init()
+{
+    ws = new QMdiArea;
+    setCentralWidget( ws );
+    db = aDatabase::database();
+//    usersForm = new UsersForm;
+//    usersForm->hide();
+//    rolesForm = new RolesForm;
+//    rolesForm->init(db);
+//    rolesForm->createTree();
+//    rolesForm->hide();
+//    ws->addSubWindow( usersForm );
+//    ws->addSubWindow( rolesForm );
+    QSqlTableModel *t = new QSqlTableModel( this, *db->db() );
+    t->setTable( db_users );
+    t->setEditStrategy(QSqlTableModel::OnFieldChange );
+    t->select();
+    QTableView *dt = new QTableView;
+    dt->setModel( t );
+    ws->addSubWindow( dt );
+    dt->show();
+    return true;
+} 
+
+
+
+void MainForm::adminRoles()
+{
+    if ( rolesForm ) rolesForm->show();
+    else {
+      rolesForm = new RolesForm( this );
+//      rolesForm->init(db);
+//      rolesForm->createTree();
+      ws->addSubWindow( rolesForm );
+    }
+}
diff --git a/src/admin/mainform.h b/src/admin/mainform.h
new file mode 100644 (file)
index 0000000..fd0660c
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef MAINFORM_H
+#define MAINFORM_H
+
+#include <QMainWindow>
+#include <QPointer>
+
+#include "ui_mainform.h"
+
+class MainForm : public QMainWindow, public Ui::MainForm
+{
+    Q_OBJECT
+
+public:
+    MainForm(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~MainForm();
+
+    aWindowsList *wl;
+    QMdiArea *ws;
+    QString rcfile;
+    QPointer<UsersForm> usersForm;
+    QPointer<RolesForm> rolesForm;
+    aDatabase *db;
+    aCfg cfg;
+
+public slots:
+    virtual void fileNew();
+    virtual void fileOpen();
+    virtual void fileSave();
+    virtual void fileSaveAs();
+    virtual void filePrint();
+    virtual void fileExit();
+    virtual void adminUsers();
+    virtual bool init();
+    virtual void adminRoles();
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // MAINFORM_H
diff --git a/src/admin/mainform.ui b/src/admin/mainform.ui
new file mode 100644 (file)
index 0000000..926f17c
--- /dev/null
@@ -0,0 +1,127 @@
+<ui version="4.0" stdsetdef="1" >
+  <author></author>
+  <comment></comment>
+  <exportmacro></exportmacro>
+  <class>MainForm</class>
+  <widget class="QMainWindow" name="MainForm" >
+    <property name="geometry" >
+      <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>724</width>
+        <height>599</height>
+      </rect>
+    </property>
+    <property name="windowTitle" >
+      <string>Ananas: Administrator</string>
+    </property>
+    <property name="windowIcon" >
+      <pixmap>a-system.png</pixmap>
+    </property>
+    <widget class="QWidget" />
+    <widget class="QToolBar" name="toolBar" >
+      <property name="label" >
+        <string>Tools</string>
+      </property>
+      <addaction name="fileExitAction" />
+    </widget>
+    <widget class="QMenuBar" name="MenuBar" >
+      <property name="geometry" >
+        <rect>
+          <x>0</x>
+          <y>0</y>
+          <width>724</width>
+          <height>28</height>
+        </rect>
+      </property>
+      <widget class="QMenu" name="fileMenu" >
+        <property name="title" >
+          <string>&amp;File</string>
+        </property>
+        <addaction name="separator" />
+        <addaction name="separator" />
+        <addaction name="fileExitAction" />
+      </widget>
+      <widget class="QMenu" name="unnamed" >
+        <property name="title" >
+          <string>&amp;Administrator</string>
+        </property>
+        <addaction name="administratorUsersAction" />
+        <addaction name="administratorRolesAction" />
+      </widget>
+      <addaction name="fileMenu" />
+      <addaction name="unnamed" />
+    </widget>
+    <action name="fileExitAction" >
+      <property name="name" >
+        <cstring>fileExitAction</cstring>
+      </property>
+      <property name="iconText" >
+        <string>Exit</string>
+      </property>
+      <property name="text" >
+        <string>E&amp;xit</string>
+      </property>
+      <property name="shortcut" >
+        <string/>
+      </property>
+    </action>
+    <action name="administratorUsersAction" >
+      <property name="name" >
+        <cstring>administratorUsersAction</cstring>
+      </property>
+      <property name="iconText" >
+        <string>&amp;Users</string>
+      </property>
+      <property name="text" >
+        <string>&amp;Users</string>
+      </property>
+    </action>
+    <action name="administratorRolesAction" >
+      <property name="name" >
+        <cstring>administratorRolesAction</cstring>
+      </property>
+      <property name="iconText" >
+        <string>Roles</string>
+      </property>
+      <property name="text" >
+        <string>Roles</string>
+      </property>
+    </action>
+  </widget>
+  <layoutdefault spacing="6" margin="11" />
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+  <includes>
+    <include location="local" >ananas.h</include>
+    <include location="local" >qworkspace.h</include>
+    <include location="local" >awindowslist.h</include>
+    <include location="global" >q3vbox.h</include>
+    <include location="local" >usersform.h</include>
+  </includes>
+  <connections>
+    <connection>
+      <sender>fileExitAction</sender>
+      <signal>activated()</signal>
+      <receiver>MainForm</receiver>
+      <slot>fileExit()</slot>
+    </connection>
+    <connection>
+      <sender>administratorUsersAction</sender>
+      <signal>activated()</signal>
+      <receiver>MainForm</receiver>
+      <slot>adminUsers()</slot>
+    </connection>
+    <connection>
+      <sender>fileExitAction</sender>
+      <signal>activated()</signal>
+      <receiver>MainForm</receiver>
+      <slot>fileExit()</slot>
+    </connection>
+    <connection>
+      <sender>administratorRolesAction</sender>
+      <signal>activated()</signal>
+      <receiver>MainForm</receiver>
+      <slot>adminRoles()</slot>
+    </connection>
+  </connections>
+</ui>
diff --git a/src/admin/mdtree.cpp b/src/admin/mdtree.cpp
new file mode 100644 (file)
index 0000000..62d8ded
--- /dev/null
@@ -0,0 +1,962 @@
+/****************************************************************************
+** $Id: mdtree.cpp,v 1.3 2008/12/05 21:11:54 leader Exp $
+**
+** Code file of the Metadata Tree of Ananas Administrator applications
+**
+** Created : 20050609
+**
+** Copyright (C) 2003-2005 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru>, Yoshkar-Ola.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qlabel.h>
+#include <qapplication.h>
+//#include <qpixmap.h>
+//#include <qpopupmenu.h>
+//#include <qstatusbar.h>
+//#include <qlineedit.h>
+//#include <qmessagebox.h>
+//#include <qvaluelist.h>
+//#include <qimage.h>
+//#include <qbitmap.h>
+//#include <qdragobject.h>
+//#include <qheader.h>
+//#include <qfont.h>
+#include <qcursor.h>
+//#include <qlayout.h>
+
+#include "adatabase.h"
+#include "mainform.h"
+#include "deditpermissions.h"
+#include "dselectuser.h"
+#include "deditrole.h"
+#include "dedituser.h"
+#include "dselectrole.h"
+//#include "deditcat.h"
+//#include "deditireg.h"
+//#include "deditareg.h"
+//#include "deditjournal.h"
+//#include "deditwebform.h"
+//#include "deditcolumns.h"
+#include "awindowslist.h"
+
+//#include "acfg.h"
+#include "acfgrc.h"
+
+#include "mdtree.h"
+#include "usersform.h"
+#include "rolesform.h"
+
+//extern MainForm *mainform;
+//extern QPixmap rcIcon(const char *name);
+//extern void set_Icon(QListViewItem *item, const char *name);
+
+
+
+aListViewItem::aListViewItem(  ananasListViewItem *parent,
+                               ananasListViewItem *after,
+                               aCfg *cfgmd,
+                               aCfgItem cfgobj,
+                               const QString &name,
+                               aUser *usr,
+                               aRole *rl
+                               ): ananasListViewItem( parent, after, cfgmd, cfgobj, name )
+{
+        adb = aDatabase::database();
+       if(usr)
+       {
+//             printf("new user\n");
+               user = new aUser(usr->db);
+               user->Select(usr->sysValue("id").toULongLong());
+       }
+       else
+       {
+               user=NULL;
+       }
+//     user = usr;
+       if(rl)
+       {
+//             printf("new role\n");
+               role = new aRole(rl->db);
+               role->Select(rl->sysValue("id").toULongLong());
+       }
+       else
+       {
+               role=NULL;
+       }
+       loadTree();
+}
+
+
+
+aListViewItem::aListViewItem(QListView *parent, aCfg *cfgmd,  aCfgItem cfgobj, const QString &name )
+: ananasListViewItem( parent, cfgmd, cfgobj, name )
+{
+        adb = aDatabase::database();
+       role=NULL;
+       user=NULL;
+       loadTree();
+}
+
+
+aListViewItem::~aListViewItem()
+{
+
+       if(role)
+       {
+//             printf("delete role\n");
+               delete role;
+               role = NULL;
+       }
+       if(user)
+       {
+//             printf("delete user\n");
+               delete user;
+               user = NULL;
+       }
+}
+
+
+QString
+aListViewItem::text( int column ) const
+{
+       return Q3ListViewItem::text( column );
+//     if ( obj.isNull() ) return QObject::tr("Unknown object context");
+       if ( !id ) return Q3ListViewItem::text( column );
+       switch ( column ) {
+       case 0: return md->attr( obj, mda_name );
+       default:
+               return "";
+       }
+}
+
+
+
+int
+aListViewItem::compare( Q3ListViewItem *i, int col, bool accending ) const
+{
+       int id1 = 0, id2 = 0;
+       aListViewItem *ai = (aListViewItem *) i;
+       id1 = md->order( obj );
+       id2 = ai->md->order( ai->obj );
+       if ( md == ai->md && md->parent( obj ) == ai->md->parent( ai->obj ) && col ==0 && accending ) {
+               if ( id1 < id2 ) return -1;
+               if ( id1 == id2 ) return 0;
+               return 1;
+       }
+       return 1;
+}
+
+
+
+void
+aListViewItem::setup()
+{
+       Q3ListViewItem::setup();
+}
+
+
+
+/*!
+Update metadata tree for the object context.
+*/
+void
+aListViewItem::update()
+{
+       QString oclass = md->objClass( obj );
+       printf("remove !\n");   
+       if( oclass == md_user )
+       {
+               if(user->First())
+               {
+                       setText(0,user->sysValue("login").toString());
+               }
+       }
+       if( oclass == md_role)
+       {
+               if(role->First())
+               {
+                       setText(0,role->sysValue("name").toString());
+               }
+               
+       }
+       if( oclass == md_rl_user)
+       {
+               
+       }
+       if( oclass == md_rl_user)
+       {
+               
+       }
+       if( oclass == md_rl_user)
+       {
+               
+       }
+       if( oclass == md_rl_user)
+       {
+               
+       }
+
+       
+}
+
+
+void
+aListViewItem::loadTree()
+{
+//printf("load tree\n");
+       aListViewItem *item, *nextitem;
+       QString oclass, ldclass="";
+       int i, n;
+       aCfgItem cobj;
+
+       // clear tree
+//       item = (aListViewItem *) firstChild();
+//        while( item ) {
+//             nextitem = (aListViewItem *) item->nextSibling();
+//             delete item;
+//             item = nextitem;
+ //       }
+       if ( !md ) return;
+       if (id) setRenameEnabled(0, true);
+       oclass = md->objClass( obj );
+//     printf("oclass=`%s'\n",oclass.ascii()); 
+       if ( oclass == md_roles )
+       {
+               loadRoles(this);        
+               
+       }
+       if ( oclass == md_role )
+       {       
+               cobj = md->find ( mdc_metadata );
+//             cobj.setTagName("eqwe");
+               new aListViewItem(this, getLastChild(), md, cobj, QObject::tr("Metadata Objects"),NULL,role );
+       //      cobj.clear();
+               cobj = cobj.cloneNode(false).toElement();
+               cobj.setTagName( md_rl_users ); // change type to users 
+//             cobj.setTagName("eqwe");
+                                       
+               aUser *usr = new aUser(adb);
+               new aListViewItem(this, getLastChild(), md, cobj, QObject::tr("Users"),usr,role);
+       }
+       if ( oclass == md_users )
+       {
+               loadUsers(this);
+       }
+       if ( oclass == md_user )
+       {
+               loadUsrRoles(this);
+       }
+       if ( oclass == md_metadata )
+       {
+               cobj = md->find ( mdc_metadata );
+               setPixmap(0, QPixmap(":/images/metadata.png"));
+       //      setOpen(true);
+               cobj = md->find ( obj, md_catalogues, 0 );
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Catalogues"),NULL,role );
+               cobj = md->find ( obj, md_documents, 0 );
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Documents"),NULL,role );
+               cobj = md->find ( obj, md_reports, 0 );
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Reports"),NULL,role );
+               cobj = md->find ( obj, md_journals, 0 );
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Journals"),NULL,role );
+               cobj = md->find ( obj, md_iregisters, 0 );
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Information registers"),NULL,role );
+               cobj = md->find ( obj, md_aregisters, 0 );
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Accumulation registers"),NULL,role );
+               
+       }
+       if ( oclass == md_catalogues ){
+               QPixmap  pixmap = QPixmap(":/images/cat_g.png");
+               if(pixmap.isNull()) printf("image not loaded\n");
+               setPixmap(0, pixmap );
+               ldclass = md_catalogue;
+       }
+       if ( oclass == md_documents ){
+               setPixmap(0, QPixmap(":/images/doc_g.png"));
+               ldclass = md_document;
+       }
+       if ( oclass == md_reports ){
+               setPixmap(0, QPixmap(":/images/report_g.png"));
+               ldclass = md_report;
+       }
+       if ( oclass == md_journals ){
+               setPixmap(0, QPixmap(":/images/journ_g.png"));
+               ldclass = md_journal;
+       }
+       if ( oclass == md_iregisters ){
+               setPixmap(0, QPixmap(":/images/reg_g.png"));
+               ldclass = md_iregister;
+       }
+       if ( oclass == md_aregisters ){
+               setPixmap(0, QPixmap(":/images/regs_g.png"));
+               ldclass = md_aregister;
+       }
+       if ( oclass == md_rl_users ){
+               setPixmap(0, QPixmap(":/images/users.png"));
+               loadRlUsers(this);
+       //      ldclass = md_rl_user;
+       }
+       if ( oclass == md_users ){
+               setPixmap(0, QPixmap(":/images/users.png"));
+       //      ldclass = md_rl_user;
+       }
+       if ( oclass == md_roles ){
+               setPixmap(0, QPixmap(":/images/roles.png"));
+       //      ldclass = md_role;
+       }
+       if ( oclass == md_user || oclass == md_rl_user){
+               setPixmap(0, QPixmap(":/images/user.png"));
+       //      ldclass = md_document;
+       }
+       if ( oclass == md_role || oclass == md_usr_role){
+               setPixmap(0, QPixmap(":/images/role.png"));
+       //      ldclass = md_document;
+       }
+       if ( !ldclass.isEmpty() ) {
+               
+               if(ldclass==md_rl_user)
+               {
+               }
+//             printf("%s\n",(const char *) ldclass.local8Bit() );
+               n = md->count( obj, ldclass );
+//             printf(" objclass=%s ldclass = %s count = %d\n", (const char *) oclass, (const char *) ldclass, n);
+               for ( i = 0; i<n; i++ ) {
+                       cobj = md->find( obj, ldclass, i );
+                       if ( !cobj.isNull() ) {
+//                             printf("%d ok\n", i);
+//                             new aListViewItem( this, md, md->find( obj, ldclass, i ), QString::null );
+                               new aListViewItem( this, getLastChild(), md,  cobj, QString::null, NULL ,role );
+                       }
+               }
+       }
+
+
+// elements
+}
+
+
+void
+aListViewItem::loadUsrRoles ( aListViewItem *parent )
+{
+       QValueList<aRole*> list = user->getRoles(true);
+       aCfgItem cobj;
+       //listId.clear();
+//     QValueList<aRole*> list = user->getRoles(false);
+       QValueList<aRole*>::iterator it;
+       for ( it = list.begin(); it != list.end(); ++it )
+       {
+               cobj = md->find ( mdc_metadata );
+               cobj = cobj.cloneNode(false).toElement();
+               cobj.setTagName( md_usr_role ); // change type to users 
+               new aListViewItem(parent, getLastChild(), md, cobj, (*it)->sysValue("name").toString(),user,(*it));
+//             listBox1->insertItem( (*it)->sysValue("name").toString() );
+               delete (*it);
+       }
+}
+
+
+
+void
+aListViewItem::loadRoles (aListViewItem *parent)
+{
+       aCfgItem cobj;
+       if( adb )
+       {
+               role = new aRole( adb );
+               
+               cobj = md->find ( mdc_metadata );
+               cobj = cobj.cloneNode(false).toElement();
+               cobj.setTagName( md_role ); // change type to users 
+               role->Select();
+               if(role->First())
+               {
+//                     printf("role first!!!\n");
+                       do
+                       {
+//                             printf("role next\n");
+                               new aListViewItem(parent, getLastChild(), md, cobj, role->sysValue("name").toString(),NULL,role);
+                       }while(role->Next());
+               }
+       }
+}
+
+
+
+void 
+aListViewItem::loadUsers (aListViewItem *parent)
+{
+       aCfgItem cobj;
+               if( adb )
+               {
+                       user = new aUser(adb);
+                       
+                       cobj = md->find ( mdc_metadata );
+                       cobj = cobj.cloneNode(false).toElement();
+                       cobj.setTagName( md_user ); // change type to role 
+                       user->Select();
+                       if(user->First())
+                       {
+//                             printf("user first!!!\n");
+                               do
+                               {
+//                                     printf("user next\n");
+                                       new aListViewItem(parent, getLastChild(), md, cobj, user->sysValue("login").toString(),user);
+                                       
+                               }while(user->Next());
+                       }
+               }
+}
+
+
+
+void 
+aListViewItem::loadRlUsers ( aListViewItem *parent ) 
+{
+//printf("load users!\n");     
+//     aUser *usr = new aUser(adb);
+       if(!user)
+       {
+               printf("user=NULL\n");
+               return;
+       }
+               
+       //user->Select();
+       aCfgItem l;
+       l = md->find( mdc_metadata );
+       l = l.cloneNode(false).toElement();
+       l.setTagName(md_rl_user);
+       user->Select();
+       if(user->First())
+       {
+//             printf("user first\n");
+               do
+               {
+                       if(role->hasUser(user->sysValue("id").toULongLong()))
+                       {
+                               new aListViewItem(parent, getLastChild(),md, l, user->sysValue("login").toString(),user,role);
+                       }
+//                     printf("user next\n");
+               }while (user->Next()); 
+       }
+//     printf("end\n");
+}
+
+
+
+void 
+aListViewItem::deleteRole ()
+{
+       printf("delete role!\n");       
+       role->Delete();
+//     removeItem(this);
+}
+
+
+
+void 
+aListViewItem::deleteUser ()
+{
+       printf("delete user!\n");       
+       user->Delete();
+//     removeItem(this);
+}
+
+
+
+void 
+aListViewItem::remove ()
+{
+       QString oclass = md->objClass( obj );
+       printf("remove !\n");   
+       if( oclass == md_usr_role )
+       {
+               user->delRole(role->sysValue("id").toULongLong());
+       }
+       if( oclass == md_rl_user)
+       {
+               role->delUser(user->sysValue("id").toULongLong());      
+       }
+//     removeItem(this);
+}
+
+
+/*
+*edit selected object
+*/
+
+
+
+void
+aListViewItem::editRole( bool isNew)
+{
+       QString oclass = md->objClass( obj );
+       if(oclass == md_role || oclass == md_roles )
+       {
+               dEditRole *e = new dEditRole( qApp->mainWidget());
+       //      wl->insert( objid, e );
+               editor = e;
+       //      QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+               if(isNew)
+               {
+                       printf("new role\n");
+                       e->setData("New Role");
+               }
+               else
+               {
+                       printf("edit role `%s'\n",role->sysValue("name").toString().ascii());
+                       e->setData(role->sysValue("name").toString());
+               }
+               if(e->exec() == QDialog::Accepted)
+               {
+                       if(isNew)
+                       {
+                               role->New(e->getData());
+                               aCfgItem l;
+                               l = md->find( mdc_metadata );
+                               l = l.cloneNode(false).toElement();
+                               l.setTagName(md_role);
+                               new aListViewItem(this,getLastChild(),md,l,role->sysValue("name").toString(),NULL,role);
+                               role->Select();
+                       }
+                       else
+                       {
+                               role->setSysValue("name",e->getData());
+                               role->Update();
+                               setText(0,e->getData());
+                       }
+               }
+               delete e;
+       }
+}
+
+
+
+void 
+aListViewItem::editPermission()
+{
+       QString oclass = md->objClass( obj );
+       dEditPermissions *e = new dEditPermissions( qApp->mainWidget());
+//     wl->insert( objid, e );
+       editor = e;
+       
+        int role_id, obj_id;
+        role_id = role->sysValue ( "id" ).toULongLong();
+        obj_id = md->id( obj );
+        printf("role = %i, obj=%i id=%i\n", role_id, obj_id, id );
+        int perm = adb->rolePermission( role_id, obj_id );
+        
+        e->setData ( perm );
+        if ( e->exec() == QDialog::Accepted )
+        {
+                perm = e->getData ();
+                adb->setRolePermission( role_id, obj_id, perm );
+        }
+        delete e;
+       
+//     QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+/*     QMap<aPermission,bool> m;
+       m [perm_read] = true; 
+       m [perm_execute] = false;
+       m [perm_turn_on] = false; 
+       m [perm_turn_off] = false; 
+       m [perm_create] = false; 
+       m [perm_delete] = false; 
+       
+       e->setData( m );
+       if(e->exec() == QDialog::Accepted)
+       {
+               e->getData( m );
+               //TODO: add logic here!
+       }
+       delete e;
+*/
+//     mainform->addTab(++mainform->lastTabId,e->name());
+//     e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+//     e->parentWidget()->frameSize().height());
+       
+//     printf("oclass = %s\n",( const char *) oclass );
+       //if ( oclass == md_documents ) newDocument();
+//     if ( oclass == md_columns ) newColumn();
+}
+
+
+
+void 
+aListViewItem::editUser(bool isNew)
+{
+       QString oclass = md->objClass( obj );
+       if ( oclass == md_users || oclass == md_user)
+       {
+               
+           dEditUser *e = new dEditUser( qApp->mainWidget() );
+           editor = e;
+           e->setData( user, isNew );
+           if(e->exec()==QDialog::Accepted)
+           {
+                       if(isNew)
+                       {
+                               aCfgItem l;
+                               l = md->find( mdc_metadata );
+                               l = l.cloneNode(false).toElement();
+                               l.setTagName(md_user);
+                               new aListViewItem(this,getLastChild(),md,l,user->sysValue("login").toString(),user,NULL);
+                               user->Select();
+                       }
+                       else
+                       {
+                               update();
+                       }
+           }
+           delete e;
+               
+       }
+}
+
+
+
+void 
+aListViewItem::addUser()
+{
+       QString oclass = md->objClass( obj );
+       if ( oclass == md_rl_users)
+       {
+               
+           dSelectUser *e = new dSelectUser( qApp->mainWidget() );
+           editor = e;
+           e->setData( role );
+           if(e->exec() == QDialog::Accepted)
+           {
+               aCfgItem l;
+               l = md->find( mdc_metadata );
+               l = l.cloneNode(false).toElement();
+               l.setTagName(md_rl_user);
+               aUser *usr = new aUser(e->getData(),role->db); 
+               new aListViewItem(this,getLastChild(),md,l,usr->sysValue("login").toString(),usr,role);
+               delete usr;
+               usr = NULL;
+           }
+           delete e;
+               
+       }
+}
+
+
+
+void 
+aListViewItem::addRole()
+{
+       QString oclass = md->objClass( obj );
+       if ( oclass == md_user)
+       {
+               
+           dSelectRole *e = new dSelectRole( qApp->mainWidget() );
+           editor = e;
+           e->setData( user );
+           if(e->exec() == QDialog::Accepted)
+           {
+               aCfgItem l;
+               l = md->find( mdc_metadata );
+               l = l.cloneNode(false).toElement();
+               l.setTagName(md_usr_role);
+               aRole *rl = new aRole(e->getData(),user->db); 
+               new aListViewItem(this,getLastChild(),md,l,rl->sysValue("name").toString(),user,rl);
+               delete rl;
+               rl = NULL;
+           }
+           delete e;
+               
+       }
+}
+
+
+
+aMetadataTreeView::aMetadataTreeView(  QWidget *parent, aCfg *cfgmd )
+:ananasTreeView( parent, cfgmd )
+{
+       aListViewItem *conf;
+
+       if ( !md ) return;
+       
+//     aCfgItem it = md->find( mdc_metadata );
+//     it = it.cloneNode(false).toElement();
+//     it.setTagName(md_roles);
+       
+//     conf = new aListViewItem( this, md, it, tr(QString("Roles")));
+//     conf->setOpen( TRUE );
+       connect( this, SIGNAL( contextMenuRequested( Q3ListViewItem*, const QPoint&, int) ), this, SLOT(ContextMenu() ) );
+//     connect( this, SIGNAL( returnPressed( QListViewItem* ) ), this, SLOT( itemEdit() ) );
+//     connect( this, SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( itemEdit() ) );
+//     connect( this, SIGNAL( collapsed( QListViewItem* ) ), this, SLOT( on_collapsed( QListViewItem* ) ) );
+}
+
+
+aMetadataTreeView::aMetadataTreeView( UsersForm  *parent, aCfg *cfgmd )
+:ananasTreeView( parent, cfgmd )
+{
+       aListViewItem *conf;
+
+       if ( !md ) return;
+       
+       aCfgItem it = md->find( mdc_metadata );
+       it = it.cloneNode(false).toElement();
+       it.setTagName(md_users);
+       
+       conf = new aListViewItem( this, md, it, tr(QString("Users")));
+       conf->setOpen( TRUE );
+       connect( this, SIGNAL( contextMenuRequested( Q3ListViewItem*, const QPoint&, int) ), this, SLOT(ContextMenu() ) );
+//     connect( this, SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( itemEdit() ) );
+       connect( this, SIGNAL( collapsed( QListViewItem* ) ), this, SLOT( on_collapsed( QListViewItem* ) ) );
+}
+
+
+aMetadataTreeView::aMetadataTreeView( RolesForm *parent, aCfg *cfgmd )
+:ananasTreeView( parent, cfgmd )
+{
+       aListViewItem *conf;
+
+       if ( !md ) return;
+       
+       aCfgItem it = md->find( mdc_metadata );
+       it = it.cloneNode(false).toElement();
+       it.setTagName(md_roles);
+       
+       conf = new aListViewItem( this, md, it, tr(QString("Roles")));
+       conf->setOpen( TRUE );
+       connect( this, SIGNAL( contextMenuRequested( Q3ListViewItem*, const QPoint&, int) ), this, SLOT(ContextMenu() ) );
+//     connect( this, SIGNAL( returnPressed( QListViewItem* ) ), this, SLOT( itemEdit() ) );
+//     connect( this, SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( itemEdit() ) );
+       connect( this, SIGNAL( collapsed( Q3ListViewItem* ) ), this, SLOT( on_collapsed( Q3ListViewItem* ) ) );
+}
+
+
+
+void 
+aMetadataTreeView::on_collapsed( Q3ListViewItem * item )
+{
+       aListViewItem *i = (aListViewItem *) item;
+       if ( i )
+       {
+               QString oclass = md->objClass( i->obj );
+               if ( oclass == md_roles ) setOpen( i, true );
+       }
+}
+
+
+void
+aMetadataTreeView::ContextMenu()
+{
+
+       QPopupMenu *m=new QPopupMenu( this, "PopupMenu" );
+       Q_CHECK_PTR(m);
+
+/*     QLabel *caption = new QLabel( "<font color=darkblue><u><b>"
+               "Context Menu</b></u></font>", this );
+               caption->setAlignment( Qt::AlignCenter );
+       m->insertItem( caption );
+       m->insertItem( "&New",  this, SLOT( itemNew() ), CTRL+Key_N );
+               m->insertItem( "&Rename", this, SLOT( itemRename() ), CTRL+Key_O);
+               m->insertItem( "&Edit",  this, SLOT( itemEdit() ), CTRL+Key_N );
+       m->insertItem( "&Delete", this, SLOT( itemDelete() ), CTRL+Key_O );*/
+       
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if(!i) return;
+               
+       QLabel *caption = new QLabel( tr("<font color=darkblue><u><b>" "Context Menu</b></u></font>"), this );
+       caption->setAlignment( Qt::AlignCenter );
+//     m->insertItem( caption );
+       
+       QString oclass = md->objClass(i->obj);
+       printf("popup oclass==`%s'\n",oclass.ascii());
+       
+       if(oclass == md_user)
+       {
+       
+               m->insertItem( tr("&Add Role"),  this, SLOT( addRole() ), Qt::CTRL+Qt::Key_A );
+       }
+       if(oclass == md_roles)
+       {
+               m->insertItem( tr("&New Role"),  this, SLOT( newRole() ), Qt::CTRL+Qt::Key_N );
+       }
+       if( oclass == md_role)
+       {
+               
+               m->insertItem( tr("&Edit Role"),  this, SLOT( editRole() ), Qt::CTRL+Qt::Key_E );
+               m->insertItem( tr("&Delete Role"),  this, SLOT( delRole() ), Qt::CTRL+Qt::Key_D );
+       }
+       
+       if(oclass==md_rl_users)
+       {
+               m->insertItem( tr("&Add User"),  this, SLOT( addUser() ), Qt::CTRL+Qt::Key_A );
+       }
+       if(oclass==md_users )
+       {
+               m->insertItem( tr("&New User"),  this, SLOT( newUser() ), Qt::CTRL+Qt::Key_N );
+       }
+       
+       if(oclass==md_user)
+       {
+               m->insertItem( tr("&Edit User "), this, SLOT( editUser() ), Qt::CTRL+Qt::Key_E );
+               m->insertItem( tr("&Delete User"), this, SLOT( delUser() ), Qt::CTRL+Qt::Key_D );
+       }
+       if(oclass==md_usr_role || oclass==md_rl_user)
+       {
+               m->insertItem( tr("&Remove"), this, SLOT( itemDelete() ), Qt::CTRL+Qt::Key_R );
+       }
+       if(     oclass    == md_catalogue 
+               || oclass == md_document
+               || oclass == md_journal
+               || oclass == md_aregister
+               || oclass == md_iregister
+               || oclass == md_report )
+       {
+               m->insertItem( tr("&Set permissions"), this, SLOT( itemSetPermission() ), Qt::CTRL+Qt::Key_S );
+       }
+
+       ContextMenuAdd(m);
+//     m->insertItem( tr("&New"),  this, SLOT( itemNew() ), CTRL+Key_N );
+       m->exec( QCursor::pos() );
+       delete m;
+}
+
+
+/*void
+aMetadataTreeView::itemRename()
+{
+       renameItem();
+}
+*/
+void
+aMetadataTreeView::newUser()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+                i->editUser(true);
+       }
+}
+
+void
+aMetadataTreeView::newRole()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               i->editRole(true);
+       }
+}
+
+void
+aMetadataTreeView::editUser()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               i->editUser(false);
+//             emit (updateRoles());
+       }
+}
+
+void
+aMetadataTreeView::editRole()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               i->editRole(false);
+               
+               //emit(updateUsers());
+       }
+}
+
+void
+aMetadataTreeView::delRole()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               i->deleteRole();
+               delete i;
+               //emit(updateUsers());
+       }
+}
+void
+aMetadataTreeView::delUser()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               i->deleteUser();
+               delete i;
+               //emit (updateRoles());
+       }
+}
+
+void
+aMetadataTreeView::addRole()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               i->addRole();
+               //i->update();
+               //emit(updateUsers());
+               //emit (updateRoles());
+       }
+}
+void
+aMetadataTreeView::addUser()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               i->addUser();
+               //i->update();
+               //emit (updateRoles());
+       }
+}
+
+void
+aMetadataTreeView::itemSetPermission()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               //if ( i->id == 0 )
+                        i->editPermission();
+       }
+}
+
+
+void
+aMetadataTreeView::itemDelete()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               i->remove();
+               delete i;
+       }
+//     deleteItem();
+}
+
+
+
diff --git a/src/admin/mdtree.h b/src/admin/mdtree.h
new file mode 100644 (file)
index 0000000..a5b3b6a
--- /dev/null
@@ -0,0 +1,158 @@
+/****************************************************************************
+** $Id: mdtree.h,v 1.3 2008/12/05 21:11:54 leader Exp $
+**
+** Header file of the Metadata Tree of Ananas Administrator applications
+**
+** Created : 20050609
+**
+** Copyright (C) 2003-2005 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru>, Yoshkar-Ola.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef MDTREE_H
+#define MDTREE_H
+#include <Qt3Support>
+//#include <qlistview.h>
+//#include <qintdict.h>
+#include "acfg.h"
+#include "atreeitems.h"
+#include "auser.h"
+#include "arole.h"
+
+#define QIntDict Q3IntDict
+#define QValueList Q3ValueList
+
+//#include "usersform.h"
+//#include "rolesform.h"
+
+//extern aFormDesigner *formdesigner;
+//#include "cfg.h"
+class QWidget;
+class UsersForm;
+class RolesForm;
+
+class  aListViewItem : public ananasListViewItem
+{
+
+public:
+/*     int id;
+       aCfgItem obj;
+       QWidget *editor;
+       aCfg *md;
+*/
+       aDatabase *adb;
+       
+       aListViewItem(  ananasListViewItem *parent,
+                       ananasListViewItem *after,
+                       aCfg * cfgmd, 
+                       aCfgItem cfgobj, 
+                       const QString &name = QString::null,
+                       aUser *usr = NULL,
+                       aRole *rl = NULL);
+//     aListViewItem(QListViewItem *parent, aCfg * cfgmd, aCfgItem cfgobj, const QString &name = QString::null );
+       aListViewItem(  QListView *parent, 
+                       aCfg * cfgmd,
+                       aCfgItem obj,
+                       const QString &name = QString::null);
+       
+       ~aListViewItem();
+       QString text( int column ) const;
+       
+       aUser *user;
+       aRole *role;
+       
+       void loadTree();
+       void setup();
+       void update();
+       void deleteUser();
+       void deleteRole();
+       void editUser(bool isNew);
+       void editRole(bool isNew);
+       void addUser();
+       void addRole();
+       void remove();
+
+       void editPermission();
+//     void newDocument();
+//     void newCatalogue();
+//     void newJournal();
+//     void newIRegister();
+//     void newARegister();
+//     void newReport();
+//     void newForm();
+//     void newWebForm();
+//     void newTable();
+       void newColumn();
+
+protected:
+//     virtual void okRename( int col );
+       virtual int compare( Q3ListViewItem *i, int col, bool accending ) const;
+private:
+//     void loadDocument ();
+//     void loadJournal ();
+//     void loadIRegister ();
+//     void loadARegister ();
+//     void loadCatalogue ();
+//     void loadReport ();
+       void loadRoles (aListViewItem *a);
+       void loadUsers ( aListViewItem *a );
+       void loadRlUsers ( aListViewItem *a );
+       void loadUsrRoles (aListViewItem *a);
+//     void loadForms (aListViewItem *parent);
+//     void loadWebForms (aListViewItem *parent);
+//     void loadColumns ( aListViewItem *parent );
+};
+
+
+class aMetadataTreeView : public ananasTreeView
+{
+       Q_OBJECT
+public:
+//     aCfg *md;
+
+       aMetadataTreeView( QWidget *parent, aCfg *cfgmd );
+       aMetadataTreeView( UsersForm *parent, aCfg *cfgmd );
+       aMetadataTreeView( RolesForm *parent, aCfg *cfgmd );
+
+signals: 
+       void updateUsers();
+       void updateRoles();
+       
+public slots:
+       void ContextMenu();
+       void newUser();
+       void editUser();
+       void delUser();
+       void addUser();
+       void newRole();
+       void editRole();
+       void delRole();
+       void addRole();
+       
+       void itemDelete();
+       void itemSetPermission();
+private slots:
+       void on_collapsed( Q3ListViewItem *item );
+private:
+       QIntDict<QWidget> editors;
+};
+
+#endif
diff --git a/src/admin/rolesform.cpp b/src/admin/rolesform.cpp
new file mode 100644 (file)
index 0000000..51f0d3c
--- /dev/null
@@ -0,0 +1,36 @@
+#include "rolesform.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a RolesForm as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ */
+RolesForm::RolesForm(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : QWidget(parent, name, fl)
+{
+    setupUi(this);
+    new QVBoxLayout( this );
+    mdtree = new aMetadataTreeView( this, &aDatabase::database()->cfg ); // metadata tree creation
+    mdtree->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+    layout()->add( mdtree );
+    updateGeometry();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+RolesForm::~RolesForm()
+{
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void RolesForm::languageChange()
+{
+    retranslateUi(this);
+}
diff --git a/src/admin/rolesform.h b/src/admin/rolesform.h
new file mode 100644 (file)
index 0000000..b05f0a4
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef ROLESFORM_H
+#define ROLESFORM_H
+
+#include "ui_rolesform.h"
+
+class RolesForm : public QWidget, public Ui::RolesForm
+{
+    Q_OBJECT
+
+public:
+    RolesForm(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = 0);
+    ~RolesForm();
+
+    QString rcfile;
+    aMetadataTreeView *mdtree;
+//    aCfg *cfg;
+
+signals:
+    void updateUsers();
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // ROLESFORM_H
diff --git a/src/admin/rolesform.ui b/src/admin/rolesform.ui
new file mode 100644 (file)
index 0000000..009b5b3
--- /dev/null
@@ -0,0 +1,26 @@
+<ui version="4.0" stdsetdef="1" >
+  <author></author>
+  <comment></comment>
+  <exportmacro></exportmacro>
+  <class>RolesForm</class>
+  <widget class="QWidget" name="RolesForm" >
+    <property name="geometry" >
+      <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>398</width>
+        <height>400</height>
+      </rect>
+    </property>
+    <property name="windowTitle" >
+      <string>Ananas: Roles</string>
+    </property>
+    <layout class="QGridLayout" />
+  </widget>
+  <layoutdefault spacing="6" margin="11" />
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+  <includes>
+    <include location="local" >mdtree.h</include>
+    <include location="local" >acfg.h</include>
+  </includes>
+</ui>
diff --git a/src/admin/usersform.cpp b/src/admin/usersform.cpp
new file mode 100644 (file)
index 0000000..c5f36c0
--- /dev/null
@@ -0,0 +1,39 @@
+#include "usersform.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a UsersForm as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ */
+UsersForm::UsersForm(QWidget* parent, Qt::WindowFlags fl)
+    : QWidget(parent, fl)
+{
+    setupUi(this);
+    new QVBoxLayout( this );
+    mdtree = new aMetadataTreeView( this, &aDatabase::database()->cfg ); // metadata tree creation
+    mdtree->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+    layout()->add( mdtree );
+    updateGeometry();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+UsersForm::~UsersForm()
+{
+
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void UsersForm::languageChange()
+{
+    retranslateUi(this);
+}
+
+
diff --git a/src/admin/usersform.h b/src/admin/usersform.h
new file mode 100644 (file)
index 0000000..24ebec8
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef USERSFORM_H
+#define USERSFORM_H
+#include <QPointer>
+
+#include "ui_usersform.h"
+
+class UsersForm : public QWidget, public Ui::UsersForm
+{
+    Q_OBJECT
+
+public:
+    UsersForm(QWidget* parent = 0, Qt::WindowFlags fl = 0);
+    ~UsersForm();
+
+signals:
+    void updateRoles();
+
+protected:
+    aCfg *cfg;
+    QPointer<aMetadataTreeView> mdtree;
+    QString rcfile;
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // USERSFORM_H
diff --git a/src/admin/usersform.ui b/src/admin/usersform.ui
new file mode 100644 (file)
index 0000000..da45988
--- /dev/null
@@ -0,0 +1,24 @@
+<ui version="4.0" >
+ <class>UsersForm</class>
+ <widget class="QWidget" name="UsersForm" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>330</width>
+    <height>291</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Ananas: Users</string>
+  </property>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <includes>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >acfg.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/ananas.pri b/src/ananas.pri
new file mode 100644 (file)
index 0000000..fbf64d0
--- /dev/null
@@ -0,0 +1,24 @@
+#QMAKE_CLEAN += $(TARGET) Makefile
+CONFIG += qt warn_on release thread
+#LANGUAGE = C++
+
+QT += qt3support sql xml
+CONFIG += warn_on designer
+
+unix {
+    UI_DIR = .ui
+    MOC_DIR = .moc
+    OBJECTS_DIR = .obj
+    INCLUDEPATH +=.ui ../lib ../../lib ../../plugins ../plugins ../lib/.ui ../../lib/.ui
+}
+win32 {
+    UI_DIR = tmp\ui
+    MOC_DIR = tmp\moc
+    OBJECTS_DIR = obj
+    debug:CONFIG += console
+    INCLUDEPATH +=tmp\ui ..\lib ..\..\lib ..\..\plugins ..\lib\tmp\ui ..\..\lib\tmp\ui ..\plugins
+    INCLUDEPATH        += ..\..\plugins 
+#    LIBS      += -L..\..\plugins -lananasplugin
+}
+
+INCLUDEPATH +=$(QTDIR)/include/qdataschema
diff --git a/src/ananas/ananas.pro b/src/ananas/ananas.pro
new file mode 100644 (file)
index 0000000..0571384
--- /dev/null
@@ -0,0 +1,46 @@
+include (../plugins/plugins.pri)
+include (../lib/lib.pri)
+include (../ananas.pri)
+load(qsa)
+
+TARGET = ananas4
+TEMPLATE = app
+
+DESTDIR = ../../bin
+
+INCLUDEPATH += ../lib ../../tmp/ui/ananas ../plugins
+LIBS += -L../../lib -lananas4 -L../../lib/designer -lananasplugin4 -lqt4-qdataschema 
+#-L$(QTDIR)/lib -lqsa1
+#LIBS += -L$(QTDIR)/lib -lqsa1  -L../lib -lananas -L../plugins -lananasplugin # -lqui
+
+#MOC_DIR = ../../tmp/moc/$$TARGET
+#OBJECTS_DIR = ../../tmp/obj/$$TARGET
+#UI_DIR = ../../tmp/ui/$$TARGET
+
+
+HEADERS = \
+    mainform.h
+
+SOURCES = \
+    main.cpp \
+    mainform.cpp
+
+#FORMS = qadocjournal.ui
+
+RESOURCE = \
+    ananas.qrc
+    
+TRANSLATIONS = \
+    ../../translations/ananas-engine-en.ts \
+    ../../translations/ananas-engine-ru.ts 
+    
+unix {
+    ananas.path = $(BINDIR)
+    ananas.files = ananas4
+}
+win32{
+#    ananas.path =.
+#    ananas.extra = CALL create_base.bat
+}    
+
+#INSTALLS += ananas
diff --git a/src/ananas/ananas.qrc b/src/ananas/ananas.qrc
new file mode 100644 (file)
index 0000000..8e02144
--- /dev/null
@@ -0,0 +1,34 @@
+<RCC>\r
+    <qresource prefix="/">\r
+        <file>images/a-system.png</file>\r
+        <file>images/cat.png</file>\r
+        <file>images/d_document_turned.png</file>\r
+        <file>images/document_turned.png</file>\r
+        <file>images/editdelete.png</file>\r
+        <file>images/editdelete2.png</file>\r
+        <file>images/engine-splash-en.png</file>\r
+        <file>images/engine-splash-ru.png</file>\r
+        <file>images/field.png</file>\r
+        <file>images/field2.png</file>\r
+        <file>images/group.png</file>\r
+        <file>images/group2.png</file>\r
+        <file>images/lib_database.png</file>\r
+        <file>images/lib_dbgroup.png</file>\r
+        <file>images/msg_error.png</file>\r
+        <file>images/msg_fatal.png</file>\r
+        <file>images/msg_info.png</file>\r
+        <file>images/msg_warning.png</file>\r
+        <file>images/object_markdeleted.png</file>\r
+        <file>images/t_cat_e.png</file>\r
+        <file>images/t_cat_ed.png</file>\r
+        <file>images/t_cat_g.png</file>\r
+        <file>images/t_cat_gd.png</file>\r
+        <file>images/t_doc.png</file>\r
+        <file>images/t_doc_d.png</file>\r
+        <file>images/t_doc_m.png</file>\r
+        <file>images/t_doc_t.png</file>\r
+        <file>images/t_doc_tm.png</file>\r
+        <file>images/t_doc_to.png</file>\r
+        <file>images/t_doc_tom.png</file>\r
+    </qresource>\r
+</RCC>\r
diff --git a/src/ananas/bkground.jpg b/src/ananas/bkground.jpg
new file mode 100644 (file)
index 0000000..06a9ee8
Binary files /dev/null and b/src/ananas/bkground.jpg differ
diff --git a/src/ananas/images/a-system.png b/src/ananas/images/a-system.png
new file mode 100644 (file)
index 0000000..6638dff
Binary files /dev/null and b/src/ananas/images/a-system.png differ
diff --git a/src/ananas/images/cat.png b/src/ananas/images/cat.png
new file mode 100644 (file)
index 0000000..3c1ae0f
Binary files /dev/null and b/src/ananas/images/cat.png differ
diff --git a/src/ananas/images/d_document_turned.png b/src/ananas/images/d_document_turned.png
new file mode 100644 (file)
index 0000000..dd4b1d3
Binary files /dev/null and b/src/ananas/images/d_document_turned.png differ
diff --git a/src/ananas/images/document_turned.png b/src/ananas/images/document_turned.png
new file mode 100644 (file)
index 0000000..101ac7d
Binary files /dev/null and b/src/ananas/images/document_turned.png differ
diff --git a/src/ananas/images/editdelete.png b/src/ananas/images/editdelete.png
new file mode 100644 (file)
index 0000000..feb3242
Binary files /dev/null and b/src/ananas/images/editdelete.png differ
diff --git a/src/ananas/images/editdelete2.png b/src/ananas/images/editdelete2.png
new file mode 100644 (file)
index 0000000..7ef9058
Binary files /dev/null and b/src/ananas/images/editdelete2.png differ
diff --git a/src/ananas/images/engine-splash-en.png b/src/ananas/images/engine-splash-en.png
new file mode 100644 (file)
index 0000000..af654ed
Binary files /dev/null and b/src/ananas/images/engine-splash-en.png differ
diff --git a/src/ananas/images/engine-splash-ru.png b/src/ananas/images/engine-splash-ru.png
new file mode 100644 (file)
index 0000000..9d7cf5b
Binary files /dev/null and b/src/ananas/images/engine-splash-ru.png differ
diff --git a/src/ananas/images/field.png b/src/ananas/images/field.png
new file mode 100644 (file)
index 0000000..efa2405
Binary files /dev/null and b/src/ananas/images/field.png differ
diff --git a/src/ananas/images/field2.png b/src/ananas/images/field2.png
new file mode 100644 (file)
index 0000000..4d0d9db
Binary files /dev/null and b/src/ananas/images/field2.png differ
diff --git a/src/ananas/images/group.png b/src/ananas/images/group.png
new file mode 100644 (file)
index 0000000..52d6fda
Binary files /dev/null and b/src/ananas/images/group.png differ
diff --git a/src/ananas/images/group2.png b/src/ananas/images/group2.png
new file mode 100644 (file)
index 0000000..5c6e955
Binary files /dev/null and b/src/ananas/images/group2.png differ
diff --git a/src/ananas/images/lib_database.png b/src/ananas/images/lib_database.png
new file mode 100644 (file)
index 0000000..5f6aad3
Binary files /dev/null and b/src/ananas/images/lib_database.png differ
diff --git a/src/ananas/images/lib_dbgroup.png b/src/ananas/images/lib_dbgroup.png
new file mode 100644 (file)
index 0000000..3005290
Binary files /dev/null and b/src/ananas/images/lib_dbgroup.png differ
diff --git a/src/ananas/images/msg_error.png b/src/ananas/images/msg_error.png
new file mode 100644 (file)
index 0000000..901b8b6
Binary files /dev/null and b/src/ananas/images/msg_error.png differ
diff --git a/src/ananas/images/msg_fatal.png b/src/ananas/images/msg_fatal.png
new file mode 100644 (file)
index 0000000..901b8b6
Binary files /dev/null and b/src/ananas/images/msg_fatal.png differ
diff --git a/src/ananas/images/msg_info.png b/src/ananas/images/msg_info.png
new file mode 100644 (file)
index 0000000..f3c275f
Binary files /dev/null and b/src/ananas/images/msg_info.png differ
diff --git a/src/ananas/images/msg_warning.png b/src/ananas/images/msg_warning.png
new file mode 100644 (file)
index 0000000..901b8b6
Binary files /dev/null and b/src/ananas/images/msg_warning.png differ
diff --git a/src/ananas/images/object_markdeleted.png b/src/ananas/images/object_markdeleted.png
new file mode 100644 (file)
index 0000000..feb3242
Binary files /dev/null and b/src/ananas/images/object_markdeleted.png differ
diff --git a/src/ananas/images/t_cat_e.png b/src/ananas/images/t_cat_e.png
new file mode 100644 (file)
index 0000000..1c93745
Binary files /dev/null and b/src/ananas/images/t_cat_e.png differ
diff --git a/src/ananas/images/t_cat_ed.png b/src/ananas/images/t_cat_ed.png
new file mode 100644 (file)
index 0000000..64ddd63
Binary files /dev/null and b/src/ananas/images/t_cat_ed.png differ
diff --git a/src/ananas/images/t_cat_g.png b/src/ananas/images/t_cat_g.png
new file mode 100644 (file)
index 0000000..99e052e
Binary files /dev/null and b/src/ananas/images/t_cat_g.png differ
diff --git a/src/ananas/images/t_cat_gd.png b/src/ananas/images/t_cat_gd.png
new file mode 100644 (file)
index 0000000..c69799c
Binary files /dev/null and b/src/ananas/images/t_cat_gd.png differ
diff --git a/src/ananas/images/t_doc.png b/src/ananas/images/t_doc.png
new file mode 100644 (file)
index 0000000..6b3b0da
Binary files /dev/null and b/src/ananas/images/t_doc.png differ
diff --git a/src/ananas/images/t_doc_d.png b/src/ananas/images/t_doc_d.png
new file mode 100644 (file)
index 0000000..1eea2f2
Binary files /dev/null and b/src/ananas/images/t_doc_d.png differ
diff --git a/src/ananas/images/t_doc_m.png b/src/ananas/images/t_doc_m.png
new file mode 100644 (file)
index 0000000..69ad25e
Binary files /dev/null and b/src/ananas/images/t_doc_m.png differ
diff --git a/src/ananas/images/t_doc_t.png b/src/ananas/images/t_doc_t.png
new file mode 100644 (file)
index 0000000..fda5f3e
Binary files /dev/null and b/src/ananas/images/t_doc_t.png differ
diff --git a/src/ananas/images/t_doc_tm.png b/src/ananas/images/t_doc_tm.png
new file mode 100644 (file)
index 0000000..b8dd0cb
Binary files /dev/null and b/src/ananas/images/t_doc_tm.png differ
diff --git a/src/ananas/images/t_doc_to.png b/src/ananas/images/t_doc_to.png
new file mode 100644 (file)
index 0000000..dd4b1d3
Binary files /dev/null and b/src/ananas/images/t_doc_to.png differ
diff --git a/src/ananas/images/t_doc_tom.png b/src/ananas/images/t_doc_tom.png
new file mode 100644 (file)
index 0000000..32596cd
Binary files /dev/null and b/src/ananas/images/t_doc_tom.png differ
diff --git a/src/ananas/main.cpp b/src/ananas/main.cpp
new file mode 100644 (file)
index 0000000..84b0b96
--- /dev/null
@@ -0,0 +1,198 @@
+/****************************************************************************
+** $Id: main.cpp,v 1.5 2008/12/10 21:05:14 leader Exp $
+**
+** Main file of Ananas Engine application
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Engine application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <aapplication.h>
+#include <qmessagebox.h>
+#include <qtranslator.h>
+#include <qsplashscreen.h>
+#include <qtextcodec.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <q3mimefactory.h>
+#include "mainform.h"
+#include "dselectdb.h"
+#include "dlogin.h"
+#include "ananas.h"
+#include "alog.h"
+#include "aextensionfactory.h"
+
+//QApplication *application = 0;
+QTranslator *translator = 0, tr_app(0), tr_lib(0), tr_plugins(0);
+QString lang="en",
+       rcfile="",
+       username="",
+       userpassword="";
+
+int setTranslator(QString lang)
+{
+        QString langdir;
+#ifdef _Windows
+       langdir = qApp->applicationDirPath()+"/translations/";
+#else
+       langdir = "/usr/share/ananas/translations/";
+#endif
+       tr_app.load( langdir+"ananas-engine-"+lang.lower()+".qm",".");
+       tr_lib.load( langdir+"ananas-lib-"+lang.lower()+".qm",".");
+       tr_plugins.load( langdir+"ananas-plugins-"+lang.lower()+".qm",".");
+       return 0;
+}
+
+int
+parseCommandLine( int argc, char **argv )
+{
+       QString param, name, value;
+       int i;
+       char *s, locale[50]="ru";
+
+       strncpy( locale, QTextCodec::locale(), sizeof( locale ) );
+       s = strchr( locale, '_' );
+       if ( s ) {
+           *s = 0;
+       }
+        lang = locale;
+        setTranslator( lang );
+//     printf("locale=%s\n", locale );
+       QString str_ru=QString::null, str_en=QString::null;
+       bool lang_setted = false;
+       bool help_setted = false;
+       for ( i=1; i<argc; i++)
+       {
+           param = argv[i];
+           name = param.section("=",0,0).lower();
+           value = param.section("=",1);
+//         printf("%s = %s\n", (const char *) name, (const char *) value );
+           if (param == "--help")
+           {
+                   str_ru = "Использование: ananas [--help] [--lang=<LANG>] [--rc=<RC_PATH>]\n";
+                   str_ru+= "LANG=ru|en\n";
+                   str_ru+= "RC_PATH=путь к *.rc файлу описания бизнес схемы\n";
+
+                   str_en = "Usage: ananas [--help] [--lang=<LANG>] [--rc=<RC_PATH>]\n";
+                   str_en+= "LANG=ru|en\n";
+                   str_en+= "RC_PATH=path to *.rc file of paticular business scheme\n";
+                   help_setted = true;
+
+           }
+           if (name == "--lang") {
+               lang = value;
+               lang_setted = true;
+               setTranslator( lang );
+           }
+           if (name == "--rc") rcfile = value;
+       }
+       if(help_setted)
+       {
+               if(lang == "ru")
+               {
+                       printf("%s",(const char*)str_ru.local8Bit());
+               }
+               else
+               {
+                       printf("%s",str_en.ascii());
+               }
+               return 1;
+       }
+       return 0;
+}
+
+int main( int argc, char ** argv )
+{
+
+       AApplication a( argc, argv, AApplication::Ananas );
+//     dSelectDB dselectdb;
+       dLogin dlogin;
+//     application = &a;
+       int rc = 1;
+       bool ok;
+       QPixmap pixmap;
+
+       QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF8") );
+
+       // Для QSettings
+       a.setOrganizationName("ananasgroup");
+        a.setApplicationName("ananas");
+
+       if ( parseCommandLine( qApp->argc(), qApp->argv() ) ) return 1;
+       qApp->installTranslator( &tr_app );
+       qApp->installTranslator( &tr_lib );
+       qApp->installTranslator( &tr_plugins );
+       //--pixmap = QPixmap::fromMimeSource( "engine-splash-"+lang+".png" );
+       pixmap = QPixmap( ":/images/engine-splash-"+lang+".png" );
+       if ( pixmap.isNull() )
+#ifdef Q_OS_WIN32
+       pixmap = QPixmap( qApp->applicationDirPath()+"/engine-splash-"+lang+".png" );
+       qApp->addLibraryPath( qApp->applicationDirPath() );
+#else
+       pixmap = QPixmap( "/usr/share/ananas/designer/locale/engine-splash-"+lang+".png" );
+       qApp->addLibraryPath( "/usr/lib/ananas/" );
+#endif
+       //--printf("extensions: \n%s\n",( const char *) AExtensionFactory::keys().join("\n") );
+// Test create extension
+//     AExtension *e = AExtensionFactory::create("AExtTest");
+//     if (e) printf("EXT OK\n"); else printf("NO EXT OK\n");
+
+       if ( pixmap.isNull() )
+               //--pixmap = QPixmap::fromMimeSource( "engine-splash-en.png" );
+               pixmap = QPixmap( ":/images/engine-splash-en.png" );
+       QSplashScreen *splash = new QSplashScreen( pixmap );
+
+//     printf("Keys:\n%s\n",( const char *) AExtensionFactory::keys().join("\n").toUtf8().data());
+       
+       if ( ananas_login( rcfile, username, userpassword, 0, AApplication::Ananas ) ){
+               splash->show();
+               splash->message( QObject::tr("Init application"), Qt::AlignBottom, Qt::white );
+               MainForm *w = new MainForm( 0, "MainForm");
+               mainform = w;
+               mainformws = mainform->ws;
+               mainformwl = mainform->wl;
+               qApp->setMainWidget( w );
+               w->rcfile = rcfile;
+//             printf( "rcfile = %s\n", rcfile.ascii() );
+               w->show();
+               ok = w->init();
+               splash->clear();
+                       splash->finish( w );
+                       delete splash;
+               if ( ok ) {
+                       qApp->connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
+                       rc = qApp->exec();
+                       ananas_logout( w->engine.db );
+                       if( w ) delete w;
+                       w=0;
+               } else {
+                       QMessageBox::critical(0, "error","Error init Ananas engine");
+               }
+               aLog::close();
+               return rc;
+       }
+       else
+       {
+               aLog::close();
+               return 0;
+       }
+}
diff --git a/src/ananas/mainform.cpp b/src/ananas/mainform.cpp
new file mode 100644 (file)
index 0000000..9993de2
--- /dev/null
@@ -0,0 +1,314 @@
+/****************************************************************************
+** $Id: mainform.cpp,v 1.2 2008/12/06 22:56:39 leader Exp $
+**
+** Code file of the Main form of Ananas Engine application
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Engine application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/****************************************************************************
+****************************************************************************/
+#include <qmenubar.h>
+#include <qmessagebox.h>
+#include <q3toolbar.h>
+#include <qstatusbar.h>
+#include <qworkspace.h>
+#include <qapplication.h>
+#include <qaction.h>
+#include <qdir.h>
+//Added by qt3to4:
+#include <Q3Frame>
+#include <QPixmap>
+#include <Q3PopupMenu>
+
+#include "mainform.h"
+
+#include "ananas.h"
+
+MainForm *mainform=NULL;
+QWorkspace *mainformws=NULL;
+aWindowsList *mainformwl=NULL;
+//extern void messageproc(int n, const char *msg);
+
+/*
+ *  Constructs a AnanasMainWindow as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+MainForm::MainForm( QWidget* parent, const char* name, Qt::WFlags fl )
+    : Q3MainWindow( parent, name, fl )
+{
+//    QApopupmenu *popup;
+    Q3VBox     *vb = new Q3VBox(this);
+
+    setIcon( rcIcon("a-system.png"));
+    vb->setFrameStyle( Q3Frame::StyledPanel | Q3Frame::Sunken );
+    ws = new QWorkspace( vb );
+    wl = new aWindowsList();
+    ws->setScrollBarsEnabled( TRUE );
+    setCentralWidget( vb );
+    statusBar()->setName("statusbar");
+    if ( !name ) setName( "mainwindow" );
+    //--engine_settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
+    //--engine_settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
+
+//    QStringList lst = settings.entryList("/engine");
+    engine_settings.beginGroup("/engine");
+    bool maximize = engine_settings.readBoolEntry( "/maximize", 0 );
+    int width = engine_settings.readNumEntry( "/geometry/width", 600 );
+    int height = engine_settings.readNumEntry( "/geometry/height", 480 );
+    int offset_x = engine_settings.readNumEntry( "/geometry/x", 0 );
+    int offset_y = engine_settings.readNumEntry( "/geometry/y", 0 );
+    engine_settings.endGroup();
+    resize( QSize(width, height) );//  .expandedTo(minimumSizeHint()) );
+    move(offset_x,offset_y);
+    if(maximize)
+    {
+//        setWindowState(windowState() ^ WindowMaximized);
+    }
+    rcfile="";
+}
+
+bool
+MainForm::init()
+{
+    MessagesWindow *msgWindow = new MessagesWindow( this );// , WDestructiveClose );
+    moveDockWindow( msgWindow, Qt::DockBottom );
+    setMessageHandler( true );
+    msgWindow->hide();
+    if ( !initEngine() ) return false;
+    connect( menubar, SIGNAL(activated(int)), &engine, SLOT(on_MenuBar(int)) );
+    languageChange();
+    engine.project.addObject(menubar);
+    engine.project.addObject(this);
+    engine.project.addObject(statusBar());
+    languageChange();
+    engine.on_systemstart();
+    return true;
+}
+
+bool
+MainForm::initEngine()
+{
+    if (rcfile.isEmpty()) return false;
+    if ( !engine.init( rcfile ) ) return false;
+    engine.ws = ws;
+    engine.wl = wl;
+    connect( &engine, SIGNAL( statusMessage( const QString & ) ), this, SLOT( statusMessage( const QString & ) ) );
+    md = engine.md;
+    if ( !md ) return false;
+    initMenuBar();
+    initStatusBar();
+    initActionBar();
+    return true;
+}
+
+void
+MainForm::initMenuBar()
+{
+       Q3PopupMenu *m;
+       m = new Q3PopupMenu();
+       windowsMenu = new Q3PopupMenu();
+       connect( windowsMenu, SIGNAL( aboutToShow() ),
+            this, SLOT( windowsMenuAboutToShow() ) );
+       m->insertItem(rcIcon("a-system.png"), tr( "About" ), this, SLOT( helpAbout() ));
+       //windowsMenu->insertItem(rcIcon("a-system.png"), tr( "Windows" ), this, SLOT( windowsMenuAboutToShow() ));
+        menubar = new AMenuBar( md, this, "menubar");
+       InsertMainMenu( tr("&Help"), m );
+       InsertMainMenu( tr("&Windows"), windowsMenu );
+       menuBar()->show();
+}
+
+void
+MainForm::initStatusBar()
+{
+}
+
+void
+MainForm::initActionBar()
+{
+    aCfgItem obj, item;
+
+    obj = md->find( md->find( mdc_interface ), md_toolbars );  // look for md_toolbars
+    item = md->firstChild( obj );
+    while ( !item.isNull() ) { // foreach md_toolbar
+       new aToolBar( md, item, &engine, this, md->attr( item, mda_name ) );            // create toolbar
+       item = md->nextSibling( item ); // next md_toolbar
+    }
+}
+
+void
+MainForm::helpAbout()
+{
+    QMessageBox::about( this, tr("About Ananas.Engine program"),
+                       tr("<h4>Ananas.Engin %1</h4> is a programm "
+                          "for executing application of accounting automation system<br><br>"
+                          "Copyright 2003-2008 Leader Infotech, Valery Grazdankin, "
+                          "Copyright 2003-2008 Project Ananas, Andrey Paskal, Grigory Panov, Andrey Strelnikov<br>"
+                          "License: GPL<br><br>"
+                          "technical support:<br>"
+                          "lider-infotech@narod.ru<br>"
+                          "app@linux.ru.net<br>"
+                          "Web sites:<br>"
+                          "<a href=\"http://ananas.lrn.ru\">http://ananas.lrn.ru</a><br>"
+                          "<a href=\"http://www.leaderit.ru\">http://www.leaderit.ru</a>"
+                          "<br>Avalable extensions:<h4>%2</h4><br>"
+                          ).arg(ananas_libversion()).arg( AExtensionFactory::keys().join(", ") ) );
+}
+
+void MainForm::InsertMainMenu(QString text, QObject *pop){
+    menubar->insertItem(text, (Q3PopupMenu *) pop);
+
+}
+
+
+void
+MainForm::Exit(int code)
+{
+
+       qApp->exit(code);
+}
+void
+MainForm::close()
+{
+        engine_settings.beginGroup("/engine");
+//     engine_settings.writeEntry( "/maximize", windowState()&WindowMaximized ? true: false);
+       engine_settings.writeEntry( "/geometry/width", width() );
+       engine_settings.writeEntry( "/geometry/height", height() );
+       engine_settings.writeEntry( "/geometry/x", pos().x() );
+       engine_settings.writeEntry( "/geometry/y", pos().y() );
+       engine_settings.endGroup();
+       printf("exit\n" );
+//MainWindow::close();
+}
+
+void
+MainForm::statusMessage( const QString &msg )
+{
+       statusBar()->message( msg );
+}
+
+void
+MainForm::setBackground( const QPixmap &pix ){
+       ws->setBackgroundPixmap( pix );
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+MainForm::~MainForm()
+{
+       engine.on_systemstop();
+       close();
+//     printf("Mainform destructor\n");
+       if(ws) delete ws;
+       ws = 0;
+       if(wl) delete wl;
+       wl=0;
+       if(menubar) delete menubar;
+       menubar=0;
+//     printf("delete mainform\n");
+//    cfg->on_systemstop();
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void MainForm::languageChange()
+{
+    setCaption(QString( tr("Ananas")+" "+ananas_libversion() )+": "+md->info( md_info_name ) );
+//    setCaption( tr( "Ananas VERSION" ) );
+}
+
+void MainForm::windowsMenuAboutToShow()
+{
+    windowsMenu->clear();
+    int cascadeId = windowsMenu->insertItem(tr("&Cascade"), ws, SLOT(cascade() ) );
+    int tileId = windowsMenu->insertItem(tr("&Tile"), ws, SLOT(tile() ) );
+    int horTileId = windowsMenu->insertItem(tr("Tile &horizontal"), this, SLOT(tileHorizontal() ) );
+    if ( ws->windowList().isEmpty() ) {
+       windowsMenu->setItemEnabled( cascadeId, FALSE );
+       windowsMenu->setItemEnabled( tileId, FALSE );
+       windowsMenu->setItemEnabled( horTileId, FALSE );
+    }
+    windowsMenu->insertSeparator();
+    QWidgetList windows = ws->windowList();
+    if(windows.count()==0) return;
+    int i=0, count = windows.count();
+
+    do
+    {
+       int id=0;
+       if(windows.at(i) && windows.at(i)->isHidden())
+       {
+               ++i;
+               continue;
+       }
+       id = windowsMenu->insertItem(windows.at(i)->caption(), this, SLOT( windowsMenuActivated( int ) ) );
+       windowsMenu->setItemParameter( id, i );
+       windowsMenu->setItemChecked( id, ws->activeWindow() == windows.at(i) );
+       ++i;
+    }while( i < count );
+}
+
+void MainForm::tileHorizontal()
+{
+    // primitive horizontal tiling
+    QWidgetList windows = ws->windowList();
+    int count =0;
+    for ( int i = 0; i < int(windows.count()); ++i )
+    {
+       QWidget *window = windows.at(i);
+       if( !window ) continue;
+       if(!window->isHidden()) count++;
+    }
+    if ( !count ) return;
+
+    int heightForEach = ws->height() / count;
+    int y = 0;
+    for ( int i = 0; i < windows.count(); ++i )
+    {
+       QWidget *window = windows.at(i);
+       if ( !window ) continue;
+       if ( window->isHidden() ) continue;
+       if ( window->windowState() == Qt::WindowMaximized )
+       {
+           // prevent flicker
+           window->hide();
+           window->showNormal();
+       }
+       int preferredHeight = window->minimumHeight()+window->parentWidget()->baseSize().height();
+       int actHeight = QMAX(heightForEach, preferredHeight);
+
+       window->parentWidget()->setGeometry( 0, y, ws->width(), actHeight );
+       y += actHeight;
+    }
+}
+
+void MainForm::windowsMenuActivated( int id )
+{
+    QWidget* w = ws->windowList().at( id );
+    if ( w ) w->showNormal();
+    w->setFocus();
+}
diff --git a/src/ananas/mainform.h b/src/ananas/mainform.h
new file mode 100644 (file)
index 0000000..9f0d7ec
--- /dev/null
@@ -0,0 +1,116 @@
+/****************************************************************************
+** $Id: mainform.h,v 1.1 2008/11/05 21:16:26 leader Exp $
+**
+** Header file of the Main form of Ananas Engine application
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Engine application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/****************************************************************************
+****************************************************************************/
+
+#ifndef ANANASMAINFORM_H
+#define ANANASMAINFORM_H
+#include <qvariant.h>
+#include <qworkspace.h>
+#include <qsinterpreter.h>
+#include <qdialog.h>
+#include <qstringlist.h>
+#include <qworkspace.h>
+#include <q3mainwindow.h>
+#include <q3vbox.h>
+#include <qapplication.h>
+#include <qsettings.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <Q3ActionGroup>
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+#include <Q3PopupMenu>
+#include "ananas.h"
+#include "amenubar.h"
+#include "atoolbar.h"
+#include "awindowslist.h"
+#include "engine.h"
+
+
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
+class QAction;
+class Q3ActionGroup;
+class Q3ToolBar;
+class Q3PopupMenu;
+
+/*!
+ * \ru
+ * Главное окно приложения Ананас, запускаемого пользователем.
+ *
+ * \_ru
+ */
+
+class MainForm : public Q3MainWindow {
+       Q_OBJECT
+
+public:
+       MainForm( QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = Qt::WType_TopLevel );
+       ~MainForm();
+       aEngine engine;
+       aCfg *md;
+
+       AMenuBar* menubar;
+       Q3PopupMenu *windowsMenu;
+       QWorkspace* ws;
+       aWindowsList* wl;
+       QString rcfile;
+
+public slots:
+       bool init();
+       bool initEngine();
+       void initMenuBar();
+       void initStatusBar();
+       void initActionBar();
+       void InsertMainMenu(QString text, QObject *pop);
+       void Exit(int code);
+       void close();
+       void helpAbout();
+       void statusMessage( const QString &msg );
+       void windowsMenuAboutToShow();
+       void windowsMenuActivated( int id );
+       void tileHorizontal();
+       void setBackground( const QPixmap &pix );
+
+protected:
+       protected slots:
+       virtual void languageChange();
+
+private:
+       QSettings engine_settings;
+};
+
+extern MainForm *mainform;
+extern QWorkspace *mainformws;
+extern aWindowsList *mainformwl;
+
+#endif // ANANASMAINFORM_H
diff --git a/src/ananas/report.sxw b/src/ananas/report.sxw
new file mode 100644 (file)
index 0000000..1fdc4e1
Binary files /dev/null and b/src/ananas/report.sxw differ
diff --git a/src/ananas/report.tpl b/src/ananas/report.tpl
new file mode 100644 (file)
index 0000000..25a88a0
--- /dev/null
@@ -0,0 +1,21 @@
+<#section main#>
+<html>
+<header>
+<title>Ananas HTTP Server</title>
+</header>
+<body bgcolor=gray>
+<img src="a-system.png"><#title#>
+<table border=1 cellspacing=0 cellpadding=0 spacing=0>
+<#endsection#>
+
+<#section endmain#>
+</table>
+</body></html>
+<#endsection#>
+
+<#section trow#><tr><td width=100 bgcolor=lightblue><#value#>)</td><#endsection#>
+
+<#section endrow#></tr>
+<#endsection#>
+
+<#section col#><td align=center><#value#></td><#endsection#>
diff --git a/src/designer/actiontree.cpp b/src/designer/actiontree.cpp
new file mode 100644 (file)
index 0000000..f77e77b
--- /dev/null
@@ -0,0 +1,257 @@
+/****************************************************************************
+** $Id: actiontree.cpp,v 1.1 2008/11/05 21:16:26 leader Exp $
+**
+** Code file of the Action Tree of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <q3listview.h>
+#include <q3header.h>
+#include <q3popupmenu.h>
+#include <qlabel.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <QPixmap>
+
+#include "acfg.h"
+#include "actiontree.h"
+#include "mainform.h"
+#include "deditaction.h"
+#include "awindowslist.h"
+
+extern MainForm *mainform;
+extern QPixmap ANANAS_EXPORT rcIcon(const char *name);
+extern void set_Icon(Q3ListViewItem *item, const char *name);
+
+
+ActionListViewItem::ActionListViewItem( Q3ListView *parent, aCfg * cfgmd, aCfgItem cfgobj, const QString &name )
+: ananasListViewItem( parent, cfgmd, cfgobj, name )
+{
+       if (id) setRenameEnabled(0, true);
+};
+
+ActionListViewItem::ActionListViewItem( ananasListViewItem *parent, ananasListViewItem *after, aCfg * cfgmd, aCfgItem cfgobj, const QString &name )
+: ananasListViewItem( parent, after, cfgmd, cfgobj, name )
+{
+    aCfgItem active;
+    QPixmap pix;
+    if (id) setRenameEnabled(0, true);
+    active = md->findChild( obj, md_active_picture, 0 );
+    if ( !active.isNull() ) {
+       pix.loadFromData( md->binary( active ) );
+       setPixmap( 0, pix );
+    }
+};
+
+void
+ActionListViewItem::loadTree()
+{
+       QString                         oclass;
+       aCfgItem                        cobj;
+
+       // clear tree
+       clearTree();
+       if ( !md ) return;
+       setPixmap(0, rcIcon("actions.png"));
+       cobj = md->firstChild ( obj );
+       while ( !cobj.isNull() )
+       {
+               oclass = md->objClass ( cobj );
+               if ( oclass == md_actiongroup )
+                       loadGroup ( this, cobj );
+               oclass = md->objClass ( cobj );
+               if ( oclass == md_action )
+                       new ActionListViewItem( this, getLastChild(), md, cobj, QString::null );
+               cobj = md->nextSibling ( cobj );
+       }
+};
+
+void
+ActionListViewItem::loadGroup( ananasListViewItem * parent, aCfgItem child )
+{
+       ActionListViewItem * gparent;
+       QString                         oclass;
+       aCfgItem                        cobj;
+
+       gparent = new ActionListViewItem( parent, getLastChild(), md, child, QString::null );
+       gparent->setPixmap(0, rcIcon("action_g.png"));
+       cobj = md->firstChild ( gparent->obj );
+       while ( !cobj.isNull() )
+       {
+               oclass = md->objClass ( cobj );
+               if ( oclass == md_actiongroup )
+                       loadGroup ( gparent, cobj );
+               oclass = md->objClass ( cobj );
+               if ( oclass == md_action )
+                       new ActionListViewItem( gparent, getLastChild(), md, cobj, QString::null );
+               cobj = md->nextSibling ( cobj );
+       }
+};
+
+void
+ActionListViewItem::newActionGroup ()
+{
+       aCfgItem                        newobj;
+       ActionListViewItem      *newitem;
+       QString                         oclass = md->objClass( obj );
+
+       if ( oclass == md_actiongroup || oclass == md_actions )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insert( obj, md_actiongroup, QObject::tr("New Action Group") );
+               newitem = new ActionListViewItem( this, getLastChild(), md, newobj );
+               newitem->setSelected( TRUE );
+               newitem->setPixmap(0, rcIcon("action_g.png"));
+               newitem->edit();
+       };
+
+}
+
+void
+ActionListViewItem::newAction ()
+{
+       aCfgItem                        newobj;
+       ActionListViewItem      *newitem;
+       QString                         oclass = md->objClass( obj );
+
+       if ( oclass == md_actiongroup || oclass == md_actions )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insert( obj, md_action, QObject::tr("New Action") );
+               newitem = new ActionListViewItem( this, getLastChild(), md, newobj );
+               newitem->setSelected( TRUE );
+               newitem->edit();
+       };
+}
+
+void
+ActionListViewItem::edit ()
+{
+    QWorkspace *ws = mainform->ws;
+    aWindowsList *wl = mainform->wl;
+    QString oclass = md->objClass( obj );
+    int objid = md->id( obj );
+    if ( wl->find( objid ) ) {
+       wl->get( objid )->setFocus();
+       return;
+    }
+
+    if ( oclass == md_action )
+    {
+       dEditAction * e = new dEditAction ( ws, 0, Qt::WDestructiveClose );
+       wl->insert( objid, e );
+       editor = e;
+       QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+       e->setData( this );
+       e->show();
+       //--mainform->addTab(++mainform->lastTabId,e->name());
+       mainform->addTab(e);
+       return;
+    }
+}
+
+aActionTreeView::aActionTreeView ( QWidget *parent, aCfg *cfgmd )
+: ananasTreeView( parent, cfgmd )
+{
+       ActionListViewItem *actions;
+       aCfgItem        item;
+       item = md->find ( mdc_actions );
+       if ( item.isNull() )
+       {
+               item = md->insert( md->find ( mdc_root ), md_actions, QString::null, -1 );
+       }
+       actions = new ActionListViewItem ( this, md, item, QObject::tr ( "Actions" ) );
+       actions->loadTree();
+       actions->setOpen ( TRUE );
+       connect( this, SIGNAL( contextMenuRequested( Q3ListViewItem*, const QPoint&, int) ), this, SLOT(ContextMenu() ) );
+       connect( this, SIGNAL( returnPressed( Q3ListViewItem*) ), this, SLOT( itemEdit() ) );
+       connect( this, SIGNAL( doubleClicked( Q3ListViewItem*) ), this, SLOT( itemEdit() ) );
+};
+
+
+void
+aActionTreeView::ContextMenu()
+{
+       Q3PopupMenu *m=new Q3PopupMenu( this, "PopupMenu" );
+       Q_CHECK_PTR(m);
+
+       ContextMenuAdd( m );
+       m->insertItem( QObject::tr("New &Group"),  this, SLOT( itemNewGroup() ), Qt::CTRL+Qt::Key_G );
+       m->insertItem( QObject::tr("New &Action"),  this, SLOT( itemNewAction() ), Qt::CTRL+Qt::Key_A );
+//     m->insertItem( QObject::tr("&Rename"), this, SLOT( itemRename() ), CTRL+Key_R);
+//     m->insertItem( QObject::tr("&Edit"),  this, SLOT( itemEdit() ), CTRL+Key_E );
+//     m->insertItem( QObject::tr("&Delete"), this, SLOT( itemDelete() ), CTRL+Key_D );
+       m->exec( QCursor::pos() );
+       delete m;
+};
+
+void
+aActionTreeView::itemNewGroup()
+{
+       ActionListViewItem *i = (ActionListViewItem *) selectedItem();
+       if ( i )
+               i->newActionGroup();
+};
+
+void
+aActionTreeView::itemNewAction()
+{
+       ActionListViewItem *i = (ActionListViewItem *) selectedItem();
+       if ( i )
+               i->newAction();
+};
+
+void
+aActionTreeView::itemDelete()
+{
+    deleteItem();
+};
+
+void
+aActionTreeView::itemMoveUp()
+{
+       moveUpItem();
+
+};
+
+void
+aActionTreeView::itemMoveDown()
+{
+       moveDownItem();
+};
+
+void
+aActionTreeView::itemEdit()
+{
+       ActionListViewItem *i = (ActionListViewItem *) selectedItem();
+       if ( i ) i->edit();
+};
+
+void
+aActionTreeView::itemRename()
+{
+       renameItem();
+}
diff --git a/src/designer/actiontree.h b/src/designer/actiontree.h
new file mode 100644 (file)
index 0000000..90abd14
--- /dev/null
@@ -0,0 +1,74 @@
+/****************************************************************************
+** $Id: actiontree.h,v 1.1 2008/11/05 21:16:26 leader Exp $
+**
+** Header file of the Action Tree of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ACTIONTREE_H
+#define ACTIONTREE_H
+#include <q3listview.h>
+#include <q3intdict.h>
+//#include "acfg.h"
+#include "atreeitems.h"
+
+class QWidget;
+
+class ActionListViewItem : public ananasListViewItem
+{
+public:
+/*     int id;
+       aCfgItem obj;
+       QWidget *editor;
+       aCfg *md;
+*/
+       ActionListViewItem( Q3ListView *parent, aCfg * cfgmd, aCfgItem cfgobj, const QString &name = QString::null );
+       ActionListViewItem( ananasListViewItem *parent, ananasListViewItem *after, aCfg * cfgmd, aCfgItem cfgobj,
+                                               const QString &name = QString::null );
+       void loadTree();
+       void loadGroup ( ananasListViewItem * parent, aCfgItem child );
+       void newActionGroup ();
+       void newAction ();
+       void edit ();
+};
+
+class aActionTreeView : public ananasTreeView
+{
+    Q_OBJECT
+public:
+
+       aActionTreeView( QWidget *parent, aCfg *cfgmd );
+
+public slots:
+       void ContextMenu();
+       void itemNewGroup();
+       void itemNewAction();
+       void itemMoveUp();
+       void itemMoveDown();
+       void itemDelete();
+       void itemEdit();
+       void itemRename();
+
+};
+#endif //ACTIONTREE_H
diff --git a/src/designer/aliaseditor.cpp b/src/designer/aliaseditor.cpp
new file mode 100644 (file)
index 0000000..55f4108
--- /dev/null
@@ -0,0 +1,88 @@
+/****************************************************************************
+** $Id: aliaseditor.cpp,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Code file of the Alias editor of Ananas
+** Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <q3header.h>
+#include "aliaseditor.h"
+#include "acfg.h"
+
+
+aAliasEditor::aAliasEditor( aCfg *c, aCfgItem o, Q3Table *t )
+{
+    ac = c;
+    obj = o;
+    tAliases = t;
+    tAliases->setNumRows( 0 );
+    tAliases->setNumCols( 1 );
+    tAliases->horizontalHeader()->setLabel( 0, tr("Name") );
+}
+
+aAliasEditor::~aAliasEditor()
+{
+}
+
+void aAliasEditor::setData()
+{
+    int i, j, n;
+    aCfgItem alias, langs, lang;
+    QString langtag;
+
+    langs = ac->find( ac->find( mdc_root ), md_languages, 0 );
+    langCount = ac->count( langs, md_language );
+    n = ac->countChild( obj, md_alias );
+    tAliases->setNumRows( langCount );
+       for ( i = 0; i < langCount; i++ ) {
+           lang = ac->findChild( langs, md_language, i );
+           langtag = ac->attr( lang, mda_tag );
+           tAliases->verticalHeader()->setLabel( i, langtag );
+           for ( j = 0; j < n; j++) {
+               alias = ac->findChild( obj, md_alias, j );
+               if ( langtag == ac->attr( alias, mda_tag ) ) {
+                   tAliases->setText( i, 0, ac->attr( alias, mda_name ) );
+               }
+           }
+       }
+}
+
+void aAliasEditor::updateMD()
+{
+    int i;
+    aCfgItem alias;
+
+    do {
+       alias = ac->findChild( obj, md_alias, 0 ) ;
+       if ( !alias.isNull() ) ac->remove( alias );
+    } while ( !alias.isNull() );
+    for (i = 0; i < tAliases->numRows(); i++ ) {
+       if ( tAliases->text( i, 0 ) != "" ) {
+           alias = ac->insert( obj, md_alias, tAliases->text( i, 0 ), -1 );
+          ac->setAttr( alias, mda_tag, tAliases->verticalHeader()->label( i ));
+       }
+    }
+}
+
diff --git a/src/designer/aliaseditor.h b/src/designer/aliaseditor.h
new file mode 100644 (file)
index 0000000..92cd06c
--- /dev/null
@@ -0,0 +1,54 @@
+/****************************************************************************
+** $Id: aliaseditor.h,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Header file of the Alias editor of Ananas
+** Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ALIASEDITOR_H
+#define ALIASEDITOR_H
+
+#include <q3table.h>
+#include <qobject.h>
+#include "acfg.h"
+
+
+class aAliasEditor : public QObject
+{
+       Q_OBJECT
+public:
+    aCfg *ac;
+    aCfgItem obj;
+    Q3Table *tAliases;
+    int langCount;
+
+    aAliasEditor( aCfg *c, aCfgItem o, Q3Table *tAliases );
+    ~aAliasEditor();
+
+    void setData();
+    void updateMD( );//aCfgItem o );
+};
+
+#endif
diff --git a/src/designer/atreeitems.cpp b/src/designer/atreeitems.cpp
new file mode 100644 (file)
index 0000000..7915bc9
--- /dev/null
@@ -0,0 +1,274 @@
+/****************************************************************************
+** $Id: atreeitems.cpp,v 1.2 2008/11/08 20:16:35 leader Exp $
+**
+** Header file of the Ananas visual tree object
+** of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <q3listview.h>
+#include <q3header.h>
+#include <q3popupmenu.h>
+#include <qlabel.h>
+#include <qcursor.h>
+
+#include "atreeitems.h"
+#include "alog.h"
+
+ananasListViewItem::ananasListViewItem( Q3ListView *parent, aCfg * cfgmd, aCfgItem cfgobj,
+                                                                                const QString &name )
+: Q3ListViewItem( parent )
+{
+       obj = cfgobj;
+       md = cfgmd;
+       if ( name.isNull() ) setText( 0, md->attr( obj, mda_name ) );
+       else setText( 0, name );
+       id = md->id(obj);
+}
+
+ananasListViewItem::ananasListViewItem( ananasListViewItem *parent, ananasListViewItem *after,
+                                                                                aCfg * cfgmd, aCfgItem cfgobj, const QString &name )
+: Q3ListViewItem( parent, after )
+{
+       obj = cfgobj;
+       md = cfgmd;
+       if ( name.isNull() ) setText( 0, md->attr( obj, mda_name ) );
+       else setText( 0, name );
+       id = md->id(obj);
+}
+
+ananasListViewItem::ananasListViewItem( Q3ListView *parent, Q3ListViewItem *after, aCfg * cfgmd, aCfgItem cfgobj, const QString &name )
+: Q3ListViewItem( parent, after )
+{
+       obj = cfgobj;
+       md = cfgmd;
+       if ( name.isNull() ) setText( 0, md->attr( obj, mda_name ) );
+       else setText( 0, name );
+       id = md->id(obj);
+}
+
+void
+ananasListViewItem::clearTree()
+{
+       Q3ListViewItem  *item, *nextitem;
+
+       // clear tree
+       item = firstChild();
+       while( item )
+       {
+               nextitem = item->nextSibling();
+               delete item;
+               item = nextitem;
+       }
+}
+
+/*
+void
+ananasListViewItem::moveItem ( QListViewItem * after )
+{
+CHECK_POINT
+       aCfgItem temp = obj, temp2 = ((ananasListViewItem*)after)->obj;
+       QListViewItem::moveItem( after );
+       obj = temp;
+       ((ananasListViewItem*)after)->obj = temp2;
+}
+*/
+void
+ananasListViewItem::moveUp ()
+{
+       if(!previousSibling()) return; // not previous item! - no changes
+       aCfgItem item = previousSibling()->obj;
+
+       if ( obj.isNull() )
+       {
+               aLog::print(aLog::Error, QObject::tr(" Ananas List View Item %1 is null").arg(md->attr(obj,mda_name)));
+               return;
+       }
+       if( md->swap( obj, item ) )
+       {
+               previousSibling()->moveItem( this );
+               aLog::print(aLog::Debug, QObject::tr("Ananas List View Item swaping"));
+       }
+       else
+       {
+               aLog::print(aLog::Error, QObject::tr("Ananas List View Item swaping"));
+       }
+}
+
+void
+ananasListViewItem::moveDown ()
+{
+       if(!nextSibling()) return; // not next item! - no changes
+       aCfgItem item = nextSibling()->obj;
+       if ( item.isNull() )
+       {
+               aLog::print(aLog::Error, QObject::tr(" Ananas List View Item %1 is null").arg(md->attr(obj,mda_name)));
+               return;
+       }
+       if( md->swap( obj, item ) )
+       {
+               moveItem( nextSibling() );
+               aLog::print(aLog::Debug, QObject::tr("Ananas List View Item swaping"));
+       }
+       else
+       {
+               aLog::print(aLog::Error, QObject::tr("Ananas List View Item swaping"));
+       }
+}
+
+ananasListViewItem *
+ananasListViewItem::previousSibling() // becose QListViewItem not have function previousSibling();
+{
+       Q3ListViewItem *parent, *item;
+       parent = this->parent();
+       item = parent->firstChild();
+       while ( item )
+               if ( (ananasListViewItem *)item->nextSibling() == this )
+                       return (ananasListViewItem *) item;
+               else item = item->nextSibling();
+       return 0;
+}
+
+ananasListViewItem*
+ananasListViewItem::nextSibling()
+{
+       return (ananasListViewItem *)Q3ListViewItem::nextSibling();
+}
+
+
+void
+ananasListViewItem::okRename( int col )
+{
+       Q3ListViewItem::okRename( col );
+       if ( id && !obj.isNull() && col == 0 ) {
+               setText( 0, text( 0 ).stripWhiteSpace() );
+               md->setAttr( obj, mda_name, text( 0 ) );
+       }
+}
+
+/*
+ananasListViewItem*
+ananasListViewItem::getLastChild( QListViewItem * parent )
+{
+       QListViewItem *item, *nextitem;
+       item = parent->firstChild();
+       while( item )
+       {
+               nextitem = item->nextSibling();
+               if ( nextitem )
+                       item = nextitem;
+               else
+                       return (ananasListViewItem*) item;
+       }
+       return 0;
+};
+*/
+
+ananasListViewItem*
+ananasListViewItem::getLastChild()
+{
+       Q3ListViewItem *item, *nextitem;
+       item = firstChild();
+       while( item )
+       {
+               nextitem = item->nextSibling();
+               if ( nextitem )
+                       item = nextitem;
+               else
+                       return (ananasListViewItem*) item;
+       }
+       return 0;
+};
+
+
+ananasTreeView::ananasTreeView ( QWidget *parent, aCfg *cfgmd )
+:Q3ListView ( parent )
+{
+       md = cfgmd;
+       addColumn( "" );
+       header()->hide();
+       setSorting ( -1 );
+       setSelectionMode( Single );
+};
+
+
+void
+ananasTreeView::ContextMenuAdd( Q3PopupMenu * m )
+{
+       //--QLabel *caption = new QLabel( tr("<font color=darkblue><u><b>" "Context Menu</b></u></font>"), this );
+       //--caption->setAlignment( Qt::AlignCenter );
+       //--m->insertItem( caption );
+       m->insertItem( tr("&Rename"), this, SLOT( itemRename() ), Qt::CTRL+Qt::Key_R);
+       m->insertItem( tr("&Edit"),  this, SLOT( itemEdit() ), Qt::CTRL+Qt::Key_E );
+       m->insertItem( tr("&Delete"), this, SLOT( itemDelete() ), Qt::CTRL+Qt::Key_D );
+       m->insertItem( tr("&MoveUp"), this, SLOT( itemMoveUp() ), Qt::CTRL+Qt::Key_U );
+       m->insertItem( tr("&MoveDown"), this, SLOT( itemMoveDown() ), Qt::CTRL+Qt::Key_M );
+       m->insertItem( tr("&SaveItem"), this, SLOT( itemSave() ) );
+       m->insertItem( tr("&LoadItem"), this, SLOT( itemLoad() ) );
+       m->insertSeparator();
+};
+
+void
+ananasTreeView::deleteItem()
+{
+       ananasListViewItem *i = (ananasListViewItem *) selectedItem();
+       if ( i )
+       {
+               if ( i->id ) {
+                       md->remove( i->obj );
+                       delete i;
+               }
+       }
+};
+
+void
+ananasTreeView::moveUpItem()
+{
+       ananasListViewItem *i = (ananasListViewItem *) selectedItem();
+       if ( i )
+       {
+               if ( i->id ) {
+                       i->moveUp();
+               }
+       }
+}
+
+void
+ananasTreeView::moveDownItem()
+{
+       ananasListViewItem *i = (ananasListViewItem *) selectedItem();
+       if ( i )
+       {
+               if ( i->id ) {
+                       i->moveDown();
+               }
+       }
+}
+
+void
+ananasTreeView::renameItem()
+{
+       if ( selectedItem() ) selectedItem()->startRename( 0 );
+}
+
diff --git a/src/designer/atreeitems.h b/src/designer/atreeitems.h
new file mode 100644 (file)
index 0000000..90f7741
--- /dev/null
@@ -0,0 +1,83 @@
+/****************************************************************************
+** $Id: atreeitems.h,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Header file of the Ananas visual tree object
+** of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ATREEITEMS_H
+#define ATREEITEMS_H
+#include <q3popupmenu.h>
+#include <q3listview.h>
+#include <q3intdict.h>
+#include "acfg.h"
+
+class QWidget;
+
+class ananasListViewItem : public Q3ListViewItem
+{
+public:
+       int id;
+       aCfgItem obj;
+       QWidget *editor;
+       aCfg *md;
+
+       ananasListViewItem( Q3ListView *parent, aCfg * cfgmd, aCfgItem cfgobj, const QString &name = QString::null );
+       ananasListViewItem( Q3ListView *parent, Q3ListViewItem *after, aCfg * cfgmd, aCfgItem cfgobj, const QString &name = QString::null );
+       ananasListViewItem( ananasListViewItem *parent, ananasListViewItem *after, aCfg * cfgmd,
+                                               aCfgItem cfgobj, const QString &name = QString::null );
+
+       void clearTree();
+       void moveUp ();
+       void moveDown ();
+
+       ananasListViewItem *previousSibling();
+       ananasListViewItem *nextSibling();
+//     ananasListViewItem *getLastChild( QListViewItem * parent );
+       ananasListViewItem *getLastChild();
+protected:
+       virtual void okRename( int col );
+};
+
+class ananasTreeView
+: public Q3ListView
+{
+    Q_OBJECT
+public:
+    aCfg *md;
+
+       ananasTreeView( QWidget *parent, aCfg *cfgmd );
+
+       void ContextMenuAdd(  Q3PopupMenu * m );
+       void deleteItem();
+       void moveUpItem ();
+       void moveDownItem ();
+       void renameItem();
+       void saveItem();
+       void loadItem();
+};
+
+
+#endif
diff --git a/src/designer/cfgform.cpp b/src/designer/cfgform.cpp
new file mode 100644 (file)
index 0000000..78347af
--- /dev/null
@@ -0,0 +1,860 @@
+#include "cfgform.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <q3listview.h>
+#include <qlabel.h>
+#include <qpixmap.h>
+#include <q3popupmenu.h>
+#include <qstatusbar.h>
+#include <qlineedit.h>
+#include <qmessagebox.h>
+#include <q3valuelist.h>
+#include <qimage.h>
+#include <qbitmap.h>
+#include <q3table.h>
+#include <q3dragobject.h>
+#include <qmime.h>
+#include <q3filedialog.h>
+#include <qinputdialog.h>
+#include <q3cstring.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <QCloseEvent>
+//#include <iostream.h>
+
+#include "ananas.h"
+#include "mainform.h"
+#include "deditfield.h"
+#include "deditcfg.h"
+#include "deditdoc.h"
+#include "deditrole.h"
+#include "deditreport.h"
+#include "deditdialog.h"
+#include "deditcat.h"
+#include "deditlang.h"
+#include "mdtree.h"
+#include "actiontree.h"
+#include "alog.h"
+
+/*
+ *  Constructs a CfgForm as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+CfgForm::CfgForm(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+CfgForm::~CfgForm()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void CfgForm::languageChange()
+{
+    retranslateUi(this);
+}
+
+extern MainForm *mainform;
+
+void
+set_Icon(Q3ListViewItem *item, const char *name)
+{
+    char in[200];
+    strcpy(in, name);
+    strcat(in,".png");
+    item->setPixmap(0, rcIcon(in));
+}
+
+
+/*class ObjEditing {
+    public:
+    ObjEditing(){item=NULL; widget=NULL;}
+    ObjEditing(QListViewItem *aitem, QWidget *awidget) {item=aitem;widget=awidget;}
+
+    QListViewItem *item;
+    QWidget *widget;
+};
+*/
+//typedef QValueList<ObjEditing> ObjEditingList;
+//ObjEditingList ObjEdList;
+
+CfgForm *configform=NULL;
+
+
+void CfgForm::fileNew()
+{
+
+}
+
+void CfgForm::fileOpen()
+{
+
+}
+
+void CfgForm::fileSave()
+{
+
+}
+
+void CfgForm::fileSaveAs()
+{
+
+}
+
+void CfgForm::filePrint()
+{
+
+}
+
+void CfgForm::fileExit()
+{
+}
+
+
+void
+CfgForm::init( QString &rcf, bool flagNew )    //      flagNew shows if it needs to create new configuration
+{
+    statusBar()->hide();
+    configform=this;
+    rcfile = rcf;      //      resource file
+    setIcon( rcIcon("a-system.png"));
+    if ( !flagNew ) {  // read rcfile
+       if ( cfg.readrc( rcfile ) ) {
+               aLog::print(aLog::Error,tr("CfgForm readrc error"));
+               return;
+       }
+    }
+//    globalCfg = &cfg;
+    setCaption(tr("Business scheme: ")+cfg.info( mda_name ));
+//     QWidget *tab_0 = new QWidget( tabWidget, "tab" );
+    Q3GridLayout *l = new Q3GridLayout( tabWidget->page(0), 1, 1, 1,  2, "tablayout" );
+    mdtree = new aMetadataTreeView( tabWidget->page(0), &cfg );        // metadata tree creation
+    l->addWidget( mdtree, 0, 0);
+//     tabWidget->insertTab( tab_0, tr( "Business scheme" ), 0 );
+//     tabWidget->setCurrentPage( 0 );
+    initLang();        //      languages tab initialization
+    initRoles();       //      rights tab initialization
+    initImageCollection();     //      image collection tab initialization
+    mainform->TBToolbar->setShown( TRUE );     //      show edit toolbar
+    mainform->configSaveAction->setVisible( TRUE );    //      show save button
+
+    actiontree = new aActionTreeView ( tabWidget->page(1), &cfg );     //      action tree creation
+    Q3GridLayout *j = new Q3GridLayout( tabWidget->page(1), 1, 1, 1,  2, "atablayout" );
+    j->addWidget( actiontree, 0, 0);
+
+    interfacetree = new InterfaceTreeView ( tabWidget->page(2), &cfg );        //      interface tree creation
+    Q3GridLayout *k = new Q3GridLayout( tabWidget->page(2), 1, 1, 1,  2, "itablayout" );
+    k->addWidget( interfacetree, 0, 0);
+    // connection toolbar actions
+    connect(mainform->objMetadataNewAction, SIGNAL(activated()), mdtree, SLOT( itemNew() ) );
+    connect(mainform->objMetadataEditAction, SIGNAL(activated()), mdtree, SLOT( itemEdit() ) );
+    connect(mainform->objActionsNewAction, SIGNAL(activated()), actiontree, SLOT( itemNewAction() ) );
+    connect(mainform->objActionsNewGroupAction, SIGNAL(activated()), actiontree, SLOT( itemNewGroup() ) );
+    connect(mainform->objActionsEditAction, SIGNAL(activated()), actiontree, SLOT( itemEdit() ) );
+    connect(mainform->objInterfaceNewCommandAction, SIGNAL(activated()), interfacetree, SLOT( itemNewCommand() ) );
+    connect(mainform->objInterfaceNewSubmenuAction, SIGNAL(activated()), interfacetree, SLOT( itemNewSubmenu() ) );
+    connect(mainform->objInterfaceNewSeparatorAction, SIGNAL(activated()), interfacetree, SLOT( itemNewSeparator() ) );
+    connect(mainform->objInterfaceEditAction, SIGNAL(activated()), interfacetree, SLOT( itemEdit() ) );
+    connect(mainform->objImageCollectionAddAction, SIGNAL(activated()), this, SLOT( bAddImage_clicked() ) );
+    connect(mainform->objLanguagesNewAction, SIGNAL(activated()), this, SLOT( bAdd_clicked() ) );
+    connect(mainform->objLanguagesEditAction, SIGNAL(activated()), this, SLOT( bEdit_clicked() ) );
+    connect(mainform->objLanguagesClearAction, SIGNAL(activated()), this, SLOT( bKill_clicked() ) );
+    connect(mainform->objRoleNewAction, SIGNAL(activated()), this, SLOT( bAddRole_clicked() ) );
+    connect(mainform->objRoleEditAction, SIGNAL(activated()), this, SLOT( bEditRole_clicked() ) );
+    connect(mainform->objRoleClearAction, SIGNAL(activated()), this, SLOT( bKillRole_clicked() ) );
+}
+
+/*
+  * Image collection initialization
+  */
+void CfgForm::initImageCollection()
+{
+    aCfgItem oroot, image_collection, image;
+    int i, n;
+    QPixmap pix;
+    QString name;
+
+    oroot = cfg.find( mdc_root );      // get root
+    image_collection = cfg.find( oroot, md_image_collection, 0 );      // get image col part
+    if ( image_collection.isNull() ) cfg.insert( oroot, md_image_collection, QString::null, -1 );
+    n = cfg.countChild( image_collection, md_image );  // count images
+    for ( i = 0; i < n; i++ ) {
+       image = cfg.findChild( image_collection, md_image, i ); // foreach
+       name = cfg.attr( image, mda_name );     // get name
+       pix.loadFromData( cfg.binary( image ) );        // load binary
+       Q3IconViewItem *item = new Q3IconViewItem( vImageCollection, name, pix );       // create image
+       item->setRenameEnabled( TRUE ); // set rename enabled
+       vImageCollection->insertItem( item, 0 );        // insert image
+       idList.insert( cfg.id( image ), item );         // add image into dict
+    }
+    if ( vImageCollection->count() ) bRemoveImage->setEnabled( TRUE ); // enable remove button
+}
+
+/*
+  * Add image into collection
+  */
+void CfgForm::bAddImage_clicked()
+{
+    QPixmap pix;
+    Q3FileDialog *fd = new Q3FileDialog( "", "Images (*.png *.xpm *.jpg *.jpeg *.bmp)", 0, 0, TRUE );
+    QByteArray ba;
+    QString name;
+    QStringList names;
+    aCfgItem image_collection, image;
+    QFile f;
+    PixmapPreview *p = new PixmapPreview;
+
+    fd->setContentsPreview( p, p );
+    fd->setPreviewMode( Q3FileDialog::Contents );
+    fd->setContentsPreviewEnabled( TRUE );
+    fd->setCaption( tr("Open image dialog" ) );
+    fd->setMode( Q3FileDialog::ExistingFiles );                // tune file dialogue
+    if ( fd->exec() == QDialog::Accepted ) {           // if accepted
+       names = fd->selectedFiles();                    // get selected filenames
+       QStringList::Iterator it = names.begin();
+       while( it != names.end() ) {                    // trough the names
+           name = *it;
+           ++it;
+           if ( !name.isEmpty() ) {                    // if not empty
+               f.setName( name );
+               if ( f.open( QIODevice::ReadOnly ) ){           // open r\o mode
+                               ba = f.readAll();       // get binary
+                               f.close();
+                               pix.loadFromData( ba ); // load pixmap from binary
+                       } else continue;
+               }
+               QFileInfo fi( name );
+               name = fi.baseName();
+               Q3IconViewItem *item = new Q3IconViewItem( vImageCollection, name, pix );
+               item->setRenameEnabled( TRUE );         // set rename enabled
+               vImageCollection->insertItem( item, 0 );        // insert image
+               image_collection = cfg.findChild( cfg.find( mdc_root ), md_image_collection, 0 );
+               image = cfg.insert( image_collection, md_image, name ); // insert image metaitem
+               cfg.setBinary( image, ba );             // set binary
+               idList.insert( cfg.id( image ), item ); // add image into dict
+           }
+       delete fd;                                      // delete file dialogue
+       bRemoveImage->setEnabled( TRUE );               // remove button enable
+       mainform->objTBDeleteAction->setEnabled( TRUE );        // toolbar button enable
+    }
+}
+
+/*
+  * Remove image from collection
+  */
+void CfgForm::bRemoveImage_clicked()
+{
+    Q3IconViewItem *current;
+    aCfgItem image_collection, image;
+    int i, n, id;
+
+    image_collection = cfg.findChild( cfg.find( mdc_root ), md_image_collection, 0 );
+    n = cfg.countChild( image_collection, md_image );          // count image in collection
+    current = vImageCollection->currentItem();                 // get current selected image
+    for ( i = 0; i < n; i++ ) {
+       image = cfg.findChild( image_collection, md_image, i ); // get metaitem
+       id = cfg.id( image );                                   // get id
+       if ( current == idList.find( id ) ) {                   // if corresponds
+           cfg.remove( image );
+           idList.remove( id );                                // rmove from metadata and from dict
+           delete current;
+           break;
+       }
+    }
+    if ( !vImageCollection->count() ) {                                // if last image removed
+       bRemoveImage->setEnabled( FALSE );                      // disable remove button and toolbar button
+       mainform->objTBDeleteAction->setEnabled( FALSE );
+    }
+    vImageCollection->sort( TRUE );    // turn image sorting on
+}
+
+/*
+  * Image rename event handler
+  */
+void CfgForm::vImageCollection_itemRenamed( Q3IconViewItem *item, const QString &name )
+{
+    aCfgItem image_collection, image;
+    int i, n;
+
+    image_collection = cfg.findChild( cfg.find( mdc_root ), md_image_collection, 0 );
+    n = cfg.countChild( image_collection, md_image );          // count images
+    for ( i = 0; i < n; i++ ) {
+       image = cfg.findChild( image_collection, md_image, i ); // get timage
+       if ( item == idList.find( cfg.id( image ) ) ) {         // if corresponds
+           cfg.setAttr( image, mda_name, name );               // rename metaitem
+           break;
+       }
+    }
+}
+
+/*
+  * Languages initialization
+  */
+void CfgForm::initLang()
+{
+       aCfgItem oroot;
+       aCfgItem lang, obj;
+       int i, n;
+
+       tLang->setNumRows( 0 );
+       oroot = cfg.find( mdc_root );           // get root
+       if ( oroot.isNull() ) {
+               aLog::print(aLog::Info,tr("CfgForm metadata root is null"));
+       }
+       lang = cfg.findChild( oroot, md_languages, 0 ); // get lang part
+       if ( lang.isNull() ) {
+               aLog::print(aLog::Info,tr("CfgForm metadata lang is null"));
+       }
+       if ( lang.isNull() ) lang = cfg.insert( oroot, md_languages, QString::null, -1 );
+       n = cfg.count( lang, md_language );             // count languages
+       aLog::print(aLog::Debug,QString(tr("lang = %1")).arg(n));
+       for ( i = 0; i < n; i++ ) {                     // foreach
+               obj = cfg.find( lang, md_language, i);          // get lang
+               if ( obj.isNull() ) aLog::print(aLog::Debug,QString(tr("CfgForm %1 metadata lang is null")).arg(i));
+               tLang->insertRows( tLang->numRows(), 1 );       // insert into table
+               tLang->setText( tLang->numRows()-1, 0, cfg.attr( obj, mda_tag ) );
+               tLang->setText( tLang->numRows()-1, 1, cfg.attr( obj, mda_name ) );
+               tLang->setText( tLang->numRows()-1, 2, cfg.attr( obj, mda_trfile ) );   // fill cols
+       }
+       if ( !tLang->numRows() ) {      //      turn buttons off
+               bDelete->setEnabled( FALSE );
+               bEdit->setEnabled( FALSE );
+               bKill->setEnabled( FALSE);
+               mainform->objLanguagesClearAction->setEnabled( FALSE );
+               mainform->objLanguagesEditAction->setEnabled( FALSE );
+       }
+}
+
+/*
+  * Roles initialization
+  */
+void CfgForm::initRoles()
+{
+    aCfgItem oroot;
+    aCfgItem role, obj;
+    int i, n;
+    QString rd;
+
+    tRole->setNumRows( 0 );                            // no rows
+    oroot = cfg.find( mdc_root );                      // get root
+    role = cfg.find( oroot, md_roles, 0 );             // get role part
+    if ( role.isNull() ) role = cfg.insert( oroot, md_roles, QString::null, -1 );
+    n = cfg.count( role, md_role );                    // count roles
+    for ( i = 0; i < n; i++ ) {
+       obj = cfg.find( role, md_role, i);              // get role
+       tRole->insertRows( tRole->numRows(), 1 );       // insert this
+       tRole->setText( tRole->numRows()-1, 0, cfg.attr( obj, mda_name ) );
+       rd = cfg.sText( obj, md_description );
+       rd.replace( QChar('\n'), " " );                 // remove \n symbol for good perception
+       tRole->setText( tRole->numRows()-1, 1, rd ); // fill cols
+    }
+    if ( !tRole->numRows() ) { //      turn unneccessary buttons off
+       bDeleteRole->setEnabled( FALSE );
+       bEditRole->setEnabled( FALSE );
+       bKillRole->setEnabled( FALSE);
+       mainform->objRoleClearAction->setEnabled( FALSE );
+       mainform->objRoleEditAction->setEnabled( FALSE );
+    }
+}
+
+/*
+  * Destroy configuration form
+  */
+void CfgForm::destroy()
+{
+       configform = 0;
+//     globalCfg = 0;                  // clear pointers
+       mainform->cfgform = NULL;
+        mainform->removeTab(name());
+}
+
+/*
+  * Save metadata on disk
+  */
+void CfgForm::save()
+{
+//    int i, n;
+//    aCfgItem oroot, lang, obj;
+    aDatabase *database = aDatabase::database();
+
+    if ( cfg.writerc( rcfile ) ) cfg_message(0, tr("Unable to write rc file."));
+    else {
+//     if ( database.init( rcfile ) ){
+               database->update();
+//             database.done();
+//     }
+  }
+}
+
+/*
+  * Add new language
+  */
+void CfgForm::bAdd_clicked()
+{
+    aCfgItem lang, obj;
+
+    tLang->insertRows( tLang->numRows(), 1 );                  // insert new row
+    tLang->setCurrentCell( tLang->numRows()-1, 0 );            // focus on new role
+    lang = cfg.find( cfg.find( mdc_root ), md_languages, 0 );  // get lang part
+    obj = cfg.insert( lang, md_language, tr("New language") ); // insert new metaitem
+    dEditLang *e = new dEditLang( ws, 0, Qt::WDestructiveClose );
+    e->setData( configform, obj );
+    e->show();                                         // create editor, set its data and show this one
+    bDelete->setEnabled( TRUE );
+    bEdit->setEnabled( TRUE );
+    bKill->setEnabled( TRUE );                         // enable control buttons and toolbar actions
+    mainform->objLanguagesClearAction->setEnabled( TRUE );
+    mainform->objLanguagesEditAction->setEnabled( TRUE );
+    mainform->objTBDeleteAction->setEnabled( TRUE );
+}
+
+/*
+  * Delete language
+  */
+void CfgForm::bDelete_clicked()
+{
+   if ( ! QMessageBox::warning( this, tr("Deleting row"), tr("Delete '%1'?").arg( tLang->text( tLang->currentRow(), 1 ) ), tr("Yes"), tr("No") ) ) {
+// request for delete
+       aCfgItem lang, obj, alias;
+       int i, n;
+
+       lang = cfg.find( cfg.find( mdc_root ), md_languages, 0 );       // get lang part
+       n = cfg.count( lang, md_language );     // count langs
+       for ( i = 0; i < n; i++ ) {
+       obj = cfg.find( lang, md_language, i );         // foreach lang
+       if ( cfg.attr( obj, mda_tag ) == tLang->text( tLang->currentRow(), 0 ) ) {
+           cfg.remove( obj );                  // if tags corresponding remove metaitem
+           break;
+       }
+       }
+       tLang->removeRow( tLang->currentRow() );                // remove row
+       if ( !tLang->numRows() ) {
+          bDelete->setEnabled( FALSE );
+          bEdit->setEnabled( FALSE );
+          bKill->setEnabled( FALSE );          // if last row removed then buttons and actions are disabled
+          mainform->objLanguagesClearAction->setEnabled( FALSE );
+          mainform->objLanguagesEditAction->setEnabled( FALSE );
+          mainform->objTBDeleteAction->setEnabled( FALSE );
+       }
+   }
+}
+
+/*
+  * Language editing
+  */
+void CfgForm::bEdit_clicked()
+{
+    aCfgItem obj;
+
+    obj = cfg.find( cfg.find( cfg.find( mdc_root ), md_languages, 0 ), md_language, tLang->currentRow() );
+    // get lang metaitem
+    dEditLang *e = new dEditLang( ws, 0, Qt::WDestructiveClose );
+    e->setData( configform, obj );
+    e->show();                         // create editor, set its data and show this one
+}
+
+/*
+  * Double-click table event
+  */
+void CfgForm::tLang_doubleClicked( int, int, int, const QPoint & )
+{
+    bEdit_clicked();           // call edit button click event
+}
+
+/*
+  * Kill dead aliases througout metadata
+  */
+void CfgForm::bKill_clicked()
+{
+    aCfgItem oroot, alias;
+    int i = 0, s, n, ac, killed = 0;
+
+    oroot = cfg.find( mdc_root );              // get root
+    n = cfg.count( oroot, md_alias );          // count aliases
+    while ( i < n ) {                          // foreach
+       ac = 0;                                 // unset counter
+       alias = cfg.find( oroot, md_alias, i ); // get alias
+       for ( s = 0; s < tLang->numRows(); s++ ) // check aliase tag on existing in lang list
+           if ( cfg.attr( alias, mda_tag ) == tLang->text( s, 0 ) ) ac++;
+       if ( !ac ) {
+           cfg.remove( alias );
+           killed++;
+           n--;                                // if dead then delete this and change counters
+       } else i++;
+    }
+    QMessageBox::warning( this, tr("Clearing dead aliases"), tr("%1 dead aliases killed.").arg( killed ), tr("OK") );
+    // information message box
+}
+
+void CfgForm::newObj()
+{
+}
+
+
+void CfgForm::listCfg_onItem( Q3ListViewItem * )
+{
+
+}
+
+
+
+void CfgForm::newField()
+{
+}
+
+
+
+void CfgForm::newForm()
+{
+}
+
+
+void CfgForm::newTable()
+{
+}
+
+/*
+  * Cofiguration form close event
+  */
+void CfgForm::closeEvent( QCloseEvent *e )
+{
+
+       if ( !cfg.modified() ) {                // if data didn't modify send event further
+       Q3MainWindow::closeEvent( e );
+       return;
+    }
+    switch( QMessageBox::warning( this, tr("Saving changes"),
+                                 tr("Save changes %1?").arg( caption() ),
+                                 tr("Yes"), tr("No"), tr("Cancel") ) ) {
+       // request for saving before exit
+    case 0:    // yes
+       {
+               mainform->closeChildWindows();
+               save();                 // save data and send event further
+               Q3MainWindow::closeEvent( e );
+/*
+           cancelupdate=0;
+           if (closeSubWindows()) e->ignore();
+           else {
+               if (mainform) mainform->configSave();
+               QMainWindow::closeEvent( e );
+           }
+*/
+       }
+       break;
+    case 1:    // no
+//     if (closeSubWindows()) {//e->ignore();
+//     }
+//     else {
+////       cancelupdate=1;
+//         //e->accept();
+//     }                               // send event further
+               mainform->closeChildWindows();
+               Q3MainWindow::closeEvent(e);
+       break;
+    default:
+       e->ignore();                    // ignore event by default
+       break;
+       mainform->TBToolbar->setShown( FALSE );
+       mainform->configSaveAction->setVisible( FALSE );
+       mainform->tbMetadata->setShown( FALSE );
+       mainform->tbActions->setShown( FALSE );
+       mainform->tbInterface->setShown( FALSE );               // disable toolbars anyway
+       mainform->tbRights->setShown( FALSE );
+       mainform->tbLanguages->setShown( FALSE );
+       mainform->tbImageCollection->setShown( FALSE );
+//     closeSubWindows();
+    }
+    //    } else {
+    //        e->accept();
+    //    }
+}
+
+/*
+  * Subwindow close event
+  */
+int
+CfgForm::closeSubWindows()
+{
+    QWidgetList windows = ws->windowList();            // workspace windows list
+    if ( windows.count() ) {                           // if there're opened windows
+       for ( int i = 0; i < int(windows.count()); ++i ) {      // foreach
+           QWidget *window = windows.at( i );
+           if (window!=this) {                         // if not this
+               if ( window->className() == tr ( "messageswindow" ) ) {
+                       delete window;  // if messageswindow remove it
+                       continue;
+               }
+               if ( !window->close() ) return 1;       // if cannot close return error
+               else delete window;                     // else delete window
+           }
+       }
+    }
+    return 0;
+}
+
+
+
+/*
+int CfgForm::activateExist( QListViewItem *item )
+{
+    QWidget *window;
+
+    window=findOpened(item);
+    if (window) {
+       window->setFocus();
+       return 1;
+    }
+    return 0;
+}
+*/
+
+//QWidget *
+//CfgForm::findOpened( QListViewItem *item )
+//{
+/*
+    ObjEditingList::iterator it;
+    QWidgetList windows = ws->windowList();
+    QWidget *window, *res=NULL;
+    int f;
+
+    if ( windows.count() ) {
+       it = ObjEdList.begin();
+       while ( it != ObjEdList.end()) {
+           f=0;
+           for ( int i = 0; i < int(windows.count()); ++i ) {
+               window = windows.at( i );
+               if (window==(*it).widget) {
+                   f=1; break;
+               }
+           }
+           if (!f) {
+               it=ObjEdList.remove(it);
+           } else it++;
+       }
+       for ( it = ObjEdList.begin(); it != ObjEdList.end(); ++it ) {
+           if (item==(*it).item) {
+               res=(*it).widget;
+               break;
+           }
+       }
+    }
+    return res;
+*/
+//    return NULL;
+//}
+
+/*
+  * When tab switches some actions reconnect to corresponding toolbar buttons and toolbars recombinate
+  */
+void CfgForm::tabWidget_selected( const QString &tab )
+{
+    bool fM, fA, fI, fR, fL, fIC;
+
+    if ( tab == tr("Metadata") ) {
+       connect(mainform->objTBDeleteAction, SIGNAL(activated()), mdtree, SLOT( itemDelete() ) );
+       connect(mainform->objTBRenameAction, SIGNAL(activated()), mdtree, SLOT( itemRename() ) );
+       connect(mainform->objTBMoveUpAction, SIGNAL(activated()), mdtree, SLOT( itemMoveUp() ) );
+       connect(mainform->objTBMoveDownAction, SIGNAL(activated()), mdtree, SLOT( itemMoveDown() ) );
+       fM = TRUE;
+    } else {
+           disconnect(mainform->objTBDeleteAction, SIGNAL(activated()), mdtree, SLOT( itemDelete() ) );
+           disconnect(mainform->objTBRenameAction, SIGNAL(activated()), mdtree, SLOT( itemRename() ) );
+           disconnect(mainform->objTBMoveUpAction, SIGNAL(activated()), mdtree, SLOT( itemMoveUp() ) );
+           disconnect(mainform->objTBMoveDownAction, SIGNAL(activated()), mdtree, SLOT( itemMoveDown() ) );
+           fM= FALSE;
+       }
+    if ( tab == tr("Actions") ) {
+       connect(mainform->objTBDeleteAction, SIGNAL(activated()), actiontree, SLOT( itemDelete() ) );
+       connect(mainform->objTBRenameAction, SIGNAL(activated()), actiontree, SLOT( itemRename() ) );
+       connect(mainform->objTBMoveUpAction, SIGNAL(activated()), actiontree, SLOT( itemMoveUp() ) );
+       connect(mainform->objTBMoveDownAction, SIGNAL(activated()), actiontree, SLOT( itemMoveDown() ) );
+       fA = TRUE;
+    } else {
+           disconnect(mainform->objTBDeleteAction, SIGNAL(activated()), actiontree, SLOT( itemDelete() ) );
+           disconnect(mainform->objTBRenameAction, SIGNAL(activated()), actiontree, SLOT( itemRename() ) );
+           disconnect(mainform->objTBMoveUpAction, SIGNAL(activated()), actiontree, SLOT( itemMoveUp() ) );
+           disconnect(mainform->objTBMoveDownAction, SIGNAL(activated()), actiontree, SLOT( itemMoveDown() ) );
+           fA = FALSE;
+       }
+    if ( tab == tr("Interface") ) {
+       connect(mainform->objTBDeleteAction, SIGNAL(activated()), interfacetree, SLOT( itemDelete() ) );
+       connect(mainform->objTBRenameAction, SIGNAL(activated()), interfacetree, SLOT( itemRename() ) );
+       connect(mainform->objTBMoveUpAction, SIGNAL(activated()), interfacetree, SLOT( itemMoveUp() ) );
+       connect(mainform->objTBMoveDownAction, SIGNAL(activated()), interfacetree, SLOT( itemMoveDown() ) );
+       fI = TRUE;
+    } else {
+           disconnect(mainform->objTBDeleteAction, SIGNAL(activated()), interfacetree, SLOT( itemDelete() ) );
+           disconnect(mainform->objTBRenameAction, SIGNAL(activated()), interfacetree, SLOT( itemRename() ) );
+           disconnect(mainform->objTBMoveUpAction, SIGNAL(activated()), interfacetree, SLOT( itemMoveUp() ) );
+           disconnect(mainform->objTBMoveDownAction, SIGNAL(activated()), interfacetree, SLOT( itemMoveDown() ) );
+           fI = FALSE;
+       }
+    if ( tab == tr("Rights") )
+    {
+        connect(mainform->objTBDeleteAction, SIGNAL(activated()), this, SLOT( bDeleteRole_clicked() ) );
+        fR = TRUE;
+        if ( !tRole->numRows() ) mainform->objTBDeleteAction->setEnabled( FALSE );
+        else mainform->objTBDeleteAction->setEnabled( TRUE );
+     } else {
+        disconnect(mainform->objTBDeleteAction, SIGNAL(activated()), this, SLOT( bDeleteRole_clicked() ) );
+        fR = FALSE;
+     }
+     if ( tab == tr("Languages") ) {
+        connect(mainform->objTBDeleteAction, SIGNAL(activated()), this, SLOT( bDelete_clicked() ) );
+        fL = TRUE;
+        if ( !tLang->numRows() ) mainform->objTBDeleteAction->setEnabled( FALSE );
+        else mainform->objTBDeleteAction->setEnabled( TRUE );
+     } else {
+        disconnect(mainform->objTBDeleteAction, SIGNAL(activated()), this, SLOT( bDelete_clicked() ) );
+        fL = FALSE;
+     }
+     if ( tab == tr("Image collection") ) {
+        connect(mainform->objTBDeleteAction, SIGNAL(activated()), this, SLOT( bRemoveImage_clicked() ) );
+        fIC = TRUE;
+        if ( !vImageCollection->count() ) mainform->objTBDeleteAction->setEnabled( FALSE );
+        else mainform->objTBDeleteAction->setEnabled( TRUE );
+     } else {
+        disconnect(mainform->objTBDeleteAction, SIGNAL(activated()), this, SLOT( bRemoveImage_clicked() ) );
+        fIC = FALSE;
+     }
+     if ( tab == tr("Image collection") || tab == tr("Languages") || tab == tr("Rights") ) {
+        mainform->objTBRenameAction->setVisible( FALSE );
+        mainform->objTBMoveUpAction->setVisible( FALSE );
+        mainform->objTBMoveDownAction->setVisible( FALSE );
+     } else {
+        mainform->objTBRenameAction->setVisible( TRUE );
+        mainform->objTBMoveUpAction->setVisible( TRUE );
+        mainform->objTBMoveDownAction->setVisible( TRUE );
+        mainform->objTBDeleteAction->setEnabled( TRUE );
+     }
+     mainform->tbMetadata->setShown( fM );
+     mainform->tbActions->setShown( fA );
+     mainform->tbInterface->setShown( fI );
+     mainform->tbRights->setShown( fR );
+     mainform->tbLanguages->setShown( fL );
+     mainform->tbImageCollection->setShown( fIC );
+}
+
+/*
+  * Adds new role
+  */
+void CfgForm::bAddRole_clicked()
+{
+    aCfgItem role, obj, roles;
+
+    tRole->insertRows( tRole->numRows(), 1 );  // insert row into table
+    tRole->setCurrentCell( tRole->numRows()-1, 0 );    // focus on new cell
+    roles = cfg.find( cfg.find( mdc_root ), md_roles, 0 ); // get role part of configuration
+    obj = cfg.insert( roles, md_role, tr("New role") );        // insert new role into part
+    dEditRole *e = new dEditRole( ws, 0, Qt::WDestructiveClose );
+    e->setData( configform, obj );
+    e->show(); // create role editor, set its data and show this one
+    bDeleteRole->setEnabled( TRUE );
+    bEditRole->setEnabled( TRUE );
+    bKillRole->setEnabled( TRUE );
+    mainform->objRoleClearAction->setEnabled( TRUE );
+    mainform->objRoleEditAction->setEnabled( TRUE );
+    mainform->objTBDeleteAction->setEnabled( TRUE ); // enable buttons and actions
+}
+
+/*
+  * Delete role
+  */
+void CfgForm::bDeleteRole_clicked()
+{
+    if ( ! QMessageBox::warning( this, tr("Deleting row"), tr("Delete '%1'?").arg( tRole->text( tRole->currentRow(), 0 ) ), tr("Yes"), tr("No") ) ) {
+// request for deleting
+       aCfgItem roles, obj, role;
+       int i, n;
+
+       roles = cfg.find( cfg.find( mdc_root ), md_roles, 0 );  // get role part of configuration
+       n = cfg.count( roles, md_role );        // count roles
+       for ( i = 0; i < n; i++ ) {     // foreach role
+           obj = cfg.find( roles, md_role, i );        // get this one
+           if ( cfg.attr( obj, mda_name ) == tRole->text( tRole->currentRow(), 0 ) ) {
+               cfg.remove( obj );
+               break;                  // if found delete and break the cycle
+           }
+       }
+       tRole->removeRow( tRole->currentRow() );        // remove row from table
+       if ( !tRole->numRows() ) {              // if there're no rows disable buttons and actions
+           bDeleteRole->setEnabled( FALSE );
+           bEditRole->setEnabled( FALSE );
+           bKillRole->setEnabled( FALSE );
+           mainform->objRoleClearAction->setEnabled( FALSE );
+           mainform->objRoleEditAction->setEnabled( FALSE );
+           mainform->objTBDeleteAction->setEnabled( FALSE );
+       }
+    }
+}
+
+/*
+  * Edit curren role
+  */
+void CfgForm::bEditRole_clicked()
+{
+    int objid;
+    aCfgItem obj;
+
+    obj = cfg.find( cfg.find( cfg.find( mdc_root ), md_roles, 0 ), md_role, tRole->currentRow() );
+    // get role
+/*    printf( "name = %s\n", cfg.attr( obj, mda_name ).ascii() );
+    objid = cfg.id( obj );
+    if ( wl->find( objid ) ) {
+       wl->get( objid )->setFocus();
+       return;
+    }
+*/
+    dEditRole *e = new dEditRole( ws, 0, Qt::WDestructiveClose );
+    e->setData( configform, obj );
+    e->show();         // create role editor, set its data and show this one
+}
+
+/*
+  * Kill dead roles throughout the configuration
+  */
+void CfgForm::bKillRole_clicked()
+{
+    aCfgItem oroot, roles, role;
+    int i = 0, s, n, ac, killed = 0;
+
+    oroot = cfg.find( mdc_root );      // get configuration root
+    n = cfg.count( oroot, md_role );   // count roles throughout configuration
+    while ( i < n ) {  // foreach role
+       ac = 0;         // unset counter
+       role = cfg.find( oroot, md_role, i );   // get this one
+       for ( s = 0; s < tRole->numRows(); s++ ) // look through role table for correspondence
+           if ( cfg.attr( role, mda_name ) == tRole->text( s, 0 ) ) ac++; // inc counter
+       if ( !ac ) {
+           cfg.remove( role );
+           killed++;
+           n--;        // if counter then remove role, inc kill-counter and dec main counter
+       } else i++;     // else inc current role number
+    }
+    QMessageBox::warning( this, tr("Clearing dead roles"), tr("%1 dead roles killed.").arg( killed ), tr("OK") );
+    // display count of killed roles
+}
+
+
+void CfgForm::tRole_doubleClicked( int, int, int, const QPoint & )
+{
+    bEditRole_clicked();       // call role edit method
+}
+
diff --git a/src/designer/cfgform.h b/src/designer/cfgform.h
new file mode 100644 (file)
index 0000000..ad954d4
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef CFGFORM_H
+#define CFGFORM_H
+
+#include "ui_cfgform.h"
+
+
+class CfgForm : public Q3MainWindow, public Ui::CfgForm
+{
+    Q_OBJECT
+
+public:
+    CfgForm(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~CfgForm();
+
+    Q3IntDict<Q3IconViewItem> idList;
+    InterfaceTreeView *interfacetree;
+    aActionTreeView *actiontree;
+    aCfg cfg;
+    QWorkspace *ws;
+    aMetadataTreeView *mdtree;
+    InterfaceTreeView *toolbartree;
+    QString rcfile;
+    aWindowsList *wl;
+
+public slots:
+    virtual void fileNew();
+    virtual void fileOpen();
+    virtual void fileSave();
+    virtual void fileSaveAs();
+    virtual void filePrint();
+    virtual void fileExit();
+    virtual void init( QString & rcf, bool flagNew );
+    virtual void initImageCollection();
+    virtual void bAddImage_clicked();
+    virtual void bRemoveImage_clicked();
+    virtual void vImageCollection_itemRenamed( Q3IconViewItem * item, const QString & name );
+    virtual void initLang();
+    virtual void initRoles();
+    virtual void save();
+    virtual void bAdd_clicked();
+    virtual void bDelete_clicked();
+    virtual void bEdit_clicked();
+    virtual void tLang_doubleClicked( int, int, int, const QPoint & );
+    virtual void bKill_clicked();
+    virtual void newObj();
+    virtual void listCfg_onItem( Q3ListViewItem * );
+    virtual void newField();
+    virtual void newForm();
+    virtual void newTable();
+    virtual void tabWidget_selected( const QString & tab );
+    virtual void bAddRole_clicked();
+    virtual void bDeleteRole_clicked();
+    virtual void bEditRole_clicked();
+    virtual void bKillRole_clicked();
+    virtual void tRole_doubleClicked( int, int, int, const QPoint & );
+
+signals:
+    void wActivate();
+    void wDeactivate();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    void destroy();
+    virtual void closeEvent( QCloseEvent * e );
+    virtual int closeSubWindows();
+
+};
+
+#endif // CFGFORM_H
diff --git a/src/designer/cfgform.ui b/src/designer/cfgform.ui
new file mode 100644 (file)
index 0000000..6ec1649
--- /dev/null
@@ -0,0 +1,775 @@
+<ui version="4.0" >
+ <author>Leader</author>
+ <class>CfgForm</class>
+ <widget class="Q3MainWindow" name="CfgForm" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>482</width>
+    <height>412</height>
+   </rect>
+  </property>
+  <property name="sizePolicy" >
+   <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle" >
+   <string>CfgForm</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>482</width>
+     <height>412</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget" >
+      <property name="font" >
+       <font>
+        <pointsize>10</pointsize>
+       </font>
+      </property>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Metadata</string>
+       </attribute>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Actions</string>
+       </attribute>
+      </widget>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Interface</string>
+       </attribute>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Rights</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tRole" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <property name="readOnly" >
+           <bool>true</bool>
+          </property>
+          <property name="selectionMode" >
+           <enum>Q3Table::Multi</enum>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Role name</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Description</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+        <item row="0" column="1" >
+         <layout class="QVBoxLayout" >
+          <item>
+           <widget class="QPushButton" name="bAddRole" >
+            <property name="text" >
+             <string>Add</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="bDeleteRole" >
+            <property name="text" >
+             <string>Remove</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="bEditRole" >
+            <property name="text" >
+             <string>Edit</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="bKillRole" >
+            <property name="text" >
+             <string>Clear dead roles</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Expanding</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>21</width>
+              <height>250</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Languages</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="1" >
+         <layout class="QVBoxLayout" >
+          <item>
+           <widget class="QPushButton" name="bAdd" >
+            <property name="text" >
+             <string>Add</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="bDelete" >
+            <property name="text" >
+             <string>Remove</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="bEdit" >
+            <property name="text" >
+             <string>Edit</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="bKill" >
+            <property name="text" >
+             <string>Clear dead aliases</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Expanding</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>20</width>
+              <height>250</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </item>
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tLang" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>3</number>
+          </property>
+          <property name="readOnly" >
+           <bool>true</bool>
+          </property>
+          <property name="selectionMode" >
+           <enum>Q3Table::Multi</enum>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Tag</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Translation file</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Image collection</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item rowspan="2" row="0" column="0" >
+         <widget class="Q3IconView" name="vImageCollection" >
+          <property name="maxItemWidth" >
+           <number>50</number>
+          </property>
+          <property name="maxItemTextLength" >
+           <number>50</number>
+          </property>
+          <property name="itemsMovable" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1" >
+         <layout class="QVBoxLayout" >
+          <item>
+           <widget class="QPushButton" name="bAddImage" >
+            <property name="text" >
+             <string>Add</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="bRemoveImage" >
+            <property name="enabled" >
+             <bool>false</bool>
+            </property>
+            <property name="text" >
+             <string>Remove</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item row="1" column="1" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeType" >
+           <enum>QSizePolicy::Expanding</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>20</width>
+            <height>240</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <action name="fileNewAction" >
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>&amp;New</string>
+   </property>
+   <property name="iconText" >
+    <string>New</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+N</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>fileNewAction</string>
+   </property>
+  </action>
+  <action name="fileOpenAction" >
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>&amp;Open...</string>
+   </property>
+   <property name="iconText" >
+    <string>Open</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+O</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>fileOpenAction</string>
+   </property>
+  </action>
+  <action name="fileSaveAction" >
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>&amp;Save</string>
+   </property>
+   <property name="iconText" >
+    <string>Save</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+S</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>fileSaveAction</string>
+   </property>
+  </action>
+  <action name="fileSaveAsAction" >
+   <property name="text" >
+    <string>Save &amp;As...</string>
+   </property>
+   <property name="iconText" >
+    <string>Save As</string>
+   </property>
+   <property name="shortcut" >
+    <string/>
+   </property>
+   <property name="name" stdset="0" >
+    <string>fileSaveAsAction</string>
+   </property>
+  </action>
+  <action name="filePrintAction" >
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>&amp;Print...</string>
+   </property>
+   <property name="iconText" >
+    <string>Print</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+P</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>filePrintAction</string>
+   </property>
+  </action>
+  <action name="fileExitAction" >
+   <property name="text" >
+    <string>E&amp;xit</string>
+   </property>
+   <property name="iconText" >
+    <string>Exit</string>
+   </property>
+   <property name="shortcut" >
+    <string/>
+   </property>
+   <property name="name" stdset="0" >
+    <string>fileExitAction</string>
+   </property>
+  </action>
+  <actiongroup name="objGroup" >
+   <action name="objEdit" >
+    <property name="icon" >
+     <iconset/>
+    </property>
+    <property name="iconText" >
+     <string>Action</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objEdit</string>
+    </property>
+   </action>
+   <action name="objNew" >
+    <property name="icon" >
+     <iconset/>
+    </property>
+    <property name="iconText" >
+     <string>Action</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objNew</string>
+    </property>
+   </action>
+   <action name="objDelete" >
+    <property name="icon" >
+     <iconset>editdelete.png</iconset>
+    </property>
+    <property name="iconText" >
+     <string>Action</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objDelete</string>
+    </property>
+   </action>
+   <property name="name" stdset="0" >
+    <string>objGroup</string>
+   </property>
+  </actiongroup>
+ </widget>
+ <layoutdefault spacing="2" margin="1" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3IconView</class>
+   <extends>Q3Frame</extends>
+   <header>q3iconview.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>tabWidget</tabstop>
+ </tabstops>
+ <includes>
+  <include location="local" >acfg.h</include>
+  <include location="local" >qworkspace.h</include>
+  <include location="local" >q3socket.h</include>
+  <include location="local" >q3serversocket.h</include>
+  <include location="local" >acfgrc.h</include>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >actiontree.h</include>
+  <include location="local" >interfacetree.h</include>
+  <include location="local" >pixmappreview.h</include>
+  <include location="local" >awindowslist.h</include>
+ </includes>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>fileExitAction</sender>
+   <signal>activated()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>fileExit()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>filePrintAction</sender>
+   <signal>activated()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>filePrint()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fileSaveAsAction</sender>
+   <signal>activated()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>fileSaveAs()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fileSaveAction</sender>
+   <signal>activated()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>fileSave()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fileOpenAction</sender>
+   <signal>activated()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>fileOpen()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fileNewAction</sender>
+   <signal>activated()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>fileNew()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bAdd</sender>
+   <signal>clicked()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>bAdd_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bDelete</sender>
+   <signal>clicked()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>bDelete_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bEdit</sender>
+   <signal>clicked()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>bEdit_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>tLang</sender>
+   <signal>doubleClicked(int,int,int,QPoint)</signal>
+   <receiver>CfgForm</receiver>
+   <slot>tLang_doubleClicked(int,int,int,QPoint)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bKill</sender>
+   <signal>clicked()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>bKill_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bAddImage</sender>
+   <signal>clicked()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>bAddImage_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bRemoveImage</sender>
+   <signal>clicked()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>bRemoveImage_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>vImageCollection</sender>
+   <signal>itemRenamed(Q3IconViewItem*,QString)</signal>
+   <receiver>CfgForm</receiver>
+   <slot>vImageCollection_itemRenamed(Q3IconViewItem*,QString)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>tabWidget</sender>
+   <signal>selected(QString)</signal>
+   <receiver>CfgForm</receiver>
+   <slot>tabWidget_selected(QString)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bAddRole</sender>
+   <signal>clicked()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>bAddRole_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bEditRole</sender>
+   <signal>clicked()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>bEditRole_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>tRole</sender>
+   <signal>doubleClicked(int,int,int,QPoint)</signal>
+   <receiver>CfgForm</receiver>
+   <slot>tRole_doubleClicked(int,int,int,QPoint)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bDeleteRole</sender>
+   <signal>clicked()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>bDeleteRole_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bKillRole</sender>
+   <signal>clicked()</signal>
+   <receiver>CfgForm</receiver>
+   <slot>bKillRole_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/designer/deditaction.cpp b/src/designer/deditaction.cpp
new file mode 100644 (file)
index 0000000..337b344
--- /dev/null
@@ -0,0 +1,366 @@
+#include "deditaction.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include "acfg.h"
+#include <qtabbar.h>
+#include <qsinterpreter.h>
+#include <qseditor.h>
+
+/*
+ *  Constructs a dEditAction as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditAction::dEditAction(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditAction::~dEditAction()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditAction::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditAction::setData( ActionListViewItem * o )
+{
+    item = o;
+    md = o->md;
+    obj = o->obj;
+    aCfgItem active, passive;
+    QString st;
+    QPixmap pix, pix1;
+    static const char *empty[] = {
+ "1 1 1 1",
+ ". c None",
+ "."};
+    dp = new QPixmap( empty );
+
+    aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+    al = a;
+    al->setData();  // alias table init
+
+    pActive->setPixmap( *dp ); // set empty pixmaps
+    pPassive->setPixmap( *dp );
+    eName->setText( md->attr( obj, mda_name ) );
+    setCaption( tr("Action:") + md->attr( obj, mda_name ) );
+    eDescription->setText( md->sText( obj, md_description ) );
+    eParams->setText( md->sText( obj, md_argument ) ); // set atributes
+    st = md->attr ( obj, mda_type);
+    if ( st == "0" ) cbType->setCurrentItem( 0 );
+    else if ( st == "1" ) cbType->setCurrentItem( 1 );
+    eModule->setText( md->sText( obj, md_sourcecode ) );
+    active = md->findChild( obj, md_active_picture, 0 );
+    if ( !active.isNull() ) {     // set active mode picture if exists
+ bRemoveActive->setEnabled( TRUE );
+ pix.loadFromData( md->binary( active ) );
+ pActive->setPixmap( pix );
+ setIcon( pix );
+    }
+    passive = md->findChild( obj, md_passive_picture, 0 );
+    if ( !passive.isNull() ) {     // set passive mode picture if exists
+ bRemovePassive->setEnabled( TRUE );
+ pix1.loadFromData( md->binary( passive ) );
+ pPassive->setPixmap( pix1 );
+    }
+
+    QStringList tlist = md->ObjectTypes();
+    otypes.clear();
+    cbObject->clear();
+    for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it )
+    {
+ otypes.append( (*it).section( "\t", 0, 0 ).section(" ", 1, 1 ) );
+ cbObject->insertItem( (*it).section("\t", 1, 1 ));
+    }
+ QString oid = md->sText( obj, md_objectid );
+ uint n = otypes.count();
+ for ( uint i = 0; i < n; i++ )
+  if ( otypes[i] == oid )
+  {
+   cbObject->setCurrentItem( i );
+   break;
+  }
+ cbObjectChange();
+ n = formslist.count();
+ oid = md->sText( obj, md_formid );
+ for ( uint i = 0; i < n; i++ ){
+  if ( formslist[i] == oid )
+  {
+   cbForm->setCurrentItem( i );
+   break;
+  }
+
+ }
+ int type = md->sText( obj, md_actiontype ).toInt();
+ switch ( type )
+ {
+  case 0 :
+   cbAction->setCurrentItem(md_action_new);
+   break;
+  case 1 :
+   cbAction->setCurrentItem(md_action_edit);
+   break;
+  case 2 :
+   cbAction->setCurrentItem(md_action_view);
+   break;
+  case 3 :
+   cbAction->setCurrentItem(md_action_execute);
+   break;
+ }
+
+
+    cbTypeChange();
+}
+
+void dEditAction::updateMD()
+{
+ al->updateMD( );
+ char sid[50]="";
+ int id = 0;
+
+ item->setText( 0, eName->text() );
+ md->setAttr( obj, mda_name, eName->text() );
+ md->setSText( obj, md_description, eDescription->text() );
+ md->setSText( obj, md_argument, eParams->text() );
+ if ( cbType->currentItem() == 0 )
+ {
+     md->setAttr( obj, mda_type, "0" );
+     id=cbAction->currentItem();
+  switch ( id )
+  {
+   case 0 :
+   sprintf(sid, "%i", md_action_new);
+   md->setSText( obj, md_actiontype, sid );
+   break;
+   case 1 :
+   sprintf(sid, "%i", md_action_edit );
+   md->setSText( obj, md_actiontype, sid );
+   break;
+   case 2 :
+   sprintf(sid, "%i", md_action_view);
+   md->setSText( obj, md_actiontype, sid );
+   break;
+   case 3 :
+   sprintf(sid, "%i", md_action_execute);
+   md->setSText( obj, md_actiontype, sid );
+   break;
+  }
+     id=cbObject->currentItem();
+     md->setSText( obj, md_objectid, otypes[id] );
+  id=cbForm->currentItem();
+  md->setSText( obj, md_formid, formslist[id] );
+ }
+
+ if ( cbType->currentItem() == 1 )
+ {
+     md->setAttr( obj, mda_type, "1" );
+     md->setSText( obj, md_sourcecode, eModule->text() );
+ }
+}
+
+
+void dEditAction::init()
+{
+
+    delete statusBar();
+    eModule->setInterpreter(new QSInterpreter());
+//    tabWidget2->page(1)->hide() ;
+//    tabWidget2->setTabEnabled ( tabWidget2->page(1), FALSE );
+}
+
+
+void dEditAction::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+
+
+void dEditAction::cbTypeChange ()
+{
+//    if ( cbType->currentItem() == 0 )
+// selectStandart();
+ //   if ( cbType->currentItem() == 1 )
+// selectUser();
+// if ( cbType->currentItem() == 2 ) wStack->raiseWidget( 2 );
+ wStack->raiseWidget( cbType->currentItem() );
+}
+
+void dEditAction::selectStandart()
+{
+    lAction->show();
+    lObject->show();
+    lParams->show();
+    cbAction->show();
+    cbObject->show();
+    cbForm->show();
+    eParams->show();
+//    tabWidget2->page(1)->hide() ;
+    eModule->hide() ;
+//    tabWidget2->setTabEnabled ( tabWidget2->page(1), FALSE );
+}
+
+
+
+void dEditAction::selectUser()
+{
+
+    lAction->hide();
+    lObject->hide();
+    lParams->hide();
+    cbAction->hide();
+    cbObject->hide();
+    cbForm->hide();
+    eParams->hide();
+    eModule->show() ;
+//    tabWidget2->setTabEnabled ( tabWidget2->page(1), TRUE );
+}
+
+
+void dEditAction::bSetActive_clicked()
+{
+    QString st;
+    QPixmap pix;
+//    QFileDialog *fd = new QFileDialog( "", "Images (*.png *.xpm *.jpg *.jpeg *.bmp)", 0, 0, TRUE );
+    QByteArray ba;
+    QString name;
+    QFile f;
+//    PixmapPreview *p = new PixmapPreview;
+    aCfgItem active;
+
+//    fd->setContentsPreview( p, p );
+//    fd->setPreviewMode( QFileDialog::Contents );
+//    fd->setContentsPreviewEnabled( TRUE );  // prepair file dialog
+//    fd->setCaption( tr("Open image dialog" ) );
+//    fd->setMode( QFileDialog::ExistingFiles );
+ name= Q3FileDialog::getOpenFileName("", "Images (*.png *.xpm *.jpg *.jpeg *.bmp)", this,
+   tr("Open image dialog"),
+   tr("Choose an image") );
+//    if ( fd->exec() == QDialog::Accepted ) { // if accepted
+// name = fd->selectedFile(); // get filename
+ if ( !name.isEmpty() ) { // if not empty
+     f.setName( name );
+     if ( f.open( QIODevice::ReadOnly ) ){ // open file
+  ba = f.readAll(); // read data
+  f.close();  // close file
+  pix.loadFromData( ba );  // load data into pixmap
+  active = item->md->findChild( item->obj, md_active_picture, 0 );
+  if ( active.isNull() ) active = item->md->insert( item->obj, md_active_picture, QString::null, -1 );
+  item->md->setBinary( active, ba ); // save data into cfg
+  item->setPixmap( 0, pix );
+  setIcon( pix ); // put on caption
+     }
+ }
+// delete fd; // remove filedialog
+ pActive->setPixmap( pix ); // put on form
+ bRemoveActive->setEnabled( TRUE ); // enable remove button
+//    }
+}
+
+
+void dEditAction::bSetPassive_clicked()
+{
+    QString st;
+    QPixmap pix;
+    Q3FileDialog *fd = new Q3FileDialog( "", "Images (*.png *.xpm *.jpg *.jpeg *.bmp)", 0, 0, TRUE );
+    QByteArray ba;
+    QString name;
+    QFile f;
+    PixmapPreview *p = new PixmapPreview;
+    aCfgItem passive;
+
+    fd->setContentsPreview( p, p );
+    fd->setPreviewMode( Q3FileDialog::Contents );
+    fd->setContentsPreviewEnabled( TRUE );
+    fd->setCaption( tr("Open image dialog" ) );
+    fd->setMode( Q3FileDialog::ExistingFiles );
+    if ( fd->exec() == QDialog::Accepted ) {
+ name = fd->selectedFile();
+ if ( !name.isEmpty() ) {
+     f.setName( name );
+     if ( f.open( QIODevice::ReadOnly ) ){
+  ba = f.readAll();
+  f.close();
+  pix.loadFromData( ba );
+  passive = item->md->findChild( item->obj, md_passive_picture, 0 );
+  if ( passive.isNull() ) passive = item->md->insert( item->obj, md_passive_picture, QString::null, -1 );
+  item->md->setBinary( passive, ba );
+     }
+ }
+ delete fd;
+ pPassive->setPixmap( pix );
+ bRemovePassive->setEnabled( TRUE );
+    }
+}
+
+
+void dEditAction::bRemoveActive_clicked()
+{
+    item->md->remove( item->md->findChild( item->obj, md_active_picture, 0 ) );
+    bRemoveActive->setEnabled( FALSE );
+    pActive->clear();
+    item->setPixmap( 0, 0 );
+    setIcon( *dp );
+    pActive->setPixmap( *dp );
+}
+
+
+void dEditAction::bRemovePassive_clicked()
+{
+    item->md->remove( item->md->findChild( item->obj, md_passive_picture, 0 ) );
+    bRemovePassive->setEnabled( FALSE );
+    pPassive->clear();
+    pPassive->setPixmap( *dp );
+}
+
+
+void dEditAction::cbObjectChange()
+{
+    aCfgItem cobj, fobj;
+ long id = otypes[cbObject->currentItem()].toLong();
+ uint n;
+ cobj=md->find(id);
+
+ cbForm->clear();
+ formslist.clear();
+
+ cbForm->insertItem( QObject::tr("default") );
+ formslist.append( "0" );
+ if ( md->objClass( cobj ) == md_catalogue )
+ {
+  cbForm->insertItem( QObject::tr("embedded editor") );
+  formslist.append( "1" );
+ }
+ n = md->count( cobj, md_form );
+ for ( uint i = 0; i < n; i++ )
+ {
+  fobj = md->find( cobj, md_form, i);
+  if ( fobj.isNull() )
+   continue;
+  cbForm->insertItem( md->attr(fobj, mda_name) );
+  formslist.append(md->attr(fobj, mda_id));
+ }
+}
diff --git a/src/designer/deditaction.h b/src/designer/deditaction.h
new file mode 100644 (file)
index 0000000..d110475
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef DEDITACTION_H
+#define DEDITACTION_H
+
+#include "ui_deditaction.h"
+
+
+class dEditAction : public Q3MainWindow, public Ui::dEditAction
+{
+    Q_OBJECT
+
+public:
+    dEditAction(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditAction();
+
+    ActionListViewItem * item;
+    aAliasEditor *al;
+    QStringList otypes;
+    QStringList formslist;
+    aCfg * md;
+    aCfgItem obj;
+    QPixmap *dp;
+
+public slots:
+    virtual void setData( ActionListViewItem * o );
+    virtual void updateMD();
+    virtual void bSetActive_clicked();
+    virtual void bSetPassive_clicked();
+    virtual void bRemoveActive_clicked();
+    virtual void bRemovePassive_clicked();
+
+protected:
+    virtual void selectStandart();
+    virtual void selectUser();
+
+protected slots:
+    virtual void languageChange();
+
+    virtual void init();
+    virtual void destroy();
+
+
+private slots:
+    virtual void cbTypeChange();
+    virtual void cbObjectChange();
+
+};
+
+#endif // DEDITACTION_H
diff --git a/src/designer/deditaction.ui b/src/designer/deditaction.ui
new file mode 100644 (file)
index 0000000..9465248
--- /dev/null
@@ -0,0 +1,663 @@
+<ui version="4.0" >
+ <class>dEditAction</class>
+ <widget class="Q3MainWindow" name="dEditAction" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>500</width>
+    <height>355</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Action</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>500</width>
+     <height>355</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget" >
+      <property name="enabled" >
+       <bool>true</bool>
+      </property>
+      <property name="font" >
+       <font/>
+      </property>
+      <property name="tabShape" >
+       <enum>QTabWidget::Rounded</enum>
+      </property>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="2" column="0" >
+         <widget class="QLabel" name="textLabel5" >
+          <property name="text" >
+           <string>Description:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="0" >
+         <layout class="QGridLayout" >
+          <item row="0" column="0" >
+           <widget class="QLabel" name="textLabel1" >
+            <property name="text" >
+             <string>Name</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0" >
+           <widget class="QLabel" name="textLabel1_2" >
+            <property name="text" >
+             <string>Type</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1" >
+           <widget class="QComboBox" name="cbType" >
+            <property name="sizePolicy" >
+             <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <item>
+             <property name="text" >
+              <string>standart command</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>user script</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>external script</string>
+             </property>
+            </item>
+           </widget>
+          </item>
+          <item row="0" column="1" >
+           <widget class="QLineEdit" name="eName" >
+            <property name="enabled" >
+             <bool>true</bool>
+            </property>
+            <property name="minimumSize" >
+             <size>
+              <width>0</width>
+              <height>22</height>
+             </size>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item row="3" column="0" >
+         <widget class="Q3TextEdit" name="eDescription" />
+        </item>
+        <item row="1" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Expanding</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>91</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item>
+           <widget class="Q3GroupBox" name="groupBox1" >
+            <property name="title" >
+             <string>Enabled icon</string>
+            </property>
+            <layout class="QGridLayout" >
+             <item row="0" column="2" >
+              <widget class="QPushButton" name="bSetActive" >
+               <property name="maximumSize" >
+                <size>
+                 <width>20</width>
+                 <height>24</height>
+                </size>
+               </property>
+               <property name="text" >
+                <string>...</string>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="0" >
+              <widget class="QLabel" name="pActive" >
+               <property name="scaledContents" >
+                <bool>true</bool>
+               </property>
+               <property name="wordWrap" >
+                <bool>false</bool>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="3" >
+              <widget class="QPushButton" name="bRemoveActive" >
+               <property name="enabled" >
+                <bool>false</bool>
+               </property>
+               <property name="maximumSize" >
+                <size>
+                 <width>20</width>
+                 <height>32767</height>
+                </size>
+               </property>
+               <property name="text" >
+                <string>X</string>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </item>
+          <item>
+           <widget class="Q3GroupBox" name="groupBox2" >
+            <property name="title" >
+             <string>Disabled icon</string>
+            </property>
+            <layout class="QGridLayout" >
+             <item row="0" column="0" >
+              <widget class="QLabel" name="pPassive" >
+               <property name="scaledContents" >
+                <bool>true</bool>
+               </property>
+               <property name="wordWrap" >
+                <bool>false</bool>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="2" >
+              <widget class="QPushButton" name="bSetPassive" >
+               <property name="sizePolicy" >
+                <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="maximumSize" >
+                <size>
+                 <width>20</width>
+                 <height>32767</height>
+                </size>
+               </property>
+               <property name="text" >
+                <string>...</string>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="3" >
+              <widget class="QPushButton" name="bRemovePassive" >
+               <property name="enabled" >
+                <bool>false</bool>
+               </property>
+               <property name="sizePolicy" >
+                <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="maximumSize" >
+                <size>
+                 <width>20</width>
+                 <height>32767</height>
+                </size>
+               </property>
+               <property name="text" >
+                <string>X</string>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Execute</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3WidgetStack" name="wStack" >
+          <widget class="QWidget" name="WStackPage" >
+           <property name="geometry" >
+            <rect>
+             <x>0</x>
+             <y>0</y>
+             <width>100</width>
+             <height>30</height>
+            </rect>
+           </property>
+           <layout class="QGridLayout" >
+            <item row="0" column="0" >
+             <layout class="QGridLayout" >
+              <item row="1" column="0" >
+               <spacer>
+                <property name="orientation" >
+                 <enum>Qt::Vertical</enum>
+                </property>
+                <property name="sizeType" >
+                 <enum>QSizePolicy::Expanding</enum>
+                </property>
+                <property name="sizeHint" >
+                 <size>
+                  <width>21</width>
+                  <height>130</height>
+                 </size>
+                </property>
+               </spacer>
+              </item>
+              <item row="0" column="0" >
+               <layout class="QGridLayout" >
+                <item row="1" column="1" >
+                 <widget class="QComboBox" name="cbObject" >
+                  <property name="sizePolicy" >
+                   <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
+                    <horstretch>0</horstretch>
+                    <verstretch>0</verstretch>
+                   </sizepolicy>
+                  </property>
+                 </widget>
+                </item>
+                <item row="2" column="1" >
+                 <widget class="QComboBox" name="cbForm" />
+                </item>
+                <item row="0" column="0" >
+                 <widget class="QLabel" name="lAction" >
+                  <property name="text" >
+                   <string>Action</string>
+                  </property>
+                  <property name="wordWrap" >
+                   <bool>false</bool>
+                  </property>
+                 </widget>
+                </item>
+                <item row="1" column="0" >
+                 <widget class="QLabel" name="lObject" >
+                  <property name="text" >
+                   <string>Object</string>
+                  </property>
+                  <property name="wordWrap" >
+                   <bool>false</bool>
+                  </property>
+                 </widget>
+                </item>
+                <item row="2" column="0" >
+                 <widget class="QLabel" name="lForm" >
+                  <property name="text" >
+                   <string>Form</string>
+                  </property>
+                  <property name="wordWrap" >
+                   <bool>false</bool>
+                  </property>
+                 </widget>
+                </item>
+                <item row="3" column="1" >
+                 <widget class="QLineEdit" name="eParams" >
+                  <property name="enabled" >
+                   <bool>true</bool>
+                  </property>
+                  <property name="minimumSize" >
+                   <size>
+                    <width>0</width>
+                    <height>22</height>
+                   </size>
+                  </property>
+                 </widget>
+                </item>
+                <item row="0" column="1" >
+                 <widget class="QComboBox" name="cbAction" >
+                  <property name="sizePolicy" >
+                   <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
+                    <horstretch>0</horstretch>
+                    <verstretch>0</verstretch>
+                   </sizepolicy>
+                  </property>
+                  <item>
+                   <property name="text" >
+                    <string>new</string>
+                   </property>
+                  </item>
+                  <item>
+                   <property name="text" >
+                    <string>edit</string>
+                   </property>
+                  </item>
+                  <item>
+                   <property name="text" >
+                    <string>view</string>
+                   </property>
+                  </item>
+                  <item>
+                   <property name="text" >
+                    <string>execute</string>
+                   </property>
+                  </item>
+                 </widget>
+                </item>
+                <item row="3" column="0" >
+                 <widget class="QLabel" name="lParams" >
+                  <property name="text" >
+                   <string>Params</string>
+                  </property>
+                  <property name="wordWrap" >
+                   <bool>false</bool>
+                  </property>
+                 </widget>
+                </item>
+               </layout>
+              </item>
+             </layout>
+            </item>
+           </layout>
+          </widget>
+          <widget class="QWidget" name="WStackPage" >
+           <property name="geometry" >
+            <rect>
+             <x>0</x>
+             <y>0</y>
+             <width>100</width>
+             <height>30</height>
+            </rect>
+           </property>
+           <layout class="QGridLayout" >
+            <item row="0" column="0" >
+             <widget class="QSEditor" native="1" name="eModule" >
+              <property name="enabled" >
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </widget>
+          <widget class="QWidget" name="WStackPage" >
+           <property name="geometry" >
+            <rect>
+             <x>0</x>
+             <y>0</y>
+             <width>100</width>
+             <height>30</height>
+            </rect>
+           </property>
+           <layout class="QGridLayout" >
+            <item row="0" column="0" >
+             <layout class="QHBoxLayout" >
+              <item>
+               <widget class="QLabel" name="textLabel1_4" >
+                <property name="text" >
+                 <string>File name</string>
+                </property>
+                <property name="wordWrap" >
+                 <bool>false</bool>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QLineEdit" name="eFileName" />
+              </item>
+              <item>
+               <widget class="QPushButton" name="bFileName" >
+                <property name="maximumSize" >
+                 <size>
+                  <width>20</width>
+                  <height>32767</height>
+                 </size>
+                </property>
+                <property name="text" >
+                 <string>...</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+            <item row="1" column="0" >
+             <spacer>
+              <property name="orientation" >
+               <enum>Qt::Vertical</enum>
+              </property>
+              <property name="sizeType" >
+               <enum>QSizePolicy::Expanding</enum>
+              </property>
+              <property name="sizeHint" >
+               <size>
+                <width>20</width>
+                <height>170</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </widget>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Lang</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <action name="Action" >
+   <property name="text" >
+    <string>Action</string>
+   </property>
+   <property name="iconText" >
+    <string>Action</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>Action</string>
+   </property>
+  </action>
+  <action name="Action_2" >
+   <property name="text" >
+    <string>Action_2</string>
+   </property>
+   <property name="iconText" >
+    <string>Action_2</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>Action_2</string>
+   </property>
+  </action>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3GroupBox</class>
+   <extends>QGroupBox</extends>
+   <header>Qt3Support/Q3GroupBox</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3WidgetStack</class>
+   <extends>Q3WidgetStack</extends>
+   <header>q3widgetstack.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QSEditor</class>
+   <extends>QWidget</extends>
+   <header>qseditor.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >actiontree.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >pixmappreview.h</include>
+  <include location="local" >mainform.h</include>
+  <include location="local" >qseditor.h</include>
+ </includes>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>cbType</sender>
+   <signal>activated(int)</signal>
+   <receiver>dEditAction</receiver>
+   <slot>cbTypeChange()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bSetActive</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditAction</receiver>
+   <slot>bSetActive_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bRemoveActive</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditAction</receiver>
+   <slot>bRemoveActive_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bSetPassive</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditAction</receiver>
+   <slot>bSetPassive_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bRemovePassive</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditAction</receiver>
+   <slot>bRemovePassive_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>cbObject</sender>
+   <signal>activated(int)</signal>
+   <receiver>dEditAction</receiver>
+   <slot>cbObjectChange()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/designer/deditareg.cpp b/src/designer/deditareg.cpp
new file mode 100644 (file)
index 0000000..b92b82e
--- /dev/null
@@ -0,0 +1,76 @@
+#include "deditareg.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+#include "acfg.h"
+
+/*
+ *  Constructs a dEditAReg as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditAReg::dEditAReg(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditAReg::~dEditAReg()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditAReg::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditAReg::init()
+{
+    delete statusBar();
+}
+
+void dEditAReg::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+
+void dEditAReg::setData( aListViewItem *o )
+{
+       item = o;
+       aCfg *md = o->md;
+       aCfgItem obj = o->obj;
+            aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+       al = a;
+       al->setData();
+       setCaption( tr("Accumulation register:") + md->attr( obj, mda_name ) );
+       eName->setText( md->attr( obj, mda_name ) );
+       eDescription->setText( md->sText( obj, md_description ) );
+}
+
+void dEditAReg::updateMD()
+{
+       aCfg *md = item->md;
+       aCfgItem obj = item->obj;
+
+       al->updateMD();
+       item->setText( 0, eName->text().stripWhiteSpace() );
+       md->setAttr( obj, mda_name, eName->text().stripWhiteSpace());
+       md->setSText( obj, md_description, eDescription->text() );
+}
diff --git a/src/designer/deditareg.h b/src/designer/deditareg.h
new file mode 100644 (file)
index 0000000..02fc4db
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef DEDITAREG_H
+#define DEDITAREG_H
+
+#include "ui_deditareg.h"
+
+
+class dEditAReg : public Q3MainWindow, public Ui::dEditAReg
+{
+    Q_OBJECT
+
+public:
+    dEditAReg(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditAReg();
+
+    aListViewItem *item;
+    aAliasEditor *al;
+
+public slots:
+    virtual void setData( aListViewItem * o );
+    virtual void updateMD();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    void init();
+    void destroy();
+
+};
+
+#endif // DEDITAREG_H
diff --git a/src/designer/deditareg.ui b/src/designer/deditareg.ui
new file mode 100644 (file)
index 0000000..42e8535
--- /dev/null
@@ -0,0 +1,123 @@
+<ui version="4.0" >
+ <class>dEditAReg</class>
+ <widget class="Q3MainWindow" name="dEditAReg" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>445</width>
+    <height>317</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Accumulating register</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>445</width>
+     <height>317</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget13" >
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel5" >
+            <property name="text" >
+             <string>Name:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eName" />
+          </item>
+         </layout>
+        </item>
+        <item row="1" column="0" >
+         <widget class="QLabel" name="textLabel6" >
+          <property name="text" >
+           <string>Description:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="0" >
+         <widget class="Q3TextEdit" name="eDescription" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Lang</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >mainform.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/designer/deditcat.cpp b/src/designer/deditcat.cpp
new file mode 100644 (file)
index 0000000..3c99a5e
--- /dev/null
@@ -0,0 +1,174 @@
+#include "deditcat.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+#include <qsinterpreter.h>
+#include <qseditor.h>
+#include "acfg.h"
+
+/*
+ *  Constructs a dEditCat as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditCat::dEditCat(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditCat::~dEditCat()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditCat::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditCat::setData( aListViewItem *o )
+{
+    long int i;
+    int fid, fcount, fieldid, stdf;
+    item = o;
+    aCfg *md = o->md;
+    aCfgItem obj = o->obj, sv, g, e, field;
+
+    aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+    al = a;
+    al->setData();
+    aRoleEditor *r = new aRoleEditor( md, obj, tRoles, md_catalogue );
+    re = r;
+    re->setData();
+    setCaption( tr("Catalogue:") + md->attr( obj, mda_name ) );
+    eName->setText( md->attr( obj, mda_name ) );
+    eDescription->setText( md->sText( obj, md_description ) );
+    g = md->find( obj, md_group ); // Find group context
+    e = md->find( obj, md_element ); // Find Element context
+    sv = md->find( g, md_string_view ); // Group string view
+//====================================
+    eStrViewFG->setText( md->sText( sv, md_svfunction ) );
+    eSvG->insertItem( "[ standart function ]" );
+    eSvG->insertItem( "[ user function ]" );
+    fid = md->sText( sv, md_fieldid ).toInt();
+    stdf = md->attr( sv, mda_stdf ).toInt();
+    eSvG->setCurrentItem( 0 );
+    for ( i = 0; i < md->count( g, md_field ); i++ ) {
+       field = md->find( g, md_field, i );
+       eSvG->insertItem( QString("%1").arg( md->attr( field, mda_name ) ) );
+       fieldid = md->id( field );
+       fieldsg.insert( i, new int( fieldid ) );
+       if ( fid == fieldid && !stdf ) {
+           eSvG->setCurrentItem( i + 2 );
+           eStrViewFG->setEnabled( FALSE );
+       }
+    }
+    if ( !fid && !stdf ) {
+       eStrViewFG->setEnabled( TRUE );
+       eSvG->setCurrentItem( 1 );
+    }
+
+//====================================
+    sv = md->find( e, md_string_view );
+    eStrViewF->setText( md->sText( sv, md_svfunction ) );
+    eSv->insertItem( "[ standart function ]" );
+    eSv->insertItem( "[ user function ]" );
+    fid = md->sText( sv, md_fieldid ).toInt();
+    stdf = md->attr( sv, mda_stdf ).toInt();
+    eSv->setCurrentItem( 0 );
+    for ( i = 0; i < md->count( e, md_field ); i++ ) {
+       field = md->find( e, md_field, i );
+       eSv->insertItem( QString("%1").arg( md->attr( field, mda_name ) ) );
+       fieldid = md->id( field );
+       fields.insert( i, new int( fieldid ) );
+       if ( fid == fieldid && !stdf ) {
+           eSv->setCurrentItem( i + 2 );
+           eStrViewF->setEnabled( FALSE );
+       }
+    }
+    if ( !fid && !stdf ) {
+       eStrViewF->setEnabled( TRUE );
+       eSv->setCurrentItem( 1 );
+    }
+}
+
+
+void dEditCat::init()
+{
+       delete statusBar();
+       eStrViewF->setInterpreter( new QSInterpreter() );
+       eStrViewF->setEnabled( FALSE );
+}
+
+
+void dEditCat::updateMD()
+{
+       aCfg *md = item->md;
+       aCfgItem obj = item->obj, sv, g, e;
+
+       al->updateMD();
+       re->updateMD();
+       item->setText( 0, eName->text().stripWhiteSpace() );
+       md->setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+       md->setSText( obj, md_description, eDescription->text() );
+       g = md->find( obj, md_group ); // Find group context
+       e= md->find( obj, md_element ); // Find Element context
+       //======== Element view save
+       sv = md->find( e, md_string_view );
+       if ( sv.isNull() ) sv = md->insert( e, md_string_view );
+       md->setSText( sv, md_svfunction, eStrViewF->text() );
+       if ( eSv->currentItem() == 0 ) md->setAttr( sv, mda_stdf, "1" );
+       else {
+           md->setAttr( sv, mda_stdf, "0" );
+           if ( eSv->currentItem() == 1 ) md->setSText( sv, md_fieldid, "0" );
+           else md->setSText( sv, md_fieldid, QString("%1").arg( *(fields.find( eSv->currentItem() - 2 ) ) ) );
+       }
+       //======== Group view save
+       sv = md->find( g, md_string_view );
+       if ( sv.isNull() ) sv = md->insert( g, md_string_view );
+       md->setSText( sv, md_svfunction, eStrViewFG->text() );
+       if ( eSvG->currentItem() == 0 ) md->setAttr( sv, mda_stdf, "1" );
+       else {
+           md->setAttr( sv, mda_stdf, "0" );
+           if ( eSvG->currentItem() == 1 ) md->setSText( sv, md_fieldid, "0" );
+           else md->setSText( sv, md_fieldid, QString("%1").arg( *(fieldsg.find( eSvG->currentItem() - 2 ) ) ) );
+       }
+
+}
+
+void dEditCat::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+
+
+
+
+void dEditCat::eSv_activated( int index )
+{
+    if ( index == 1 ) eStrViewF->setEnabled( TRUE );
+    else eStrViewF->setEnabled( FALSE );
+}
+
+void dEditCat::eSvG_activated( int index )
+{
+    if ( index == 1 ) eStrViewFG->setEnabled( TRUE );
+    else eStrViewFG->setEnabled( FALSE );
+}
diff --git a/src/designer/deditcat.h b/src/designer/deditcat.h
new file mode 100644 (file)
index 0000000..6943d7e
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef DEDITCAT_H
+#define DEDITCAT_H
+
+#include "ui_deditcat.h"
+
+
+class dEditCat : public Q3MainWindow, public Ui::dEditCat
+{
+    Q_OBJECT
+
+public:
+    dEditCat(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditCat();
+
+    aRoleEditor *re;
+    Q3IntDict<int> fields, fieldsg;
+    aAliasEditor *al;
+    aListViewItem *item;
+
+public slots:
+    virtual void setData( aListViewItem * o );
+    virtual void updateMD();
+    virtual void eSv_activated( int index );
+    virtual void eSvG_activated( int index );
+
+protected:
+    int newVariable;
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    void init();
+    void destroy();
+
+};
+
+#endif // DEDITCAT_H
diff --git a/src/designer/deditcat.ui b/src/designer/deditcat.ui
new file mode 100644 (file)
index 0000000..f2cf761
--- /dev/null
@@ -0,0 +1,266 @@
+<ui version="4.0" >
+ <class>dEditCat</class>
+ <widget class="Q3MainWindow" name="dEditCat" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>465</width>
+    <height>297</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Catalogue</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>465</width>
+     <height>297</height>
+    </rect>
+   </property>
+   <layout class="QHBoxLayout" >
+    <item>
+     <widget class="QTabWidget" name="tabWidget2" >
+      <property name="font" >
+       <font/>
+      </property>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QVBoxLayout" >
+        <item>
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="Label" >
+            <property name="text" >
+             <string>Name:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eName" />
+          </item>
+         </layout>
+        </item>
+        <item>
+         <widget class="QLabel" name="textLabel3" >
+          <property name="text" >
+           <string>Description:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="Q3TextEdit" name="eDescription" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Lang</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Element string view</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="1" column="0" >
+         <widget class="QSEditor" native="1" name="eStrViewF" >
+          <property name="enabled" >
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="0" >
+         <widget class="QComboBox" name="eSv" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Group string view</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="1" column="0" >
+         <widget class="QSEditor" native="1" name="eStrViewFG" >
+          <property name="enabled" >
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="0" >
+         <widget class="QComboBox" name="eSvG" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Access</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tRoles" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <property name="showGrid" >
+           <bool>false</bool>
+          </property>
+          <property name="selectionMode" >
+           <enum>Q3Table::Multi</enum>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Read</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Write</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QSEditor</class>
+   <extends>QWidget</extends>
+   <header>qseditor.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >mainform.h</include>
+  <include location="local" >roleeditor.h</include>
+  <include location="local" >qseditor.h</include>
+  <include location="local" >qseditor.h</include>
+ </includes>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>eSv</sender>
+   <signal>activated(int)</signal>
+   <receiver>dEditCat</receiver>
+   <slot>eSv_activated(int)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>eSv</sender>
+   <signal>highlighted(int)</signal>
+   <receiver>dEditCat</receiver>
+   <slot>eSv_activated(int)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>eSvG</sender>
+   <signal>activated(int)</signal>
+   <receiver>dEditCat</receiver>
+   <slot>eSvG_activated(int)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>eSvG</sender>
+   <signal>highlighted(int)</signal>
+   <receiver>dEditCat</receiver>
+   <slot>eSvG_activated(int)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/designer/deditcfg.cpp b/src/designer/deditcfg.cpp
new file mode 100644 (file)
index 0000000..223bc1d
--- /dev/null
@@ -0,0 +1,171 @@
+#include "deditcfg.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "acfg.h"
+#include "qlayout.h"
+#include "qsproject.h"
+#include "qsscript.h"
+//#include "qseditor.h"
+#include <qsinterpreter.h>
+#include <qstatusbar.h>
+
+#ifndef QSA_NO_IDE
+#include "qsworkbench.h"
+#endif
+
+/*
+ *  Constructs a dEditCfg as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditCfg::dEditCfg(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditCfg::~dEditCfg()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditCfg::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditCfg::init()
+{
+       delete statusBar();
+
+       eDBType->clear();
+       eDBType->insertItem(trUtf8("Unknown"), 0);
+       eDBType->insertItem(trUtf8("MySQL"), 1);
+       eDBType->insertItem(trUtf8("Postgres"), 2);
+//     QGridLayout *l=new QGridLayout(tabWidget->page(2));
+//     eModule=NULL;
+//     eModule = new QSEditor(tabWidget->page(2), "global module");
+//     l->addWidget(eModule, 5, 5, 0);
+       eModule->setInterpreter(new QSInterpreter());
+}
+
+
+
+void dEditCfg::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+    // item->editor = 0;
+}
+
+
+void dEditCfg::setData( aListViewItem *o )
+{
+//     int n;
+//     char to[100]="";
+//     cfg_objptr code, remark, context=NULL;
+//     char    *id0;
+            item = o;
+            aCfg *md = item->md;
+       aCfgItem obj = item->obj;
+
+       QString v;
+//     int rc=0;
+
+       setCaption( tr("Business scheme parameters: ") + md->info( md_info_name ) );
+       v = md->rc.value("dbtype");
+       eDBType->setCurrentItem(0);
+       if ( v == "postgres" ) eDBType->setCurrentItem(2);
+       if ( v == "mysql" ) eDBType->setCurrentItem(1);
+
+       eCfgName->setText( md->rc.value("configfile") );
+       eWorkDir->setText( md->rc.value("workdir") );
+       eDBHost->setText( md->rc.value("dbhost") );
+       eDBName->setText( md->rc.value("dbname") );
+       eDBHeader->setText( md->rc.value("dbtitle") );
+       eDBPass->setText( md->rc.value("dbpass") );
+       eDBUserName->setText( md->rc.value("dbuser") );
+       eName->setText( md->info( md_info_name ) );
+       eAuthor->setText( md->info( md_info_author ) );
+       eDate->setText( md->info( md_info_date ) );
+       eDescription->setText( md->info( md_info_remark ) );
+       globals = md->find( obj, md_globals, 0 );
+       eModule->setText( md->sText( globals, md_sourcecode ) );
+
+/*
+       n=cfgobj_count(context, aot_remark);
+       if (n) {
+               id0=cfgobj_idn(context, aot_remark, 1, &remark);
+               if (remark) eRemark->setText(trUtf8(cfgobj_text(remark)));
+       }
+       n=cfgobj_count(context, aot_sourcecode);
+       if (n) {
+               id0=cfgobj_idn(context, aot_sourcecode, 1, &code);
+               if (code) eModule->setText(trUtf8(cfgobj_text(code)));
+       }
+*/
+}
+
+
+
+void dEditCfg::updateMD()
+{
+//     int n;
+//     char to[100]="";
+//     cfg_objptr code, remark, context=NULL;
+//     char    *id;
+//     cfg_objptr o;
+       aCfg *md = item->md;
+       aCfgItem obj = item->obj;
+
+       md->setInfo( md_info_name, eName->text() );
+       md->setInfo( md_info_remark, eDescription->text() );
+       md->setInfo( md_info_author, eAuthor->text() );
+       md->setInfo( md_info_date, eDate->text() );
+       md->rc.setValue( "configfile", eCfgName->text().stripWhiteSpace() );
+       md->rc.setValue( "workdir", eWorkDir->text().stripWhiteSpace() );
+       md->rc.setValue( "dbhost", eDBHost->text().stripWhiteSpace() );
+       md->rc.setValue( "dbtitle", eDBHeader->text().stripWhiteSpace() );
+       md->rc.setValue( "dbname", eDBName->text().stripWhiteSpace() );
+       md->rc.setValue( "dbpass", eDBPass->text().stripWhiteSpace() );
+       md->rc.setValue( "dbuser", eDBUserName->text().stripWhiteSpace() );
+       if (eDBType->currentItem()==1) md->rc.setValue( "dbtype", "mysql" );
+       if (eDBType->currentItem()==2) md->rc.setValue( "dbtype", "postgres" );
+       globals = md->find( obj, md_globals, 0 );
+       md->setSText( globals, md_sourcecode, eModule->text() );
+
+/*
+       if (cancelupdate) return;
+       item->setText(0, eName->text());
+//     item->setText(1, eID->text());
+//     item->setText(2, eType->text());
+//     o=cfgobj_find(eID->text());
+//     if (o) {
+//             printf("founded id=%s!\n", cfgobj_attr(o,"id"));
+       cfg_setinfo("name", eName->text().utf8());
+       n=cfgobj_count(context, aot_remark);
+       if (!n) remark=cfgobj_new(context, aot_remark, trUtf8("Комментарий"), NULL);
+       else id=cfgobj_idn(context, aot_remark, 1, &remark);
+       if (remark) cfgobj_settext(remark, eRemark->text().utf8());
+       n=cfgobj_count(context, aot_sourcecode);
+       if (!n) code=cfgobj_new(context, aot_sourcecode, trUtf8("Глобальный модуль"), NULL);
+       else id=cfgobj_idn(context, aot_sourcecode, 1, &code);
+       if (code) cfgobj_settext(code, eModule->text().utf8());
+
+*/
+}
diff --git a/src/designer/deditcfg.h b/src/designer/deditcfg.h
new file mode 100644 (file)
index 0000000..129d83e
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef DEDITCFG_H
+#define DEDITCFG_H
+
+#include "ui_deditcfg.h"
+
+
+class dEditCfg : public Q3MainWindow, public Ui::dEditCfg
+{
+    Q_OBJECT
+
+public:
+    dEditCfg(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditCfg();
+
+    aListViewItem *item;
+    aCfgItem globals;
+
+public slots:
+    virtual void init();
+    virtual void destroy();
+    virtual void setData( aListViewItem * o );
+    virtual void updateMD();
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // DEDITCFG_H
diff --git a/src/designer/deditcfg.ui b/src/designer/deditcfg.ui
new file mode 100644 (file)
index 0000000..6c0d3e7
--- /dev/null
@@ -0,0 +1,449 @@
+<ui version="4.0" >
+ <class>dEditCfg</class>
+ <widget class="Q3MainWindow" name="dEditCfg" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>461</width>
+    <height>364</height>
+   </rect>
+  </property>
+  <property name="minimumSize" >
+   <size>
+    <width>400</width>
+    <height>364</height>
+   </size>
+  </property>
+  <property name="windowTitle" >
+   <string>Business scheme parameters</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>461</width>
+     <height>364</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget" >
+      <property name="font" >
+       <font>
+        <pointsize>10</pointsize>
+       </font>
+      </property>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QVBoxLayout" >
+        <item>
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel5" >
+            <property name="minimumSize" >
+             <size>
+              <width>80</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="frameShape" >
+             <enum>QFrame::NoFrame</enum>
+            </property>
+            <property name="frameShadow" >
+             <enum>QFrame::Plain</enum>
+            </property>
+            <property name="text" >
+             <string>Name</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eName" />
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel7" >
+            <property name="minimumSize" >
+             <size>
+              <width>80</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="text" >
+             <string>Author</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eAuthor" />
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel8" >
+            <property name="minimumSize" >
+             <size>
+              <width>80</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="text" >
+             <string>Date</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eDate" />
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QVBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel6" >
+            <property name="text" >
+             <string>Description</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="Q3TextEdit" name="eDescription" />
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>User</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="QLabel" name="textLabel1" >
+          <property name="minimumSize" >
+           <size>
+            <width>160</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="text" >
+           <string>Data base server user</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1" >
+         <widget class="QLineEdit" name="eDBUserName" />
+        </item>
+        <item row="1" column="0" colspan="2" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel2" >
+            <property name="minimumSize" >
+             <size>
+              <width>160</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="text" >
+             <string>Data base password</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eDBPass" >
+            <property name="echoMode" >
+             <enum>QLineEdit::Password</enum>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item row="2" column="0" colspan="2" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel3" >
+            <property name="minimumSize" >
+             <size>
+              <width>160</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="maximumSize" >
+             <size>
+              <width>160</width>
+              <height>32767</height>
+             </size>
+            </property>
+            <property name="text" >
+             <string>Data base type</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QComboBox" name="eDBType" >
+            <property name="editable" >
+             <bool>false</bool>
+            </property>
+            <property name="duplicatesEnabled" >
+             <bool>false</bool>
+            </property>
+            <item>
+             <property name="text" >
+              <string>Unknown</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>mysql</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>postgres</string>
+             </property>
+            </item>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item row="3" column="0" colspan="2" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel4" >
+            <property name="minimumSize" >
+             <size>
+              <width>160</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="text" >
+             <string>Data base server address</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eDBHost" />
+          </item>
+         </layout>
+        </item>
+        <item row="5" column="0" colspan="2" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel6_2" >
+            <property name="minimumSize" >
+             <size>
+              <width>160</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="text" >
+             <string>Data base name</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eDBName" />
+          </item>
+         </layout>
+        </item>
+        <item row="4" column="0" colspan="2" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <layout class="QHBoxLayout" >
+            <item>
+             <widget class="QLabel" name="textLabel5_2" >
+              <property name="minimumSize" >
+               <size>
+                <width>160</width>
+                <height>0</height>
+               </size>
+              </property>
+              <property name="text" >
+               <string>Data base server port</string>
+              </property>
+              <property name="wordWrap" >
+               <bool>false</bool>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLineEdit" name="eDBPort" />
+            </item>
+           </layout>
+          </item>
+          <item>
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Expanding</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>130</width>
+              <height>21</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </item>
+        <item row="7" column="0" colspan="2" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel7_2" >
+            <property name="minimumSize" >
+             <size>
+              <width>160</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="text" >
+             <string>Work directory</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eWorkDir" />
+          </item>
+         </layout>
+        </item>
+        <item row="8" column="0" colspan="2" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel8_2" >
+            <property name="minimumSize" >
+             <size>
+              <width>160</width>
+              <height>0</height>
+             </size>
+            </property>
+            <property name="text" >
+             <string>Configuration file name</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eCfgName" />
+          </item>
+         </layout>
+        </item>
+        <item row="9" column="1" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeType" >
+           <enum>QSizePolicy::Expanding</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>20</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="6" column="0" >
+         <widget class="QLabel" name="textLabel1_2" >
+          <property name="text" >
+           <string>Data base header</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="6" column="1" >
+         <widget class="QLineEdit" name="eDBHeader" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Global module</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="QSEditor" native="1" name="eModule" />
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QSEditor</class>
+   <extends>QWidget</extends>
+   <header>qseditor.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >acfg.h</include>
+  <include location="local" >qseditor.h</include>
+  <include location="local" >mainform.h</include>
+  <include location="local" >qseditor.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/designer/deditcolumns.cpp b/src/designer/deditcolumns.cpp
new file mode 100644 (file)
index 0000000..e78c624
--- /dev/null
@@ -0,0 +1,266 @@
+#include "deditcolumns.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+#include <q3header.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <QPixmap>
+#include "acfg.h"
+
+/*
+ *  Constructs a dEditColumns as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditColumns::dEditColumns(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditColumns::~dEditColumns()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditColumns::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditColumns::setData( ananasListViewItem * o )
+{
+    item = o;
+    md = o->md;
+    obj = o->obj;
+    aCfgItem  com_action, apix;
+    QPixmap pix;
+
+
+       usedFields = new ananasTreeView( gbFields,  md );
+       Q3GridLayout *l = new Q3GridLayout( gbFields );
+       l->addWidget( usedFields, 0, 0);
+       availableFields = new ananasTreeView( frmFields,  md );
+       l = new Q3GridLayout( frmFields );
+       l->addWidget( availableFields, 0, 0);
+
+       aCfgItem        cobj, fobj, dobj, pobj, tobj;
+
+       uint n, fCount, tCount, addfields, addtables;
+       long id;
+       QString dName, fName;
+       cobj = md->parent(md->parent(obj));
+       setCaption( tr("Column:") + md->attr( cobj, mda_name ) + "." + md->attr( obj, mda_name ));
+       eName->setText( md->attr( obj, mda_name ) );
+       ananasListViewItem *fitem, *ditem, *titem, *tparent, *docs;
+       QStringList docsId = md->getJournalDocuments(cobj);
+       docs = new ananasListViewItem( availableFields, availableFields->lastItem(), md, md->find(md->find(mdc_metadata),md_documents,0), QObject::tr("Documents") );
+       docs->setPixmap(0, rcIcon("doc_g.png"));
+       docs->setOpen(true);
+       n = docsId.count();
+       for ( uint i = 0; i < n; i++ )
+       {
+               id = docsId[i].toInt();
+               dobj = md->find(id);
+               if ( dobj.isNull() )
+                       continue;
+               ditem = new ananasListViewItem( docs, docs->getLastChild(), md, dobj );
+               ditem->setPixmap(0, rcIcon("doc.png"));
+               tobj = md->find(dobj,md_header,0);
+               tparent = new ananasListViewItem( ditem, ditem->getLastChild(), md, tobj, QObject::tr("Header") );
+               tparent->setPixmap(0, rcIcon("doc_h.png"));
+               fCount = md->count(tobj,md_field);
+               for ( uint k = 0; k < fCount; k++ )
+               {
+                       fobj = md->find(tobj,md_field,k);
+                       if ( fobj.isNull())
+                                       continue;
+                       fitem = new ananasListViewItem ( tparent, tparent->getLastChild(), md, fobj );
+                       fitem->setPixmap(0, rcIcon("field.png"));
+               }
+               pobj = md->find(ditem->obj, md_tables, 0);
+               if ( !pobj.isNull() )
+               {
+                       tparent = new ananasListViewItem( ditem, ditem->getLastChild(), md, pobj, QObject::tr("Tables") );
+                       tparent->setPixmap(0, rcIcon("table_g.png"));
+                       addtables = 0;
+                       tCount = md->count(pobj,md_table);
+                       for ( uint j = 0; j < tCount; j++ )
+                       {
+                               tobj = md->find ( pobj, md_table, j );
+                               if ( tobj.isNull() )
+                                       continue;
+                               titem = new ananasListViewItem( tparent, tparent->getLastChild(), md, tobj );
+                               titem->setPixmap(0, rcIcon("table.png"));
+                               fCount = md->count(tobj,md_field);
+                               addfields = 0;
+                               for ( uint k = 0; k < fCount; k++ )
+                               {
+                                       fobj = md->find(tobj,md_field,k);
+                                       if ( fobj.isNull())
+                                               continue;
+                                       QString sum = md->attr(fobj,mda_sum);
+                                       if ( sum != "1" )
+                                               continue;
+                                       addfields++;
+                                       fitem = new ananasListViewItem ( titem, titem->getLastChild(), md, fobj );
+                                       fitem->setPixmap(0, rcIcon("field.png"));
+                               }
+                               if ( !addfields )
+                                       delete titem;
+                               else
+                                       addtables++;
+                       }
+                       if ( !addtables )
+                               delete tparent;
+               }
+       }
+       fieldsList.clear();
+       n = md->count(obj,md_fieldid);
+       for (uint i = 0; i < n; i++)
+       {
+               fobj = md->find( obj, md_fieldid, i );
+               if ( fobj.isNull() )
+                       continue;
+               id = md->text(fobj).toLong();
+               aCfgItem testitem = md->find(id);
+               if (testitem.isNull())
+                       md->remove( testitem );
+               else
+                       addField( testitem );
+       }
+}
+
+
+void dEditColumns::updateMD()
+{
+       aCfgItem field;
+       item->setText( 0, eName->text().stripWhiteSpace() );
+       md->setAttr(obj, mda_name, eName->text().stripWhiteSpace());
+    do
+       {
+               field = md->findChild( obj, md_fieldid, 0 );
+               if ( !field.isNull() )
+                        md->remove( field );
+    } while ( !field.isNull() );
+    ananasListViewItem *aitem = (ananasListViewItem *)usedFields->firstChild();
+       if (!aitem)
+               return;
+    while ( aitem )
+       {
+               field = md->insert( obj, md_fieldid, QString::null, -1 );
+               md->setText( field, QString( "%1" ).arg( aitem->id ) );
+               aitem = (ananasListViewItem *)aitem->nextSibling();
+    }
+}
+
+void dEditColumns::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+
+void dEditColumns::init()
+{
+       statusBar()->hide();
+}
+
+
+void
+dEditColumns::bAddAction_clicked()
+{
+    ananasListViewItem *cur = (ananasListViewItem *)availableFields->selectedItem();
+       if (!cur)
+               return;
+       if ( md->objClass( cur->obj ) != md_field )
+               return;
+       eName->setText( md->attr( cur->obj, mda_name ) );
+       addField( cur->obj );
+}
+
+
+void dEditColumns::bRemoveAction_clicked()
+{
+       ananasListViewItem *rmItem = (ananasListViewItem*)usedFields->selectedItem();
+       if ( !rmItem )
+               return;
+       aCfgItem cobj = md->find(md->id(rmItem->obj));
+       aCfgItem doc, parent = md->parent(cobj);
+       if ( md->objClass (parent) == md_header )
+               doc = md->parent(parent);
+       else
+               doc = md->parent(md->parent(parent));
+       fieldsList.remove(md->attr(doc,mda_id));
+       usedFields->removeItem( rmItem );
+}
+
+
+void dEditColumns::bMoveUp_clicked()
+{
+    Q3ListViewItem *aitem, *after;
+
+    aitem =  usedFields->selectedItem();
+    if ( aitem )
+       {
+               after = aitem->itemAbove();
+               if ( after )
+                       after->moveItem( aitem );
+       }
+}
+
+
+void dEditColumns::bMoveDown_clicked()
+{
+       Q3ListViewItem *aitem, *after;
+       aitem = usedFields->selectedItem();
+       if ( aitem )
+       {
+               after = aitem->itemBelow();
+               if ( after )
+                       aitem->moveItem( after );
+    }
+}
+
+
+
+void dEditColumns::addField( aCfgItem addItem )
+{
+       aCfgItem fparent, parent;
+       fparent = md->parent(addItem);
+       QString fName;
+       if ( md->objClass( fparent ) == md_header )
+       {
+               fName = QObject::tr("header");
+               parent = md->parent(fparent);
+       }
+       else
+       {
+               fName =  md->attr( fparent, mda_name );
+               parent = md->parent(md->parent(fparent));
+       }
+       QString fId = md->attr( parent, mda_id );
+       if ( fieldsList.findIndex(fId) != -1  )
+               return;
+       fName = md->attr(parent,mda_name)+"."+fName+"."+md->attr(addItem,mda_name);
+       ananasListViewItem *aitem = new ananasListViewItem(usedFields, usedFields->lastItem(), md, addItem,fName );
+       aitem->setPixmap(0, rcIcon("field.png"));
+       aitem->setRenameEnabled(0,false);
+       fieldsList.append(fId);
+}
+
diff --git a/src/designer/deditcolumns.h b/src/designer/deditcolumns.h
new file mode 100644 (file)
index 0000000..8e7478c
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef DEDITCOLUMNS_H
+#define DEDITCOLUMNS_H
+
+#include "ui_deditcolumns.h"
+
+
+class dEditColumns : public Q3MainWindow, public Ui::dEditColumns
+{
+    Q_OBJECT
+
+public:
+    dEditColumns(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditColumns();
+
+public slots:
+    virtual void setData( ananasListViewItem * o );
+    virtual void updateMD();
+    virtual void bAddAction_clicked();
+    virtual void bRemoveAction_clicked();
+    virtual void bMoveUp_clicked();
+    virtual void bMoveDown_clicked();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    aCfgItem obj;
+    aCfg *md;
+    aAliasEditor *al;
+    ananasListViewItem * item;
+    ananasTreeView *availableFields;
+    ananasTreeView *usedFields;
+    QStringList fieldsList;
+
+    void destroy();
+    void init();
+    virtual void addField( aCfgItem addItem );
+
+};
+
+#endif // DEDITCOLUMNS_H
diff --git a/src/designer/deditcolumns.ui b/src/designer/deditcolumns.ui
new file mode 100644 (file)
index 0000000..f618475
--- /dev/null
@@ -0,0 +1,293 @@
+<ui version="4.0" >
+ <class>dEditColumns</class>
+ <widget class="Q3MainWindow" name="dEditColumns" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>495</width>
+    <height>361</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Columns</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>495</width>
+     <height>361</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" colspan="3" >
+     <layout class="QHBoxLayout" >
+      <item>
+       <widget class="QLabel" name="textLabel1" >
+        <property name="text" >
+         <string>Name:</string>
+        </property>
+        <property name="wordWrap" >
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLineEdit" name="eName" >
+        <property name="enabled" >
+         <bool>true</bool>
+        </property>
+        <property name="minimumSize" >
+         <size>
+          <width>0</width>
+          <height>22</height>
+         </size>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item row="1" column="1" >
+     <layout class="QVBoxLayout" >
+      <item>
+       <spacer>
+        <property name="orientation" >
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeType" >
+         <enum>QSizePolicy::Expanding</enum>
+        </property>
+        <property name="sizeHint" >
+         <size>
+          <width>20</width>
+          <height>44</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QPushButton" name="bAddAction" >
+        <property name="sizePolicy" >
+         <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text" >
+         <string/>
+        </property>
+        <property name="icon" >
+         <iconset/>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="bRemoveAction" >
+        <property name="sizePolicy" >
+         <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text" >
+         <string/>
+        </property>
+        <property name="icon" >
+         <iconset/>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="bMoveUp" >
+        <property name="sizePolicy" >
+         <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text" >
+         <string/>
+        </property>
+        <property name="icon" >
+         <iconset/>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="bMoveDown" >
+        <property name="sizePolicy" >
+         <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text" >
+         <string/>
+        </property>
+        <property name="icon" >
+         <iconset/>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer>
+        <property name="orientation" >
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeType" >
+         <enum>QSizePolicy::Expanding</enum>
+        </property>
+        <property name="sizeHint" >
+         <size>
+          <width>21</width>
+          <height>35</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </item>
+    <item row="1" column="2" >
+     <widget class="Q3Frame" name="frmFields" >
+      <property name="sizePolicy" >
+       <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="frameShape" >
+       <enum>QFrame::NoFrame</enum>
+      </property>
+      <property name="frameShadow" >
+       <enum>QFrame::Plain</enum>
+      </property>
+     </widget>
+    </item>
+    <item row="1" column="0" >
+     <widget class="Q3GroupBox" name="gbFields" >
+      <property name="sizePolicy" >
+       <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="title" >
+       <string>Columns</string>
+      </property>
+      <property name="midLineWidth" >
+       <number>0</number>
+      </property>
+      <property name="margin" >
+       <number>0</number>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <action name="Action" >
+   <property name="iconText" >
+    <string>Action</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>Action</string>
+   </property>
+  </action>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3GroupBox</class>
+   <extends>QGroupBox</extends>
+   <header>Qt3Support/Q3GroupBox</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Frame</class>
+   <extends>QFrame</extends>
+   <header>Qt3Support/Q3Frame</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >atreeitems.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >mainform.h</include>
+ </includes>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>bAddAction</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditColumns</receiver>
+   <slot>bAddAction_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bRemoveAction</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditColumns</receiver>
+   <slot>bRemoveAction_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bMoveUp</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditColumns</receiver>
+   <slot>bMoveUp_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bMoveDown</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditColumns</receiver>
+   <slot>bMoveDown_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/designer/deditcommand.cpp b/src/designer/deditcommand.cpp
new file mode 100644 (file)
index 0000000..5423ecb
--- /dev/null
@@ -0,0 +1,241 @@
+#include "deditcommand.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+#include <q3header.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include "acfg.h"
+
+//extern aCfg cfg;
+
+/*
+ *  Constructs a dEditCommand as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditCommand::dEditCommand(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditCommand::~dEditCommand()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditCommand::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditCommand::updateMD()
+{
+    aCfgItem com_action, apix;
+    al->updateMD( );
+    QPixmap pix;
+
+    item->setText( 0, eName->text().stripWhiteSpace() );
+    md->setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+    md->setSText( obj, md_description, eDescription->text() );
+    md->setSText( obj, md_menutext, eMenuText->text() );
+
+    QString sKey = "";
+    if ( cbKey-> currentText () != "" )
+    {
+       if ( cbCTRL->isChecked() )
+           sKey += md_km_ctrl;
+       if ( cbALT->isChecked() )
+           sKey += md_km_alt;
+       if ( cbShift->isChecked() )
+           sKey += md_km_shift;
+       sKey += cbKey->currentText ();
+    }
+    md->setSText( obj, md_key, sKey );
+
+    do
+       {
+               com_action = md->findChild( obj, md_comaction, 0 );
+               if ( !com_action.isNull() )
+                        md->remove( com_action );
+    } while ( !com_action.isNull() );
+    ananasListViewItem *aitem = (ananasListViewItem *)vComActions->firstChild();
+       if (!aitem)
+               return;
+    while ( aitem )
+       {
+               com_action = md->insert( obj, md_comaction, QString::null, -1 );
+               md->setText( com_action, QString( "%1" ).arg( aitem->id ) );
+               aitem = (ananasListViewItem *)aitem->nextSibling();
+    }
+    aitem = (ananasListViewItem *)vComActions->firstChild();
+    apix = md->findChild( md->find( aitem->id ), md_active_picture, 0 );
+       if ( apix.isNull() )
+               return;
+    pix.loadFromData( md->binary( apix ) );
+    item->setPixmap( 0, pix );
+}
+
+void dEditCommand::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+
+void dEditCommand::init()
+{
+       statusBar()->hide();
+}
+
+void dEditCommand::setData( InterfaceListViewItem * o )
+{
+    int i, j, n, k, id;
+    item = o;
+    md = o->md;
+    obj = o->obj;
+    aCfgItem  com_action, apix;
+    aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+    QPixmap pix;
+
+       vComActions = new ananasTreeView( tabWidget2->page(1),  md );
+    vComActions->setSorting( -1 );
+    // TODO Fixme!!!
+    //--layout28->addWidget( vComActions, 0, 0 );
+    actiontree = new aActionTreeView ( tabWidget2->page(1),  md );
+    disconnect( actiontree, SIGNAL( contextMenuRequested( Q3ListViewItem*, const QPoint&, int) ), actiontree, SLOT(ContextMenu() ) );
+    disconnect( actiontree, SIGNAL( returnPressed( Q3ListViewItem*) ), actiontree, SLOT( itemEdit() ) );
+    disconnect( actiontree, SIGNAL( doubleClicked( Q3ListViewItem*) ), actiontree, SLOT( itemEdit() ) );
+    // TODO Fixme!!!
+    //--layout29->addWidget( actiontree, 0, 0 );
+
+    al = a;
+    al->setData();
+
+    setCaption( tr("Command:") + md->attr( obj, mda_name ) );
+    eName->setText( md->attr( obj, mda_name ) );
+    eMenuText->setText( md->sText( obj, md_menutext ) );
+    eDescription->setText( md->sText( obj, md_description ) );
+
+    QString sKey = md->sText( obj, md_key );
+       if ( ( sKey.find (md_km_ctrl) ) >= 0 )
+       {
+               cbCTRL->setChecked ( TRUE );
+               sKey.remove(md_km_ctrl);
+       }
+       if ( ( sKey.find (md_km_alt) ) >= 0 )
+       {
+               cbALT->setChecked ( TRUE );
+               sKey.remove(md_km_alt);
+       }
+       if ( ( sKey.find (md_km_shift) ) >= 0 )
+       {
+               cbShift->setChecked ( TRUE );
+               sKey.remove(md_km_shift);
+       }
+
+
+       n = cbKey->count();
+       for ( i = 0; i < n; i++ )
+               if ( sKey == cbKey->text( i ) )
+               {
+                       cbKey->setCurrentItem( i );
+                       break;
+               }
+    n = md->countChild( obj, md_comaction );
+       k = md->count( md->find ( mdc_actions ), md_action );
+       ananasListViewItem *aitem;
+       aCfgItem actionObj;
+       for ( i = 0; i < n; i++ )
+       {
+               actionObj = md->find (obj, md_comaction, i);
+               id = md->text(actionObj).toLong();
+               if ( actionObj.isNull() )
+                       md->remove(actionObj);
+               com_action = md->find(id);
+               aitem = new ananasListViewItem (vComActions, vComActions->lastItem(), md, com_action);
+               aitem->setRenameEnabled( 0, FALSE );
+               apix = md->findChild( com_action, md_active_picture, 0 );
+               if ( apix.isNull() )
+                       break;
+               pix.loadFromData( md->binary( apix ) );
+               aitem->setPixmap( 0, pix );
+/*             for ( j = 0; j < k; j++)
+               {
+                       com_action = md->find ( md->find( mdc_actions ), md_action, j  );
+                       if ( md->id(com_action) == id )
+                       {
+                               aitem = new ananasListViewItem (vComActions, vComActions->lastItem(), md, com_action);
+                               aitem->setRenameEnabled( 0, FALSE );
+                               apix = md->findChild( com_action, md_active_picture, 0 );
+                               if ( apix.isNull() )
+                                       break;
+                               pix.loadFromData( md->binary( apix ) );
+                               aitem->setPixmap( 0, pix );
+                       }
+               }*/
+    }
+}
+
+
+void
+dEditCommand::bAddAction_clicked()
+{
+    aCfgItem apix;
+    QPixmap pix;
+
+    ananasListViewItem *cur = (ananasListViewItem *)actiontree->selectedItem();
+       if (!cur)
+               return;
+       if ( md->objClass( cur->obj ) != md_action )
+               return;
+       ananasListViewItem *aitem = new ananasListViewItem(vComActions, vComActions->lastItem(), md, cur->obj );
+       apix = md->findChild( md->find( aitem->id ), md_active_picture, 0 );
+       pix.loadFromData( md->binary( apix ) );
+       aitem->setPixmap( 0, pix );
+}
+
+
+void dEditCommand::bRemoveAction_clicked()
+{
+       vComActions->removeItem( vComActions->selectedItem() );
+}
+
+
+void dEditCommand::bMoveUp_clicked()
+{
+    ananasListViewItem *aitem, *after;
+
+    aitem = (ananasListViewItem *) vComActions->selectedItem();
+    if ( aitem ) {
+       after = (ananasListViewItem *)aitem->itemAbove();
+       if ( after ) after->moveItem( aitem );
+    }
+
+}
+
+
+void dEditCommand::bMoveDown_clicked()
+{
+    ananasListViewItem *aitem, *after;
+    aitem = (ananasListViewItem *)vComActions->selectedItem();
+    if ( aitem ) {
+       after = (ananasListViewItem *)aitem->itemBelow();
+       if ( after ) aitem->moveItem( after );
+    }
+}
diff --git a/src/designer/deditcommand.h b/src/designer/deditcommand.h
new file mode 100644 (file)
index 0000000..3b22e6c
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DEDITCOMMAND_H
+#define DEDITCOMMAND_H
+
+#include "ui_deditcommand.h"
+
+
+class dEditCommand : public Q3MainWindow, public Ui::dEditCommand
+{
+    Q_OBJECT
+
+public:
+    dEditCommand(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditCommand();
+
+    ananasTreeView *vComActions;
+    aActionTreeView *actiontree;
+    InterfaceListViewItem * item;
+    aAliasEditor *al;
+    aCfg *md;
+    aCfgItem obj;
+
+public slots:
+    virtual void updateMD();
+    virtual void setData( InterfaceListViewItem * o );
+    virtual void bAddAction_clicked();
+    virtual void bRemoveAction_clicked();
+    virtual void bMoveUp_clicked();
+    virtual void bMoveDown_clicked();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    void destroy();
+    void init();
+
+};
+
+#endif // DEDITCOMMAND_H
diff --git a/src/designer/deditcommand.ui b/src/designer/deditcommand.ui
new file mode 100644 (file)
index 0000000..9320388
--- /dev/null
@@ -0,0 +1,577 @@
+<ui version="4.0" >
+ <class>dEditCommand</class>
+ <widget class="Q3MainWindow" name="dEditCommand" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>569</width>
+    <height>371</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Command</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>569</width>
+     <height>371</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget2" >
+      <property name="font" >
+       <font/>
+      </property>
+      <property name="tabShape" >
+       <enum>QTabWidget::Rounded</enum>
+      </property>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="4" column="0" colspan="3" >
+         <layout class="QVBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel5" >
+            <property name="text" >
+             <string>Description:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="Q3TextEdit" name="eDescription" />
+          </item>
+         </layout>
+        </item>
+        <item row="3" column="0" colspan="3" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="lHotKey" >
+            <property name="text" >
+             <string>Hot Key:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="cbCTRL" >
+            <property name="text" >
+             <string>Ctrl</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="cbALT" >
+            <property name="text" >
+             <string>Alt</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="cbShift" >
+            <property name="text" >
+             <string>Shift</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QComboBox" name="cbKey" >
+            <item>
+             <property name="text" >
+              <string/>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>1</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>2</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>3</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>4</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>5</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>6</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>7</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>8</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>9</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>0</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>A</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>B</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>C</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>D</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>E</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>F</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>G</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>H</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>I</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>J</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>K</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>L</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>M</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>N</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>O</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>P</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>Q</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>R</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>S</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>T</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>U</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>V</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>W</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>X</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>Y</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>Z</string>
+             </property>
+            </item>
+           </widget>
+          </item>
+          <item>
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Expanding</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>71</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </item>
+        <item row="2" column="0" >
+         <widget class="QLabel" name="textLabel2" >
+          <property name="text" >
+           <string>Type:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0" >
+         <widget class="QLabel" name="textLabel1_2" >
+          <property name="text" >
+           <string>Menu text</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1" colspan="2" >
+         <widget class="QLineEdit" name="eMenuText" />
+        </item>
+        <item row="0" column="1" colspan="2" >
+         <widget class="QLineEdit" name="eName" >
+          <property name="enabled" >
+           <bool>true</bool>
+          </property>
+          <property name="minimumSize" >
+           <size>
+            <width>0</width>
+            <height>22</height>
+           </size>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="2" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeType" >
+           <enum>QSizePolicy::Expanding</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>360</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="2" column="1" >
+         <widget class="QComboBox" name="eType" />
+        </item>
+        <item row="0" column="0" >
+         <widget class="QLabel" name="textLabel1" >
+          <property name="text" >
+           <string>Name:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Actions</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <layout class="QGridLayout" />
+          </item>
+          <item>
+           <layout class="QVBoxLayout" >
+            <item>
+             <spacer>
+              <property name="orientation" >
+               <enum>Qt::Vertical</enum>
+              </property>
+              <property name="sizeType" >
+               <enum>QSizePolicy::Expanding</enum>
+              </property>
+              <property name="sizeHint" >
+               <size>
+                <width>20</width>
+                <height>44</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bAddAction" >
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bRemoveAction" >
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bMoveUp" >
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bMoveDown" >
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer>
+              <property name="orientation" >
+               <enum>Qt::Vertical</enum>
+              </property>
+              <property name="sizeType" >
+               <enum>QSizePolicy::Expanding</enum>
+              </property>
+              <property name="sizeHint" >
+               <size>
+                <width>21</width>
+                <height>44</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Lang</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >interfacetree.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >actiontree.h</include>
+  <include location="local" >mainform.h</include>
+ </includes>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>bAddAction</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditCommand</receiver>
+   <slot>bAddAction_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bRemoveAction</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditCommand</receiver>
+   <slot>bRemoveAction_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bMoveUp</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditCommand</receiver>
+   <slot>bMoveUp_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bMoveDown</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditCommand</receiver>
+   <slot>bMoveDown_clicked()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/designer/deditdialog.cpp b/src/designer/deditdialog.cpp
new file mode 100644 (file)
index 0000000..9580d6a
--- /dev/null
@@ -0,0 +1,337 @@
+#include "deditdialog.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "qtextcodec.h"
+
+#include <qstring.h>
+#include <qfile.h>
+#include <qstatusbar.h>
+#include "acfg.h"
+#include "qsproject.h"
+#include "qsscript.h"
+#include <qsinterpreter.h>
+#include <qdialog.h>
+//--#include <qwidgetfactory.h>
+#include <QFormBuilder>
+#include <qobject.h>
+#include <q3textstream.h>
+#include <qbuffer.h>
+#include <qsinterpreter.h>
+#include <qseditor.h>
+#include <q3process.h>
+#include <qapplication.h>
+
+#include "formdesigner.h"
+#include "mainform.h"
+#include "alog.h"
+
+//#include "qananastable.h"
+//#include <unistd.h>
+
+//extern QApplication *application;
+
+/*
+ *  Constructs a dEditDialog as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditDialog::dEditDialog(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditDialog::~dEditDialog()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditDialog::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditDialog::init()
+{
+       delete statusBar();
+       eModule->setInterpreter(new QSInterpreter());
+//     fd = new aFormDesigner();
+}
+
+
+void dEditDialog::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+
+
+void dEditDialog::setData( aListViewItem *o )
+{
+       item=NULL;
+       QString parentClass;
+       if (o) {
+               item = o;
+               aCfg *md = o->md;
+               aCfgItem obj = o->obj;
+               aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+               al = a;
+               al->setData();
+               eName->setText( md->attr( obj, mda_name ) );
+               eDescription->setText( md->sText( obj, md_description ) );
+               eModule->setText( md->sText( obj, md_sourcecode ) );
+               eFormFile->setText( QString("inputform_")+QString::number(item->id)+QString(".ui"));
+               setCaption( tr("Form:") + eName->text() );
+               parentClass = md->objClass( md->parent ( md->parent( obj ) ) );
+               if ( parentClass == md_document ) {
+//                     cbFormMode->insertItem(QObject::tr("Document"));
+               }
+               if ( parentClass == md_catalogue ) {
+//                     cbDefault->insertItem(QObject::tr("selection"));
+                       cbFormMode->clear();
+                       cbFormMode->insertItem(QObject::tr("Elements list dialog"));
+                       cbFormMode->insertItem(QObject::tr("Element dialog"));
+                       cbFormMode->insertItem(QObject::tr("Group dialog"));
+               }
+               else cbSelect->setHidden( true );
+               int i = md->sText(obj, md_defaultmod).toInt();
+               cbNew->setChecked( (i>>md_form_new)%2 );
+               cbView->setChecked( (i>>md_form_view)%2 );
+               cbEdit->setChecked( (i>>md_form_edit)%2 );
+               cbSelect->setChecked( (i>>md_form_select)%2 );
+               i = md->attr( obj, mda_type ).toInt();
+               cbFormMode->setCurrentItem( i );
+               i = md->attr( obj, mda_readonly ).toInt();
+               cbReadOnly->setChecked( i );
+               QString ui= md->sText( obj, md_formdesign );
+//             bPreview->setDisabled(ui.isEmpty());
+       }
+}
+
+//#include "mainform.h"
+//#include <formwindow.h>
+//extern MainForm *mainform;
+
+void dEditDialog::EditForm()
+{
+
+       aCfg *md = item->md;
+       aCfgItem obj = item->obj, o;
+       QString ui, s, tpl_name = "inputform.ui.tpl", tpldir;
+       QFile f( eFormFile->text() );
+//     char* arg;
+//     int rc;
+       aLog::print(aLog::Debug,tr("dEditDialog edit form"));
+       //MainForm *mw = (MainForm*) topLevelWidget();
+       //printf("end getting pointer to Main form\n");
+       QStringList env;
+//     QProcess proc( this );
+
+#ifdef Q_OS_WIN32
+       tpldir = qApp->applicationDirPath()+"/templates/";
+#else
+       tpldir = "/usr/share/ananas/templates/";
+#endif
+       tpldir = ":/designer/templates/";
+
+/*
+       int rc;
+       char* arg;
+       QFile f;
+       QString s;
+       const char *ui;
+       int fc=0;
+
+    if (cfg_rcfile()) {
+       setenv("ANANASRCFILE",cfg_rcfile(),1);
+    } else {
+       cfg_message(1, "Ошибка! Не удалось получить значение для записи в ANANASRCFILE\n");
+    }
+*/
+
+   if (!f.exists())
+   {
+       aLog::print(aLog::Debug,tr("dEditDialog form file does not exists"));
+       ui= md->sText( obj, md_formdesign );
+       if (!ui.isEmpty())
+       {
+
+               aLog::print(aLog::Debug, tr("dEditDialog create form file from metadata"));
+               QFile f1(eFormFile->text());
+               f1.open(QIODevice::WriteOnly);
+               f1.writeBlock(ui, strlen(ui));
+               f1.close();
+
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("dEditDialog create new form file from template"));
+               o = md->parent( md->parent( obj ) );
+               if ( md->objClass( o ) == md_document ) tpl_name = "inputformdoc.tpl";
+               if ( md->objClass( o ) == md_catalogue ) tpl_name = "inputformcat.tpl";
+               if ( md->objClass( o ) == md_journal ) tpl_name = "inputformjourn.tpl";
+               if ( md->objClass( o ) == md_report ) tpl_name = "inputformrep.tpl";
+               QFile fi( tpldir+tpl_name );
+               if ( fi.open( QIODevice::ReadOnly ))
+               {
+                       if(f.open( QIODevice::WriteOnly ))
+                       {
+                               Q3TextStream tso( &f );
+                               tso.setEncoding( Q3TextStream::UnicodeUTF8 );
+                               QString form = fi.readAll();
+//                     printf("obj id = %i\n", md->id( o ) );
+                               form.replace( QString("$$$id$$$"), QString("%1").arg( md->id( o ) ) );
+                               form.replace( QString("$$$name$$$"), QString("") );
+                               form.replace( QString("$$$caption$$$"), md->attr( o, mda_name ) );
+                               tso << form; //tsi.read();
+                               fi.close();
+                               f.close();
+                       }
+                       else
+                       {
+                               aLog::print(aLog::Error, tr("dEditDialog open file %1 for write").arg(f.name()));
+                       }
+               }
+               else
+               {
+                       aLog::print(aLog::Error,tr("dEditDialog open file %1 for read from templates directory %2").arg(tpl_name).arg(tpldir));
+               }
+//             s=QString("cp inputform.ui.tpl ")+  eFormFile->text();
+//             system((const char *)s);
+       }
+   }
+
+       if(!QFile(eFormFile->text()).exists())
+       {
+
+               aLog::print(aLog::Error, tr("dEditDialog file %1 not exists").arg(eFormFile->text()));
+       }
+       formdesigner->fileOpen( eFormFile->text() );
+       aLog::print(aLog::Debug, tr("dEditDialog show formdesigner"));
+       formdesigner->show();
+
+//     }
+
+
+//
+//     if (!proc.start()) {
+//             printf("Error running qt designer\n");
+//     }
+//CHECK_POINT
+/*
+    if ((rc=fork())==0) {
+       arg = strdup( (const char *) eFormFile->text() );
+       execlp("designer","designer","-client",arg,0);
+       printf("Error running qt designer: errno=%d\terror=%s\n",
+                     errno,strerror(errno));
+    } else if (rc==-1) {
+       printf("Error while fork: errno=%d\terror=%s\n",
+                     errno,strerror(errno));
+    }
+*/
+}
+
+
+void dEditDialog::EditModule()
+{
+//     cfgobj_editcode(objectptr);
+}
+
+
+void dEditDialog::updateMD()
+{
+
+    formdesigner->fileSaveAll();
+       aCfg *md = item->md;
+       aCfgItem obj = item->obj;
+       QString ui;
+       QFile f(eFormFile->text());
+//if (cancelupdate) return;
+       al->updateMD();
+       item->setText( 0, eName->text().stripWhiteSpace() );
+       md->setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+       md->setAttr( obj, mda_type, cbFormMode->currentItem() );
+       md->setAttr( obj, mda_readonly, cbReadOnly->isChecked() );
+       md->setSText( obj, md_description, eDescription->text() );
+       md->setSText( obj, md_sourcecode, eModule->text() );
+//     ui.arg(cbDefault->currentItem());
+//     md->setSText( obj, md_defaultmod, QString( "%1" ).arg( cbDefault->currentItem() ) );
+       int i = (1<<md_form_new) * cbNew->isChecked() + \
+               (1<<md_form_view) * cbView->isChecked() + \
+               (1<<md_form_edit) * cbEdit->isChecked() +\
+               (1<<md_form_select) * cbSelect->isChecked();
+       md->setSText( obj, md_defaultmod, QString( "%1" ).arg( i ) );
+       if (f.open(QIODevice::ReadOnly)){
+               Q3TextStream ts(&f);
+               ts.setEncoding(Q3TextStream::UnicodeUTF8);
+               ui=ts.read();
+               md->setSText( obj, md_formdesign, ui );
+               f.close();
+               f.remove();
+       }
+
+}
+
+
+
+void dEditDialog::formPreview()
+{
+//    if ( !QFile::exists(eFormFile->text())) return;
+
+       aCfg *md = item->md;
+       aCfgItem obj = item->obj;
+       QString ui, s;
+       QFile f(eFormFile->text());
+
+       if (!f.exists()){
+               ui= md->sText( obj, md_formdesign );
+               if (!ui.isEmpty()) {
+                       f.open(QIODevice::WriteOnly);
+                       f.writeBlock(ui, strlen(ui));
+                       f.close();
+               } else {
+                   return;
+                       QFile fi("inputform.ui.tpl");
+                       if ( fi.open( QIODevice::ReadOnly ) && f.open( QIODevice::WriteOnly ) ){
+                               Q3TextStream tsi( &fi ), tso( &f );
+                               tso << tsi.read();
+                               fi.close();
+                               f.close();
+                       }
+               }
+       }
+
+       QIODevice *d;
+       d= &f;
+       d->open(QIODevice::ReadOnly);
+       //--QWidget *form = QWidgetFactory::create(d);
+    QFormBuilder fb;
+    QWidget *form = fb.load(d);
+       d->close();
+       if (form) form->show();
+       else printf("Error create form\n");
+
+}
+
+
+
+
+int dEditDialog::getDocId()
+{
+    return docId;
+}
diff --git a/src/designer/deditdialog.h b/src/designer/deditdialog.h
new file mode 100644 (file)
index 0000000..8010dce
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef DEDITDIALOG_H
+#define DEDITDIALOG_H
+
+#include "ui_deditdialog.h"
+
+
+class dEditDialog : public Q3MainWindow, public Ui::dEditDialog
+{
+    Q_OBJECT
+
+public:
+    dEditDialog(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditDialog();
+
+    int docId;
+    aAliasEditor *al;
+    aFormDesigner *fd;
+    aListViewItem *item;
+
+    virtual int getDocId();
+
+public slots:
+    virtual void init();
+    virtual void destroy();
+    virtual void setData( aListViewItem * o );
+    virtual void EditForm();
+    virtual void EditModule();
+    virtual void updateMD();
+
+protected slots:
+    virtual void languageChange();
+
+private slots:
+    virtual void formPreview();
+
+};
+
+#endif // DEDITDIALOG_H
diff --git a/src/designer/deditdialog.ui b/src/designer/deditdialog.ui
new file mode 100644 (file)
index 0000000..6b1a01d
--- /dev/null
@@ -0,0 +1,374 @@
+<ui version="4.0" >
+ <class>dEditDialog</class>
+ <widget class="Q3MainWindow" name="dEditDialog" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>436</width>
+    <height>336</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>436</width>
+     <height>336</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget3" >
+      <property name="currentIndex" >
+       <number>1</number>
+      </property>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="6" column="0" colspan="7" >
+         <layout class="QVBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel4" >
+            <property name="text" >
+             <string>Description:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="Q3TextEdit" name="eDescription" />
+          </item>
+         </layout>
+        </item>
+        <item row="1" column="0" >
+         <widget class="QLabel" name="textLabel1" >
+          <property name="minimumSize" >
+           <size>
+            <width>100</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="text" >
+           <string>Module file</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item rowspan="2" row="4" column="0" >
+         <widget class="QLabel" name="textLabel1_3_2" >
+          <property name="text" >
+           <string>Form mode:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1" colspan="6" >
+         <widget class="QLineEdit" name="eModFile" />
+        </item>
+        <item row="0" column="0" >
+         <widget class="QLabel" name="textLabel1_2" >
+          <property name="minimumSize" >
+           <size>
+            <width>100</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="text" >
+           <string>Name</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="0" >
+         <widget class="QLabel" name="textLabel1_3" >
+          <property name="text" >
+           <string>Use for:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1" colspan="6" >
+         <widget class="QLineEdit" name="eFormFile" >
+          <property name="readOnly" >
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="5" column="1" colspan="3" >
+         <widget class="QComboBox" name="cbFormMode" >
+          <item>
+           <property name="text" >
+            <string>Dialog</string>
+           </property>
+          </item>
+         </widget>
+        </item>
+        <item row="0" column="1" colspan="6" >
+         <widget class="QLineEdit" name="eName" >
+          <property name="readOnly" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="0" >
+         <widget class="QLabel" name="textLabel2" >
+          <property name="minimumSize" >
+           <size>
+            <width>100</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="text" >
+           <string>Form file</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item rowspan="2" row="3" column="1" >
+         <widget class="QCheckBox" name="cbNew" >
+          <property name="text" >
+           <string>New</string>
+          </property>
+         </widget>
+        </item>
+        <item rowspan="2" row="3" column="2" >
+         <widget class="QCheckBox" name="cbView" >
+          <property name="text" >
+           <string>View</string>
+          </property>
+         </widget>
+        </item>
+        <item rowspan="2" row="3" column="3" colspan="2" >
+         <widget class="QCheckBox" name="cbEdit" >
+          <property name="text" >
+           <string>Edit</string>
+          </property>
+         </widget>
+        </item>
+        <item rowspan="2" row="3" column="5" >
+         <widget class="QCheckBox" name="cbSelect" >
+          <property name="text" >
+           <string>Selection</string>
+          </property>
+         </widget>
+        </item>
+        <item rowspan="2" row="3" column="6" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeType" >
+           <enum>QSizePolicy::Expanding</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>30</width>
+            <height>21</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="5" column="4" colspan="3" >
+         <widget class="QCheckBox" name="cbReadOnly" >
+          <property name="text" >
+           <string>Read only</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Design</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" colspan="3" >
+         <widget class="Q3Frame" name="frame3" >
+          <property name="frameShape" >
+           <enum>QFrame::NoFrame</enum>
+          </property>
+          <property name="frameShadow" >
+           <enum>QFrame::Plain</enum>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0" colspan="2" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeType" >
+           <enum>QSizePolicy::Expanding</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>151</width>
+            <height>171</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item row="2" column="0" >
+         <widget class="QPushButton" name="pbDesigner" >
+          <property name="text" >
+           <string>Designer</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1" >
+         <widget class="QPushButton" name="bPreview" >
+          <property name="text" >
+           <string>Preview</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="2" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Module</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="QSEditor" native="1" name="eModule" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Lang</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3Frame</class>
+   <extends>QFrame</extends>
+   <header>Qt3Support/Q3Frame</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QSEditor</class>
+   <extends>QWidget</extends>
+   <header>qseditor.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >formdesigner.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >mainform.h</include>
+  <include location="local" >qseditor.h</include>
+ </includes>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>bPreview</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditDialog</receiver>
+   <slot>formPreview()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>pbDesigner</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditDialog</receiver>
+   <slot>EditForm()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/designer/deditdoc.cpp b/src/designer/deditdoc.cpp
new file mode 100644 (file)
index 0000000..a1a383e
--- /dev/null
@@ -0,0 +1,131 @@
+#include "deditdoc.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+#include "acfg.h"
+#include <qsinterpreter.h>
+#include <qseditor.h>
+
+/*
+ *  Constructs a dEditDoc as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditDoc::dEditDoc(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditDoc::~dEditDoc()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditDoc::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditDoc::init()
+{
+       delete statusBar();
+       eModule->setInterpreter( new QSInterpreter() );
+       eStrViewF->setInterpreter( new QSInterpreter() );
+       eStrViewF->setEnabled( FALSE );
+}
+
+
+void dEditDoc::destroy()
+{
+    updateMD();
+    item->editor = 0;
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+
+
+void dEditDoc::setData( aListViewItem *o )
+{
+    long int i;
+    int fid, fcount, fieldid, stdf;
+    item = o;
+    aCfg *md = o->md;
+    aCfgItem obj = o->obj, sv, field;
+
+    aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+    al = a;
+    al->setData();
+    aRoleEditor *r = new aRoleEditor( md, obj, tRoles, md_document );
+    re = r;
+    re->setData();
+    setCaption( tr("Document:") + md->attr( obj, mda_name ) );
+    eName->setText( md->attr( obj, mda_name ) );
+    eDescription->setText( md->sText( obj, md_description ) );
+    eModule->setText( md->sText( obj, md_sourcecode ) );
+    sv = md->find( obj, md_string_view );
+    eStrViewF->setText( md->sText( sv, md_svfunction ) );
+    eSv->insertItem( "[ standart function ]" );
+    eSv->insertItem( "[ user function ]" );
+    fid = md->sText( sv, md_fieldid ).toInt();
+    stdf = md->attr( sv, mda_stdf ).toInt();
+    eSv->setCurrentItem( 0 );
+    for ( i = 0; i < md->count( obj, md_field ); i++ ) {
+       field = md->find( obj, md_field, i );
+       eSv->insertItem( QString("%1").arg( md->attr( field, mda_name ) ) );
+       fieldid = md->id( field );
+       fields.insert( i, new int( fieldid ) );
+       if ( fid == fieldid && !stdf ) {
+           eSv->setCurrentItem( i + 2 );
+           eStrViewF->setEnabled( FALSE );
+       }
+    }
+    if ( !fid & !stdf ) {
+       eStrViewF->setEnabled( TRUE );
+       eSv->setCurrentItem( 1 );
+    }
+}
+
+void dEditDoc::updateMD()
+{
+       aCfg *md = item->md;
+       aCfgItem obj = item->obj, sv;
+
+       al->updateMD();
+       re->updateMD();
+       item->setText( 0, eName->text().stripWhiteSpace() );
+       md->setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+       md->setSText( obj, md_description, eDescription->text() );
+       md->setSText( obj, md_sourcecode, eModule->text() );
+       sv = md->find( obj, md_string_view );
+       if ( sv.isNull() ) sv = md->insert( obj, md_string_view );
+       md->setSText( sv, md_svfunction, eStrViewF->text() );
+       if ( eSv->currentItem() == 0 ) md->setAttr( sv, mda_stdf, "1" );
+       else {
+           md->setAttr( sv, mda_stdf, "0" );
+           if ( eSv->currentItem() == 1 ) md->setSText( sv, md_fieldid, "0" );
+           else md->setSText( sv, md_fieldid, QString("%1").arg( *(fields.find( eSv->currentItem() - 2 ) ) ) );
+       }
+}
+
+
+
+void dEditDoc::eSv_activated( int index )
+{
+    if ( index == 1 ) eStrViewF->setEnabled( TRUE );
+    else eStrViewF->setEnabled( FALSE );
+}
diff --git a/src/designer/deditdoc.h b/src/designer/deditdoc.h
new file mode 100644 (file)
index 0000000..ac1437b
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef DEDITDOC_H
+#define DEDITDOC_H
+
+#include "ui_deditdoc.h"
+
+
+class dEditDoc : public Q3MainWindow, public Ui::dEditDoc
+{
+    Q_OBJECT
+
+public:
+    dEditDoc(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditDoc();
+
+    aListViewItem *item;
+    aAliasEditor *al;
+    Q3IntDict<int> fields;
+    aRoleEditor *re;
+
+public slots:
+    virtual void setData( aListViewItem * o );
+    virtual void updateMD();
+    virtual void eSv_activated( int index );
+
+protected slots:
+    virtual void languageChange();
+
+    virtual void init();
+    virtual void destroy();
+
+
+};
+
+#endif // DEDITDOC_H
diff --git a/src/designer/deditdoc.ui b/src/designer/deditdoc.ui
new file mode 100644 (file)
index 0000000..4444461
--- /dev/null
@@ -0,0 +1,225 @@
+<ui version="4.0" >
+ <class>dEditDoc</class>
+ <widget class="Q3MainWindow" name="dEditDoc" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>446</width>
+    <height>322</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Document</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>446</width>
+     <height>322</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" colspan="2" >
+     <widget class="QTabWidget" name="tabWidget2" >
+      <property name="font" >
+       <font/>
+      </property>
+      <property name="tabShape" >
+       <enum>QTabWidget::Rounded</enum>
+      </property>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QVBoxLayout" >
+        <item>
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel1" >
+            <property name="text" >
+             <string>Name</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eName" />
+          </item>
+         </layout>
+        </item>
+        <item>
+         <widget class="QLabel" name="textLabel5" >
+          <property name="text" >
+           <string>Description:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="Q3TextEdit" name="eDescription" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Module</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="QSEditor" native="1" name="eModule" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>1</number>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>String view</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="QComboBox" name="eSv" />
+        </item>
+        <item row="1" column="0" >
+         <widget class="QSEditor" native="1" name="eStrViewF" >
+          <property name="enabled" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Access</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tRoles" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <property name="showGrid" >
+           <bool>false</bool>
+          </property>
+          <property name="selectionMode" >
+           <enum>Q3Table::Multi</enum>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Read</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Write</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QSEditor</class>
+   <extends>QWidget</extends>
+   <header>qseditor.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >mainform.h</include>
+  <include location="local" >roleeditor.h</include>
+  <include location="local" >qseditor.h</include>
+  <include location="local" >qseditor.h</include>
+ </includes>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>eSv</sender>
+   <signal>activated(int)</signal>
+   <receiver>dEditDoc</receiver>
+   <slot>eSv_activated(int)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>eSv</sender>
+   <signal>highlighted(int)</signal>
+   <receiver>dEditDoc</receiver>
+   <slot>eSv_activated(int)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/designer/deditfield.cpp b/src/designer/deditfield.cpp
new file mode 100644 (file)
index 0000000..cd575de
--- /dev/null
@@ -0,0 +1,326 @@
+#include "deditfield.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "acfg.h"
+#include "acfgrc.h"
+#include <qstatusbar.h>
+#include "alog.h"
+
+/*
+#include <qsproject.h>
+#include <qsscript.h>
+#include <qseditor.h>
+#include <qsinterpreter.h>
+*/
+
+/*
+ *  Constructs a dEditField as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditField::dEditField(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditField::~dEditField()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditField::languageChange()
+{
+    retranslateUi(this);
+}
+
+void
+setText(){
+
+}
+
+
+void dEditField::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+
+
+
+void dEditField::init()
+{
+// eModule->setInterpreter(new QSInterpreter());
+       delete statusBar();
+       otypes.clear();
+       artypes.clear();
+       eType->clear();
+       otypes.append(" ");
+       eType->insertItem(tr("Unknown"), 0);
+
+}
+
+
+void dEditField::setData( aListViewItem *o )
+{
+       item = o;
+       aCfg *md = o->md;
+       aCfgItem obj = o->obj;
+
+       QString ts;
+       char t=' ';
+       int w=0, d=0, oid, idx=0;
+       unsigned int i;
+
+
+       aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+       al = a;
+       al->setData();
+       // setCaption( tr("Field:") + md->attr( obj, mda_name ) );
+       eName->setText( md->attr( obj, mda_name ) );
+       nameChanged();
+       // eID->setText( md->attr( obj, mda_id ) );
+       ts = md->attr( obj, mda_type );
+       if(md->objClass(md->parent(obj))==md_element)
+       {
+               saldoTextLabel->show();
+               comboBox2->show();
+//             updateGeometry();
+       }
+       else
+       {
+               saldoTextLabel->hide();
+               comboBox2->hide();
+//             layout()->remove(comboBox2);
+//             layout()->remove(saldoTextLabel);
+
+//             updateGeometry();
+       }
+       // eType0->setText( ts );
+       // eModule->setText( md->sText( obj, md_sourcecode ) );
+       eDescription->setText( md->sText( obj, md_description ) );
+
+       if( md->attr( obj, mda_sort ) == "1" ) efSort->setChecked( true );
+       else efSort->setChecked( false );
+       if( md->attr( obj, mda_plus ) == "1" ) efPlus->setChecked( true );
+       else efPlus->setChecked( false );
+       if( md->attr( obj, mda_nz ) == "1" ) efNZ->setChecked( true );
+       else efNZ->setChecked( false );
+       efSum->setChecked(md->attr( obj, mda_sum ) == "1");
+
+       QStringList tlist;
+       if(md->objClass(md->parent(obj))==md_resources)
+       {
+               tlist.append("\t"+QObject::tr("Unknown"));
+               tlist.append("N %d %d\t"+QObject::tr("Numberic"));
+       }
+       else
+       {
+               tlist = md->types();
+       }
+       otypes.clear();
+
+       eType->clear();
+       for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
+               otypes.append( (*it).section( "\t", 0, 0 ) );
+               eType->insertItem( (*it).section("\t", 1, 1 ), idx++ );
+       }
+
+       if ( !ts.isEmpty() )
+       {
+                sscanf( ts, "%c %d %d", &t, &w, &d );
+       }
+       else
+       {
+               t = 'N';
+               w = 10;
+       }
+       if ( t=='O' ) {
+               for( i = 0 ; i < otypes.count(); i++ ) {
+                       if( otypes[i][0] == 'O' ) {
+                               sscanf( (const char *)otypes[ i ], "O %d", &oid );
+                               if ( oid == w ) {
+                                        eType->setCurrentItem( i );
+                                        break;
+                               }
+                       }
+               }
+       } else {
+                if ( t == ' ' ) eType->setCurrentItem( 0 );
+                if ( t == 'N' )
+                {
+                       eWidth->setMaxValue(20);
+                       eDec->setMaxValue(99);
+                       eType->setCurrentItem( 1 );
+                }
+                if ( t == 'C' )
+                {
+
+                       eWidth->setMaxValue(254);
+                       eDec->setMaxValue(99);
+                       eType->setCurrentItem( 2 );
+                }
+                if ( t == 'D' ) eType->setCurrentItem( 3 );
+                if ( t == 'B' ) eType->setCurrentItem( 4 );
+                eWidth->setValue( w );
+                eDec->setValue( d );
+       }
+       aCfgItem obj2;
+       int n, n1,aregid, aregfid;
+       QString str;
+       QStringList l_name;
+ //long oid;
+       aCfgItem context = md->findChild(md->find(mdc_metadata),md_registers);
+       comboBox2->clear();
+       comboBox2->insertItem(" ");
+       artypes.clear();
+       artypes.append(" ");
+       n = md->count( context, md_aregister );
+// printf("n=%d name = %s\n",n, md->attr(context,mda_name).ascii());
+       for (i=0; i<n; i++)
+       {
+               obj = md->find( context, md_aregister, i);
+               if ( !obj.isNull() )
+               {
+                       aregid=md->attr(obj,mda_id).toInt();
+                       str = tr(QString("AccumulationRegister."))+md->attr( obj, mda_name );
+                       //printf("`%s'\n",str.ascii());
+                       obj = md->findChild(obj,md_resources);
+                       n1 = md->count( obj, md_field);
+//   printf("n=%d name = %s\n",n, md->attr(obj,mda_name).ascii());
+                       for (uint j=0; j<n1; j++)
+                       {
+                               obj2 = md->find( obj, md_field, j);
+                               if ( !obj2.isNull() )
+                               {
+                                       aregfid = md->attr(obj2, mda_id).toInt();
+                                       artypes.append(QString(" %1 %2").arg(aregid).arg(aregfid));
+                                       comboBox2->insertItem(str+"."+md->attr( obj2, mda_name ));
+                                       if(w==aregid && d==aregfid) comboBox2->setCurrentItem(comboBox2->count()-1);
+                               }
+                       }
+               }
+       }
+       typeSelect( eType->currentItem() );
+}
+
+void dEditField::updateMD()
+{
+ QString st;
+
+ aCfg *md = item->md;
+ aCfgItem obj = item->obj;
+
+ al->updateMD();
+ item->setText( 0, eName->text().stripWhiteSpace() );
+ md->setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+ md->setSText( obj, md_description, eDescription->text() );
+// md->setSText( obj, md_sourcecode, eModule->text() );
+
+ if ( md->objClass(md->parent(obj)) == md_resources )
+  efSort->setChecked( true );
+ if( efSort->isChecked() ) md->setAttr( obj, mda_sort, "1" );
+ else md->setAttr( obj, mda_sort, "0" );
+ if( efPlus->isChecked() ) md->setAttr( obj, mda_plus, "1" );
+ else md->setAttr( obj, mda_plus, "0" );
+ if( efNZ->isChecked() ) md->setAttr( obj, mda_nz, "1" );
+ else md->setAttr( obj, mda_nz, "0" );
+ if( efSum->isChecked() )
+     md->setAttr( obj, mda_sum, "1" );
+ else
+     md->setAttr( obj, mda_sum, "0" );
+ if(eType->currentItem()==0)
+ {
+        st.sprintf(artypes[comboBox2->currentItem()]);
+ }
+ else
+ {
+       st.sprintf( otypes[ eType->currentItem() ], eWidth->value(), eDec->value() );
+       printf("type is %s\n",st.ascii());
+       if ( efSort->isChecked() )
+               st.append(" I");
+ }
+ //printf("%s\n",st.ascii());
+ md->setAttr( obj, mda_type, st );
+}
+
+
+void dEditField::typeSelect( int idx )
+{
+       if ( otypes[ idx ][0] == 'N' )
+       {
+               eWidth->setMaxValue(20);
+               eWidth->show();
+               eDec->setMaxValue(99);
+               eDec->show();
+               tWidth->show();
+               tDec->show();
+               efSum->show();
+               comboBox2->setEnabled(false);
+       }
+       else
+       {
+               if ( otypes[ idx ][0] == 'C' )
+               {
+                       eWidth->setMaxValue(254);
+                       eWidth->show();
+                       eDec->hide();
+                       tWidth->show();
+                       tDec->hide();
+                       efSum->hide();
+                       efSum->setChecked(false);
+                       comboBox2->setEnabled(false);
+               }
+               else
+               {
+                       if( idx == 0)
+                       {
+                               comboBox2->setEnabled(true);
+                               eWidth->hide();
+                               eDec->hide();
+                               tWidth->hide();
+                               tDec->hide();
+                               efSum->hide();
+                               efSum->setChecked(false);
+                       }
+                       else
+                       {
+                               comboBox2->setEnabled(false);
+                               eWidth->hide();
+                               eDec->hide();
+                               tWidth->hide();
+                               tDec->hide();
+                               efSum->hide();
+                               efSum->setChecked(false);
+ // comboBox2->setEnabled(false);
+                       }
+               }
+       }
+}
+
+
+void dEditField::nameChanged()
+{
+       setCaption( tr("Field:") + eName->text() );
+}
+
+
+void dEditField::AARegSelect( int i )
+{
+
+}
diff --git a/src/designer/deditfield.h b/src/designer/deditfield.h
new file mode 100644 (file)
index 0000000..05eed74
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef DEDITFIELD_H
+#define DEDITFIELD_H
+
+#include "ui_deditfield.h"
+
+
+class dEditField : public Q3MainWindow, public Ui::dEditField
+{
+    Q_OBJECT
+
+public:
+    dEditField(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditField();
+
+    QStringList otypes;
+    QStringList artypes;
+    aListViewItem *item;
+    aAliasEditor *al;
+
+public slots:
+    virtual void setData( aListViewItem * o );
+    virtual void updateMD();
+    virtual void typeSelect( int idx );
+    virtual void nameChanged();
+    virtual void AARegSelect( int i );
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    QString capt;
+
+    void destroy();
+    void init();
+
+};
+
+#endif // DEDITFIELD_H
diff --git a/src/designer/deditfield.ui b/src/designer/deditfield.ui
new file mode 100644 (file)
index 0000000..94b4872
--- /dev/null
@@ -0,0 +1,355 @@
+<ui version="4.0" >
+ <class>dEditField</class>
+ <widget class="Q3MainWindow" name="dEditField" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>521</width>
+    <height>403</height>
+   </rect>
+  </property>
+  <property name="minimumSize" >
+   <size>
+    <width>521</width>
+    <height>343</height>
+   </size>
+  </property>
+  <property name="windowTitle" >
+   <string>Field</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>521</width>
+     <height>403</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget" >
+      <property name="font" >
+       <font>
+        <pointsize>10</pointsize>
+       </font>
+      </property>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="2" column="0" >
+         <widget class="QLabel" name="tWidth" >
+          <property name="sizePolicy" >
+           <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text" >
+           <string>Width</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QSpinBox" name="eWidth" >
+            <property name="minimum" >
+             <number>1</number>
+            </property>
+            <property name="maximum" >
+             <number>254</number>
+            </property>
+            <property name="value" >
+             <number>10</number>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="tDec" >
+            <property name="sizePolicy" >
+             <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="text" >
+             <string>Decimals</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QSpinBox" name="eDec" />
+          </item>
+          <item>
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Expanding</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>230</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </item>
+        <item row="1" column="0" >
+         <widget class="QLabel" name="textLabel4" >
+          <property name="sizePolicy" >
+           <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="minimumSize" >
+           <size>
+            <width>80</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="maximumSize" >
+           <size>
+            <width>80</width>
+            <height>32767</height>
+           </size>
+          </property>
+          <property name="text" >
+           <string>Type</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="0" >
+         <widget class="QLabel" name="textLabel1" >
+          <property name="sizePolicy" >
+           <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="minimumSize" >
+           <size>
+            <width>80</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="text" >
+           <string>Name</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1" >
+         <widget class="QLineEdit" name="eName" />
+        </item>
+        <item row="3" column="0" colspan="2" >
+         <widget class="Q3GroupBox" name="groupBox1" >
+          <property name="title" >
+           <string>Flags</string>
+          </property>
+          <layout class="QVBoxLayout" >
+           <item>
+            <widget class="QCheckBox" name="efSort" >
+             <property name="text" >
+              <string>Sort</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QCheckBox" name="efPlus" >
+             <property name="text" >
+              <string>Positive</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QCheckBox" name="efNZ" >
+             <property name="text" >
+              <string>Not null</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QCheckBox" name="efSum" >
+             <property name="text" >
+              <string>Sum</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </item>
+        <item row="1" column="1" >
+         <widget class="QComboBox" name="eType" >
+          <property name="duplicatesEnabled" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="4" column="0" >
+         <widget class="QLabel" name="saldoTextLabel" >
+          <property name="sizePolicy" >
+           <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="text" >
+           <string>Saldo source</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="5" column="0" colspan="2" >
+         <widget class="QComboBox" name="comboBox2" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Description</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3TextEdit" name="eDescription" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Lang</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3GroupBox</class>
+   <extends>QGroupBox</extends>
+   <header>Qt3Support/Q3GroupBox</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >acfg.h</include>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >qseditor.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >mainform.h</include>
+ </includes>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>eType</sender>
+   <signal>activated(int)</signal>
+   <receiver>dEditField</receiver>
+   <slot>typeSelect(int)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>eName</sender>
+   <signal>textChanged(QString)</signal>
+   <receiver>dEditField</receiver>
+   <slot>nameChanged()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>comboBox2</sender>
+   <signal>activated(int)</signal>
+   <receiver>dEditField</receiver>
+   <slot>AARegSelect(int)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/designer/deditimagecollection.cpp b/src/designer/deditimagecollection.cpp
new file mode 100644 (file)
index 0000000..2ecebb0
--- /dev/null
@@ -0,0 +1,49 @@
+#include "deditimagecollection.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+
+/*
+ *  Constructs a dEditImageCollection as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditImageCollection::dEditImageCollection(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditImageCollection::~dEditImageCollection()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditImageCollection::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditImageCollection::init()
+{
+    delete statusBar();
+}
+
+void dEditImageCollection::setData( )
+{
+    //--obj = o;
+
+}
diff --git a/src/designer/deditimagecollection.h b/src/designer/deditimagecollection.h
new file mode 100644 (file)
index 0000000..4a58390
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef DEDITIMAGECOLLECTION_H
+#define DEDITIMAGECOLLECTION_H
+
+#include "ui_deditimagecollection.h"
+
+
+class dEditImageCollection : public Q3MainWindow, public Ui::dEditImageCollection
+{
+    Q_OBJECT
+
+public:
+    dEditImageCollection(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditImageCollection();
+
+    aCfgItem obj;
+
+public slots:
+    virtual void setData();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    void init();
+
+};
+
+#endif // DEDITIMAGECOLLECTION_H
diff --git a/src/designer/deditimagecollection.ui b/src/designer/deditimagecollection.ui
new file mode 100644 (file)
index 0000000..b8c0591
--- /dev/null
@@ -0,0 +1,84 @@
+<ui version="4.0" >
+ <class>dEditImageCollection</class>
+ <widget class="Q3MainWindow" name="dEditImageCollection" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>523</width>
+    <height>320</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Image Collection</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>523</width>
+     <height>320</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="1" >
+     <layout class="QVBoxLayout" >
+      <item>
+       <widget class="QPushButton" name="bAdd" >
+        <property name="text" >
+         <string>Add</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="bRename" >
+        <property name="text" >
+         <string>Rename</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="bDelete" >
+        <property name="text" >
+         <string>Remove</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+    <item row="1" column="1" >
+     <spacer>
+      <property name="orientation" >
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeType" >
+       <enum>QSizePolicy::Expanding</enum>
+      </property>
+      <property name="sizeHint" >
+       <size>
+        <width>31</width>
+        <height>81</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >acfg.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/designer/deditireg.cpp b/src/designer/deditireg.cpp
new file mode 100644 (file)
index 0000000..f36fd36
--- /dev/null
@@ -0,0 +1,85 @@
+#include "deditireg.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+#include "acfg.h"
+
+/*
+ *  Constructs a dEditIReg as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditIReg::dEditIReg(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditIReg::~dEditIReg()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditIReg::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditIReg::init()
+{
+    delete statusBar();
+}
+
+void dEditIReg::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+
+void dEditIReg::setData( aListViewItem *o )
+{
+       item = o;
+       aCfg *md = o->md;
+       aCfgItem obj = o->obj;
+            aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+       al = a;
+       al->setData();
+       setCaption( tr("Information register:") + md->attr( obj, mda_name ) );
+       eName->setText( md->attr( obj, mda_name ) );
+       if(md->attr(obj, mda_no_unconduct)=="1")
+       {
+               checkBox1->setChecked(true);
+       }
+       else
+       {
+               checkBox1->setChecked(false);
+       }
+       eDescription->setText( md->sText( obj, md_description ) );
+}
+
+void dEditIReg::updateMD()
+{
+       aCfg *md = item->md;
+       aCfgItem obj = item->obj;
+
+       al->updateMD();
+       item->setText( 0, eName->text().stripWhiteSpace() );
+       md->setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+       md->setAttr( obj, mda_no_unconduct, checkBox1->isChecked()?"1":"0");
+       md->setSText( obj, md_description, eDescription->text() );
+}
diff --git a/src/designer/deditireg.h b/src/designer/deditireg.h
new file mode 100644 (file)
index 0000000..5fe49c8
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef DEDITIREG_H
+#define DEDITIREG_H
+
+#include "ui_deditireg.h"
+
+
+class dEditIReg : public Q3MainWindow, public Ui::dEditIReg
+{
+    Q_OBJECT
+
+public:
+    dEditIReg(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditIReg();
+
+    aListViewItem *item;
+    aAliasEditor *al;
+
+public slots:
+    virtual void setData( aListViewItem * o );
+    virtual void updateMD();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    void init();
+    void destroy();
+
+};
+
+#endif // DEDITIREG_H
diff --git a/src/designer/deditireg.ui b/src/designer/deditireg.ui
new file mode 100644 (file)
index 0000000..05c2538
--- /dev/null
@@ -0,0 +1,130 @@
+<ui version="4.0" >
+ <class>dEditIReg</class>
+ <widget class="Q3MainWindow" name="dEditIReg" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>447</width>
+    <height>314</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Information register</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>447</width>
+     <height>314</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget2" >
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel1" >
+            <property name="text" >
+             <string>Name:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eName" />
+          </item>
+         </layout>
+        </item>
+        <item row="3" column="0" >
+         <widget class="Q3TextEdit" name="eDescription" />
+        </item>
+        <item row="2" column="0" >
+         <widget class="QLabel" name="textLabel2" >
+          <property name="text" >
+           <string>Description:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0" >
+         <widget class="QCheckBox" name="checkBox1" >
+          <property name="text" >
+           <string>Don't delete record in unconduct</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Lang</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >mainform.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/designer/deditjournal.cpp b/src/designer/deditjournal.cpp
new file mode 100644 (file)
index 0000000..75a4c71
--- /dev/null
@@ -0,0 +1,197 @@
+#include "deditjournal.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+#include "acfg.h"
+
+/*
+ *  Constructs a dEditJournal as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditJournal::dEditJournal(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditJournal::~dEditJournal()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditJournal::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditJournal::setData( aListViewItem *o )
+{
+    item = o;
+    md = o->md;
+    obj = o->obj;
+    aCfgItem cobj, doc, docs;
+    int i, j, n;
+    aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+    al = a;
+    al->setData();
+    aRoleEditor *r = new aRoleEditor( md, obj, tRoles, md_journal );
+    re = r;
+    re->setData();
+    setCaption( tr("Journal:") + md->attr( obj, mda_name ) );
+    eName->setText( md->attr( obj, mda_name ) );
+    eDescription->setText( md->sText( obj, md_description ) );
+
+    i = md->attr ( obj, mda_type ).toInt();
+    cbType-> setCurrentItem(i);
+
+    journalDocs = new ananasTreeView( tabWidget18->page(2),  md  );
+    journalDocs->setSorting( -1 );
+    // TODO Fix me!!!
+    //--layout28->addWidget( journalDocs, 0, 0 );
+    n = md->count( obj, md_used_doc );
+    for ( j = 0; j < n; j++ )
+    {
+       cobj = md->find( obj, md_used_doc, j );
+       if ( cobj.isNull() )
+           continue;
+//             did = md->text(cobj).toLong();
+       doc = md->find(md->text(cobj).toLong());
+       if ( doc.isNull() )
+           md->remove(cobj);
+       else
+           new ananasListViewItem( journalDocs, journalDocs->lastItem(), md, doc );
+    }
+
+    allDocs = new ananasTreeView( tabWidget18->page(2),  md  );
+    allDocs->setSorting( -1 );
+    // TODO Fix me!!!
+    //--layout29->add( allDocs );
+    docs = md->find(md->find(mdc_metadata),md_documents,0);
+    n = md->count( docs, md_document );
+    for ( j = 0; j < n; j++ )
+    {
+       cobj = md->find( docs, md_document, j );
+       if ( cobj.isNull() )
+           return;
+       //              did = md->id(cobj);
+       doc = md->find(md->id(cobj));
+       new ananasListViewItem( allDocs, allDocs->lastItem(), md, doc );
+    }
+    docPage = tabWidget18->page(2);
+    if ( cbType->currentItem() != 1 )
+       typeChange();
+}
+
+
+void dEditJournal::init()
+{
+    statusBar()->hide();
+}
+
+
+void dEditJournal::updateMD()
+{
+    aCfgItem doc, docs;
+    int i;
+
+    al->updateMD();
+    re->updateMD();
+    item->setText( 0, eName->text().stripWhiteSpace() );
+    md->setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+    md->setSText( obj, md_description, eDescription->text() );
+    md->setAttr( obj, mda_type, cbType->currentItem() );
+    docs = md->find(obj,md_columns,0);
+    do
+    {
+       doc = md->findChild( docs, md_used_doc, 0 );
+       if ( !doc.isNull() )
+           md->remove( doc );
+    } while ( !doc.isNull() );
+    if ( cbType->currentItem() != 1 )
+       return;
+    ananasListViewItem *aitem = (ananasListViewItem *)journalDocs->firstChild();
+    for ( i = 0; i < journalDocs->childCount(); i++ )
+    {
+       doc = md->insert( docs, md_used_doc, QString::null, -1 );
+       md->setText( doc, QString( "%1" ).arg( aitem->id ) );
+       aitem = (ananasListViewItem *)aitem->nextSibling();
+    }
+
+}
+
+void dEditJournal::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+
+
+
+
+void dEditJournal::typeChange()
+{
+    if ( cbType->currentItem() != 1 )
+       tabWidget18->removePage(tabWidget18->page(2));
+    else
+       tabWidget18->insertTab(docPage,QObject::tr("Documents"));
+}
+
+
+void dEditJournal::addDoc()
+{
+    ananasListViewItem *cur = (ananasListViewItem *)allDocs->selectedItem();
+    if (!cur)
+       return;
+    if ( md->objClass( cur->obj ) != md_document )
+       return;
+    new ananasListViewItem(journalDocs, journalDocs->lastItem(), md, cur->obj );
+}
+
+
+void dEditJournal::removeDoc()
+{
+    journalDocs->removeItem( journalDocs->selectedItem() );
+}
+
+
+void dEditJournal::moveUp()
+{
+    ananasListViewItem *aitem, *after;
+
+    aitem = (ananasListViewItem *) journalDocs->selectedItem();
+    if ( aitem )
+    {
+       after = (ananasListViewItem *)aitem->itemAbove();
+       if ( after )
+           after->moveItem( aitem );
+    }
+}
+
+
+void dEditJournal::moveDown()
+{
+    ananasListViewItem *aitem, *after;
+    aitem = (ananasListViewItem *)journalDocs->selectedItem();
+    if ( aitem )
+    {
+       after = (ananasListViewItem *)aitem->itemBelow();
+       if ( after )
+           aitem->moveItem( after );
+    }
+}
diff --git a/src/designer/deditjournal.h b/src/designer/deditjournal.h
new file mode 100644 (file)
index 0000000..15c4b1a
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef DEDITJOURNAL_H
+#define DEDITJOURNAL_H
+
+#include "ui_deditjournal.h"
+
+
+class dEditJournal : public Q3MainWindow, public Ui::dEditJournal
+{
+    Q_OBJECT
+
+public:
+    dEditJournal(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditJournal();
+
+    aListViewItem *item;
+    aAliasEditor *al;
+    ananasTreeView * journalDocs;
+    ananasTreeView * allDocs;
+    aCfg *md;
+    aCfgItem obj;
+    QWidget * docPage;
+    aRoleEditor *re;
+
+public slots:
+    virtual void setData( aListViewItem * o );
+    virtual void updateMD();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    void init();
+    void destroy();
+
+private slots:
+    virtual void typeChange();
+    virtual void addDoc();
+    virtual void removeDoc();
+    virtual void moveUp();
+    virtual void moveDown();
+
+};
+
+#endif // DEDITJOURNAL_H
diff --git a/src/designer/deditjournal.ui b/src/designer/deditjournal.ui
new file mode 100644 (file)
index 0000000..4f02d90
--- /dev/null
@@ -0,0 +1,398 @@
+<ui version="4.0" >
+ <class>dEditJournal</class>
+ <widget class="Q3MainWindow" name="dEditJournal" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>503</width>
+    <height>328</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Journal</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>503</width>
+     <height>328</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget18" >
+      <property name="sizePolicy" >
+       <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel3" >
+            <property name="text" >
+             <string>Name:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eName" />
+          </item>
+         </layout>
+        </item>
+        <item row="3" column="0" >
+         <widget class="Q3TextEdit" name="eDescription" />
+        </item>
+        <item row="1" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="lType" >
+            <property name="text" >
+             <string>Type:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QComboBox" name="cbType" >
+            <item>
+             <property name="text" >
+              <string>Common</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>Special</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>Othes</string>
+             </property>
+            </item>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item row="2" column="0" >
+         <widget class="QLabel" name="textLabel4" >
+          <property name="text" >
+           <string>Description:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>0</number>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Documents</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <layout class="QHBoxLayout" />
+          </item>
+          <item>
+           <layout class="QVBoxLayout" >
+            <item>
+             <spacer>
+              <property name="orientation" >
+               <enum>Qt::Vertical</enum>
+              </property>
+              <property name="sizeType" >
+               <enum>QSizePolicy::Expanding</enum>
+              </property>
+              <property name="sizeHint" >
+               <size>
+                <width>20</width>
+                <height>40</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bAddDoc" >
+              <property name="sizePolicy" >
+               <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bRemoveDoc" >
+              <property name="sizePolicy" >
+               <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bMoveUp" >
+              <property name="sizePolicy" >
+               <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bMoveDown" >
+              <property name="sizePolicy" >
+               <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer>
+              <property name="orientation" >
+               <enum>Qt::Vertical</enum>
+              </property>
+              <property name="sizeType" >
+               <enum>QSizePolicy::Expanding</enum>
+              </property>
+              <property name="sizeHint" >
+               <size>
+                <width>20</width>
+                <height>56</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Access</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tRoles" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <property name="showGrid" >
+           <bool>false</bool>
+          </property>
+          <property name="selectionMode" >
+           <enum>Q3Table::Multi</enum>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Read</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Write</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <action name="Action" >
+   <property name="iconText" >
+    <string>Action</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>Action</string>
+   </property>
+  </action>
+  <action name="Action_2" >
+   <property name="iconText" >
+    <string>Action_2</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>Action_2</string>
+   </property>
+  </action>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >atreeitems.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >mainform.h</include>
+  <include location="local" >roleeditor.h</include>
+ </includes>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>cbType</sender>
+   <signal>activated(int)</signal>
+   <receiver>dEditJournal</receiver>
+   <slot>typeChange()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bAddDoc</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditJournal</receiver>
+   <slot>addDoc()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bRemoveDoc</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditJournal</receiver>
+   <slot>removeDoc()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bMoveUp</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditJournal</receiver>
+   <slot>moveUp()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>bMoveDown</sender>
+   <signal>clicked()</signal>
+   <receiver>dEditJournal</receiver>
+   <slot>moveDown()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/designer/deditlang.cpp b/src/designer/deditlang.cpp
new file mode 100644 (file)
index 0000000..5d63ef3
--- /dev/null
@@ -0,0 +1,78 @@
+#include "deditlang.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "acfg.h"
+#include <qstatusbar.h>
+#include <qmessagebox.h>
+
+/*
+ *  Constructs a dEditLang as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditLang::dEditLang(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditLang::~dEditLang()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditLang::languageChange()
+{
+    retranslateUi(this);
+}
+
+extern aCfg cfg;
+
+void dEditLang::setData( CfgForm *c, aCfgItem o )
+{
+//    aCfgItem alias;
+//    int i, n, count;
+
+    cf = c;
+    obj = o;
+
+    setCaption( tr("Language:") + cf->cfg.attr( obj, mda_name ) );
+    eTag->setText( cf->cfg.attr( obj, mda_tag ) );
+    eName->setText( cf->cfg.attr( obj, mda_name ) );
+    eTrFile->setText( cf->cfg.attr( obj, mda_trfile ) );
+}
+
+void dEditLang::init()
+{
+    delete statusBar();
+}
+
+void dEditLang::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+void
+dEditLang::updateMD()
+{
+    cf->cfg.setAttr( obj, mda_tag, eTag->text() );
+    cf->cfg.setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+    cf->cfg.setAttr( obj, mda_trfile, eTrFile->text() );
+    cf->initLang();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+}
+
diff --git a/src/designer/deditlang.h b/src/designer/deditlang.h
new file mode 100644 (file)
index 0000000..27c5ec2
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef DEDITLANG_H
+#define DEDITLANG_H
+
+#include "ui_deditlang.h"
+
+
+class dEditLang : public Q3MainWindow, public Ui::dEditLang
+{
+    Q_OBJECT
+
+public:
+    dEditLang(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditLang();
+
+public slots:
+    virtual void setData( CfgForm * c, aCfgItem o );
+    virtual void updateMD();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    aCfgItem obj;
+    int langCount;
+    CfgForm *cf;
+
+    void init();
+    void destroy();
+
+};
+
+#endif // DEDITLANG_H
diff --git a/src/designer/deditlang.ui b/src/designer/deditlang.ui
new file mode 100644 (file)
index 0000000..11e1753
--- /dev/null
@@ -0,0 +1,123 @@
+<ui version="4.0" >
+ <class>dEditLang</class>
+ <widget class="Q3MainWindow" name="dEditLang" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>299</width>
+    <height>185</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Language</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>299</width>
+     <height>185</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget11" >
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <layout class="QVBoxLayout" >
+            <item>
+             <widget class="QLabel" name="textLabel1" >
+              <property name="text" >
+               <string>Tag:</string>
+              </property>
+              <property name="wordWrap" >
+               <bool>false</bool>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="textLabel2" >
+              <property name="text" >
+               <string>Name:</string>
+              </property>
+              <property name="wordWrap" >
+               <bool>false</bool>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="textLabel3" >
+              <property name="text" >
+               <string>Translation file:</string>
+              </property>
+              <property name="wordWrap" >
+               <bool>false</bool>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <layout class="QVBoxLayout" >
+            <item>
+             <widget class="QLineEdit" name="eTag" />
+            </item>
+            <item>
+             <widget class="QLineEdit" name="eName" />
+            </item>
+            <item>
+             <widget class="QLineEdit" name="eTrFile" />
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </item>
+        <item row="1" column="0" >
+         <spacer>
+          <property name="orientation" >
+           <enum>Qt::Vertical</enum>
+          </property>
+          <property name="sizeType" >
+           <enum>QSizePolicy::Expanding</enum>
+          </property>
+          <property name="sizeHint" >
+           <size>
+            <width>21</width>
+            <height>141</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >cfgform.h</include>
+  <include location="local" >mainform.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/designer/deditreport.cpp b/src/designer/deditreport.cpp
new file mode 100644 (file)
index 0000000..d500557
--- /dev/null
@@ -0,0 +1,83 @@
+#include "deditreport.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+#include "acfg.h"
+#include <qsinterpreter.h>
+#include <qseditor.h>
+
+/*
+ *  Constructs a dEditReport as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditReport::dEditReport(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditReport::~dEditReport()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditReport::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditReport::setData( aListViewItem *o )
+{
+       item = o;
+       aCfg *md = o->md;
+       aCfgItem obj = o->obj;
+            aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+       al = a;
+       al->setData();
+       setCaption( tr("Report:") + md->attr( obj, mda_name ) );
+       eName->setText( md->attr( obj, mda_name ) );
+       eDescription->setText( md->sText( obj, md_description ) );
+       eModule->setText( md->sText( obj, md_sourcecode ) );
+}
+
+
+void dEditReport::init()
+{
+       delete statusBar();
+       eModule->setInterpreter(new QSInterpreter());
+}
+
+
+void dEditReport::updateMD()
+{
+       aCfg *md = item->md;
+       aCfgItem obj = item->obj;
+
+       al->updateMD();
+       item->setText( 0, eName->text().stripWhiteSpace() );
+       md->setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+       md->setSText( obj, md_description, eDescription->text() );
+       md->setSText( obj, md_sourcecode, eModule->text() );
+}
+
+void dEditReport::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
diff --git a/src/designer/deditreport.h b/src/designer/deditreport.h
new file mode 100644 (file)
index 0000000..e4a5103
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef DEDITREPORT_H
+#define DEDITREPORT_H
+
+#include "ui_deditreport.h"
+
+
+class dEditReport : public Q3MainWindow, public Ui::dEditReport
+{
+    Q_OBJECT
+
+public:
+    dEditReport(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditReport();
+
+    aListViewItem *item;
+    aAliasEditor *al;
+
+public slots:
+    virtual void setData( aListViewItem * o );
+    virtual void updateMD();
+
+protected slots:
+    virtual void languageChange();
+
+    virtual void init();
+    virtual void destroy();
+
+
+};
+
+#endif // DEDITREPORT_H
diff --git a/src/designer/deditreport.ui b/src/designer/deditreport.ui
new file mode 100644 (file)
index 0000000..646975f
--- /dev/null
@@ -0,0 +1,142 @@
+<ui version="4.0" >
+ <class>dEditReport</class>
+ <widget class="Q3MainWindow" name="dEditReport" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>447</width>
+    <height>313</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Report</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>447</width>
+     <height>313</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget2" >
+      <property name="font" >
+       <font/>
+      </property>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QVBoxLayout" >
+        <item>
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel2" >
+            <property name="text" >
+             <string>Name:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eName" />
+          </item>
+         </layout>
+        </item>
+        <item>
+         <widget class="QLabel" name="textLabel7" >
+          <property name="text" >
+           <string>Description:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="Q3TextEdit" name="eDescription" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Module</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="QSEditor" native="1" name="eModule" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Lang</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QSEditor</class>
+   <extends>QWidget</extends>
+   <header>qseditor.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >mainform.h</include>
+  <include location="local" >qseditor.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/designer/deditrole.cpp b/src/designer/deditrole.cpp
new file mode 100644 (file)
index 0000000..6c350e9
--- /dev/null
@@ -0,0 +1,76 @@
+#include "deditrole.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "acfg.h"
+#include <qstatusbar.h>
+#include <qmessagebox.h>
+
+/*
+ *  Constructs a dEditRole as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditRole::dEditRole(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditRole::~dEditRole()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditRole::languageChange()
+{
+    retranslateUi(this);
+}
+
+extern aCfg cfg;
+
+void dEditRole::setData( CfgForm *c, aCfgItem o )
+{
+//    aCfgItem alias;
+//    int i, n, count;
+
+    cf = c;
+    obj = o;
+
+    setCaption( tr("Role:") + cf->cfg.attr( obj, mda_name ) );
+    eName->setText( cf->cfg.attr( obj, mda_name ) );
+    eDescription->setText( cf->cfg.sText( obj, md_description ) );
+}
+
+void dEditRole::init()
+{
+    delete statusBar();
+}
+
+void dEditRole::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+void
+dEditRole::updateMD()
+{
+    cf->cfg.setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+    cf->cfg.setSText( obj, md_description, eDescription->text() );
+    cf->initRoles();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+}
+
diff --git a/src/designer/deditrole.h b/src/designer/deditrole.h
new file mode 100644 (file)
index 0000000..50d2c7e
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef DEDITROLE_H
+#define DEDITROLE_H
+
+#include "ui_deditrole.h"
+
+
+class dEditRole : public Q3MainWindow, public Ui::dEditRole
+{
+    Q_OBJECT
+
+public:
+    dEditRole(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditRole();
+
+public slots:
+    virtual void setData( CfgForm * c, aCfgItem o );
+    virtual void updateMD();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    aCfgItem obj;
+    CfgForm *cf;
+    int roleCount;
+
+    void init();
+    void destroy();
+
+};
+
+#endif // DEDITROLE_H
diff --git a/src/designer/deditrole.ui b/src/designer/deditrole.ui
new file mode 100644 (file)
index 0000000..0c53f93
--- /dev/null
@@ -0,0 +1,91 @@
+<ui version="4.0" >
+ <class>dEditRole</class>
+ <widget class="Q3MainWindow" name="dEditRole" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>365</width>
+    <height>198</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Role</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>365</width>
+     <height>198</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget7" >
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="1" column="0" >
+         <widget class="QLabel" name="textLabel2" >
+          <property name="text" >
+           <string>Description:</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel1" >
+            <property name="text" >
+             <string>Name:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eName" />
+          </item>
+         </layout>
+        </item>
+        <item row="2" column="0" >
+         <widget class="Q3TextEdit" name="eDescription" />
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >cfgform.h</include>
+  <include location="local" >mainform.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/designer/dedittoolbar.cpp b/src/designer/dedittoolbar.cpp
new file mode 100644 (file)
index 0000000..7fe2e26
--- /dev/null
@@ -0,0 +1,228 @@
+#include "dedittoolbar.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+#include <q3header.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include "acfg.h"
+
+//extern aCfg cfg;
+
+/*
+ *  Constructs a dEditToolbar as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditToolbar::dEditToolbar(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditToolbar::~dEditToolbar()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditToolbar::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditToolbar::updateMD()
+{
+    int i;
+    aCfgItem com_action, apix;
+    al->updateMD( );
+    QPixmap pix;
+
+    item->setText( 0, eName->text().stripWhiteSpace() );
+    md->setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+    md->setSText( obj, md_description, eDescription->text() );
+//    md->setSText( obj, md_menutext, eMenuText->text() );
+
+    QString sKey = "";
+    if ( cbKey-> currentText () != "" )
+    {
+       if ( cbCTRL->isChecked() )
+           sKey += md_km_ctrl;
+       if ( cbALT->isChecked() )
+           sKey += md_km_alt;
+       if ( cbShift->isChecked() )
+           sKey += md_km_shift;
+       sKey += cbKey->currentText ();
+    }
+    md->setSText( obj, md_key, sKey );
+
+    do
+       {
+               com_action = md->findChild( obj, md_comaction, 0 );
+               if ( !com_action.isNull() )
+                        md->remove( com_action );
+    } while ( !com_action.isNull() );
+    ananasListViewItem *aitem = (ananasListViewItem *)vComActions->firstChild();
+    for ( i = 0; i < vComActions->childCount(); i++ )
+       {
+               com_action = md->insert( obj, md_comaction, QString::null, -1 );
+               md->setText( com_action, QString( "%1" ).arg( aitem->id ) );
+               aitem = (ananasListViewItem *)aitem->nextSibling();
+    }
+    aitem = (ananasListViewItem *)vComActions->firstChild();
+    apix = md->findChild( md->find( aitem->id ), md_active_picture, 0 );
+       if ( apix.isNull() )
+               return;
+    pix.loadFromData( md->binary( apix ) );
+    item->setPixmap( 0, pix );
+}
+
+void dEditToolbar::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+}
+
+void dEditToolbar::init()
+{
+    statusBar()->hide();
+}
+
+void dEditToolbar::setData( InterfaceListViewItem * o )
+{
+    int i, j, n, k, id;
+    item = o;
+    md = o->md;
+    obj = o->obj;
+    aCfgItem  com_action, apix;
+    aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+    QPixmap pix;
+
+    vComActions = new ananasTreeView( tabWidget2->page(1),  md );
+    vComActions->setSorting( -1 );
+    // TODO Fix me!!!
+    //--layout28->addWidget( vComActions, 0, 0 );
+    actiontree = new aActionTreeView ( tabWidget2->page(1),  md );
+    disconnect( actiontree, SIGNAL( contextMenuRequested( Q3ListViewItem*, const QPoint&, int) ), actiontree, SLOT(ContextMenu() ) );
+    disconnect( actiontree, SIGNAL( returnPressed( Q3ListViewItem*) ), actiontree, SLOT( itemEdit() ) );
+    disconnect( actiontree, SIGNAL( doubleClicked( Q3ListViewItem*) ), actiontree, SLOT( itemEdit() ) );
+    // TODO Fix me!!!
+    //--layout29->addWidget( actiontree, 0, 0 );
+
+    al = a;
+    al->setData();
+
+    setCaption( tr("Command:") + md->attr( obj, mda_name ) );
+    eName->setText( md->attr( obj, mda_name ) );
+//    eMenuText->setText( md->sText( obj, md_menutext ) );
+    eDescription->setText( md->sText( obj, md_description ) );
+
+    QString sKey = md->sText( obj, md_key );
+       if ( ( sKey.find (md_km_ctrl) ) >= 0 )
+       {
+               cbCTRL->setChecked ( TRUE );
+               sKey.remove(md_km_ctrl);
+       }
+       if ( ( sKey.find (md_km_alt) ) >= 0 )
+       {
+               cbALT->setChecked ( TRUE );
+               sKey.remove(md_km_alt);
+       }
+       if ( ( sKey.find (md_km_shift) ) >= 0 )
+       {
+               cbShift->setChecked ( TRUE );
+               sKey.remove(md_km_shift);
+       }
+
+
+       n = cbKey->count();
+       for ( i = 0; i < n; i++ )
+               if ( sKey == cbKey->text( i ) )
+               {
+                       cbKey->setCurrentItem( i );
+                       break;
+               }
+    n = md->countChild( obj, md_comaction );
+       k = md->count( md->find ( mdc_actions ), md_action );
+       ananasListViewItem *aitem;
+       for ( i = 0; i < n; i++ )
+       {
+               id = md->text(( md->find (obj, md_comaction, i))).toInt();
+               for ( j = 0; j < k; j++)
+               {
+                       com_action = md->find ( md->find( mdc_actions ), md_action, j  );
+                       if ( md->id(com_action) == id )
+                       {
+                               aitem = new ananasListViewItem (vComActions, vComActions->lastItem(), md, com_action);
+                               aitem->setRenameEnabled( 0, FALSE );
+                               apix = md->findChild( md->find( aitem->id ), md_active_picture, 0 );
+                               if ( apix.isNull() )
+                                       break;
+                               pix.loadFromData( md->binary( apix ) );
+                               aitem->setPixmap( 0, pix );
+                       }
+               }
+    }
+}
+
+
+void
+dEditToolbar::bAddAction_clicked()
+{
+    aCfgItem apix;
+    QPixmap pix;
+
+    ananasListViewItem *cur = (ananasListViewItem *)actiontree->selectedItem();
+       if (!cur)
+               return;
+       if ( md->objClass( cur->obj ) != md_action )
+               return;
+       ananasListViewItem *aitem = new ananasListViewItem(vComActions, vComActions->lastItem(), md, cur->obj );
+       apix = md->findChild( md->find( aitem->id ), md_active_picture, 0 );
+       pix.loadFromData( md->binary( apix ) );
+       aitem->setPixmap( 0, pix );
+}
+
+
+void dEditToolbar::bRemoveAction_clicked()
+{
+       vComActions->removeItem( vComActions->selectedItem() );
+}
+
+
+void dEditToolbar::bMoveUp_clicked()
+{
+    ananasListViewItem *aitem, *after;
+
+    aitem = (ananasListViewItem *) vComActions->selectedItem();
+    if ( aitem ) {
+       after = (ananasListViewItem *)aitem->itemAbove();
+       if ( after ) after->moveItem( aitem );
+    }
+
+}
+
+
+void dEditToolbar::bMoveDown_clicked()
+{
+    ananasListViewItem *aitem, *after;
+    aitem = (ananasListViewItem *)vComActions->selectedItem();
+    if ( aitem ) {
+       after = (ananasListViewItem *)aitem->itemBelow();
+       if ( after ) aitem->moveItem( after );
+    }
+}
diff --git a/src/designer/dedittoolbar.h b/src/designer/dedittoolbar.h
new file mode 100644 (file)
index 0000000..fb65eab
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DEDITTOOLBAR_H
+#define DEDITTOOLBAR_H
+
+#include "ui_dedittoolbar.h"
+
+
+class dEditToolbar : public Q3MainWindow, public Ui::dEditToolbar
+{
+    Q_OBJECT
+
+public:
+    dEditToolbar(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditToolbar();
+
+    ananasTreeView *vComActions;
+    aAliasEditor *al;
+    InterfaceListViewItem *item;
+    aActionTreeView *actiontree;
+    aCfg *md;
+    aCfgItem obj;
+
+public slots:
+    virtual void updateMD();
+    virtual void setData( InterfaceListViewItem * o );
+    virtual void bAddAction_clicked();
+    virtual void bRemoveAction_clicked();
+    virtual void bMoveUp_clicked();
+    virtual void bMoveDown_clicked();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    void destroy();
+    void init();
+
+};
+
+#endif // DEDITTOOLBAR_H
diff --git a/src/designer/dedittoolbar.ui b/src/designer/dedittoolbar.ui
new file mode 100644 (file)
index 0000000..5726b59
--- /dev/null
@@ -0,0 +1,503 @@
+<ui version="4.0" >
+ <class>dEditToolbar</class>
+ <widget class="Q3MainWindow" name="dEditToolbar" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>570</width>
+    <height>321</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form1</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>570</width>
+     <height>321</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget2" >
+      <property name="font" >
+       <font/>
+      </property>
+      <property name="tabShape" >
+       <enum>QTabWidget::Rounded</enum>
+      </property>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="2" column="0" >
+         <layout class="QVBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel5" >
+            <property name="text" >
+             <string>Description:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="Q3TextEdit" name="eDescription" />
+          </item>
+         </layout>
+        </item>
+        <item row="1" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="lHotKey" >
+            <property name="text" >
+             <string>Hot Key:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="cbCTRL" >
+            <property name="text" >
+             <string>Ctrl</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="cbALT" >
+            <property name="text" >
+             <string>Alt</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="cbShift" >
+            <property name="text" >
+             <string>Shift</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QComboBox" name="cbKey" >
+            <item>
+             <property name="text" >
+              <string/>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>1</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>2</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>3</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>4</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>5</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>6</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>7</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>8</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>9</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>0</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>A</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>B</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>C</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>D</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>E</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>F</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>G</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>H</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>I</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>J</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>K</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>L</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>M</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>N</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>O</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>P</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>Q</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>R</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>S</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>T</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>U</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>V</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>W</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>X</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>Y</string>
+             </property>
+            </item>
+            <item>
+             <property name="text" >
+              <string>Z</string>
+             </property>
+            </item>
+           </widget>
+          </item>
+          <item>
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Expanding</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>71</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </item>
+        <item row="0" column="0" >
+         <layout class="QGridLayout" >
+          <item row="2" column="0" >
+           <widget class="QLabel" name="textLabel2" >
+            <property name="text" >
+             <string>Type:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1" >
+           <widget class="QComboBox" name="eType" />
+          </item>
+          <item row="2" column="2" >
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Expanding</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>51</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item row="0" column="0" >
+           <widget class="QLabel" name="textLabel1" >
+            <property name="text" >
+             <string>Name:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1" colspan="2" >
+           <widget class="QLineEdit" name="eName" >
+            <property name="enabled" >
+             <bool>true</bool>
+            </property>
+            <property name="minimumSize" >
+             <size>
+              <width>0</width>
+              <height>22</height>
+             </size>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Actions</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <layout class="QGridLayout" />
+          </item>
+          <item>
+           <layout class="QVBoxLayout" >
+            <item>
+             <spacer>
+              <property name="orientation" >
+               <enum>Qt::Vertical</enum>
+              </property>
+              <property name="sizeType" >
+               <enum>QSizePolicy::Expanding</enum>
+              </property>
+              <property name="sizeHint" >
+               <size>
+                <width>20</width>
+                <height>44</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bAddAction" >
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bRemoveAction" >
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bMoveUp" >
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="bMoveDown" >
+              <property name="text" >
+               <string/>
+              </property>
+              <property name="icon" >
+               <iconset/>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer>
+              <property name="orientation" >
+               <enum>Qt::Vertical</enum>
+              </property>
+              <property name="sizeType" >
+               <enum>QSizePolicy::Expanding</enum>
+              </property>
+              <property name="sizeHint" >
+               <size>
+                <width>21</width>
+                <height>44</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>2</number>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Lang</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >actiontree.h</include>
+  <include location="local" >interfacetree.h</include>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >mainform.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/designer/deditwebform.cpp b/src/designer/deditwebform.cpp
new file mode 100644 (file)
index 0000000..5339192
--- /dev/null
@@ -0,0 +1,89 @@
+#include "deditwebform.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qstatusbar.h>
+#include "acfg.h"
+#include <qsinterpreter.h>
+#include <qseditor.h>
+
+/*
+ *  Constructs a dEditWebForm as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+dEditWebForm::dEditWebForm(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditWebForm::~dEditWebForm()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditWebForm::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dEditWebForm::init()
+{
+       delete statusBar();
+       eServerModule->setInterpreter(new QSInterpreter());
+       eClientModule->setInterpreter(new QSInterpreter());
+}
+
+void dEditWebForm::destroy()
+{
+    updateMD();
+    ( (MainForm*)this->topLevelWidget() )->wl->remove( this );
+    ( (MainForm*)this->topLevelWidget() )->removeTab(name());
+    item->editor = 0;
+}
+
+
+void dEditWebForm::setData( aListViewItem *o )
+{
+       item = o;
+       aCfg *md = o->md;
+       aCfgItem obj = o->obj;
+
+       aAliasEditor *a = new aAliasEditor( md, obj, tAliases );
+       al = a;
+       al->setData();
+       setCaption( tr("Web form:") + md->attr( obj, mda_name ) );
+       eName->setText( md->attr( obj, mda_name ) );
+       eDescription->setText( md->sText( obj, md_description ) );
+       eServerModule->setText( md->sText( obj, md_servermodule ) );
+       eClientModule->setText( md->sText( obj, md_clientmodule ) );
+       eFormSource->setText( md->sText( obj, md_formsource ) );
+}
+
+void dEditWebForm::updateMD()
+{
+       aCfg *md = item->md;
+       aCfgItem obj = item->obj;
+
+       al->updateMD( );
+       item->setText( 0, eName->text().stripWhiteSpace() );
+       md->setAttr( obj, mda_name, eName->text().stripWhiteSpace() );
+       md->setSText( obj, md_description, eDescription->text() );
+       md->setSText( obj, md_servermodule, eServerModule->text() );
+       md->setSText( obj, md_clientmodule, eClientModule->text() );
+       md->setSText( obj, md_formsource, eFormSource->text() );
+}
diff --git a/src/designer/deditwebform.h b/src/designer/deditwebform.h
new file mode 100644 (file)
index 0000000..7a3000e
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef DEDITWEBFORM_H
+#define DEDITWEBFORM_H
+
+#include "ui_deditwebform.h"
+
+
+class dEditWebForm : public Q3MainWindow, public Ui::dEditWebForm
+{
+    Q_OBJECT
+
+public:
+    dEditWebForm(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~dEditWebForm();
+
+    aAliasEditor *al;
+    aListViewItem *item;
+
+public slots:
+    virtual void setData( aListViewItem * o );
+    virtual void updateMD();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    void init();
+    void destroy();
+
+};
+
+#endif // DEDITWEBFORM_H
diff --git a/src/designer/deditwebform.ui b/src/designer/deditwebform.ui
new file mode 100644 (file)
index 0000000..b95aaaa
--- /dev/null
@@ -0,0 +1,154 @@
+<ui version="4.0" >
+ <class>dEditWebForm</class>
+ <widget class="Q3MainWindow" name="dEditWebForm" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>445</width>
+    <height>328</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Web Form</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>445</width>
+     <height>328</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" >
+    <item row="0" column="0" >
+     <widget class="QTabWidget" name="tabWidget10" >
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Common</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="1" column="0" >
+         <widget class="QLabel" name="textLabel2" >
+          <property name="text" >
+           <string>Description</string>
+          </property>
+          <property name="wordWrap" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="0" >
+         <widget class="Q3TextEdit" name="eDescription" />
+        </item>
+        <item row="0" column="0" >
+         <layout class="QHBoxLayout" >
+          <item>
+           <widget class="QLabel" name="textLabel1" >
+            <property name="text" >
+             <string>Name:</string>
+            </property>
+            <property name="wordWrap" >
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="eName" />
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Form editor</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3TextEdit" name="eFormSource" >
+          <property name="textFormat" >
+           <enum>Qt::PlainText</enum>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tab" >
+       <attribute name="title" >
+        <string>Client module</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="QSEditor" native="1" name="eClientModule" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Server module</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="QSEditor" native="1" name="eServerModule" />
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="TabPage" >
+       <attribute name="title" >
+        <string>Aliases</string>
+       </attribute>
+       <layout class="QGridLayout" >
+        <item row="0" column="0" >
+         <widget class="Q3Table" name="tAliases" >
+          <property name="numRows" >
+           <number>0</number>
+          </property>
+          <property name="numCols" >
+           <number>0</number>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>rcIcon</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>Q3Table</class>
+   <extends>Q3Frame</extends>
+   <header>q3table.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3TextEdit</class>
+   <extends>Q3Frame</extends>
+   <header>q3textedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QSEditor</class>
+   <extends>QWidget</extends>
+   <header>qseditor.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >aliaseditor.h</include>
+  <include location="local" >mdtree.h</include>
+  <include location="local" >mainform.h</include>
+  <include location="local" >qseditor.h</include>
+  <include location="local" >qseditor.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/designer/designer.pro b/src/designer/designer.pro
new file mode 100644 (file)
index 0000000..ca9006f
--- /dev/null
@@ -0,0 +1,182 @@
+include(../plugins/plugins.pri)
+include(../lib/lib.pri)
+TARGET = ananas4-designer
+TEMPLATE = app
+
+CONFIG += designer
+
+DESTDIR = ../../bin
+
+INCLUDEPATH += . ./formdesigner ../lib ../../tmp/ui/ananas ../plugins
+LIBS += -L../../lib -lananas4 -L../../lib/designer -lananasplugin4 -lqt4-qdataschema
+unix {
+    #LIBS += -L$(QTINC)/QtDesigner
+    LIBS += -lQtDesignerComponents
+#    LIBS += -lqt4designer
+}
+win32{
+    LIBS += -lQtDesignerComponents4
+}
+
+MOC_DIR = ../../tmp/moc/$$TARGET
+OBJECTS_DIR = ../../tmp/obj/$$TARGET
+UI_DIR = ../../tmp/ui/$$TARGET
+
+#LIBS  += -L../lib -L../plugins -lananas -lananasplugin -lqsa -ldesignercore -lqassistantclient
+#LIBS  += -L. -L../lib -L../plugins -lananas -lananasplugin -lqsa -lformdesigner -lqassistantclient
+#INCLUDEPATH   += ../lib ../lib/tmp/ui ../lib/.ui $(QTDIR)/tools/designer/designer ../../qt-headers/tools/designer/designer /usr/lib
+#INCLUDEPATH   += ../lib ../lib/tmp/ui ../lib/.ui ./formdesigner /usr/lib
+
+include ( ../ananas.pri )
+load(qsa)
+
+HEADERS        = \
+    actiontree.h \
+    aliaseditor.h \
+    atreeitems.h \
+    cfgform.h \
+#    cfgform.ui.h \
+    deditaction.h \
+#    deditaction.ui.h \
+    deditareg.h \
+#    deditareg.ui.h \
+    deditcat.h \
+#    deditcat.ui.h \
+    deditcfg.h \
+#    deditcfg.ui.h \
+    deditcolumns.h \
+#    deditcolumns.ui.h \
+    deditcommand.h \
+#    deditcommand.ui.h \
+    deditdialog.h \
+#    deditdialog.ui.h \
+    deditdoc.h \
+#    deditdoc.ui.h \
+    deditfield.h \
+#    deditfield.ui.h \
+    deditimagecollection.h \
+#    deditimagecollection.ui.h \
+    deditireg.h \
+#    deditireg.ui.h \
+    deditjournal.h \
+#    deditjournal.ui.h \
+    deditlang.h \
+#    deditlang.ui.h \
+    deditreport.h \
+#    deditreport.ui.h \
+    deditrole.h \
+#    deditrole.ui.h \
+    dedittoolbar.h \
+#    dedittoolbar.ui.h \
+    deditwebform.h \
+#    deditwebform.ui.h \
+    formdesigner.h \
+    interfacetree.h \
+    mainform.h \
+#    mainform.ui.h \
+    mdtree.h \
+    pixmappreview.h \
+    roleeditor.h     \
+    formdesigner/formwindowsettings.h \
+    formdesigner/newform.h \
+    formdesigner/plugindialog.h \
+    formdesigner/qdesigner_actioneditor.h \
+    formdesigner/qdesigner_actions.h \
+    formdesigner/qdesigner_formwindow.h \
+    formdesigner/qdesigner_objectinspector.h \
+    formdesigner/qdesigner_pch.h \
+    formdesigner/qdesigner_propertyeditor.h \
+    formdesigner/qdesigner_resourceeditor.h \
+    formdesigner/qdesigner_settings.h \
+    formdesigner/qdesigner_signalsloteditor.h \
+    formdesigner/qdesigner_toolwindow.h \
+    formdesigner/qdesigner_widgetbox.h \
+    formdesigner/qdesigner_workbench.h \
+    formdesigner/saveformastemplate.h
+
+SOURCES        = \
+    actiontree.cpp \
+    aliaseditor.cpp \
+    atreeitems.cpp \
+    cfgform.cpp \
+    deditaction.cpp \
+    deditareg.cpp \
+    deditcat.cpp \
+    deditcfg.cpp \
+    deditcolumns.cpp \
+    deditcommand.cpp \
+    deditdialog.cpp \
+    deditdoc.cpp \
+    deditfield.cpp \
+    deditimagecollection.cpp \
+    deditireg.cpp \
+    deditjournal.cpp \
+    deditlang.cpp \
+    deditreport.cpp \
+    deditrole.cpp \
+    dedittoolbar.cpp \
+    deditwebform.cpp \
+    formdesigner.cpp \
+    interfacetree.cpp \
+    main.cpp \
+    mainform.cpp \
+    mdtree.cpp \
+    roleeditor.cpp     \
+    formdesigner/formwindowsettings.cpp \
+    formdesigner/newform.cpp \
+    formdesigner/plugindialog.cpp \
+    formdesigner/qdesigner_actioneditor.cpp \
+    formdesigner/qdesigner_actions.cpp \
+    formdesigner/qdesigner_formwindow.cpp \
+    formdesigner/qdesigner_objectinspector.cpp \
+    formdesigner/qdesigner_propertyeditor.cpp \
+    formdesigner/qdesigner_resourceeditor.cpp \
+    formdesigner/qdesigner_settings.cpp \
+    formdesigner/qdesigner_signalsloteditor.cpp \
+    formdesigner/qdesigner_toolwindow.cpp \
+    formdesigner/qdesigner_widgetbox.cpp \
+    formdesigner/qdesigner_workbench.cpp \
+    formdesigner/saveformastemplate.cpp
+
+FORMS = \
+    cfgform.ui \
+    deditaction.ui \
+    deditareg.ui \
+    deditcat.ui \
+    deditcfg.ui \
+    deditcolumns.ui \
+    deditcommand.ui \
+    deditdialog.ui \
+    deditdoc.ui \
+    deditfield.ui \
+    deditimagecollection.ui \
+    deditireg.ui \
+    deditjournal.ui \
+    deditlang.ui \
+    deditreport.ui \
+    deditrole.ui \
+    dedittoolbar.ui \
+    deditwebform.ui \
+    mainform.ui     \
+    formdesigner/formwindowsettings.ui \
+    formdesigner/newform.ui \
+    formdesigner/plugindialog.ui \
+    formdesigner/saveformastemplate.ui
+
+RESOURCES = \
+    designer.qrc 
+#    formdesigner/designer.qrc
+
+TRANSLATIONS = \
+    ../../translations/ananas-designer-en.ts \
+    ../../translations/ananas-designer-ru.ts 
+
+unix {
+       adesigner.path = $(BINDIR)
+       adesigner.files = ananas-designer
+#      acfg.path = /etc/ananas
+#      acfg.files= testwrite.cfg
+     } 
+
+#INSTALLS += adesigner
+
diff --git a/src/designer/designer.qrc b/src/designer/designer.qrc
new file mode 100644 (file)
index 0000000..665da14
--- /dev/null
@@ -0,0 +1,82 @@
+<RCC>
+    <qresource prefix="/">
+        <file>images/a-system.png</file>
+        <file>images/action_g.png</file>
+        <file>images/actions.png</file>
+        <file>images/arrow_down.png</file>
+        <file>images/arrow_left.png</file>
+        <file>images/arrow_right.png</file>
+        <file>images/arrow_up.png</file>
+        <file>images/cat.png</file>
+        <file>images/cat_g.png</file>
+        <file>images/columns.png</file>
+        <file>images/d_editdelete.png</file>
+        <file>images/designer-splash-en.png</file>
+        <file>images/designer-splash-ru.png</file>
+        <file>images/dimensions.png</file>
+        <file>images/doc.png</file>
+        <file>images/doc_g.png</file>
+        <file>images/doc_h.png</file>
+        <file>images/editcopy.png</file>
+        <file>images/editcut.png</file>
+        <file>images/editdelete.png</file>
+        <file>images/editedit.png</file>
+        <file>images/editpaste.png</file>
+        <file>images/editrename.png</file>
+        <file>images/editsep.png</file>
+        <file>images/element.png</file>
+        <file>images/field.png</file>
+        <file>images/filenew.png</file>
+        <file>images/fileopen.png</file>
+        <file>images/filesave.png</file>
+        <file>images/form.png</file>
+        <file>images/form_g.png</file>
+        <file>images/function.png</file>
+        <file>images/group.png</file>
+        <file>images/help.png</file>
+        <file>images/hi22-action-project_open.png</file>
+        <file>images/hi22-action-run.png</file>
+        <file>images/information.png</file>
+        <file>images/journ.png</file>
+        <file>images/journ_g.png</file>
+        <file>images/m_menu.png</file>
+        <file>images/msg_error.png</file>
+        <file>images/msg_fatal.png</file>
+        <file>images/msg_info.png</file>
+        <file>images/msg_warning.png</file>
+        <file>images/object.png</file>
+        <file>images/p_menus.png</file>
+        <file>images/play.png</file>
+        <file>images/playprev.png</file>
+        <file>images/print.png</file>
+        <file>images/project.png</file>
+        <file>images/qsa.png</file>
+        <file>images/redo.png</file>
+        <file>images/reg.png</file>
+        <file>images/reg_g.png</file>
+        <file>images/regs.png</file>
+        <file>images/regs_g.png</file>
+        <file>images/report.png</file>
+        <file>images/report_g.png</file>
+        <file>images/resourses.png</file>
+        <file>images/script.png</file>
+        <file>images/scriptnew.png</file>
+        <file>images/scriptobject.png</file>
+        <file>images/searchfind.png</file>
+        <file>images/separator.png</file>
+        <file>images/submenu.png</file>
+        <file>images/table.png</file>
+        <file>images/table_g.png</file>
+        <file>images/toolbar.png</file>
+        <file>images/undo.png</file>
+        <file>images/webform.png</file>
+        <file>images/webform_g.png</file>
+    </qresource>
+    <qresource prefix="/designer">
+        <file>templates/inputform.tpl</file>
+        <file>templates/inputformcat.tpl</file>
+        <file>templates/inputformdoc.tpl</file>
+        <file>templates/inputformjourn.tpl</file>
+        <file>templates/inputformrep.tpl</file>
+    </qresource>
+</RCC>
diff --git a/src/designer/embed.cpp b/src/designer/embed.cpp
new file mode 100644 (file)
index 0000000..b5f7cd1
--- /dev/null
@@ -0,0 +1,312 @@
+/**********************************************************************
+** Copyright (C) 2000-2003 Trolltech AS.  All rights reserved.
+**
+** This file is part of Qt Designer.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+**   information about Qt Commercial License Agreements.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "uic.h"
+#include <qfile.h>
+#include <qimage.h>
+#include <qstringlist.h>
+#include <qdatetime.h>
+#include <qfileinfo.h>
+//Added by qt3to4:
+#include <Q3PtrList>
+#include <stdio.h>
+#include <ctype.h>
+
+// on embedded, we do not compress image data. Rationale: by mapping
+// the ready-only data directly into memory we are both faster and
+// more memory efficient
+#if defined(Q_WS_QWS) && !defined(QT_NO_IMAGE_COLLECTION_COMPRESSION)
+#define QT_NO_IMAGE_COLLECTION_COMPRESSION
+#endif
+
+struct EmbedImage
+{
+    ~EmbedImage() { delete[] colorTable; }
+    int width, height, depth;
+    int numColors;
+    QRgb* colorTable;
+    QString name;
+    QString cname;
+    bool alpha;
+#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
+    ulong compressed;
+#endif
+};
+
+static QString convertToCIdentifier( const char *s )
+{
+    QString r = s;
+    int len = r.length();
+    if ( len > 0 && !isalpha( (char)r[0].latin1() ) )
+       r[0] = '_';
+    for ( int i=1; i<len; i++ ) {
+       if ( !isalnum( (char)r[i].latin1() ) )
+           r[i] = '_';
+    }
+    return r;
+}
+
+
+static ulong embedData( Q3TextStream& out, const uchar* input, int nbytes )
+{
+#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
+    QByteArray bazip( qCompress( input, nbytes ) );
+    ulong len = bazip.size();
+#else
+    ulong len = nbytes;
+#endif
+    static const char hexdigits[] = "0123456789abcdef";
+    QString s;
+    for ( int i=0; i<(int)len; i++ ) {
+       if ( (i%14) == 0 ) {
+           s += "\n    ";
+           out << (const char*)s;
+           s.truncate( 0 );
+       }
+       uint v = (uchar)
+#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
+                bazip
+#else
+                input
+#endif
+                [i];
+       s += "0x";
+       s += hexdigits[(v >> 4) & 15];
+       s += hexdigits[v & 15];
+       if ( i < (int)len-1 )
+           s += ',';
+    }
+    if ( s.length() )
+       out << (const char*)s;
+    return len;
+}
+
+static void embedData( Q3TextStream& out, const QRgb* input, int n )
+{
+    out << hex;
+    const QRgb *v = input;
+    for ( int i=0; i<n; i++ ) {
+       if ( (i%14) == 0  )
+           out << "\n    ";
+       out << "0x";
+       out << hex << *v++;
+       if ( i < n-1 )
+           out << ',';
+    }
+    out << dec; // back to decimal mode
+}
+
+void Uic::embed( Q3TextStream& out, const char* project, const QStringList& images )
+{
+
+    QString cProject = convertToCIdentifier( project );
+
+    QStringList::ConstIterator it;
+    out << "/****************************************************************************\n";
+    out << "** Image collection for project '" << project << "'.\n";
+    out << "**\n";
+    out << "** Generated from reading image files: \n";
+    for ( it = images.begin(); it != images.end(); ++it )
+       out << "**      " << *it << "\n";
+    out << "**\n";
+    out << "** Created: " << QDateTime::currentDateTime().toString() << "\n";
+    out << "**      by: The User Interface Compiler ($Id: embed.cpp,v 1.1 2008/11/05 21:16:27 leader Exp $)\n";
+    out << "**\n";
+    out << "** WARNING! All changes made in this file will be lost!\n";
+    out << "****************************************************************************/\n";
+    out << "\n";
+
+    out << "#include <qimage.h>\n";
+    out << "#include <qdict.h>\n";
+    out << "#include <qmime.h>\n";
+    out << "#include <qdragobject.h>\n";
+    out << "\n";
+
+    Q3PtrList<EmbedImage> list_image;
+    list_image.setAutoDelete( TRUE );
+    int image_count = 0;
+    for ( it = images.begin(); it != images.end(); ++it ) {
+       QImage img;
+       if ( !img.load( *it ) ) {
+           fprintf( stderr, "uic: cannot load image file %s\n", (*it).latin1() );
+           continue;
+       }
+       EmbedImage *e = new EmbedImage;
+       e->width = img.width();
+       e->height = img.height();
+       e->depth = img.depth();
+       e->numColors = img.numColors();
+       e->colorTable = new QRgb[e->numColors];
+       e->alpha = img.hasAlphaBuffer();
+       memcpy(e->colorTable, img.colorTable(), e->numColors*sizeof(QRgb));
+       QFileInfo fi( *it );
+       e->name = fi.fileName();
+       e->cname = QString("image_%1").arg( image_count++);
+       list_image.append( e );
+       out << "// " << *it << "\n";
+       QString s;
+       if ( e->depth == 1 )
+           img = img.convertBitOrder(QImage::BigEndian);
+       out << s.sprintf( "static const unsigned char %s_data[] = {",
+                         (const char *)e->cname );
+#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
+       e->compressed =
+#endif
+           embedData( out, img.bits(), img.numBytes() );
+       out << "\n};\n\n";
+       if ( e->numColors ) {
+           out << s.sprintf( "static const QRgb %s_ctable[] = {",
+                             (const char *)e->cname );
+           embedData( out, e->colorTable, e->numColors );
+           out << "\n};\n\n";
+       }
+    }
+
+    if ( !list_image.isEmpty() ) {
+       out << "static struct EmbedImage {\n"
+           "    int width, height, depth;\n"
+           "    const unsigned char *data;\n"
+#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
+           "    ulong compressed;\n"
+#endif
+           "    int numColors;\n"
+           "    const QRgb *colorTable;\n"
+           "    bool alpha;\n"
+           "    const char *name;\n"
+           "} embed_image_vec[] = {\n";
+       EmbedImage *e = list_image.first();
+       while ( e ) {
+           out << "    { "
+               << e->width << ", "
+               << e->height << ", "
+               << e->depth << ", "
+               << "(const unsigned char*)" << e->cname << "_data, "
+#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
+               << e->compressed << ", "
+#endif
+               << e->numColors << ", ";
+           if ( e->numColors )
+               out << e->cname << "_ctable, ";
+           else
+               out << "0, ";
+           if ( e->alpha )
+               out << "TRUE, ";
+           else
+               out << "FALSE, ";
+           out << "\"" << e->name << "\" },\n";
+           e = list_image.next();
+       }
+#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
+       out << "    { 0, 0, 0, 0, 0, 0, 0, 0, 0 }\n};\n";
+#else
+       out << "    { 0, 0, 0, 0, 0, 0, 0, 0 }\n};\n";
+#endif
+
+       out << "\n"
+           "static QImage uic_findImage( const QString& name )\n"
+           "{\n"
+           "    for ( int i=0; embed_image_vec[i].data; i++ ) {\n"
+           "   if ( QString::fromUtf8(embed_image_vec[i].name) == name ) {\n"
+#ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION
+           "       QByteArray baunzip;\n"
+           "       baunzip = qUncompress( embed_image_vec[i].data, \n"
+           "           embed_image_vec[i].compressed );\n"
+           "       QImage img((uchar*)baunzip.data(),\n"
+           "                   embed_image_vec[i].width,\n"
+           "                   embed_image_vec[i].height,\n"
+           "                   embed_image_vec[i].depth,\n"
+           "                   (QRgb*)embed_image_vec[i].colorTable,\n"
+           "                   embed_image_vec[i].numColors,\n"
+           "                   QImage::BigEndian\n"
+           "           );\n"
+           "       img = img.copy();\n"
+#else
+           "       QImage img((uchar*)embed_image_vec[i].data,\n"
+           "                   embed_image_vec[i].width,\n"
+           "                   embed_image_vec[i].height,\n"
+           "                   embed_image_vec[i].depth,\n"
+           "                   (QRgb*)embed_image_vec[i].colorTable,\n"
+           "                   embed_image_vec[i].numColors,\n"
+           "                   QImage::BigEndian\n"
+           "           );\n"
+#endif
+           "       if ( embed_image_vec[i].alpha )\n"
+           "           img.setAlphaBuffer(TRUE);\n"
+           "       return img;\n"
+           "        }\n"
+           "    }\n"
+           "    return QImage();\n"
+           "}\n\n";
+
+       out << "class MimeSourceFactory_" << cProject << " : public QMimeSourceFactory\n";
+       out << "{\n";
+       out << "public:\n";
+       out << "    MimeSourceFactory_" << cProject << "() {}\n";
+       out << "    ~MimeSourceFactory_" << cProject << "() {}\n";
+       out << "    const QMimeSource* data( const QString& abs_name ) const {\n";
+       out << "\tconst QMimeSource* d = QMimeSourceFactory::data( abs_name );\n";
+       out << "\tif ( d || abs_name.isNull() ) return d;\n";
+       out << "\tQImage img = uic_findImage( abs_name );\n";
+       out << "\tif ( !img.isNull() )\n";
+       out << "\t    ((QMimeSourceFactory*)this)->setImage( abs_name, img );\n";
+       out << "\treturn QMimeSourceFactory::data( abs_name );\n";
+       out << "    };\n";
+       out << "};\n\n";
+
+       out << "static QMimeSourceFactory* factory = 0;\n";
+       out << "\n";
+
+       out << "void qInitImages_" << cProject << "()\n";
+       out << "{\n";
+       out << "    if ( !factory ) {\n";
+       out << "\tfactory = new MimeSourceFactory_" << cProject << ";\n";
+       out << "\tQMimeSourceFactory::defaultFactory()->addFactory( factory );\n";
+       out << "    }\n";
+       out << "}\n\n";
+
+       out << "void qCleanupImages_" << cProject << "()\n";
+       out << "{\n";
+       out << "    if ( factory ) {\n";
+       out << "\tQMimeSourceFactory::defaultFactory()->removeFactory( factory );\n";
+       out << "\tdelete factory;\n";
+       out << "\tfactory = 0;\n";
+       out << "    }\n";
+       out << "}\n\n";
+
+       out << "class StaticInitImages_" << cProject << "\n";
+       out << "{\n";
+       out << "public:\n";
+       out << "    StaticInitImages_" << cProject << "() { qInitImages_" << cProject << "(); }\n";
+       out << "#if defined(Q_OS_SCO) || defined(Q_OS_UNIXWARE)\n";
+       out << "    ~StaticInitImages_" << cProject << "() { }\n";
+       out << "#else\n";
+       out << "    ~StaticInitImages_" << cProject << "() { qCleanupImages_" << cProject << "(); }\n";
+       out << "#endif\n";
+       out << "};\n\n";
+
+       out << "static StaticInitImages_" << cProject << " staticImages;\n";
+    }
+}
diff --git a/src/designer/embed.h b/src/designer/embed.h
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/src/designer/formdesigner.cpp b/src/designer/formdesigner.cpp
new file mode 100644 (file)
index 0000000..bf9c067
--- /dev/null
@@ -0,0 +1,159 @@
+/****************************************************************************
+** $Id: formdesigner.cpp,v 1.2 2008/11/27 20:20:55 leader Exp $
+**
+** Code file of the Form designer of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "formdesigner.h"
+
+#include <QCloseEvent>
+//#include <QDesignerWidgetBoxInterface>
+#include "formdesigner/qdesigner_workbench.h"
+#include "formdesigner/qdesigner_formwindow.h"
+//#include <QtDesigner/qdesigner_components.h>
+
+//--aFormDesigner* aFormDesigner::m_designer = 0;
+
+aFormDesigner::aFormDesigner()
+{
+    m_workbench = new QDesignerWorkbench();
+    setCentralWidget( m_workbench->mainWindow() );
+//    resize( );
+/*
+    designerInterface = QDesignerComponents::createFormEditor( this );
+    //new QDesignerFormEditorInterface( 0 );
+
+    QWidget *w = designerInterface->topLevel();
+    if (w) w->show();
+    else printf("no designer widget\n");
+    
+    QDesignerWidgetBoxInterface *widgetBox = 0;
+    widgetBox = designerInterface->widgetBox();
+    if ( widgetBox ) widgetBox->show(); 
+//    designerInterface->show();
+*/    
+}
+
+
+aFormDesigner::~aFormDesigner()
+{
+}
+
+
+/*aFormDesigner* aFormDesigner::designer()
+{
+    if (!m_designer)
+        m_designer = new aFormDesigner();
+    return m_designer;
+}*/
+
+
+/*QWidget* aFormDesigner::mainWindow()
+{
+    return m_workbench->mainWindow();
+}*/
+
+
+void aFormDesigner::fileOpen(const QString& fileName)
+{
+    //m_guibuilder->openFile(fileName);
+    m_workbench->readInForm(fileName);
+}
+
+
+void aFormDesigner::closeEvent( QCloseEvent *e )
+{
+//CHECK_POINT
+    fileSaveAll();
+       e->accept();
+//     deleteLater();
+   // ( (MainForm*)this->topLevelWidget() )->removeTab(caption());
+//     e->ignore();
+}
+
+
+void aFormDesigner::show()
+{
+    QMainWindow::show();
+/*CHECK_POINT
+       MainWindow::show();
+CHECK_POINT
+//     actioneditor()->hide();
+       propertyeditor()->removePage( propertyeditor()->page( 1 ) ); //eventList()->hide();
+       objectHierarchy()->parentWidget()->close();
+       if(outputWindow() != NULL && outputWindow()->parentWidget()!=NULL)
+       {
+
+#ifndef _Windows
+               outputWindow()->parentWidget()->close();
+#endif
+       }
+       workspace()->parentWidget()->parentWidget()->close();*/
+       //--mainWindow()->show();
+}
+
+
+void aFormDesigner::hide()
+{
+       QMainWindow::hide();
+       //--fileSaveAll();
+       //--fileClose();
+  //  ( (MainForm*)this->topLevelWidget() )->removeTab(caption());
+}
+
+
+void aFormDesigner::mouseDoubleClickEvent ( QMouseEvent * e )
+{
+//CHECK_POINT
+
+//     MainWindow::mouseDoubleClickEvent ( e );
+}
+
+
+/*GuiBuilderPart *aFormDesigner::guibuilder() const
+{
+  return m_guibuilder;
+}*/
+
+QDesignerWorkbench *
+aFormDesigner::workbench()
+{
+    return m_workbench;
+}
+
+
+void 
+aFormDesigner::fileSaveAll()
+{
+    int i;
+    QDesignerFormWindow *w;
+
+    for (i=0; i< workbench()->formWindowCount(); i++){
+        w = workbench()->formWindow( i );
+        workbench()->saveForm(w->editor());
+        printf("w=%s\n", w->windowTitle().toUtf8().data());
+    }
+}
+
diff --git a/src/designer/formdesigner.h b/src/designer/formdesigner.h
new file mode 100644 (file)
index 0000000..b3398b5
--- /dev/null
@@ -0,0 +1,58 @@
+/****************************************************************************
+** $Id: formdesigner.h,v 1.3 2008/11/27 20:20:55 leader Exp $
+**
+** Header file of the Form designer of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef FORMDESIGNER_H
+#define FORMDESIGNER_H
+
+#include <QMouseEvent>
+#include <QCloseEvent>
+#include <QMainWindow>
+
+
+class QDesignerWorkbench;
+class aFormDesigner : public QMainWindow
+{
+public:
+       aFormDesigner();
+       virtual ~aFormDesigner();
+       void show();
+       void hide();
+       void fileOpen(const QString&);
+       void fileSaveAll();
+        QDesignerWorkbench *workbench();
+
+protected:
+       virtual void closeEvent( QCloseEvent *e );
+       virtual void mouseDoubleClickEvent ( QMouseEvent * e );
+
+private:
+    QDesignerWorkbench *m_workbench;
+};
+
+#endif
diff --git a/src/designer/formdesigner/designer.qrc b/src/designer/formdesigner/designer.qrc
new file mode 100644 (file)
index 0000000..11a3b0f
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE RCC><RCC version="1.0">\r
+<qresource prefix="/trolltech/designer">\r
+<file>images/designer.png</file>\r
+<file>templates/forms/Dialog_with_Buttons_Bottom.ui</file>\r
+<file>templates/forms/Dialog_with_Buttons_Right.ui</file>\r
+<file>templates/forms/Widget.ui</file>\r
+<file>templates/forms/Main_Window.ui</file>\r
+</qresource>\r
+</RCC>\r
diff --git a/src/designer/formdesigner/formwindowsettings.cpp b/src/designer/formdesigner/formwindowsettings.cpp
new file mode 100644 (file)
index 0000000..c9c018a
--- /dev/null
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include "formwindowsettings.h"
+#include <QtDesigner/QtDesigner>
+#include <QtGui/QStyle>
+
+FormWindowSettings::FormWindowSettings(QDesignerFormWindowInterface *parent)
+    : QDialog(parent), m_formWindow(parent)
+{
+    ui.setupUi(this);
+
+    int defaultMargin = INT_MIN, defaultSpacing = INT_MIN;
+    formWindow()->layoutDefault(&defaultMargin, &defaultSpacing);
+
+    QStyle *style = formWindow()->style();
+    ui.defaultMarginSpinBox->setValue(style->pixelMetric(QStyle::PM_DefaultChildMargin, 0));
+    ui.defaultSpacingSpinBox->setValue(style->pixelMetric(QStyle::PM_DefaultLayoutSpacing, 0));
+
+    if (defaultMargin != INT_MIN || defaultMargin != INT_MIN) {
+        ui.layoutDefaultGroupBox->setChecked(true);
+
+        if (defaultMargin != INT_MIN)
+            ui.defaultMarginSpinBox->setValue(defaultMargin);
+
+        if (defaultSpacing != INT_MIN)
+            ui.defaultSpacingSpinBox->setValue(defaultSpacing);
+    } else {
+        ui.layoutDefaultGroupBox->setChecked(false);
+    }
+
+    QString marginFunction, spacingFunction;
+    formWindow()->layoutFunction(&marginFunction, &spacingFunction);
+    if (!marginFunction.isEmpty() || !spacingFunction.isEmpty()) {
+        ui.layoutFunctionGroupBox->setChecked(true);
+        ui.marginFunctionLineEdit->setText(marginFunction);
+        ui.spacingFunctionLineEdit->setText(spacingFunction);
+    } else {
+        ui.layoutFunctionGroupBox->setChecked(false);
+    }
+
+    QString pixFunction = formWindow()->pixmapFunction();
+    ui.pixmapFunctionGroupBox->setChecked(!pixFunction.isEmpty());
+    ui.pixmapFunctionLineEdit->setText(pixFunction);
+
+    ui.authorLineEdit->setText(formWindow()->author());
+
+    foreach (QString includeHint, formWindow()->includeHints()) {
+        if (includeHint.isEmpty())
+            continue;
+
+        ui.includeHintsTextEdit->append(includeHint);
+    }
+}
+
+FormWindowSettings::~FormWindowSettings()
+{
+}
+
+QDesignerFormWindowInterface *FormWindowSettings::formWindow() const
+{
+    return m_formWindow;
+}
+
+void FormWindowSettings::accept()
+{
+    formWindow()->setAuthor(ui.authorLineEdit->text());
+
+    if (ui.pixmapFunctionGroupBox->isChecked())
+        formWindow()->setPixmapFunction(ui.pixmapFunctionLineEdit->text());
+
+    if (ui.layoutDefaultGroupBox->isChecked())
+        formWindow()->setLayoutDefault(ui.defaultMarginSpinBox->value(), ui.defaultSpacingSpinBox->value());
+
+    if (ui.layoutFunctionGroupBox->isChecked())
+        formWindow()->setLayoutFunction(ui.marginFunctionLineEdit->text(), ui.spacingFunctionLineEdit->text());
+
+    formWindow()->setIncludeHints(ui.includeHintsTextEdit->toPlainText().split(QLatin1String("\n")));
+
+    formWindow()->setDirty(true);
+
+    QDialog::accept();
+}
diff --git a/src/designer/formdesigner/formwindowsettings.h b/src/designer/formdesigner/formwindowsettings.h
new file mode 100644 (file)
index 0000000..4d08d3d
--- /dev/null
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef FORMWINDOWSETTINGS_H
+#define FORMWINDOWSETTINGS_H
+
+#include "ui_formwindowsettings.h"
+
+class QDesignerFormWindowInterface;
+
+class FormWindowSettings: public QDialog
+{
+    Q_OBJECT
+public:
+    FormWindowSettings(QDesignerFormWindowInterface *formWindow);
+    virtual ~FormWindowSettings();
+
+    QDesignerFormWindowInterface *formWindow() const;
+
+    virtual void accept();
+
+private:
+    Ui::FormWindowSettings ui;
+    QDesignerFormWindowInterface *m_formWindow;
+};
+
+#endif // FORMWINDOWSETTINGS_H
+
diff --git a/src/designer/formdesigner/formwindowsettings.ui b/src/designer/formdesigner/formwindowsettings.ui
new file mode 100644 (file)
index 0000000..18342f5
--- /dev/null
@@ -0,0 +1,319 @@
+<ui version="4.0" >\r
+ <author></author>\r
+  <comment>*********************************************************************\r
+**\r
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.\r
+**\r
+** This file is part of the Qt Designer of the Qt Toolkit.\r
+**\r
+** This file may be used under the terms of the GNU General Public\r
+** License version 2.0 as published by the Free Software Foundation\r
+** and appearing in the file LICENSE.GPL included in the packaging of\r
+** this file.  Please review the following information to ensure GNU\r
+** General Public Licensing requirements will be met:\r
+** http://www.trolltech.com/products/qt/opensource.html\r
+**\r
+** If you are unsure which license is appropriate for your use, please\r
+** review the following information:\r
+** http://www.trolltech.com/products/qt/licensing.html or contact the\r
+** sales department at sales@trolltech.com.\r
+**\r
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE\r
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+**\r
+*********************************************************************</comment>\r
+ <exportmacro></exportmacro>\r
+ <class>FormWindowSettings</class>\r
+ <widget class="QDialog" name="FormWindowSettings" >\r
+  <property name="geometry" >\r
+   <rect>\r
+    <x>0</x>\r
+    <y>0</y>\r
+    <width>433</width>\r
+    <height>465</height>\r
+   </rect>\r
+  </property>\r
+  <property name="windowTitle" >\r
+   <string>Form Settings</string>\r
+  </property>\r
+  <layout class="QGridLayout" >\r
+   <property name="margin" >\r
+    <number>8</number>\r
+   </property>\r
+   <property name="spacing" >\r
+    <number>6</number>\r
+   </property>\r
+   <item row="3" column="1" >\r
+    <spacer>\r
+     <property name="orientation" >\r
+      <enum>Qt::Vertical</enum>\r
+     </property>\r
+     <property name="sizeHint" >\r
+      <size>\r
+       <width>111</width>\r
+       <height>115</height>\r
+      </size>\r
+     </property>\r
+    </spacer>\r
+   </item>\r
+   <item row="2" column="1" >\r
+    <layout class="QHBoxLayout" >\r
+     <property name="margin" >\r
+      <number>0</number>\r
+     </property>\r
+     <property name="spacing" >\r
+      <number>6</number>\r
+     </property>\r
+     <item>\r
+      <widget class="QGroupBox" name="pixmapFunctionGroupBox" >\r
+       <property name="title" >\r
+        <string>&amp;Pixmap Function</string>\r
+       </property>\r
+       <property name="checkable" >\r
+        <bool>true</bool>\r
+       </property>\r
+       <layout class="QVBoxLayout" >\r
+        <property name="margin" >\r
+         <number>8</number>\r
+        </property>\r
+        <property name="spacing" >\r
+         <number>6</number>\r
+        </property>\r
+        <item>\r
+         <widget class="QLineEdit" name="pixmapFunctionLineEdit" />\r
+        </item>\r
+       </layout>\r
+      </widget>\r
+     </item>\r
+    </layout>\r
+   </item>\r
+   <item rowspan="2" row="2" column="0" >\r
+    <widget class="QGroupBox" name="includeHintsGroupBox" >\r
+     <property name="title" >\r
+      <string>&amp;Include Hints</string>\r
+     </property>\r
+     <layout class="QVBoxLayout" >\r
+      <property name="margin" >\r
+       <number>8</number>\r
+      </property>\r
+      <property name="spacing" >\r
+       <number>6</number>\r
+      </property>\r
+      <item>\r
+       <widget class="QTextEdit" name="includeHintsTextEdit" />\r
+      </item>\r
+     </layout>\r
+    </widget>\r
+   </item>\r
+   <item row="0" column="0" colspan="2" >\r
+    <widget class="QGroupBox" name="pixmapFunctionGroupBox_2" >\r
+     <property name="title" >\r
+      <string>&amp;Author</string>\r
+     </property>\r
+     <layout class="QVBoxLayout" >\r
+      <property name="margin" >\r
+       <number>8</number>\r
+      </property>\r
+      <property name="spacing" >\r
+       <number>6</number>\r
+      </property>\r
+      <item>\r
+       <widget class="QLineEdit" name="authorLineEdit" />\r
+      </item>\r
+     </layout>\r
+    </widget>\r
+   </item>\r
+   <item row="1" column="0" colspan="2" >\r
+    <layout class="QHBoxLayout" >\r
+     <property name="margin" >\r
+      <number>0</number>\r
+     </property>\r
+     <property name="spacing" >\r
+      <number>6</number>\r
+     </property>\r
+     <item>\r
+      <widget class="QGroupBox" name="layoutDefaultGroupBox" >\r
+       <property name="title" >\r
+        <string>Layout &amp;Default</string>\r
+       </property>\r
+       <property name="checkable" >\r
+        <bool>true</bool>\r
+       </property>\r
+       <layout class="QGridLayout" >\r
+        <property name="margin" >\r
+         <number>8</number>\r
+        </property>\r
+        <property name="spacing" >\r
+         <number>6</number>\r
+        </property>\r
+        <item row="1" column="0" >\r
+         <widget class="QLabel" name="label_2" >\r
+          <property name="text" >\r
+           <string>&amp;Spacing:</string>\r
+          </property>\r
+          <property name="buddy" >\r
+           <cstring>defaultSpacingSpinBox</cstring>\r
+          </property>\r
+         </widget>\r
+        </item>\r
+        <item row="0" column="0" >\r
+         <widget class="QLabel" name="label" >\r
+          <property name="text" >\r
+           <string>&amp;Margin:</string>\r
+          </property>\r
+          <property name="buddy" >\r
+           <cstring>defaultMarginSpinBox</cstring>\r
+          </property>\r
+         </widget>\r
+        </item>\r
+        <item row="1" column="1" >\r
+         <widget class="QSpinBox" name="defaultSpacingSpinBox" />\r
+        </item>\r
+        <item row="0" column="1" >\r
+         <widget class="QSpinBox" name="defaultMarginSpinBox" />\r
+        </item>\r
+       </layout>\r
+      </widget>\r
+     </item>\r
+     <item>\r
+      <widget class="QGroupBox" name="layoutFunctionGroupBox" >\r
+       <property name="title" >\r
+        <string>&amp;Layout Function</string>\r
+       </property>\r
+       <property name="checkable" >\r
+        <bool>true</bool>\r
+       </property>\r
+       <layout class="QGridLayout" >\r
+        <property name="margin" >\r
+         <number>8</number>\r
+        </property>\r
+        <property name="spacing" >\r
+         <number>6</number>\r
+        </property>\r
+        <item row="1" column="1" >\r
+         <widget class="QLineEdit" name="spacingFunctionLineEdit" />\r
+        </item>\r
+        <item row="0" column="1" >\r
+         <widget class="QLineEdit" name="marginFunctionLineEdit" />\r
+        </item>\r
+        <item row="0" column="0" >\r
+         <widget class="QLabel" name="label_3" >\r
+          <property name="text" >\r
+           <string>Ma&amp;rgin:</string>\r
+          </property>\r
+          <property name="buddy" >\r
+           <cstring>marginFunctionLineEdit</cstring>\r
+          </property>\r
+         </widget>\r
+        </item>\r
+        <item row="1" column="0" >\r
+         <widget class="QLabel" name="label_3_2" >\r
+          <property name="text" >\r
+           <string>Spa&amp;cing:</string>\r
+          </property>\r
+          <property name="buddy" >\r
+           <cstring>spacingFunctionLineEdit</cstring>\r
+          </property>\r
+         </widget>\r
+        </item>\r
+       </layout>\r
+      </widget>\r
+     </item>\r
+    </layout>\r
+   </item>\r
+   <item row="4" column="0" colspan="2" >\r
+    <widget class="Line" name="line" >\r
+     <property name="orientation" >\r
+      <enum>Qt::Horizontal</enum>\r
+     </property>\r
+    </widget>\r
+   </item>\r
+   <item row="5" column="0" colspan="2" >\r
+    <layout class="QHBoxLayout" >\r
+     <property name="margin" >\r
+      <number>0</number>\r
+     </property>\r
+     <property name="spacing" >\r
+      <number>6</number>\r
+     </property>\r
+     <item>\r
+      <spacer>\r
+       <property name="orientation" >\r
+        <enum>Qt::Horizontal</enum>\r
+       </property>\r
+       <property name="sizeHint" >\r
+        <size>\r
+         <width>131</width>\r
+         <height>31</height>\r
+        </size>\r
+       </property>\r
+      </spacer>\r
+     </item>\r
+     <item>\r
+      <widget class="QPushButton" name="okButton" >\r
+       <property name="text" >\r
+        <string>OK</string>\r
+       </property>\r
+       <property name="default" >\r
+        <bool>true</bool>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+     <item>\r
+      <widget class="QPushButton" name="cancelButton" >\r
+       <property name="text" >\r
+        <string>Cancel</string>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+    </layout>\r
+   </item>\r
+  </layout>\r
+ </widget>\r
+ <pixmapfunction></pixmapfunction>\r
+ <tabstops>\r
+  <tabstop>authorLineEdit</tabstop>\r
+  <tabstop>defaultMarginSpinBox</tabstop>\r
+  <tabstop>defaultSpacingSpinBox</tabstop>\r
+  <tabstop>marginFunctionLineEdit</tabstop>\r
+  <tabstop>spacingFunctionLineEdit</tabstop>\r
+  <tabstop>pixmapFunctionLineEdit</tabstop>\r
+  <tabstop>okButton</tabstop>\r
+  <tabstop>cancelButton</tabstop>\r
+ </tabstops>\r
+ <resources/>\r
+ <connections>\r
+  <connection>\r
+   <sender>okButton</sender>\r
+   <signal>clicked()</signal>\r
+   <receiver>FormWindowSettings</receiver>\r
+   <slot>accept()</slot>\r
+   <hints>\r
+    <hint type="sourcelabel" >\r
+     <x>351</x>\r
+     <y>38</y>\r
+    </hint>\r
+    <hint type="destinationlabel" >\r
+     <x>233</x>\r
+     <y>29</y>\r
+    </hint>\r
+   </hints>\r
+  </connection>\r
+  <connection>\r
+   <sender>cancelButton</sender>\r
+   <signal>clicked()</signal>\r
+   <receiver>FormWindowSettings</receiver>\r
+   <slot>reject()</slot>\r
+   <hints>\r
+    <hint type="sourcelabel" >\r
+     <x>330</x>\r
+     <y>66</y>\r
+    </hint>\r
+    <hint type="destinationlabel" >\r
+     <x>197</x>\r
+     <y>125</y>\r
+    </hint>\r
+   </hints>\r
+  </connection>\r
+ </connections>\r
+</ui>\r
diff --git a/src/designer/formdesigner/images/designer.png b/src/designer/formdesigner/images/designer.png
new file mode 100644 (file)
index 0000000..1014a9c
Binary files /dev/null and b/src/designer/formdesigner/images/designer.png differ
diff --git a/src/designer/formdesigner/images/mdi.png b/src/designer/formdesigner/images/mdi.png
new file mode 100644 (file)
index 0000000..5012ab3
Binary files /dev/null and b/src/designer/formdesigner/images/mdi.png differ
diff --git a/src/designer/formdesigner/images/sdi.png b/src/designer/formdesigner/images/sdi.png
new file mode 100644 (file)
index 0000000..7fff6e8
Binary files /dev/null and b/src/designer/formdesigner/images/sdi.png differ
diff --git a/src/designer/formdesigner/images/workbench.png b/src/designer/formdesigner/images/workbench.png
new file mode 100644 (file)
index 0000000..b4397fb
Binary files /dev/null and b/src/designer/formdesigner/images/workbench.png differ
diff --git a/src/designer/formdesigner/newform.cpp b/src/designer/formdesigner/newform.cpp
new file mode 100644 (file)
index 0000000..dae9841
--- /dev/null
@@ -0,0 +1,244 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include "newform.h"
+//#include "qdesigner.h"
+#include "qdesigner_workbench.h"
+#include "qdesigner_actions.h"
+#include "qdesigner_formwindow.h"
+#include "qdesigner_settings.h"
+
+#include "private/qdesigner_formbuilder_p.h"
+#include "private/sheet_delegate_p.h"
+
+#include <QtDesigner/abstractformwindow.h>
+
+#include <QtCore/QDir>
+#include <QtCore/QFile>
+#include <QtCore/QFileInfo>
+#include <QtGui/QHeaderView>
+#include <QtGui/QPainter>
+
+#include <QtCore/qdebug.h>
+
+enum NewForm_CustomRole
+{
+    TemplateNameRole = Qt::UserRole + 100
+};
+
+NewForm::NewForm(QDesignerWorkbench *workbench, QWidget *parentWidget)
+    : QDialog(parentWidget,
+#ifdef Q_WS_MAC
+            Qt::Tool |
+#endif
+            Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
+      m_workbench(workbench)
+{
+    ui.setupUi(this);
+    ui.treeWidget->setItemDelegate(new qdesigner_internal::SheetDelegate(ui.treeWidget, this));
+    ui.treeWidget->header()->hide();
+    ui.treeWidget->header()->setStretchLastSection(true);
+    ui.lblPreview->setBackgroundRole(QPalette::Base);
+    ui.chkShowOnStartup->setChecked(QDesignerSettings().showNewFormOnStartup());
+
+    loadFrom(QLatin1String(":/trolltech/designer/templates/forms"), true);
+
+    QDesignerSettings settings;
+    foreach(QString path, settings.formTemplatePaths())
+        loadFrom(path, false);
+}
+
+NewForm::~NewForm()
+{
+    QDesignerSettings().setShowNewFormOnStartup(ui.chkShowOnStartup->isChecked());
+}
+
+void NewForm::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *)
+{
+    if (current && current->parent()) {
+        QIcon icon = formPreviewIcon(current->data(0, TemplateNameRole).toString());
+        if (icon.isNull()) {
+            ui.createButton->setEnabled(false);
+            ui.lblPreview->setText(tr("Error loading form"));
+        } else {
+            ui.createButton->setEnabled(true);
+            ui.createButton->setDefault(true);
+            ui.lblPreview->setPixmap(icon.pixmap(QSize(256, 256)));
+        }
+    } else {
+        ui.createButton->setEnabled(false);
+        ui.lblPreview->setText(tr("Choose a template for a preview"));
+    }
+}
+
+void NewForm::on_treeWidget_itemActivated(QTreeWidgetItem *item)
+{
+    if (item->data(0, TemplateNameRole).isValid())
+        ui.createButton->animateClick(0);
+}
+
+void NewForm::on_createButton_clicked()
+{
+    if (QTreeWidgetItem *item = ui.treeWidget->currentItem()) {
+        close();
+
+        int maxUntitled = 0;
+        int totalWindows = m_workbench->formWindowCount();
+        // This will cause some problems with i18n, but for now I need the string to be "static"
+        QRegExp rx(QLatin1String("untitled( (\\d+))?"));
+        for (int i = 0; i < totalWindows; ++i) {
+            QString title = m_workbench->formWindow(i)->windowTitle();
+            title = title.replace(QLatin1String("[*]"), QLatin1String(""));
+            if (rx.indexIn(title) != 1) {
+                if (maxUntitled == 0)
+                    ++maxUntitled;
+                if (rx.numCaptures() > 1)
+                    maxUntitled = qMax(rx.cap(2).toInt(), maxUntitled);
+            }
+        }
+
+        QDesignerFormWindow *formWindow = workbench()->createFormWindow();
+        if (QDesignerFormWindowInterface *editor = formWindow->editor()) {
+            QString formTemplateName = item->data(0, TemplateNameRole).toString();
+            QFile f(formTemplateName);
+            if (f.open(QFile::ReadOnly)) {
+                editor->setContents(&f);
+                f.close();
+            } else {
+                editor->setContents(QString());
+            }
+
+            if (QWidget *container = editor->mainContainer())
+                formWindow->resize(container->size());
+        }
+        QString newTitle = QLatin1String("untitled");
+        if (maxUntitled)
+            newTitle += QLatin1String(" ") + QString::number(maxUntitled + 1);
+
+        newTitle.append(QLatin1String("[*]"));
+        formWindow->setWindowTitle(newTitle);
+        formWindow->editor()->setFileName("");
+        formWindow->show();
+    }
+}
+
+void NewForm::on_closeButton_clicked()
+{
+    close();
+}
+
+QDesignerWorkbench *NewForm::workbench() const
+{
+    return m_workbench;
+}
+
+QIcon NewForm::formPreviewIcon(const QString &fileName)
+{
+    QIcon result;
+
+    QFile f(fileName);
+    if (f.open(QFile::ReadOnly)) {
+        qdesigner_internal::QDesignerFormBuilder formBuilder(workbench()->core(),qdesigner_internal::QDesignerFormBuilder::DisableScripts);
+
+        QWidget *fake = new QWidget(0);
+        fake->setAttribute(Qt::WA_WState_Visible);
+
+        if (QWidget *widget = formBuilder.load(&f, fake)) {
+            widget->setParent(fake, 0);
+            widget->show();
+            f.close();
+
+            QPixmap pix = QPixmap::grabWidget(widget);
+            QImage image = pix.toImage();
+            image = image.scaled(256, 256, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+            result = QPixmap::fromImage(image);
+        }
+
+        fake->deleteLater();
+    }
+
+    return result;
+}
+
+void NewForm::loadFrom(const QString &path, bool resourceFile)
+{
+    QDir dir(path);
+
+    if (!dir.exists())
+        return;
+
+    // Iterate through the directory and add the templates
+    QFileInfoList list = dir.entryInfoList(QStringList() << "*.ui", QDir::Files);
+
+    if (list.isEmpty())
+        return;
+
+    QChar separator = resourceFile ? QChar(QLatin1Char('/'))
+                                   : QChar(QDir::separator());
+    QTreeWidgetItem *root = new QTreeWidgetItem(ui.treeWidget);
+    // Try to get something that is easy to read.
+    QString visiblePath = path;
+    int index = visiblePath.lastIndexOf(separator);
+    if (index != -1) {
+        // try to find a second slash, just to be a bit better.
+        int index2 = visiblePath.lastIndexOf(separator, index - 1);
+        if (index2 != -1)
+            index = index2;
+        visiblePath = visiblePath.mid(index + 1);
+        visiblePath = QDir::convertSeparators(visiblePath);
+    }
+
+    root->setText(0, visiblePath.replace(QLatin1String("_"), QLatin1String(" ")));
+    root->setToolTip(0, path);
+
+    foreach(QFileInfo fi, list) {
+        if (!fi.isFile())
+            continue;
+
+        QTreeWidgetItem *item = new QTreeWidgetItem(root);
+        item->setText(0, fi.baseName().replace(QLatin1String("_"), QLatin1String(" ")));
+        item->setData(0, TemplateNameRole, fi.absoluteFilePath());
+
+        QTreeWidgetItem *i = ui.treeWidget->currentItem();
+        if (i == 0) {
+            ui.treeWidget->setCurrentItem(item);
+            ui.treeWidget->setItemSelected(item, true);
+        }
+    }
+    ui.treeWidget->setItemExpanded(root, true);
+}
+
+void NewForm::on_openButton_clicked()
+{
+    hide();
+    if (m_workbench->actionManager()->openForm())
+        close();
+    else
+        show();
+}
+
+void NewForm::on_treeWidget_itemPressed(QTreeWidgetItem *item)
+{
+    if (item && !item->parent())
+        ui.treeWidget->setItemExpanded(item, !ui.treeWidget->isItemExpanded(item));
+}
diff --git a/src/designer/formdesigner/newform.h b/src/designer/formdesigner/newform.h
new file mode 100644 (file)
index 0000000..bdc9b7f
--- /dev/null
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef NEWFORM_H
+#define NEWFORM_H
+
+#include "ui_newform.h"
+
+#include <QDialog>
+
+class QDesignerWorkbench;
+
+class NewForm: public QDialog
+{
+    Q_OBJECT
+public:
+    NewForm(QDesignerWorkbench *workbench, QWidget *parentWidget);
+    virtual ~NewForm();
+
+    QDesignerWorkbench *workbench() const;
+
+private slots:
+    void on_createButton_clicked();
+    void on_closeButton_clicked();
+    void on_openButton_clicked();
+    void on_treeWidget_itemActivated(QTreeWidgetItem *item);
+    void on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *);
+    void on_treeWidget_itemPressed(QTreeWidgetItem *item);
+
+private:
+    QIcon formPreviewIcon(const QString &fileName);
+    void loadFrom(const QString &path, bool resourceFile);
+
+private:
+    QDesignerWorkbench *m_workbench;
+    Ui::NewForm ui;
+};
+
+#endif // NEWFORM_H
diff --git a/src/designer/formdesigner/newform.ui b/src/designer/formdesigner/newform.ui
new file mode 100644 (file)
index 0000000..b513748
--- /dev/null
@@ -0,0 +1,254 @@
+<ui version="4.0" >\r
+ <author></author>\r
+  <comment>*********************************************************************\r
+**\r
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.\r
+**\r
+** This file is part of the Qt Designer of the Qt Toolkit.\r
+**\r
+** This file may be used under the terms of the GNU General Public\r
+** License version 2.0 as published by the Free Software Foundation\r
+** and appearing in the file LICENSE.GPL included in the packaging of\r
+** this file.  Please review the following information to ensure GNU\r
+** General Public Licensing requirements will be met:\r
+** http://www.trolltech.com/products/qt/opensource.html\r
+**\r
+** If you are unsure which license is appropriate for your use, please\r
+** review the following information:\r
+** http://www.trolltech.com/products/qt/licensing.html or contact the\r
+** sales department at sales@trolltech.com.\r
+**\r
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE\r
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+**\r
+*********************************************************************</comment>\r
+ <exportmacro></exportmacro>\r
+ <class>NewForm</class>\r
+ <widget class="QDialog" name="NewForm" >\r
+  <property name="geometry" >\r
+   <rect>\r
+    <x>0</x>\r
+    <y>0</y>\r
+    <width>494</width>\r
+    <height>300</height>\r
+   </rect>\r
+  </property>\r
+  <property name="windowTitle" >\r
+   <string>New Form</string>\r
+  </property>\r
+  <layout class="QVBoxLayout" >\r
+   <property name="margin" >\r
+    <number>9</number>\r
+   </property>\r
+   <property name="spacing" >\r
+    <number>6</number>\r
+   </property>\r
+   <item>\r
+    <layout class="QHBoxLayout" >\r
+     <property name="margin" >\r
+      <number>1</number>\r
+     </property>\r
+     <property name="spacing" >\r
+      <number>6</number>\r
+     </property>\r
+     <item>\r
+      <widget class="QTreeWidget" name="treeWidget" >\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>1</x>\r
+         <y>1</y>\r
+         <width>256</width>\r
+         <height>205</height>\r
+        </rect>\r
+       </property>\r
+       <property name="sizePolicy" >\r
+        <sizepolicy>\r
+         <hsizetype>1</hsizetype>\r
+         <vsizetype>7</vsizetype>\r
+         <horstretch>0</horstretch>\r
+         <verstretch>0</verstretch>\r
+        </sizepolicy>\r
+       </property>\r
+       <property name="iconSize" >\r
+        <size>\r
+         <width>128</width>\r
+         <height>128</height>\r
+        </size>\r
+       </property>\r
+       <property name="rootIsDecorated" >\r
+        <bool>false</bool>\r
+       </property>\r
+       <property name="columnCount" >\r
+        <number>1</number>\r
+       </property>\r
+       <column>\r
+        <property name="text" >\r
+         <string>0</string>\r
+        </property>\r
+       </column>\r
+      </widget>\r
+     </item>\r
+     <item>\r
+      <widget class="QLabel" name="lblPreview" >\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>263</x>\r
+         <y>1</y>\r
+         <width>212</width>\r
+         <height>205</height>\r
+        </rect>\r
+       </property>\r
+       <property name="sizePolicy" >\r
+        <sizepolicy>\r
+         <hsizetype>7</hsizetype>\r
+         <vsizetype>5</vsizetype>\r
+         <horstretch>0</horstretch>\r
+         <verstretch>0</verstretch>\r
+        </sizepolicy>\r
+       </property>\r
+       <property name="lineWidth" >\r
+        <number>1</number>\r
+       </property>\r
+       <property name="text" >\r
+        <string>Choose a template for a preview</string>\r
+       </property>\r
+       <property name="alignment" >\r
+        <set>Qt::AlignCenter</set>\r
+       </property>\r
+       <property name="margin" >\r
+        <number>5</number>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+    </layout>\r
+   </item>\r
+   <item>\r
+    <widget class="QFrame" name="horizontalLine" >\r
+     <property name="geometry" >\r
+      <rect>\r
+       <x>9</x>\r
+       <y>222</y>\r
+       <width>476</width>\r
+       <height>3</height>\r
+      </rect>\r
+     </property>\r
+     <property name="frameShape" >\r
+      <enum>QFrame::HLine</enum>\r
+     </property>\r
+     <property name="frameShadow" >\r
+      <enum>QFrame::Sunken</enum>\r
+     </property>\r
+    </widget>\r
+   </item>\r
+   <item>\r
+    <layout class="QGridLayout" >\r
+     <property name="margin" >\r
+      <number>1</number>\r
+     </property>\r
+     <property name="spacing" >\r
+      <number>6</number>\r
+     </property>\r
+     <item row="1" column="0" >\r
+      <widget class="QPushButton" name="openButton" >\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>1</x>\r
+         <y>27</y>\r
+         <width>103</width>\r
+         <height>32</height>\r
+        </rect>\r
+       </property>\r
+       <property name="text" >\r
+        <string>&amp;Open...</string>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+     <item row="1" column="1" >\r
+      <spacer>\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>110</x>\r
+         <y>27</y>\r
+         <width>147</width>\r
+         <height>32</height>\r
+        </rect>\r
+       </property>\r
+       <property name="orientation" >\r
+        <enum>Qt::Horizontal</enum>\r
+       </property>\r
+       <property name="sizeHint" >\r
+        <size>\r
+         <width>61</width>\r
+         <height>32</height>\r
+        </size>\r
+       </property>\r
+      </spacer>\r
+     </item>\r
+     <item row="1" column="2" >\r
+      <widget class="QPushButton" name="createButton" >\r
+       <property name="enabled" >\r
+        <bool>false</bool>\r
+       </property>\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>263</x>\r
+         <y>27</y>\r
+         <width>103</width>\r
+         <height>32</height>\r
+        </rect>\r
+       </property>\r
+       <property name="text" >\r
+        <string>C&amp;reate</string>\r
+       </property>\r
+       <property name="autoDefault" >\r
+        <bool>false</bool>\r
+       </property>\r
+       <property name="default" >\r
+        <bool>true</bool>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+     <item row="1" column="3" >\r
+      <widget class="QPushButton" name="closeButton" >\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>372</x>\r
+         <y>27</y>\r
+         <width>103</width>\r
+         <height>32</height>\r
+        </rect>\r
+       </property>\r
+       <property name="text" >\r
+        <string>&amp;Close</string>\r
+       </property>\r
+       <property name="autoDefault" >\r
+        <bool>false</bool>\r
+       </property>\r
+       <property name="default" >\r
+        <bool>false</bool>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+     <item row="0" column="0" colspan="2" >\r
+      <widget class="QCheckBox" name="chkShowOnStartup" >\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>1</x>\r
+         <y>1</y>\r
+         <width>256</width>\r
+         <height>20</height>\r
+        </rect>\r
+       </property>\r
+       <property name="text" >\r
+        <string>Show this Dialog on Startup</string>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+    </layout>\r
+   </item>\r
+  </layout>\r
+ </widget>\r
+ <pixmapfunction></pixmapfunction>\r
+ <resources/>\r
+ <connections/>\r
+</ui>\r
diff --git a/src/designer/formdesigner/plugindialog.cpp b/src/designer/formdesigner/plugindialog.cpp
new file mode 100644 (file)
index 0000000..c57f097
--- /dev/null
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2005-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include <QtDesigner/QtDesigner>
+#include "private/pluginmanager_p.h"
+
+#include <QtGui/QtGui>
+
+#include "plugindialog.h"
+
+PluginDialog::PluginDialog(QDesignerFormEditorInterface *core, QWidget *parent)
+    : QDialog(parent
+#ifdef Q_WS_MAC
+            , Qt::Tool
+#endif
+            ), m_core(core)
+{
+    ui.setupUi(this);
+
+    ui.message->hide();
+
+    QStringList headerLabels;
+    headerLabels << tr("Components");
+
+    ui.treeWidget->setAlternatingRowColors(false);
+    ui.treeWidget->setSelectionMode(QAbstractItemView::NoSelection);
+    ui.treeWidget->setHeaderLabels(headerLabels);
+    ui.treeWidget->header()->hide();
+
+    interfaceIcon.addPixmap(style()->standardPixmap(QStyle::SP_DirOpenIcon),
+                            QIcon::Normal, QIcon::On);
+    interfaceIcon.addPixmap(style()->standardPixmap(QStyle::SP_DirClosedIcon),
+                            QIcon::Normal, QIcon::Off);
+    featureIcon.addPixmap(style()->standardPixmap(QStyle::SP_FileIcon));
+
+    setWindowTitle(tr("Plugin Information"));
+    populateTreeWidget();
+}
+
+QDesignerFormEditorInterface *PluginDialog::core() const
+{
+    return m_core;
+}
+
+void PluginDialog::populateTreeWidget()
+{
+    QStringList fileNames = core()->pluginManager()->registeredPlugins();
+
+    foreach (QString fileName, fileNames) {
+        QPluginLoader loader(fileName);
+        QFileInfo fileInfo(fileName);
+
+        QObject *plugin = loader.instance();
+
+        QTreeWidgetItem *pluginItem = new QTreeWidgetItem(ui.treeWidget);
+        pluginItem->setText(0, fileInfo.fileName());
+        pluginItem->setIcon(0, style()->standardPixmap(QStyle::SP_DirOpenIcon));
+        ui.treeWidget->setItemExpanded(pluginItem, true);
+
+        QFont boldFont = pluginItem->font(0);
+        boldFont.setBold(true);
+        pluginItem->setFont(0, boldFont);
+
+        if (plugin != 0) {
+            QDesignerCustomWidgetCollectionInterface *c = qobject_cast<QDesignerCustomWidgetCollectionInterface*>(plugin);
+            if (c != 0) {
+                foreach (QDesignerCustomWidgetInterface *p, c->customWidgets()) {
+                    QTreeWidgetItem *item = new QTreeWidgetItem(pluginItem);
+                    item->setText(0, p->name());
+                    item->setIcon(0, pluginIcon(p->icon()));
+                    item->setToolTip(0, p->toolTip());
+                    item->setWhatsThis(0, p->whatsThis());
+                }
+            }
+
+            QDesignerCustomWidgetInterface *p = qobject_cast<QDesignerCustomWidgetInterface*>(plugin);
+            if (p != 0) {
+                QTreeWidgetItem *item = new QTreeWidgetItem(pluginItem);
+                item->setText(0, p->name());
+                item->setIcon(0, pluginIcon(p->icon()));
+                item->setToolTip(0, p->toolTip());
+                item->setWhatsThis(0, p->whatsThis());
+            }
+        }
+    }
+
+    if (ui.treeWidget->topLevelItemCount() == 0) {
+        ui.label->setText(tr("Qt Designer couldn't find any plugins"));
+        ui.treeWidget->hide();
+    } else {
+        ui.label->setText(tr("Qt Designer found the following plugins"));
+    }
+}
+
+QIcon PluginDialog::pluginIcon(const QIcon &icon)
+{
+    if (icon.isNull())
+        return QIcon(":/trolltech/formeditor/images/qtlogo.png");
+
+    return icon;
+}
+
diff --git a/src/designer/formdesigner/plugindialog.h b/src/designer/formdesigner/plugindialog.h
new file mode 100644 (file)
index 0000000..90e95f9
--- /dev/null
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2005-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef PLUGINDIALOG_H
+#define PLUGINDIALOG_H
+
+#include "ui_plugindialog.h"
+
+class QDesignerFormEditorInterface;
+
+class PluginDialog : public QDialog
+{
+    Q_OBJECT
+public:
+    PluginDialog(QDesignerFormEditorInterface *core, QWidget *parent = 0);
+
+    QDesignerFormEditorInterface *core() const;
+
+private:
+    void populateTreeWidget();
+    QIcon pluginIcon(const QIcon &icon);
+
+private:
+    QDesignerFormEditorInterface *m_core;
+    Ui::PluginDialog ui;
+    QIcon interfaceIcon;
+    QIcon featureIcon;
+};
+
+#endif
diff --git a/src/designer/formdesigner/plugindialog.ui b/src/designer/formdesigner/plugindialog.ui
new file mode 100644 (file)
index 0000000..be89004
--- /dev/null
@@ -0,0 +1,134 @@
+<ui version="4.0" >\r
+ <author></author>\r
+  <comment>*********************************************************************\r
+**\r
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.\r
+**\r
+** This file is part of the Qt Designer of the Qt Toolkit.\r
+**\r
+** This file may be used under the terms of the GNU General Public\r
+** License version 2.0 as published by the Free Software Foundation\r
+** and appearing in the file LICENSE.GPL included in the packaging of\r
+** this file.  Please review the following information to ensure GNU\r
+** General Public Licensing requirements will be met:\r
+** http://www.trolltech.com/products/qt/opensource.html\r
+**\r
+** If you are unsure which license is appropriate for your use, please\r
+** review the following information:\r
+** http://www.trolltech.com/products/qt/licensing.html or contact the\r
+** sales department at sales@trolltech.com.\r
+**\r
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE\r
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+**\r
+*********************************************************************</comment>\r
+ <exportmacro></exportmacro>\r
+ <class>PluginDialog</class>\r
+ <widget class="QDialog" name="PluginDialog" >\r
+  <property name="geometry" >\r
+   <rect>\r
+    <x>0</x>\r
+    <y>0</y>\r
+    <width>401</width>\r
+    <height>331</height>\r
+   </rect>\r
+  </property>\r
+  <property name="windowTitle" >\r
+   <string>Plugin Informations</string>\r
+  </property>\r
+  <layout class="QVBoxLayout" >\r
+   <property name="margin" >\r
+    <number>8</number>\r
+   </property>\r
+   <property name="spacing" >\r
+    <number>6</number>\r
+   </property>\r
+   <item>\r
+    <widget class="QLabel" name="label" >\r
+     <property name="text" >\r
+      <string>TextLabel</string>\r
+     </property>\r
+     <property name="wordWrap" >\r
+      <bool>true</bool>\r
+     </property>\r
+    </widget>\r
+   </item>\r
+   <item>\r
+    <widget class="QTreeWidget" name="treeWidget" />\r
+   </item>\r
+   <item>\r
+    <widget class="QLabel" name="message" >\r
+     <property name="text" >\r
+      <string>TextLabel</string>\r
+     </property>\r
+     <property name="wordWrap" >\r
+      <bool>true</bool>\r
+     </property>\r
+    </widget>\r
+   </item>\r
+   <item>\r
+    <layout class="QHBoxLayout" >\r
+     <property name="margin" >\r
+      <number>0</number>\r
+     </property>\r
+     <property name="spacing" >\r
+      <number>6</number>\r
+     </property>\r
+     <item>\r
+      <spacer>\r
+       <property name="orientation" >\r
+        <enum>Qt::Horizontal</enum>\r
+       </property>\r
+       <property name="sizeHint" >\r
+        <size>\r
+         <width>131</width>\r
+         <height>31</height>\r
+        </size>\r
+       </property>\r
+      </spacer>\r
+     </item>\r
+     <item>\r
+      <widget class="QPushButton" name="okButton" >\r
+       <property name="text" >\r
+        <string>OK</string>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+     <item>\r
+      <spacer>\r
+       <property name="orientation" >\r
+        <enum>Qt::Horizontal</enum>\r
+       </property>\r
+       <property name="sizeHint" >\r
+        <size>\r
+         <width>40</width>\r
+         <height>20</height>\r
+        </size>\r
+       </property>\r
+      </spacer>\r
+     </item>\r
+    </layout>\r
+   </item>\r
+  </layout>\r
+ </widget>\r
+ <pixmapfunction></pixmapfunction>\r
+ <resources/>\r
+ <connections>\r
+  <connection>\r
+   <sender>okButton</sender>\r
+   <signal>clicked()</signal>\r
+   <receiver>PluginDialog</receiver>\r
+   <slot>accept()</slot>\r
+   <hints>\r
+    <hint type="sourcelabel" >\r
+     <x>278</x>\r
+     <y>253</y>\r
+    </hint>\r
+    <hint type="destinationlabel" >\r
+     <x>96</x>\r
+     <y>254</y>\r
+    </hint>\r
+   </hints>\r
+  </connection>\r
+ </connections>\r
+</ui>\r
diff --git a/src/designer/formdesigner/private/formscriptrunner_p.h b/src/designer/formdesigner/private/formscriptrunner_p.h
new file mode 100644 (file)
index 0000000..627ee21
--- /dev/null
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef FORMSCRIPTRUNNER_H
+#define FORMSCRIPTRUNNER_H
+
+#include <QtDesigner/uilib_global.h>
+#include <QtCore/QList>
+#include <QtCore/QFlags>
+#include <QtCore/QString>
+
+class QWidget;
+
+#ifdef QFORMINTERNAL_NAMESPACE
+namespace QFormInternal
+{
+#endif
+
+class DomWidget;
+
+class QDESIGNER_UILIB_EXPORT QFormScriptRunner
+{
+public:
+    QFormScriptRunner();
+    ~QFormScriptRunner();
+
+    typedef QList<QWidget*> WidgetList;
+
+    bool run(const DomWidget *domWidget,
+             const QString &customWidgetScript,
+             QWidget *widget, const WidgetList &children,
+             QString *errorMessage);
+
+    struct Error {
+        QString objectName;
+        QString script;
+        QString errorMessage;
+    };
+    typedef QList<Error> Errors;
+    Errors errors() const;
+    void clearErrors();
+
+    enum Option {
+         NoOptions = 0x0,
+         DisableWarnings = 0x1,
+         DisableScripts = 02
+     };
+     Q_DECLARE_FLAGS(Options, Option)
+
+    Options options() const;
+    void setOptions(Options options);
+
+private:
+    class QFormScriptRunnerPrivate;
+    QFormScriptRunnerPrivate *m_impl;
+
+    QFormScriptRunner(const QFormScriptRunner &);
+    void operator = (const QFormScriptRunner &);
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QFormScriptRunner::Options)
+
+#ifdef QFORMINTERNAL_NAMESPACE
+}
+#endif
+
+#endif // FORMSCRIPTRUNNER_H
diff --git a/src/designer/formdesigner/private/pluginmanager_p.h b/src/designer/formdesigner/private/pluginmanager_p.h
new file mode 100644 (file)
index 0000000..e970b04
--- /dev/null
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the Qt API.  It exists for the convenience
+// of Qt Designer.  This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef PLUGINMANAGER_H
+#define PLUGINMANAGER_H
+
+#include "shared_global_p.h"
+
+#include <QtCore/QMap>
+#include <QtCore/QStringList>
+#include <QtCore/QSettings>
+
+class QDesignerFormEditorInterface;
+class QDesignerCustomWidgetInterface;
+
+class QDESIGNER_SHARED_EXPORT QDesignerPluginManager: public QObject
+{
+    Q_OBJECT
+public:
+    QDesignerPluginManager(QDesignerFormEditorInterface *core);
+    virtual ~QDesignerPluginManager();
+
+    QDesignerFormEditorInterface *core() const;
+
+    QObject *instance(const QString &plugin) const;
+
+    QStringList registeredPlugins() const;
+
+    QStringList findPlugins(const QString &path);
+
+    QStringList pluginPaths() const;
+    void setPluginPaths(const QStringList &plugin_paths);
+
+    QStringList disabledPlugins() const;
+    void setDisabledPlugins(const QStringList &disabled_plugins);
+
+    QStringList failedPlugins() const;
+    QString failureReason(const QString &pluginName) const;
+
+    QList<QObject*> instances() const;
+    QList<QDesignerCustomWidgetInterface*> registeredCustomWidgets() const;
+
+    bool registerNewPlugins();
+
+public slots:
+    bool syncSettings();
+    void ensureInitialized();
+
+private:
+    void updateRegisteredPlugins();
+    void registerPath(const QString &path);
+    void registerPlugin(const QString &plugin);
+
+private:
+    QDesignerFormEditorInterface *m_core;
+    QStringList m_pluginPaths;
+    QStringList m_registeredPlugins;
+    QStringList m_disabledPlugins;
+
+    typedef QMap<QString, QString> FailedPluginMap;
+    FailedPluginMap m_failedPlugins;
+
+    typedef QList<QDesignerCustomWidgetInterface*> CustomWidgetList;
+    CustomWidgetList m_customWidgets;
+
+    QStringList defaultPluginPaths() const;
+};
+
+#endif // PLUGINMANAGER_H
diff --git a/src/designer/formdesigner/private/qdesigner_formbuilder_p.h b/src/designer/formdesigner/private/qdesigner_formbuilder_p.h
new file mode 100644 (file)
index 0000000..028c595
--- /dev/null
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the Qt API.  It exists for the convenience
+// of Qt Designer.  This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QDESIGNER_FORMBUILDER_H
+#define QDESIGNER_FORMBUILDER_H
+
+#include "shared_global_p.h"
+
+#include <private/formscriptrunner_p.h>
+#include <QtDesigner/formbuilder.h>
+
+#include <QtCore/QMap>
+#include <QtCore/QSet>
+
+class QDesignerFormEditorInterface;
+class QDesignerFormWindowInterface;
+
+namespace qdesigner_internal {
+
+// Form builder used for previewing forms
+class QDESIGNER_SHARED_EXPORT QDesignerFormBuilder: public QFormBuilder
+{
+public:
+    enum Mode {
+        // Use container extension to populate containers. Disable scripts.
+        DisableScripts,
+        // Use container extension to populate containers as well as scripts
+        UseScriptAndContainerExtension,
+        // Experimental: Use scripts to populate the container
+        UseScriptForContainerExtension
+    };
+
+    QDesignerFormBuilder(QDesignerFormEditorInterface *core, Mode mode);
+
+    QWidget *createWidgetFromContents(const QString &contents, QWidget *parentWidget = 0);
+
+    virtual QWidget *createWidget(DomWidget *ui_widget, QWidget *parentWidget = 0)
+    { return QFormBuilder::create(ui_widget, parentWidget); }
+
+    inline QDesignerFormEditorInterface *core() const
+    { return m_core; }
+
+    typedef QFormScriptRunner::Errors ScriptErrors;
+    // Create a preview widget (for integrations) or return 0. The widget has to be embedded into a main window.
+    // Experimental, depending on script support.
+    static QWidget *createPreview(const QDesignerFormWindowInterface *fw, const QString &styleName /* ="" */,
+                                  ScriptErrors *scriptErrors, QString *errorMessage);
+    // Convenience that pops up message boxes in case of failures.
+    static QWidget *createPreview(const QDesignerFormWindowInterface *fw, const QString &styleName = QString());
+
+protected:
+    using QFormBuilder::createDom;
+    using QFormBuilder::create;
+
+    virtual QWidget *create(DomUI *ui, QWidget *parentWidget);
+    virtual DomWidget *createDom(QWidget *widget, DomWidget *ui_parentWidget, bool recursive = true);
+    virtual QWidget *create(DomWidget *ui_widget, QWidget *parentWidget);
+    virtual QLayout *create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget);
+
+    virtual QWidget *createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name);
+    virtual bool addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget);
+    virtual bool addItem(DomLayoutItem *ui_item, QLayoutItem *item, QLayout *layout);
+
+    virtual QIcon nameToIcon(const QString &filePath, const QString &qrcPath);
+    virtual QPixmap nameToPixmap(const QString &filePath, const QString &qrcPath);
+
+    virtual void applyProperties(QObject *o, const QList<DomProperty*> &properties);
+
+    virtual void loadExtraInfo(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget);
+
+private:
+    bool addItemContainerExtension(QWidget *widget, QWidget *parentWidget);
+    QDesignerFormEditorInterface *m_core;
+    const Mode m_mode;
+    
+    typedef QSet<QWidget *> WidgetSet;
+    WidgetSet m_customWidgetsWithScript;
+};
+
+} // namespace qdesigner_internal
+
+#endif // QDESIGNER_FORMBUILDER_H
diff --git a/src/designer/formdesigner/private/qdesigner_integration_p.h b/src/designer/formdesigner/private/qdesigner_integration_p.h
new file mode 100644 (file)
index 0000000..3ac94bd
--- /dev/null
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the Qt API.  It exists for the convenience
+// of Qt Designer.  This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QDESIGNER_INTEGRATION_H
+#define QDESIGNER_INTEGRATION_H
+
+#include "shared_global_p.h"
+#include "abstractintegration.h"
+
+#include <QtCore/QObject>
+
+class QDesignerFormEditorInterface;
+class QDesignerFormWindowInterface;
+class QDesignerFormWindowManagerInterface;
+
+class QVariant;
+class QWidget;
+
+namespace qdesigner_internal {
+
+struct Selection;
+
+class QDESIGNER_SHARED_EXPORT QDesignerIntegration: public QDesignerIntegrationInterface
+{
+    Q_OBJECT
+public:
+    QDesignerIntegration(QDesignerFormEditorInterface *core, QObject *parent = 0);
+    virtual ~QDesignerIntegration();
+
+    virtual QWidget *containerWindow(QWidget *widget) const;
+
+    // Load plugins into widget database and factory.
+    static void initializePlugins(QDesignerFormEditorInterface *formEditor);
+
+signals:
+    void propertyChanged(QDesignerFormWindowInterface *formWindow, const QString &name, const QVariant &value);
+
+public slots:
+    virtual void updateProperty(const QString &name, const QVariant &value);
+    // Additional signals of designer property editor
+    virtual void updatePropertyComment(const QString &name, const QString &value);
+    virtual void resetProperty(const QString &name);
+    virtual void addDynamicProperty(const QString &name, const QVariant &value);
+    virtual void removeDynamicProperty(const QString &name);
+
+
+    virtual void updateActiveFormWindow(QDesignerFormWindowInterface *formWindow);
+    virtual void setupFormWindow(QDesignerFormWindowInterface *formWindow);
+    virtual void updateSelection();
+    virtual void updateGeometry();
+    virtual void activateWidget(QWidget *widget);
+
+    void updateCustomWidgetPlugins();
+
+private:
+    void initialize();
+    void getSelection(Selection &s);
+    QObject *propertyEditorObject();
+
+    QDesignerFormWindowManagerInterface *m_formWindowManager;
+};
+
+} // namespace qdesigner_internal
+
+#endif // QDESIGNER_INTEGRATION_H
diff --git a/src/designer/formdesigner/private/qtundo_p.h b/src/designer/formdesigner/private/qtundo_p.h
new file mode 100644 (file)
index 0000000..0e3e29f
--- /dev/null
@@ -0,0 +1,274 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the Qt API.  It exists for the convenience
+// of Qt Designer.  This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef QTUNDO_H
+#define QTUNDO_H
+
+#include "shared_global_p.h"
+
+#include <QAbstractItemModel>
+#include <QtCore/QMap>
+#include <QtCore/QList>
+#include <QStringList>
+#include <QListView>
+
+class QWidget;
+class QAction;
+class QtUndoStack;
+
+class QDESIGNER_SHARED_EXPORT QtCommand : public QObject
+{
+    Q_OBJECT
+
+    friend class QtUndoStack;
+
+    public:
+        enum Type { Command, MacroBegin, MacroEnd };
+
+        QtCommand(Type type, const QString &description = QString(),
+                        bool canMerge = false);
+        QtCommand(const QString &description = QString(),
+                        bool canMerge = true);
+
+        virtual void redo() {};
+        virtual void undo() {};
+
+        QString description() const
+            { return m_description; }
+        void setDescription(const QString &s)
+            { m_description = s; }
+        bool canMerge() const
+            { return m_can_merge; }
+        void setCanMerge(bool b)
+            { m_can_merge = b; }
+        Type type() const
+            { return m_type; }
+
+        bool isMacroBegin() const
+            { return m_type == MacroBegin; }
+        bool isMacroEnd() const
+            { return m_type == MacroEnd; }
+        bool isCommand() const
+            { return m_type == Command; }
+
+    protected:
+        virtual bool mergeMeWith(QtCommand *other);
+
+    private:
+        void shortenStack();
+
+        bool m_can_merge;
+        QString m_description;
+        Type m_type;
+};
+
+class QtMultiCommand : public QtCommand
+{
+public:
+    QtMultiCommand(const QString &description = QString());
+    QtMultiCommand(const QList<QtCommand*> &command_list,
+                    const QString &description = QString());
+    ~QtMultiCommand();
+    virtual void redo();
+    virtual void undo();
+
+    void append(QtCommand *command);
+    int count() const;
+    QtCommand *command(int i) const;
+
+private:
+    QList<QtCommand*> m_command_list;
+};
+
+class QtUndoState;
+
+class QDESIGNER_SHARED_EXPORT QtUndoStack : public QObject, private QList<QtCommand*>
+{
+    Q_OBJECT
+
+    friend class QtUndoManager;
+
+    public:
+        QtUndoStack(QObject *parent = 0);
+        void push(QtCommand *command);
+        bool canUndo() const;
+        bool canRedo() const;
+        QString undoDescription() const;
+        QString redoDescription() const;
+        QStringList undoList() const;
+        QStringList redoList() const;
+        bool isClean() const;
+
+        void setCurrent();
+
+        QAction *createUndoAction(QObject *parent) const;
+        QAction *createRedoAction(QObject *parent) const;
+
+        inline int currentIndex() const { return m_current_iter; }
+
+    public slots:
+        void undo(int count = 1);
+        void redo(int count = 1);
+        void clear();
+
+        void setClean();
+
+    signals:
+            void cleanChanged(bool clean);
+        void commandExecuted();
+
+        void undoDescriptionChanged(const QString &newDescription);
+        void redoDescriptionChanged(const QString &newDescription);
+        void canUndoChanged(bool enabled);
+        void canRedoChanged(bool enabled);
+
+    private:
+        typedef int CommandIter;
+
+        void undoMacro();
+        void redoMacro();
+        CommandIter findMacroBegin(CommandIter it) const;
+        CommandIter findMacroEnd(CommandIter it) const;
+
+        void beforeChange(QtUndoState &state);
+        void afterChange(const QtUndoState &state);
+
+        // *m_current_iter == 0 means "one-before-first"
+        CommandIter m_current_iter;
+        uint m_num_commands;
+        int m_macro_nest;
+
+        bool m_have_clean_command;
+        const QtCommand *m_clean_command;
+
+        QtCommand *commandAt(CommandIter it) const;
+};
+
+class QDESIGNER_SHARED_EXPORT QtUndoManager : public QObject
+{
+    Q_OBJECT
+
+    public:
+        QtUndoManager();
+
+        QAction *createUndoAction(QObject *parent) const;
+        QAction *createRedoAction(QObject *parent) const;
+
+        void associateView(QObject *obj, QtUndoStack *stack);
+        void disassociateView(QObject *obj);
+
+        bool canUndo() const;
+        bool canRedo() const;
+        QString undoDescription() const;
+        QString redoDescription() const;
+        void setUndoLimit(uint i);
+        uint undoLimit() const;
+        QStringList undoList() const;
+        QStringList redoList() const;
+        QtUndoStack *currentStack() const;
+        void setCurrentStack(QtUndoStack *stack);
+
+        static QtUndoManager *manager();
+
+    public slots:
+        void undo(int count = 1);
+        void redo(int count = 1);
+
+        void updateActions();
+
+    signals:
+        void changed();
+
+        void undoDescriptionChanged(const QString &newDescription);
+        void redoDescriptionChanged(const QString &newDescription);
+        void canUndoChanged(bool enabled);
+        void canRedoChanged(bool enabled);
+
+    private slots:
+        void stackDestroyed(QObject *stack);
+        void viewDestroyed(QObject *view);
+
+    private:
+        typedef QMap<QObject*, QtUndoStack*> StackMap;
+
+        StackMap m_stack_map;
+        QtUndoStack *m_current_stack;
+
+        static QtUndoManager *m_manager; // singleton
+        static uint m_undo_limit;
+
+        bool m_can_undo, m_can_redo;
+        QString m_undo_description, m_redo_description;
+};
+
+class QDESIGNER_SHARED_EXPORT QtUndoListModel: public QAbstractItemModel
+{
+    Q_OBJECT
+public:
+    QtUndoListModel(QObject *parent = 0);
+    virtual ~QtUndoListModel();
+
+    inline int undoIndex() const { return m_undoIndex; }
+
+    virtual int rowCount(const QModelIndex &parent) const;
+    virtual int columnCount(const QModelIndex &parent) const;
+    virtual bool hasChildren(const QModelIndex &parent) const
+    { return rowCount(parent) > 0; }
+
+    virtual QModelIndex parent(const QModelIndex &index) const;
+    virtual QModelIndex index(int row, int column, const QModelIndex &parent) const;
+    virtual QVariant data(const QModelIndex &index, int role) const;
+
+private slots:
+    void updateItems();
+
+private:
+    QStringList m_items;
+    int m_undoIndex;
+};
+
+class QDESIGNER_SHARED_EXPORT QtUndoListView: public QListView
+{
+    Q_OBJECT
+public:
+    QtUndoListView(QWidget *parent = 0);
+    virtual ~QtUndoListView();
+    virtual void reset();
+private slots:
+    void undoOrRedo();
+};
+
+
+
+#endif
diff --git a/src/designer/formdesigner/private/shared_global_p.h b/src/designer/formdesigner/private/shared_global_p.h
new file mode 100644 (file)
index 0000000..32fb525
--- /dev/null
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the Qt API.  It exists for the convenience
+// of Qt Designer.  This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef SHARED_GLOBAL_H
+#define SHARED_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+#ifdef QT_DESIGNER_STATIC
+#define QDESIGNER_SHARED_EXTERN
+#define QDESIGNER_SHARED_IMPORT
+#else
+#define QDESIGNER_SHARED_EXTERN Q_DECL_EXPORT
+#define QDESIGNER_SHARED_IMPORT Q_DECL_IMPORT
+#endif
+
+#ifndef QT_NO_SHARED_EXPORT
+#  ifdef QDESIGNER_SHARED_LIBRARY
+#    define QDESIGNER_SHARED_EXPORT QDESIGNER_SHARED_EXTERN
+#  else
+#    define QDESIGNER_SHARED_EXPORT QDESIGNER_SHARED_IMPORT
+#  endif
+#else
+#  define QDESIGNER_SHARED_EXPORT
+#endif
+
+#endif // SHARED_GLOBAL_H
diff --git a/src/designer/formdesigner/private/sheet_delegate_p.h b/src/designer/formdesigner/private/sheet_delegate_p.h
new file mode 100644 (file)
index 0000000..f260f03
--- /dev/null
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the Qt API.  It exists for the convenience
+// of Qt Designer.  This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#ifndef SHEET_DELEGATE_H
+#define SHEET_DELEGATE_H
+
+#include "shared_global_p.h"
+
+#include <QItemDelegate>
+#include <QTreeView>
+
+class QTreeView;
+
+namespace qdesigner_internal {
+
+class QDESIGNER_SHARED_EXPORT SheetDelegate: public QItemDelegate
+{
+    Q_OBJECT
+public:
+    SheetDelegate(QTreeView *view, QWidget *parent);
+
+    virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+    virtual QSize sizeHint(const QStyleOptionViewItem &opt, const QModelIndex &index) const;
+
+private:
+    QTreeView *m_view;
+};
+
+} // namespace qdesigner_internal
+
+#endif // SHEET_DELEGATE_H
diff --git a/src/designer/formdesigner/qdesigner_actioneditor.cpp b/src/designer/formdesigner/qdesigner_actioneditor.cpp
new file mode 100644 (file)
index 0000000..fedaaa2
--- /dev/null
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//#include "qdesigner.h"
+#include "qdesigner_actioneditor.h"
+#include "qdesigner_workbench.h"
+
+#include <QtDesigner/QtDesigner>
+#include <QtDesigner/QDesignerComponents>
+
+QDesignerActionEditor::QDesignerActionEditor(QDesignerWorkbench *workbench)
+    : QDesignerToolWindow(workbench)
+{
+    setObjectName(QLatin1String("ActionEditor"));
+    QDesignerActionEditorInterface *widget = QDesignerComponents::createActionEditor(workbench->core(), this);
+    workbench->core()->setActionEditor(widget);
+
+    setCentralWidget(widget);
+
+    setWindowTitle(tr("Action Editor"));
+}
+
+QDesignerActionEditor::~QDesignerActionEditor()
+{
+}
+
+QRect QDesignerActionEditor::geometryHint() const
+{
+    QRect g = workbench()->availableGeometry();
+    int margin = workbench()->marginHint();
+
+    QSize sz(g.width() * 1/4, g.height() * 1/6);
+
+    return QRect((g.width() - sz.width() - margin), margin,
+                  sz.width(), sz.height());
+}
diff --git a/src/designer/formdesigner/qdesigner_actioneditor.h b/src/designer/formdesigner/qdesigner_actioneditor.h
new file mode 100644 (file)
index 0000000..a940ccf
--- /dev/null
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef QDESIGNER_ACTIONEDITOR_H
+#define QDESIGNER_ACTIONEDITOR_H
+
+#include "qdesigner_toolwindow.h"
+
+class QDesignerWorkbench;
+
+class QDesignerActionEditor: public QDesignerToolWindow
+{
+    Q_OBJECT
+public:
+    QDesignerActionEditor(QDesignerWorkbench *workbench);
+    virtual ~QDesignerActionEditor();
+
+    virtual QRect geometryHint() const;
+};
+
+#endif // QDESIGNER_ACTIONEDITOR_H
diff --git a/src/designer/formdesigner/qdesigner_actions.cpp b/src/designer/formdesigner/qdesigner_actions.cpp
new file mode 100644 (file)
index 0000000..6ff32fd
--- /dev/null
@@ -0,0 +1,998 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//#include "qdesigner.h"
+#include "qdesigner_toolwindow.h"
+#include "qdesigner_actions.h"
+#include "qdesigner_workbench.h"
+#include "qdesigner_formwindow.h"
+#include "qdesigner_settings.h"
+#include "newform.h"
+//#include "versiondialog.h"
+//#include "oublietteview.h"
+#include "saveformastemplate.h"
+#include "plugindialog.h"
+#include "formwindowsettings.h"
+
+// sdk
+#include <QtDesigner/QtDesigner>
+#include "private/qdesigner_formbuilder_p.h"
+#include "private/qtundo_p.h"
+#include "private/pluginmanager_p.h"
+
+#include <QtAssistant/QAssistantClient>
+
+#include <QtGui/QStyleFactory>
+#include <QtGui/QAction>
+#include <QtGui/QActionGroup>
+#include <QtGui/QCloseEvent>
+#include <QtGui/QFileDialog>
+#include <QtGui/QMenu>
+#include <QtGui/QMessageBox>
+#include <QtGui/QIcon>
+
+#include <QtCore/QLibraryInfo>
+#include <QtCore/QBuffer>
+#include <QtCore/QPluginLoader>
+#include <QtCore/qdebug.h>
+
+QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
+    : QObject(workbench),
+      m_workbench(workbench), m_assistantClient(0), m_openDirectory(QString())
+{
+    Q_ASSERT(m_workbench != 0);
+
+    m_core = m_workbench->core();
+    Q_ASSERT(m_core != 0);
+
+    QDesignerFormWindowManagerInterface *formWindowManager = m_core->formWindowManager();
+    Q_ASSERT(formWindowManager != 0);
+
+    QDesignerSettings settings;
+    m_fileActions = new QActionGroup(this);
+    m_fileActions->setExclusive(false);
+
+    m_recentFilesActions = new QActionGroup(this);
+    m_recentFilesActions->setExclusive(false);
+
+    m_editActions = new QActionGroup(this);
+    m_editActions->setExclusive(false);
+
+    m_formActions = new QActionGroup(this);
+    m_formActions->setExclusive(false);
+
+    m_windowActions = new QActionGroup(this);
+    m_windowActions->setExclusive(false);
+
+    m_toolActions = new QActionGroup(this);
+    m_toolActions->setExclusive(true);
+
+    m_helpActions = new QActionGroup(this);
+    m_helpActions->setExclusive(false);
+
+
+//
+// file actions
+//
+    m_newFormAction = new QAction(tr("&New Form..."), this);
+    m_newFormAction->setShortcut(tr("CTRL+N"));
+    connect(m_newFormAction, SIGNAL(triggered()), this, SLOT(createForm()));
+    m_fileActions->addAction(m_newFormAction);
+
+    m_openFormAction = new QAction(tr("&Open Form..."), this);
+    m_openFormAction->setShortcut(tr("CTRL+O"));
+    connect(m_openFormAction, SIGNAL(triggered()), this, SLOT(openForm()));
+    m_fileActions->addAction(m_openFormAction);
+
+    QAction *act;
+    // Need to insert this into the QAction.
+    for (int i = 0; i < MaxRecentFiles; ++i) {
+        act = new QAction(this);
+        act->setVisible(false);
+        connect(act, SIGNAL(triggered()), this, SLOT(openRecentForm()));
+        m_recentFilesActions->addAction(act);
+    }
+    updateRecentFileActions();
+
+    act = new QAction(this);
+    act->setSeparator(true);
+    m_recentFilesActions->addAction(act);
+
+    act = new QAction(tr("Clear &Menu"), this);
+    connect(act, SIGNAL(triggered()), this, SLOT(clearRecentFiles()));
+    m_recentFilesActions->addAction(act);
+
+    QAction *sep = new QAction(this);
+    sep->setSeparator(true);
+    m_fileActions->addAction(sep);
+
+    m_saveFormAction = new QAction(tr("&Save Form"), this);
+    m_saveFormAction->setShortcut(tr("CTRL+S"));
+    connect(m_saveFormAction, SIGNAL(triggered()), this, SLOT(saveForm()));
+    m_fileActions->addAction(m_saveFormAction);
+
+    m_saveFormAsAction = new QAction(tr("Save Form &As..."), this);
+    connect(m_saveFormAsAction, SIGNAL(triggered()), this, SLOT(saveFormAs()));
+    m_fileActions->addAction(m_saveFormAsAction);
+
+    m_saveFormAsTemplateAction = new QAction(tr("Save Form As &Template..."), this);
+    connect(m_saveFormAsTemplateAction, SIGNAL(triggered()), this, SLOT(saveFormAsTemplate()));
+    m_fileActions->addAction(m_saveFormAsTemplateAction);
+
+    sep = new QAction(this);
+    sep->setSeparator(true);
+    m_fileActions->addAction(sep);
+
+    m_closeFormAction = new QAction(tr("&Close Form"), this);
+    m_closeFormAction->setShortcut(tr("CTRL+W"));
+    connect(m_closeFormAction, SIGNAL(triggered()), this, SLOT(closeForm()));
+    m_fileActions->addAction(m_closeFormAction);
+
+    sep = new QAction(this);
+    sep->setSeparator(true);
+    m_fileActions->addAction(sep);
+
+    m_quitAction = new QAction(tr("&Quit"), this);
+    m_quitAction->setShortcut(tr("CTRL+Q"));
+    connect(m_quitAction, SIGNAL(triggered()),
+            this, SLOT(shutdown()));
+    m_fileActions->addAction(m_quitAction);
+
+//
+// edit actions
+//
+    m_undoAction = formWindowManager->actionUndo();
+    m_undoAction->setShortcut(tr("CTRL+Z"));
+    m_editActions->addAction(m_undoAction);
+
+    m_redoAction = formWindowManager->actionRedo();
+    m_redoAction->setShortcut(tr("CTRL+SHIFT+Z"));
+    m_editActions->addAction(m_redoAction);
+
+    sep = new QAction(this);
+    sep->setSeparator(true);
+    m_editActions->addAction(sep);
+
+    m_cutAction = formWindowManager->actionCut();
+    m_editActions->addAction(m_cutAction);
+
+    m_copyAction = formWindowManager->actionCopy();
+    m_editActions->addAction(m_copyAction);
+
+    m_pasteAction = formWindowManager->actionPaste();
+    m_editActions->addAction(m_pasteAction);
+
+    m_deleteAction = formWindowManager->actionDelete();
+    m_editActions->addAction(m_deleteAction);
+
+    m_selectAllAction = formWindowManager->actionSelectAll();
+    m_editActions->addAction(m_selectAllAction);
+
+    sep = new QAction(this);
+    sep->setSeparator(true);
+    m_editActions->addAction(sep);
+
+    m_sendToBackAction = formWindowManager->actionLower();
+    m_editActions->addAction(m_sendToBackAction);
+
+    m_bringToFrontAction = formWindowManager->actionRaise();
+    m_editActions->addAction(m_bringToFrontAction);
+
+//
+// edit mode actions
+//
+
+    m_editWidgetsAction = new QAction(tr("Edit Widgets"), this);
+    m_editWidgetsAction->setCheckable(true);
+    m_editWidgetsAction->setShortcut(tr("F3"));
+    m_editWidgetsAction->setIcon(QIcon(m_core->resourceLocation() + QLatin1String("/widgettool.png")));
+    connect(formWindowManager, SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)),
+                this, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface*)));
+    connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(editWidgetsSlot()));
+    m_toolActions->addAction(m_editWidgetsAction);
+    m_editWidgetsAction->setChecked(true);
+    m_editWidgetsAction->setEnabled(false);
+    QList<QObject*> builtinPlugins = QPluginLoader::staticInstances();
+    builtinPlugins += m_core->pluginManager()->instances();
+    foreach (QObject *plugin, builtinPlugins) {
+        if (QDesignerFormEditorPluginInterface *formEditorPlugin = qobject_cast<QDesignerFormEditorPluginInterface*>(plugin)) {
+            m_toolActions->addAction(formEditorPlugin->action());
+            formEditorPlugin->action()->setCheckable(true);
+        }
+    }
+
+    m_uiMode = new QActionGroup(this);
+    m_uiMode->setExclusive(true);
+
+    m_sdiAction = m_uiMode->addAction(tr("Multiple Top-Level Windows"));
+    m_sdiAction->setCheckable(true);
+
+    m_dockedMdiAction = m_uiMode->addAction(tr("Docked Window"));
+    m_dockedMdiAction->setCheckable(true);
+
+    switch (settings.uiMode()) {
+        default: Q_ASSERT(0); break;
+
+        case QDesignerWorkbench::TopLevelMode:
+            m_sdiAction->setChecked(true);
+            break;
+        case QDesignerWorkbench::DockedMode:
+            m_dockedMdiAction->setChecked(true);
+            break;
+    }
+
+    connect(m_uiMode, SIGNAL(triggered(QAction*)), this, SLOT(updateUIMode(QAction*)));
+
+//
+// form actions
+//
+    m_layoutHorizontallyAction = formWindowManager->actionHorizontalLayout();
+    m_formActions->addAction(m_layoutHorizontallyAction);
+
+    m_layoutVerticallyAction = formWindowManager->actionVerticalLayout();
+    m_formActions->addAction(m_layoutVerticallyAction);
+
+    m_layoutHorizontallyInSplitterAction = formWindowManager->actionSplitHorizontal();
+    m_formActions->addAction(m_layoutHorizontallyInSplitterAction);
+
+    m_layoutVerticallyInSplitterAction = formWindowManager->actionSplitVertical();
+    m_formActions->addAction(m_layoutVerticallyInSplitterAction);
+
+    m_layoutGridAction = formWindowManager->actionGridLayout();
+    m_formActions->addAction(m_layoutGridAction);
+
+    m_breakLayoutAction = formWindowManager->actionBreakLayout();
+    m_formActions->addAction(m_breakLayoutAction);
+
+    m_adjustSizeAction = formWindowManager->actionAdjustSize();
+    m_formActions->addAction(m_adjustSizeAction);
+
+    sep = new QAction(this);
+    sep->setSeparator(true);
+
+    m_formActions->addAction(sep);
+
+    m_previewFormAction = new QAction(tr("&Preview"), this);
+    m_previewFormAction->setShortcut(tr("CTRL+R"));
+    connect(m_previewFormAction, SIGNAL(triggered()), this, SLOT(previewFormLater()));
+    m_formActions->addAction(m_previewFormAction);
+
+    m_styleActions = new QActionGroup(this);
+    m_styleActions->setExclusive(true);
+    connect(m_styleActions, SIGNAL(triggered(QAction*)), this, SLOT(previewForm(QAction*)));
+
+    QAction *sep2 = new QAction(this);
+    sep2->setSeparator(true);
+    m_formActions->addAction(sep2);
+
+    m_formSettings = new QAction(tr("Form &Settings..."), this);
+    m_formSettings->setEnabled(false);
+    connect(m_formSettings, SIGNAL(triggered()), this, SLOT(showFormSettings()));
+    m_formActions->addAction(m_formSettings);
+
+    QStringList availableStyleList = QStyleFactory::keys();
+    foreach (QString style, availableStyleList) {
+        QAction *a = new QAction(this);
+        a->setText(tr("%1 Style").arg(style));
+        a->setObjectName(QLatin1String("__qt_action_style_") + style);
+
+        m_styleActions->addAction(a);
+    }
+
+//
+// window actions
+//
+    m_minimizeAction = new QAction(tr("&Minimize"), this);
+    m_minimizeAction->setEnabled(false);
+    m_minimizeAction->setShortcut(tr("CTRL+M"));
+    connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(minimizeForm()));
+    m_windowActions->addAction(m_minimizeAction);
+
+    sep = new QAction(this);
+    sep->setSeparator(true);
+    m_windowActions->addAction(sep);
+
+    m_bringToFrontAction = new QAction(tr("Bring All to Front"), this);
+    connect(m_bringToFrontAction, SIGNAL(triggered()), this, SLOT(bringAllToFront()));
+    m_windowActions->addAction(m_bringToFrontAction);
+
+//
+// Help actions
+//
+
+    m_mainHelpAction = new QAction(tr("Qt Designer &Help"), this);
+    connect(m_mainHelpAction, SIGNAL(triggered()), this, SLOT(showDesignerHelp()));
+    m_mainHelpAction->setShortcut(Qt::CTRL + Qt::Key_Question);
+    m_helpActions->addAction(m_mainHelpAction);
+
+    sep = new QAction(this);
+    sep->setSeparator(true);
+    m_helpActions->addAction(sep);
+
+    m_widgetHelp = new QAction(tr("Current Widget Help"), this);
+    m_widgetHelp->setShortcut(Qt::Key_F1);
+    connect(m_widgetHelp, SIGNAL(triggered()), this, SLOT(showWidgetSpecificHelp()));
+    m_helpActions->addAction(m_widgetHelp);
+
+    sep = new QAction(this);
+    sep->setSeparator(true);
+    m_helpActions->addAction(sep);
+
+    m_whatsNewAction = new QAction(tr("What's New in Qt Designer?"), this);
+    connect(m_whatsNewAction, SIGNAL(triggered()), this, SLOT(showWhatsNew()));
+    m_helpActions->addAction(m_whatsNewAction);
+
+    // On Mac OS X, the about items are merged in so this separator is redundant.
+#ifndef Q_WS_MAC
+    sep = new QAction(this);
+    sep->setSeparator(true);
+    m_helpActions->addAction(sep);
+    m_aboutPluginsAction = new QAction(tr("About Plugins"), this);
+#else
+    m_aboutPluginsAction = new QAction(tr("Plugin Information"), this);
+#endif
+    connect(m_aboutPluginsAction, SIGNAL(triggered()), this, SLOT(aboutPlugins()));
+    m_helpActions->addAction(m_aboutPluginsAction);
+
+    m_aboutDesignerAction = new QAction(tr("About Qt Designer"), this);
+    connect(m_aboutDesignerAction, SIGNAL(triggered()), this, SLOT(aboutDesigner()));
+    m_helpActions->addAction(m_aboutDesignerAction);
+
+    m_aboutQtAction = new QAction(tr("About Qt"), this);
+    connect(m_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+    m_helpActions->addAction(m_aboutQtAction);
+//
+// connections
+//
+    fixActionContext();
+    activeFormWindowChanged(core()->formWindowManager()->activeFormWindow());
+}
+
+QDesignerActions::~QDesignerActions()
+{
+}
+
+QActionGroup *QDesignerActions::toolActions() const
+{ return m_toolActions; }
+
+QDesignerWorkbench *QDesignerActions::workbench() const
+{ return m_workbench; }
+
+QDesignerFormEditorInterface *QDesignerActions::core() const
+{ return m_core; }
+
+QActionGroup *QDesignerActions::fileActions() const
+{ return m_fileActions; }
+
+QActionGroup *QDesignerActions::editActions() const
+{ return m_editActions; }
+
+QActionGroup *QDesignerActions::formActions() const
+{ return m_formActions; }
+
+QActionGroup *QDesignerActions::windowActions() const
+{ return m_windowActions; }
+
+QActionGroup *QDesignerActions::helpActions() const
+{ return m_helpActions; }
+
+QActionGroup *QDesignerActions::styleActions() const
+{ return m_styleActions; }
+
+QAction *QDesignerActions::newFormAction() const
+{ return m_newFormAction; }
+
+QAction *QDesignerActions::openFormAction() const
+{ return m_openFormAction; }
+
+QAction *QDesignerActions::saveFormAction() const
+{ return m_saveFormAction; }
+
+QAction *QDesignerActions::saveFormAsAction() const
+{ return m_saveFormAsAction; }
+
+QAction *QDesignerActions::saveFormAsTemplateAction() const
+{ return m_saveFormAsTemplateAction; }
+
+QAction *QDesignerActions::closeFormAction() const
+{ return m_closeFormAction; }
+
+QAction *QDesignerActions::quitAction() const
+{ return m_quitAction; }
+
+QAction *QDesignerActions::undoAction() const
+{ return m_undoAction; }
+
+QAction *QDesignerActions::redoAction() const
+{ return m_redoAction; }
+
+QAction *QDesignerActions::cutAction() const
+{ return m_cutAction; }
+
+QAction *QDesignerActions::copyAction() const
+{ return m_copyAction; }
+
+QAction *QDesignerActions::pasteAction() const
+{ return m_pasteAction; }
+
+QAction *QDesignerActions::selectAllAction() const
+{ return m_selectAllAction; }
+
+QAction *QDesignerActions::deleteAction() const
+{ return m_deleteAction; }
+
+QAction *QDesignerActions::sendToBackAction() const
+{ return m_sendToBackAction; }
+
+QAction *QDesignerActions::bringToFrontAction() const
+{ return m_bringToFrontAction; }
+
+QAction *QDesignerActions::mainHelpAction() const
+{ return m_mainHelpAction; }
+
+QAction *QDesignerActions::whatsNewAction() const
+{ return m_whatsNewAction; }
+
+QAction *QDesignerActions::aboutQtAction() const
+{ return m_aboutQtAction; }
+
+QAction *QDesignerActions::aboutDesignerAction() const
+{ return m_aboutDesignerAction; }
+
+QAction *QDesignerActions::layoutHorizontallyAction() const
+{ return m_layoutHorizontallyAction; }
+
+QAction *QDesignerActions::layoutVerticallyAction() const
+{ return m_layoutVerticallyAction; }
+
+QAction *QDesignerActions::layoutHorizontallyInSplitterAction() const
+{ return m_layoutHorizontallyInSplitterAction; }
+
+QAction *QDesignerActions::layoutVerticallyInSplitterAction() const
+{ return m_layoutVerticallyInSplitterAction; }
+
+QAction *QDesignerActions::layoutGridAction() const
+{ return m_layoutGridAction; }
+
+QAction *QDesignerActions::breakLayoutAction() const
+{ return m_breakLayoutAction; }
+
+QAction *QDesignerActions::adjustSizeAction() const
+{ return m_adjustSizeAction; }
+
+QAction *QDesignerActions::previewFormAction() const
+{ return m_previewFormAction; }
+
+QAction *QDesignerActions::formSettings() const
+{ return m_formSettings; }
+
+void QDesignerActions::editWidgetsSlot()
+{
+    QDesignerFormWindowManagerInterface *formWindowManager = core()->formWindowManager();
+    for (int i=0; i<formWindowManager->formWindowCount(); ++i) {
+        QDesignerFormWindowInterface *formWindow = formWindowManager->formWindow(i);
+        formWindow->editWidgets();
+    }
+}
+
+void QDesignerActions::createForm()
+{
+    NewForm *dlg = new NewForm(workbench(), 0);
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->setAttribute(Qt::WA_ShowModal);
+    dlg->show();
+}
+
+bool QDesignerActions::openForm()
+{
+    QString fileName = QFileDialog::getOpenFileName(
+            core()->topLevel(),
+            tr("Open Form"), m_openDirectory,
+            tr("Designer UI files (*.ui)"), 0, QFileDialog::DontUseSheet);
+
+    if (!fileName.isEmpty()) {
+        return readInForm(fileName);
+    }
+    return false;
+}
+
+bool QDesignerActions::saveFormAs(QDesignerFormWindowInterface *fw)
+{
+    QString fileName = fw->fileName().isEmpty() ? QDir::current().absolutePath()
+            + QLatin1String("/untitled.ui") : fw->fileName();
+    QString saveFile = QFileDialog::getSaveFileName(fw, tr("Save form as"),
+            fileName,
+            tr("Designer UI files (*.ui)"));
+    if (saveFile.isEmpty())
+        return false;
+
+    if (QFileInfo(saveFile).suffix() != QLatin1String("ui"))
+        saveFile.append(QLatin1String(".ui"));
+
+    fw->setFileName(saveFile);
+    return writeOutForm(fw, saveFile);
+}
+
+void QDesignerActions::saveForm()
+{
+    if (QDesignerFormWindowInterface *fw = core()->formWindowManager()->activeFormWindow())
+        saveForm(fw);
+}
+
+bool QDesignerActions::saveForm(QDesignerFormWindowInterface *fw)
+{
+    bool ret;
+    if (fw->fileName().isEmpty())
+        ret = saveFormAs(fw);
+    else
+        ret =  writeOutForm(fw, fw->fileName());
+    return ret;
+}
+
+void QDesignerActions::closeForm()
+{
+    if (QDesignerFormWindowInterface *fw = core()->formWindowManager()->activeFormWindow())
+        fw->parentWidget()->close();
+}
+
+void QDesignerActions::saveFormAs()
+{
+    if (QDesignerFormWindowInterface *fw = core()->formWindowManager()->activeFormWindow())
+        saveFormAs(fw);
+}
+
+void QDesignerActions::saveFormAsTemplate()
+{
+    if (QDesignerFormWindowInterface *fw = core()->formWindowManager()->activeFormWindow()) {
+        SaveFormAsTemplate dlg(fw, fw->window());
+        dlg.exec();
+    }
+}
+
+void QDesignerActions::notImplementedYet()
+{
+    QMessageBox::information(core()->topLevel(), tr("Designer"), tr("Feature not implemented yet!"));
+}
+
+void QDesignerActions::updateUIMode(QAction *act)
+{
+    QDesignerWorkbench::UIMode mode = QDesignerWorkbench::TopLevelMode;
+    if (act == m_dockedMdiAction)
+        mode = QDesignerWorkbench::DockedMode;
+
+    QDesignerSettings settings;
+    settings.setUIMode(mode);
+
+    m_workbench->setUIMode(QDesignerWorkbench::UIMode(settings.uiMode()));
+}
+
+void QDesignerActions::previewFormLater(QAction *action)
+{
+    qRegisterMetaType<QAction*>("QAction*");
+    QMetaObject::invokeMethod(this, "previewForm", Qt::QueuedConnection,
+                                Q_ARG(QAction*, action));
+}
+
+void QDesignerActions::previewForm(QAction *action)
+{
+//return;
+
+    if (QDesignerFormWindowInterface *fw = core()->formWindowManager()->activeFormWindow()) {
+        qdesigner_internal::QDesignerFormBuilder builder(core(), qdesigner_internal::QDesignerFormBuilder::DisableScripts);
+        builder.setWorkingDirectory(fw->absoluteDir());
+
+        QByteArray bytes = fw->contents().toUtf8();
+        QBuffer buffer(&bytes);
+
+        QWidget *widget = builder.load(&buffer, 0);
+        Q_ASSERT(widget);
+
+
+        widget->setParent(fw->window(), Qt::Dialog);
+        widget->setWindowModality(Qt::ApplicationModal);
+        widget->setAttribute(Qt::WA_DeleteOnClose, true);
+        widget->move(fw->mapToGlobal(QPoint(0, 0)) + QPoint(10, 10));
+
+        QStyle *style = 0;
+
+        if (action != 0 && action->objectName().startsWith(QLatin1String("__qt_action_style_"))) {
+            QString styleName = action->objectName().mid(QString::fromUtf8("__qt_action_style_").count());
+            style = QStyleFactory::create(styleName);
+
+            if (style != 0) {
+                style->setParent(widget);
+                widget->setStyle(style);
+                widget->setPalette(style->standardPalette());
+                QList<QWidget*> lst = qFindChildren<QWidget*>(widget);
+                foreach (QWidget *w, lst) {
+                    if (w->windowType() == Qt::Popup)
+                        w->setPalette(style->standardPalette());
+                    w->setStyle(style);
+                }
+            }
+        }
+
+        widget->setWindowTitle(tr("%1 - [Preview]").arg(widget->windowTitle()));
+
+        widget->show();
+    }
+}
+
+void QDesignerActions::fixActionContext()
+{
+    QList<QAction*> actions;
+    actions += m_fileActions->actions();
+    actions += m_editActions->actions();
+    actions += m_toolActions->actions();
+    actions += m_formActions->actions();
+    actions += m_windowActions->actions();
+    actions += m_helpActions->actions();
+
+    foreach (QAction *a, actions) {
+        a->setShortcutContext(Qt::ApplicationShortcut);
+    }
+}
+
+bool QDesignerActions::readInForm(const QString &fileName)
+{
+    // First make sure that we don't have this one open already.
+    QDesignerFormWindowManagerInterface *formWindowManager = core()->formWindowManager();
+    int totalWindows = formWindowManager->formWindowCount();
+    for (int i = 0; i < totalWindows; ++i) {
+        QDesignerFormWindowInterface *w = formWindowManager->formWindow(i);
+        if (w->fileName() == fileName) {
+            w->raise();
+            formWindowManager->setActiveFormWindow(w);
+            addRecentFile(fileName);
+            return true;
+        }
+    }
+
+    // Otherwise load it.
+    QFile f(fileName);
+    if (!f.open(QFile::ReadOnly)) {
+        QMessageBox::warning(core()->topLevel(), tr("Read Error"), tr("Couldn't open file: %1\nReason: %2")
+                .arg(f.fileName()).arg(f.errorString()));
+        return false;
+    }
+
+    m_openDirectory = QFileInfo(f).absolutePath();
+
+    QDesignerFormWindow *formWindow = workbench()->createFormWindow();
+    if (QDesignerFormWindowInterface *editor = formWindow->editor()) {
+        editor->setFileName(fileName);
+        editor->setContents(&f);
+        Q_ASSERT(editor->mainContainer() != 0);
+        formWindow->updateWindowTitle(fileName);
+        formWindow->resize(editor->mainContainer()->size());
+        formWindowManager->setActiveFormWindow(editor);
+    }
+    formWindow->show();
+    addRecentFile(fileName);
+    formWindow->editor()->setDirty(false);
+    return true;
+}
+
+bool QDesignerActions::writeOutForm(QDesignerFormWindowInterface *fw, const QString &saveFile)
+{
+    Q_ASSERT(fw && !saveFile.isEmpty());
+    QFile f(saveFile);
+    while (!f.open(QFile::WriteOnly)) {
+        QMessageBox box(tr("Save Form?"),
+                        tr("Could not open file: %1"
+                                "\nReason: %2"
+                                "\nWould you like to retry or change your file?")
+                                .arg(f.fileName()).arg(f.errorString()),
+                        QMessageBox::Warning,
+                        QMessageBox::Yes | QMessageBox::Default, QMessageBox::No,
+                        QMessageBox::Cancel | QMessageBox::Escape, fw, Qt::Sheet);
+        box.setButtonText(QMessageBox::Yes, tr("Retry"));
+        box.setButtonText(QMessageBox::No, tr("Select New File"));
+        switch(box.exec()) {
+            case QMessageBox::Yes:
+                break;
+                case QMessageBox::No: {
+                    QString fileName = QFileDialog::getSaveFileName(fw, tr("Save form as"),
+                            QDir::current().absolutePath(), QLatin1String("*.ui"));
+                    if (fileName.isEmpty())
+                        return false;
+                    f.setFileName(fileName);
+                    fw->setFileName(fileName);
+                    break; }
+            case QMessageBox::Cancel:
+                return false;
+        }
+    }
+    QByteArray utf8Array = fw->contents().toUtf8();
+    while (f.write(utf8Array, utf8Array.size()) != utf8Array.size()) {
+        QMessageBox box(tr("Save Form?"),
+                        tr("Could not write file: %1\nReason:%2\nWould you like to retry?")
+                                .arg(f.fileName()).arg(f.errorString()),
+                        QMessageBox::Warning,
+                        QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, 0,
+                        fw, Qt::Sheet);
+        box.setButtonText(QMessageBox::Yes, tr("Retry"));
+        box.setButtonText(QMessageBox::No, tr("Don't Retry"));
+        switch(box.exec()) {
+            case QMessageBox::Yes:
+                f.resize(0);
+                break;
+            case QMessageBox::No:
+                return false;
+        }
+    }
+    addRecentFile(saveFile);
+    fw->setDirty(false);
+    fw->parentWidget()->setWindowModified(false);
+    return true;
+}
+
+void QDesignerActions::shutdown()
+{
+
+    // Follow the idea from the Mac, i.e. send the Application a close event
+    // and if it's accepted, quit.
+    /*QCloseEvent ev;
+    QApplication::sendEvent(qDesigner, &ev);
+    if (ev.isAccepted())
+        qDesigner->quit();*/
+}
+
+void QDesignerActions::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow)
+{
+    bool enable = formWindow != 0;
+
+    m_saveFormAction->setEnabled(enable);
+    m_saveFormAsAction->setEnabled(enable);
+    m_saveFormAsTemplateAction->setEnabled(enable);
+    m_closeFormAction->setEnabled(enable);
+
+    m_editWidgetsAction->setEnabled(enable);
+    m_formSettings->setEnabled(enable);
+
+    m_previewFormAction->setEnabled(enable);
+    m_styleActions->setEnabled(enable);
+}
+
+void QDesignerActions::updateRecentFileActions()
+{
+    QDesignerSettings settings;
+    QStringList files = settings.recentFilesList();
+    int originalSize = files.size();
+    int numRecentFiles = qMin(files.size(), int(MaxRecentFiles));
+    QList<QAction *> recentFilesActs = m_recentFilesActions->actions();
+
+    for (int i = 0; i < numRecentFiles; ++i) {
+        QFileInfo fi(files[i]);
+        // If the file doesn't exist anymore, just remove it from the list so
+        // people don't get confused.
+        if (!fi.exists()) {
+            files.removeAt(i);
+            --i;
+            numRecentFiles = qMin(files.size(), int(MaxRecentFiles));
+            continue;
+        }
+        QString text = fi.fileName();
+        recentFilesActs[i]->setText(text);
+        recentFilesActs[i]->setIconText(files[i]);
+        recentFilesActs[i]->setVisible(true);
+    }
+
+    for (int j = numRecentFiles; j < MaxRecentFiles; ++j)
+        recentFilesActs[j]->setVisible(false);
+
+    // If there's been a change, right it back
+    if (originalSize != files.size())
+        settings.setRecentFilesList(files);
+}
+
+void QDesignerActions::openRecentForm()
+{
+    if (QAction *action = qobject_cast<QAction *>(sender())) {
+        if (!readInForm(action->iconText()))
+            updateRecentFileActions(); // File doesn't exist, remove it from settings
+    }
+}
+
+void QDesignerActions::clearRecentFiles()
+{
+    QDesignerSettings settings;
+    settings.setRecentFilesList(QStringList());
+    updateRecentFileActions();
+}
+
+QActionGroup *QDesignerActions::recentFilesActions() const
+{
+    return m_recentFilesActions;
+}
+
+void QDesignerActions::addRecentFile(const QString &fileName)
+{
+    QDesignerSettings settings;
+    QStringList files = settings.recentFilesList();
+    files.removeAll(fileName);
+    files.prepend(fileName);
+    while (files.size() > MaxRecentFiles)
+        files.removeLast();
+
+    settings.setRecentFilesList(files);
+    updateRecentFileActions();
+}
+
+void QDesignerActions::minimizeForm()
+{
+    if (QDesignerFormWindowInterface *fw = core()->formWindowManager()->activeFormWindow()) {
+        if (m_workbench->mode() == QDesignerWorkbench::DockedMode) {
+            // Yuck, I need to get to the QWorkspaceChild::showShaded(), but there is no way
+            // to do that legally, so I use the QMetaObject as my guide.
+            QMetaObject::invokeMethod(fw->parentWidget()->parentWidget(), "showShaded");
+        } else {
+            fw->parentWidget()->showMinimized();
+        }
+    }
+}
+
+void QDesignerActions::bringAllToFront()
+{
+    int i;
+    for (i = 0; i < m_workbench->formWindowCount(); ++i)
+        m_workbench->formWindow(i)->raise();
+
+    for (i = 0; i < m_workbench->toolWindowCount(); ++i)
+        m_workbench->toolWindow(i)->raise();
+}
+
+QAction *QDesignerActions::minimizeAction() const
+{
+    return m_minimizeAction;
+}
+
+QAction *QDesignerActions::bringAllToFront() const
+{
+    return m_bringToFrontAction;
+}
+
+void QDesignerActions::showDesignerHelp()
+{
+    showHelp(QLatin1String("designer-manual.html"));
+}
+
+void QDesignerActions::showWhatsNew()
+{
+    showHelp(QLatin1String("qt4-designer.html"));
+}
+
+void QDesignerActions::showHelp(const QString &url)
+{
+    /*if (!m_assistantClient)
+        m_assistantClient
+            = new QAssistantClient(QLibraryInfo::location(QLibraryInfo::BinariesPath), this);
+
+    QString filePath = QLibraryInfo::location(QLibraryInfo::DocumentationPath)
+                                + QLatin1String("/html/") + url;
+
+    QString cleanFilePath;
+    int index = filePath.lastIndexOf(QLatin1Char('#'));
+    if (index != -1)
+        cleanFilePath = filePath.left(index);
+    else
+        cleanFilePath = filePath;
+
+    if (!QFile::exists(cleanFilePath)) {
+        filePath = QLibraryInfo::location(QLibraryInfo::DocumentationPath)
+                                + QLatin1String("/html/designer-manual.html");
+    }
+
+    m_assistantClient->showPage(filePath);*/
+}
+
+void QDesignerActions::aboutDesigner()
+{
+    /*VersionDialog mb(core()->topLevel());
+    mb.setWindowTitle(tr("About Qt Designer"));
+    if (mb.exec()) {
+        OublietteView *oubliette = new OublietteView;
+        oubliette->setAttribute(Qt::WA_DeleteOnClose);
+        oubliette->setMinimumSize(800, 600);
+        oubliette->show();
+    }*/
+}
+
+QActionGroup *QDesignerActions::uiMode() const
+{
+    return m_uiMode;
+}
+
+
+QAction *QDesignerActions::editWidgets() const
+{
+    return m_editWidgetsAction;
+}
+
+void QDesignerActions::showWidgetSpecificHelp()
+{
+    QDesignerFormWindowInterface *fw = core()->formWindowManager()->activeFormWindow();
+    if (!fw) {
+        showDesignerHelp();
+        return;
+    }
+
+    QString className;
+    QString currentPropertyName;
+
+    currentPropertyName = core()->propertyEditor()->currentPropertyName();
+    if (!currentPropertyName.isEmpty()) {
+        QDesignerPropertySheetExtension *ps
+            = qt_extension<QDesignerPropertySheetExtension *>(core()->extensionManager(),
+                                                            core()->propertyEditor()->object());
+        if (!ps)
+            ps = qt_extension<QDesignerPropertySheetExtension *>(core()->extensionManager(),
+                                                            fw->cursor()->selectedWidget(0));
+        Q_ASSERT(ps);
+        className = ps->propertyGroup(ps->indexOf(currentPropertyName));
+    } else {
+        QDesignerWidgetDataBaseInterface *db = core()->widgetDataBase();
+        QDesignerWidgetDataBaseItemInterface *dbi = db->item(db->indexOfObject(fw->cursor()->selectedWidget(0), true));
+        className = dbi->name();
+    }
+
+    // ### generalize using the Widget Data Base
+    if (className == QLatin1String("Line"))
+        className = QLatin1String("QFrame");
+    else if (className == QLatin1String("Spacer"))
+        className = QLatin1String("QSpacerItem");
+    else if (className == QLatin1String("QLayoutWidget"))
+        className = QLatin1String("QLayout");
+
+    QString url = className.toLower();
+
+    // special case
+    url += QLatin1String(".html");
+
+    if (!currentPropertyName.isEmpty())
+        url += QLatin1Char('#') + currentPropertyName;
+
+    showHelp(url);
+}
+
+QAction *QDesignerActions::widgetHelpAction() const
+{
+    return m_widgetHelp;
+}
+
+void QDesignerActions::aboutPlugins()
+{
+    PluginDialog dlg(core(), core()->topLevel());
+    dlg.exec();
+}
+
+void QDesignerActions::showFormSettings()
+{
+    QDesignerFormWindowInterface *formWindow = core()->formWindowManager()->activeFormWindow();
+    QDesignerFormWindow *window = m_workbench->findFormWindow(formWindow);
+    FormWindowSettings dlg(formWindow);
+    if (dlg.exec() && window) {
+        formWindow->setDirty(true);
+        window->updateChanged();
+    }
+}
diff --git a/src/designer/formdesigner/qdesigner_actions.h b/src/designer/formdesigner/qdesigner_actions.h
new file mode 100644 (file)
index 0000000..9cbdcee
--- /dev/null
@@ -0,0 +1,223 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef QDESIGNER_ACTIONS_H
+#define QDESIGNER_ACTIONS_H
+
+#include <QtCore/QPointer>
+#include <QtCore/QObject>
+#include <QtGui/QAction>
+
+class QDesignerMainWindow;
+class QDesignerWorkbench;
+
+class QAction;
+class QActionGroup;
+class QDesignerFormEditorInterface;
+class QDesignerFormWindowInterface;
+class QAssistantClient;
+
+class QDesignerActions: public QObject
+{
+    Q_OBJECT
+public:
+    QDesignerActions(QDesignerWorkbench *mainWindow);
+    virtual ~QDesignerActions();
+
+    QDesignerWorkbench *workbench() const;
+    QDesignerFormEditorInterface *core() const;
+
+    bool saveForm(QDesignerFormWindowInterface *fw);
+    bool readInForm(const QString &fileName);
+    bool writeOutForm(QDesignerFormWindowInterface *formWindow, const QString &fileName);
+
+    QActionGroup *fileActions() const;
+    QActionGroup *recentFilesActions() const;
+    QActionGroup *editActions() const;
+    QActionGroup *formActions() const;
+    QActionGroup *windowActions() const;
+    QActionGroup *toolActions() const;
+    QActionGroup *helpActions() const;
+    QActionGroup *uiMode() const;
+    QActionGroup *styleActions() const;
+
+//
+// file actions
+//
+    QAction *newFormAction() const;
+    QAction *openFormAction() const;
+    QAction *saveFormAction() const;
+    QAction *saveFormAsAction() const;
+    QAction *saveFormAsTemplateAction() const;
+    QAction *closeFormAction() const;
+    QAction *quitAction() const;
+
+//
+// edit actions
+//
+    QAction *undoAction() const;
+    QAction *redoAction() const;
+    QAction *cutAction() const;
+    QAction *copyAction() const;
+    QAction *pasteAction() const;
+    QAction *deleteAction() const;
+    QAction *selectAllAction() const;
+    QAction *sendToBackAction() const;
+    QAction *bringToFrontAction() const;
+
+//
+// edit mode actions
+//
+    QAction *editWidgets() const;
+    QAction *editConnections() const;
+    QAction *editTabOrders() const;
+    QAction *editBuddies() const;
+
+//
+// form actions
+//
+    QAction *layoutHorizontallyAction() const;
+    QAction *layoutVerticallyAction() const;
+    QAction *layoutHorizontallyInSplitterAction() const;
+    QAction *layoutVerticallyInSplitterAction() const;
+    QAction *layoutGridAction() const;
+    QAction *breakLayoutAction() const;
+    QAction *adjustSizeAction() const;
+    QAction *previewFormAction() const;
+    QAction *formSettings() const;
+
+//
+// window actions
+//
+    QAction *minimizeAction() const;
+    QAction *bringAllToFront() const;
+
+//
+// help actions
+//
+    QAction *mainHelpAction() const;
+    QAction *widgetHelpAction() const;
+    QAction *whatsNewAction() const;
+    QAction *aboutQtAction() const;
+    QAction *aboutDesignerAction() const;
+
+public slots:
+    void activeFormWindowChanged(QDesignerFormWindowInterface *formWindow);
+    void createForm();
+    bool openForm();
+
+signals:
+    void useBigIcons(bool);
+
+private slots:
+    void saveForm();
+    void saveFormAs();
+    void saveFormAsTemplate();
+    void previewForm(QAction *action = 0);
+    void previewFormLater(QAction *action = 0);
+    void notImplementedYet();
+    void shutdown();
+    void editWidgetsSlot();
+    void openRecentForm();
+    void clearRecentFiles();
+    void closeForm();
+    void minimizeForm();
+    void bringAllToFront();
+    void showDesignerHelp();
+    void showWhatsNew();
+    void aboutPlugins();
+    void aboutDesigner();
+    void updateUIMode(QAction *act);
+    void showWidgetSpecificHelp();
+    void showFormSettings();
+
+private:
+    bool saveFormAs(QDesignerFormWindowInterface *fw);
+    void fixActionContext();
+    void updateRecentFileActions();
+    void addRecentFile(const QString &fileName);
+    void showHelp(const QString &help);
+
+private:
+    enum { MaxRecentFiles = 10 };
+    QDesignerWorkbench *m_workbench;
+    QDesignerFormEditorInterface *m_core;
+    QAssistantClient *m_assistantClient;
+    QString m_openDirectory;
+
+    QActionGroup *m_fileActions;
+    QActionGroup *m_recentFilesActions;
+    QActionGroup *m_editActions;
+    QActionGroup *m_formActions;
+    QActionGroup *m_windowActions;
+    QActionGroup *m_toolActions;
+    QActionGroup *m_helpActions;
+    QActionGroup *m_uiMode;
+    QActionGroup *m_styleActions;
+
+    QAction *m_editWidgetsAction;
+
+    QAction *m_newFormAction;
+    QAction *m_openFormAction;
+    QAction *m_saveFormAction;
+    QAction *m_saveFormAsAction;
+    QAction *m_saveFormAsTemplateAction;
+    QAction *m_closeFormAction;
+
+    QAction *m_quitAction;
+    QAction *m_undoAction;
+    QAction *m_redoAction;
+    QAction *m_cutAction;
+    QAction *m_copyAction;
+    QAction *m_pasteAction;
+    QAction *m_deleteAction;
+    QAction *m_sendToBackAction;
+    QAction *m_bringToFrontAction;
+    QAction *m_selectAllAction;
+
+
+    QAction *m_layoutHorizontallyAction;
+    QAction *m_layoutVerticallyAction;
+    QAction *m_layoutHorizontallyInSplitterAction;
+    QAction *m_layoutVerticallyInSplitterAction;
+    QAction *m_layoutGridAction;
+    QAction *m_breakLayoutAction;
+    QAction *m_adjustSizeAction;
+    QAction *m_previewFormAction;
+    QAction *m_formSettings;
+
+    QAction *m_minimizeAction;
+    QAction *m_bringAllToFrontAction;
+
+    QAction *m_mainHelpAction;
+    QAction *m_widgetHelp;
+    QAction *m_whatsNewAction;
+    QAction *m_aboutQtAction;
+    QAction *m_aboutPluginsAction;
+    QAction *m_aboutDesignerAction;
+    QAction *m_sdiAction;
+    QAction *m_dockedMdiAction;
+};
+
+#endif // QDESIGNER_ACTIONS_H
+
diff --git a/src/designer/formdesigner/qdesigner_formwindow.cpp b/src/designer/formdesigner/qdesigner_formwindow.cpp
new file mode 100644 (file)
index 0000000..0081f49
--- /dev/null
@@ -0,0 +1,180 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include "qdesigner_actions.h"
+#include "qdesigner_formwindow.h"
+#include "qdesigner_workbench.h"
+#include "qdesigner_settings.h"
+
+// sdk
+#include <QtDesigner/QtDesigner>
+
+// shared
+#include "private/qtundo_p.h"
+
+#include <QtCore/QEvent>
+#include <QtCore/QFile>
+#include <QtCore/QTimer>
+#include <QtCore/qdebug.h>
+
+#include <QtGui/QAction>
+#include <QtGui/QCloseEvent>
+#include <QtGui/QFileDialog>
+#include <QtGui/QMessageBox>
+
+QDesignerFormWindow::QDesignerFormWindow(QDesignerFormWindowInterface *editor, QDesignerWorkbench *workbench, QWidget *parent, Qt::WindowFlags flags)
+    : QMainWindow(parent, flags),
+      m_editor(editor),
+      m_workbench(workbench)
+{
+    Q_ASSERT(workbench);
+
+    if (m_editor) {
+        m_editor->setParent(this);
+    } else {
+        m_editor = workbench->core()->formWindowManager()->createFormWindow(this);
+    }
+
+    setCentralWidget(m_editor);
+
+    m_action = new QAction(this);
+    m_action->setCheckable(true);
+
+    connect((QObject*)m_editor->commandHistory(), SIGNAL(commandExecuted()), this, SLOT(updateChanged()));
+    connect(m_editor, SIGNAL(fileNameChanged(QString)), this, SLOT(updateWindowTitle(QString)));
+}
+
+QDesignerFormWindow::~QDesignerFormWindow()
+{
+    if (workbench())
+        workbench()->removeFormWindow(this);
+}
+
+QAction *QDesignerFormWindow::action() const
+{
+    return m_action;
+}
+
+void QDesignerFormWindow::changeEvent(QEvent *e)
+{
+    switch (e->type()) {
+        case QEvent::ActivationChange: {
+            if (isActiveWindow()) {
+                m_action->setChecked(true);
+                // ### raise();
+            }
+        } break;
+        case QEvent::WindowTitleChange:
+            m_action->setText(windowTitle().replace(QLatin1String("[*]"), ""));
+            break;
+        case QEvent::WindowIconChange:
+            m_action->setIcon(windowIcon());
+            break;
+        default:
+            break;
+    }
+    QMainWindow::changeEvent(e);
+}
+
+QRect QDesignerFormWindow::geometryHint() const
+{
+    return QRect(0, 0, 400, 300);
+}
+
+QDesignerFormWindowInterface *QDesignerFormWindow::editor() const
+{
+    return m_editor;
+}
+
+QDesignerWorkbench *QDesignerFormWindow::workbench() const
+{
+    return m_workbench;
+}
+
+void QDesignerFormWindow::updateWindowTitle(const QString &fileName)
+{
+    QString fn = fileName;
+
+    if (fn.isEmpty()) {
+        // Try to preserve its "untitled" number.
+        QRegExp rx(QLatin1String("unnamed( (\\d+))?"));
+
+        if (rx.indexIn(windowTitle()) != -1) {
+            fn = rx.cap(0);
+        } else {
+            fn = QLatin1String("untitled");
+        }
+    }
+
+    if (QWidget *mc = m_editor->mainContainer()) {
+        setWindowIcon(mc->windowIcon());
+        setWindowTitle(tr("%1 - %2[*]").arg(mc->windowTitle()).arg(fn));
+    } else {
+        setWindowTitle(fn);
+    }
+}
+
+void QDesignerFormWindow::closeEvent(QCloseEvent *ev)
+{
+    if (m_editor->isDirty()) {
+// Сохраняем автоматически
+        bool ok = workbench()->saveForm(m_editor);
+        ev->setAccepted(ok);
+        m_editor->setDirty(!ok);
+       
+/*        raise();
+        QMessageBox box(tr("Save Form?"),
+                tr("Do you want to save the changes you made to \"%1\" before closing?")
+                .arg(m_editor->fileName().isEmpty() ? action()->text() : m_editor->fileName()),
+                QMessageBox::Information,
+                QMessageBox::Yes | QMessageBox::Default, QMessageBox::No,
+                QMessageBox::Cancel | QMessageBox::Escape, m_editor, Qt::Sheet);
+        box.setButtonText(QMessageBox::Yes, m_editor->fileName().isEmpty() ? tr("Save...") : tr("Save"));
+        box.setButtonText(QMessageBox::No, tr("Don't Save"));
+        switch (box.exec()) {
+            case QMessageBox::Yes: {
+                bool ok = workbench()->saveForm(m_editor);
+                ev->setAccepted(ok);
+                m_editor->setDirty(!ok);
+                break;
+            }
+            case QMessageBox::No:
+                m_editor->setDirty(false); // Not really necessary, but stops problems if we get close again.
+                ev->accept();
+                break;
+            case QMessageBox::Cancel:
+                ev->ignore();
+                break;
+        }*/
+    }
+
+    if (m_workbench->core()->formWindowManager()->formWindowCount() == 1 && ev->isAccepted()
+            && QDesignerSettings().showNewFormOnStartup())
+        QTimer::singleShot(200, m_workbench->actionManager(), SLOT(createForm()));  // Use timer in case we are quitting.
+}
+
+void QDesignerFormWindow::updateChanged()
+{
+    setWindowModified(m_editor->isDirty());
+    updateWindowTitle(m_editor->fileName());
+}
diff --git a/src/designer/formdesigner/qdesigner_formwindow.h b/src/designer/formdesigner/qdesigner_formwindow.h
new file mode 100644 (file)
index 0000000..61e7af2
--- /dev/null
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef QDESIGNER_FORMWINDOW_H
+#define QDESIGNER_FORMWINDOW_H
+
+#include <QtCore/QPointer>
+#include <QtGui/QMainWindow>
+
+class QDesignerWorkbench;
+class QDesignerFormWindowInterface;
+
+class QDesignerFormWindow: public QMainWindow
+{
+    Q_OBJECT
+public:
+    QDesignerFormWindow(QDesignerFormWindowInterface *formWindow, QDesignerWorkbench *workbench,
+                        QWidget *parent = 0, Qt::WindowFlags flags = 0);
+
+    virtual ~QDesignerFormWindow();
+
+    QAction *action() const;
+    QDesignerWorkbench *workbench() const;
+    QDesignerFormWindowInterface *editor() const;
+
+    virtual QRect geometryHint() const;
+
+public slots:
+    void updateWindowTitle(const QString &fileName);
+    void updateChanged();
+
+protected:
+    virtual void changeEvent(QEvent *e);
+    virtual void closeEvent(QCloseEvent *ev);
+
+private:
+    QDesignerFormWindowInterface *m_editor;
+    QPointer<QDesignerWorkbench> m_workbench;
+    QAction *m_action;
+};
+
+#endif // QDESIGNER_FORMWINDOW_H
diff --git a/src/designer/formdesigner/qdesigner_objectinspector.cpp b/src/designer/formdesigner/qdesigner_objectinspector.cpp
new file mode 100644 (file)
index 0000000..0a6fa88
--- /dev/null
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//#include "qdesigner.h"
+#include "qdesigner_objectinspector.h"
+#include "qdesigner_workbench.h"
+
+#include <QtDesigner/QtDesigner>
+#include <QtDesigner/QDesignerComponents>
+
+QDesignerObjectInspector::QDesignerObjectInspector(QDesignerWorkbench *workbench)
+    : QDesignerToolWindow(workbench)
+{
+    setObjectName(QLatin1String("ObjectInspector"));
+    QDesignerObjectInspectorInterface *widget = QDesignerComponents::createObjectInspector(workbench->core(), this);
+    workbench->core()->setObjectInspector(widget);
+
+    setCentralWidget(widget);
+
+    setWindowTitle(tr("Object Inspector"));
+}
+
+QDesignerObjectInspector::~QDesignerObjectInspector()
+{
+}
+
+QRect QDesignerObjectInspector::geometryHint() const
+{
+    QRect g = workbench()->availableGeometry();
+    int margin = workbench()->marginHint();
+
+    QSize sz(g.width() * 1/4, g.height() * 1/6);
+
+    return QRect((g.width() - sz.width() - margin), margin,
+                  sz.width(), sz.height());
+}
diff --git a/src/designer/formdesigner/qdesigner_objectinspector.h b/src/designer/formdesigner/qdesigner_objectinspector.h
new file mode 100644 (file)
index 0000000..f6f50e8
--- /dev/null
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef QDESIGNER_OBJECTINSPECTOR_H
+#define QDESIGNER_OBJECTINSPECTOR_H
+
+#include "qdesigner_toolwindow.h"
+
+class QDesignerWorkbench;
+
+class QDesignerObjectInspector: public QDesignerToolWindow
+{
+    Q_OBJECT
+public:
+    QDesignerObjectInspector(QDesignerWorkbench *workbench);
+    virtual ~QDesignerObjectInspector();
+
+    virtual QRect geometryHint() const;
+};
+
+#endif // QDESIGNER_OBJECTINSPECTOR_H
diff --git a/src/designer/formdesigner/qdesigner_pch.h b/src/designer/formdesigner/qdesigner_pch.h
new file mode 100644 (file)
index 0000000..397a997
--- /dev/null
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#if defined __cplusplus
+#include <QtCore/QObject>
+#include <QtCore/QPointer>
+#include <QtCore/QSettings>
+#include <QtCore/qdebug.h>
+#include <QtGui/QCloseEvent>
+#include <QtGui/QHeaderView>
+#include <QtGui/QMessageBox>
+#include <QtGui/QVBoxLayout>
+#include <QtDesigner/abstractformeditor.h>
+#include <QtDesigner/abstractformwindow.h>
+
+#include "qdesigner.h"
+#include "qdesigner_formwindow.h"
+#include "qdesigner_settings.h"
+#include "qdesigner_toolwindow.h"
+#include "qdesigner_workbench.h"
+#endif
diff --git a/src/designer/formdesigner/qdesigner_propertyeditor.cpp b/src/designer/formdesigner/qdesigner_propertyeditor.cpp
new file mode 100644 (file)
index 0000000..dbb4cef
--- /dev/null
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//#include "qdesigner.h"
+#include "qdesigner_propertyeditor.h"
+#include "qdesigner_workbench.h"
+
+#include <QtGui/QAction>
+
+#include <QtDesigner/QtDesigner>
+#include <QtDesigner/QDesignerComponents>
+
+QDesignerPropertyEditor::QDesignerPropertyEditor(QDesignerWorkbench *workbench)
+    : QDesignerToolWindow(workbench)
+{
+    setObjectName(QLatin1String("PropertyEditor"));
+    QDesignerPropertyEditorInterface *widget = QDesignerComponents::createPropertyEditor(workbench->core(), this);
+    workbench->core()->setPropertyEditor(widget);
+
+    setCentralWidget(widget);
+
+    setWindowTitle(tr("Property Editor"));
+    action()->setShortcut(tr("Ctrl+I"));
+}
+
+QDesignerPropertyEditor::~QDesignerPropertyEditor()
+{
+}
+
+QRect QDesignerPropertyEditor::geometryHint() const
+{
+    QRect g = workbench()->availableGeometry();
+    int margin = workbench()->marginHint();
+    int spacing = 40;
+
+    QSize sz(g.width() * 1/4, g.height() * 4/6);
+
+    return QRect((g.width() - sz.width() - margin), (margin + g.height() * 1/6) + spacing,
+                  sz.width(), sz.height());
+}
+
+void QDesignerPropertyEditor::showEvent(QShowEvent *event)
+{
+    if (QDesignerPropertyEditorInterface *e = workbench()->core()->propertyEditor()) {
+        // workaround to update the propertyeditor when it is not visible!
+        e->setObject(e->object()); // ### remove me
+    }
+
+    QDesignerToolWindow::showEvent(event);
+}
+
diff --git a/src/designer/formdesigner/qdesigner_propertyeditor.h b/src/designer/formdesigner/qdesigner_propertyeditor.h
new file mode 100644 (file)
index 0000000..2629ff9
--- /dev/null
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef QDESIGNER_PROPERTYEDITOR_H
+#define QDESIGNER_PROPERTYEDITOR_H
+
+#include "qdesigner_toolwindow.h"
+
+class QDesignerWorkbench;
+
+class QDesignerPropertyEditor: public QDesignerToolWindow
+{
+    Q_OBJECT
+public:
+    QDesignerPropertyEditor(QDesignerWorkbench *workbench);
+    virtual ~QDesignerPropertyEditor();
+
+    virtual QRect geometryHint() const;
+
+protected:
+    virtual void showEvent(QShowEvent *event);
+};
+
+#endif // QDESIGNER_PROPERTYEDITOR_H
diff --git a/src/designer/formdesigner/qdesigner_resourceeditor.cpp b/src/designer/formdesigner/qdesigner_resourceeditor.cpp
new file mode 100644 (file)
index 0000000..770e59d
--- /dev/null
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//#include "qdesigner.h"
+#include "qdesigner_workbench.h"
+#include "qdesigner_resourceeditor.h"
+#include "qdesigner_settings.h"
+
+#include <QtDesigner/QtDesigner>
+#include <QtDesigner/QDesignerComponents>
+
+#include <QtCore/qdebug.h>
+
+
+QDesignerResourceEditor::QDesignerResourceEditor(QDesignerWorkbench *workbench)
+    : QDesignerToolWindow(workbench)
+{
+    setObjectName(QLatin1String("ResourceEditor"));
+    QWidget *widget = QDesignerComponents::createResourceEditor(workbench->core(), this);
+
+    setCentralWidget(widget);
+
+    setWindowTitle(tr("Resource Editor"));
+}
+
+QDesignerResourceEditor::~QDesignerResourceEditor()
+{
+}
+
+QRect QDesignerResourceEditor::geometryHint() const
+{
+    QRect g = workbench()->availableGeometry();
+    int margin = workbench()->marginHint();
+
+    QSize sz(g.width() * 1/3, g.height() * 1/6);
+    QRect r(QPoint(0, 0), sz);
+    r.moveCenter(g.center());
+    r.moveBottom(g.bottom() - margin);
+
+    return r;
+}
+
diff --git a/src/designer/formdesigner/qdesigner_resourceeditor.h b/src/designer/formdesigner/qdesigner_resourceeditor.h
new file mode 100644 (file)
index 0000000..03b9dce
--- /dev/null
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef QDESIGNER_RESOURCEEDITOR_H
+#define QDESIGNER_RESOURCEEDITOR_H
+
+#include "qdesigner_toolwindow.h"
+
+class QDesignerWorkbench;
+class QDesignerAbstractFormWindowInterface;
+
+class QDesignerResourceEditor: public QDesignerToolWindow
+{
+    Q_OBJECT
+public:
+    QDesignerResourceEditor(QDesignerWorkbench *workbench);
+    virtual ~QDesignerResourceEditor();
+
+    virtual QRect geometryHint() const;
+};
+
+#endif // QDESIGNER_RESOURCEEDITOR_H
diff --git a/src/designer/formdesigner/qdesigner_settings.cpp b/src/designer/formdesigner/qdesigner_settings.cpp
new file mode 100644 (file)
index 0000000..643766b
--- /dev/null
@@ -0,0 +1,202 @@
+/****************************************************************************
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//#include "qdesigner.h"
+#include "qdesigner_settings.h"
+#include "qdesigner_widgetbox.h"
+#include "qdesigner_workbench.h"
+#include "qdesigner_propertyeditor.h"
+#include "qdesigner_objectinspector.h"
+
+#include <QtCore/QVariant>
+#include <QtCore/QDir>
+
+#include <QtGui/QDesktopWidget>
+#include <QtGui/QStyle>
+#include <QtGui/QApplication>
+
+#include <QtCore/qdebug.h>
+
+QDesignerSettings::QDesignerSettings()
+    : QSettings()
+{
+    m_designerPath = QLatin1String("/.designer");
+
+    QStringList paths = defaultFormTemplatePaths();
+    foreach (QString path, paths) {
+        if (!QDir::current().exists(path))
+            QDir::current().mkpath(path);
+    }
+}
+
+QDesignerSettings::~QDesignerSettings()
+{
+}
+
+QStringList QDesignerSettings::formTemplatePaths() const
+{
+    return value(QLatin1String("FormTemplatePaths"),
+                 defaultFormTemplatePaths()).toStringList();
+}
+
+void QDesignerSettings::setFormTemplatePaths(const QStringList &paths)
+{
+    setValue(QLatin1String("FormTemplatePaths"), paths);
+}
+
+QString QDesignerSettings::defaultUserWidgetBoxXml() const
+{
+    return QDir::homePath() + m_designerPath + QLatin1String("/widgetbox.xml");
+}
+
+QStringList QDesignerSettings::defaultFormTemplatePaths() const
+{
+    QStringList paths;
+
+    QString templatePath = QLatin1String("/templates");
+
+    paths.append(QDir::homePath() + m_designerPath + templatePath);
+    paths.append(QApplication::applicationDirPath() + templatePath);
+
+    return paths;
+}
+
+void QDesignerSettings::saveGeometryFor(const QWidget *w)
+{
+    Q_ASSERT(w && !w->objectName().isEmpty());
+    saveGeometryHelper(w, w->objectName());
+}
+
+void QDesignerSettings::setGeometryFor(QWidget *w, const QRect &fallBack) const
+{
+    Q_ASSERT(w && !w->objectName().isEmpty());
+    setGeometryHelper(w, w->objectName(),
+                      fallBack.isNull() ? QRect(QPoint(0, 0), w->sizeHint()) : fallBack);
+}
+
+void QDesignerSettings::saveGeometryHelper(const QWidget *w, const QString &key)
+{
+    beginGroup(key);
+    QPoint pos = w->pos();
+    if (!w->isWindow()) // in workspace
+        pos = w->parentWidget()->pos();
+
+    setValue(QLatin1String("screen"), QApplication::desktop()->screenNumber(w));
+    setValue(QLatin1String("geometry"), QRect(pos, w->size()));
+    setValue(QLatin1String("visible"), w->isVisible());
+    setValue(QLatin1String("maximized"), w->isMaximized());
+    endGroup();
+}
+
+void QDesignerSettings::setGeometryHelper(QWidget *w, const QString &key,
+                                          const QRect &fallBack) const
+{
+//    beginGroup();
+    int screen = value(key + QLatin1String("/screen"), 0).toInt();
+    QRect g = value(key + QLatin1String("/geometry"), fallBack).toRect();
+    QRect screenRect = QApplication::desktop()->availableGeometry(screen);
+
+    // Do geometry in a couple of steps
+    // 1) Make sure the rect is within the specified geometry
+    // 2) Make sure the bottom right and top left fit on the screen, move them in.
+    // 3) Check again and resize.
+
+    if (w->isWindow() && g.intersect(screenRect).isEmpty())
+        g = fallBack;
+
+    // Maybe use center?
+    if (!screenRect.contains(g.bottomRight())) {
+        g.moveRight(qMax(0 + g.width(), qMin(screenRect.right(), g.right())));
+        g.moveBottom(qMax(0 + g.height(), qMin(screenRect.bottom(), g.bottom())));
+    }
+
+    if (!screenRect.contains(g.topLeft())) {
+        g.moveLeft(qMin(screenRect.right() - g.width(), qMax(screenRect.left(), g.left())));
+        g.moveTop(qMin(screenRect.bottom() - g.height(), qMax(screenRect.top(), g.top())));
+    }
+
+    if (!screenRect.contains(g.bottomRight())) {
+        g.setRight(qMin(screenRect.right(), g.right()));
+        g.moveBottom(qMin(screenRect.bottom(), g.bottom()));
+    }
+
+    if (!screenRect.contains(g.topLeft())) {
+        g.setLeft(qMax(0, qMin(screenRect.left(), g.left())));
+        g.moveTop(qMax(0, qMin(screenRect.top(), g.top())));
+    }
+
+
+    if (!w->isWindow()) // in workspace
+        w->parentWidget()->move(g.topLeft());
+    else
+        w->move(g.topLeft());
+
+    if (value(key + QLatin1String("/maximized"), false).toBool()) {
+        w->setWindowState(w->windowState() | Qt::WindowMaximized);
+    } else {
+        w->resize(g.size());
+    }
+
+    if (value(key + QLatin1String("/visible"), true).toBool())
+        w->show();
+//    endGroup();
+}
+
+QStringList QDesignerSettings::recentFilesList() const
+{
+    return value(QLatin1String("recentFilesList")).toStringList();
+}
+
+void QDesignerSettings::setRecentFilesList(const QStringList &sl)
+{
+    setValue(QLatin1String("recentFilesList"), sl);
+}
+
+void QDesignerSettings::setShowNewFormOnStartup(bool showIt)
+{
+    setValue(QLatin1String("newFormDialog/ShowOnStartup"), showIt);
+}
+
+bool QDesignerSettings::showNewFormOnStartup() const
+{
+    return value(QLatin1String("newFormDialog/ShowOnStartup"), true).toBool();
+}
+
+void QDesignerSettings::setUIMode(int mode)
+{
+    setValue(QLatin1String("UI/currentMode"), mode);
+}
+
+int QDesignerSettings::uiMode() const
+{
+    return value(QLatin1String("UI/currentMode"), QDesignerWorkbench::TopLevelMode).toInt();
+}
+
+QByteArray QDesignerSettings::mainWindowState() const
+{
+    return value(QLatin1String("MainWindowState")).toByteArray();
+}
+
+void QDesignerSettings::setMainWindowState(const QByteArray &mainWindowState)
+{
+    setValue(QLatin1String("MainWindowState"), mainWindowState);
+}
+
diff --git a/src/designer/formdesigner/qdesigner_settings.h b/src/designer/formdesigner/qdesigner_settings.h
new file mode 100644 (file)
index 0000000..1416f11
--- /dev/null
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef QDESIGNER_SETTINGS_H
+#define QDESIGNER_SETTINGS_H
+
+#include <QtCore/QRect>
+#include <QtCore/QSettings>
+
+class QDesignerSettings : public QSettings
+{
+public:
+    QDesignerSettings();
+    virtual ~QDesignerSettings();
+
+    QStringList formTemplatePaths() const;
+    void setFormTemplatePaths(const QStringList &paths);
+
+    QString defaultUserWidgetBoxXml() const;
+
+    void setGeometryFor(QWidget *w, const QRect &fallBack = QRect()) const;
+    void saveGeometryFor(const QWidget *w);
+
+    QStringList recentFilesList() const;
+    void setRecentFilesList(const QStringList &list);
+
+    void setShowNewFormOnStartup(bool showIt);
+    bool showNewFormOnStartup() const;
+
+    void setUIMode(int mode);
+    int uiMode() const;
+
+    QByteArray mainWindowState() const;
+    void setMainWindowState(const QByteArray &mainWindowState);
+
+private:
+    QStringList defaultFormTemplatePaths() const;
+
+    void setGeometryHelper(QWidget *w, const QString &key, const QRect &fallBack) const;
+    void saveGeometryHelper(const QWidget *w, const QString &key);
+
+private:
+    QString m_designerPath;
+};
+
+#endif // QDESIGNER_SETTINGS_H
diff --git a/src/designer/formdesigner/qdesigner_signalsloteditor.cpp b/src/designer/formdesigner/qdesigner_signalsloteditor.cpp
new file mode 100644 (file)
index 0000000..f2df5fe
--- /dev/null
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//#include "qdesigner.h"
+#include "qdesigner_signalsloteditor.h"
+#include "qdesigner_workbench.h"
+#include "qdesigner_settings.h"
+
+#include <QtDesigner/QtDesigner>
+#include <QtDesigner/QDesignerComponents>
+
+#include <QtCore/qdebug.h>
+
+
+QDesignerSignalSlotEditor::QDesignerSignalSlotEditor(QDesignerWorkbench *workbench)
+    : QDesignerToolWindow(workbench)
+{
+    setObjectName(QLatin1String("SignalSlotEditorWindow"));
+    QWidget *widget = QDesignerComponents::createSignalSlotEditor(workbench->core(), this);
+
+    setCentralWidget(widget);
+
+    setWindowTitle(tr("Signal/Slot Editor"));
+}
+
+QDesignerSignalSlotEditor::~QDesignerSignalSlotEditor()
+{
+}
+
+QRect QDesignerSignalSlotEditor::geometryHint() const
+{
+    QRect g = workbench()->availableGeometry();
+    int margin = workbench()->marginHint();
+
+    QSize sz(g.width() * 1/3, g.height() * 1/6);
+    QRect r(QPoint(0, 0), sz);
+    r.moveCenter(g.center());
+    r.moveTop(margin);
+
+    return r;
+}
diff --git a/src/designer/formdesigner/qdesigner_signalsloteditor.h b/src/designer/formdesigner/qdesigner_signalsloteditor.h
new file mode 100644 (file)
index 0000000..17bcfa3
--- /dev/null
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef QDESIGNER_SIGNALSLOTEDITOR_H
+#define QDESIGNER_SIGNALSLOTEDITOR_H
+
+#include "qdesigner_toolwindow.h"
+
+class QDesignerWorkbench;
+
+class QDesignerSignalSlotEditor: public QDesignerToolWindow
+{
+    Q_OBJECT
+public:
+    QDesignerSignalSlotEditor(QDesignerWorkbench *workbench);
+    virtual ~QDesignerSignalSlotEditor();
+
+    virtual QRect geometryHint() const;
+};
+
+#endif // QDESIGNER_SIGNALSLOTEDITOR_H
diff --git a/src/designer/formdesigner/qdesigner_toolwindow.cpp b/src/designer/formdesigner/qdesigner_toolwindow.cpp
new file mode 100644 (file)
index 0000000..1fb8d2e
--- /dev/null
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//#include "qdesigner.h"
+#include "qdesigner_toolwindow.h"
+#include "qdesigner_settings.h"
+#include "qdesigner_workbench.h"
+
+#include <QtCore/QEvent>
+#include <QtCore/qdebug.h>
+#include <QtGui/QAction>
+#include <QtGui/QCloseEvent>
+#include <QtGui/QWorkspace>
+
+QDesignerToolWindow::QDesignerToolWindow(QDesignerWorkbench *workbench, QWidget *parent, Qt::WindowFlags flags)
+    : QMainWindow(parent, flags),
+      m_workbench(workbench),
+      m_saveSettings(false)
+{
+    Q_ASSERT(workbench != 0);
+
+    m_action = new QAction(this);
+    m_action->setShortcutContext(Qt::ApplicationShortcut);
+    m_action->setText(windowTitle());
+    m_action->setCheckable(true);
+    connect(m_action, SIGNAL(triggered(bool)), this, SLOT(showMe(bool)));
+}
+
+QDesignerToolWindow::~QDesignerToolWindow()
+{
+    if (workbench())
+        workbench()->removeToolWindow(this);
+}
+
+void QDesignerToolWindow::showMe(bool v)
+{
+    QWidget *target = parentWidget() == 0 ? this : parentWidget();
+
+    if (v)
+        target->setWindowState(target->windowState() & ~Qt::WindowMinimized);
+
+    target->setVisible(v);
+}
+
+void QDesignerToolWindow::showEvent(QShowEvent *e)
+{
+    Q_UNUSED(e);
+
+    bool blocked = m_action->blockSignals(true);
+    m_action->setChecked(true);
+    m_action->blockSignals(blocked);
+}
+
+void QDesignerToolWindow::hideEvent(QHideEvent *e)
+{
+    Q_UNUSED(e);
+
+    bool blocked = m_action->blockSignals(true);
+    m_action->setChecked(false);
+    m_action->blockSignals(blocked);
+}
+
+QAction *QDesignerToolWindow::action() const
+{
+    return m_action;
+}
+
+void QDesignerToolWindow::changeEvent(QEvent *e)
+{
+    switch (e->type()) {
+        case QEvent::WindowTitleChange:
+            m_action->setText(windowTitle());
+            break;
+        case QEvent::WindowIconChange:
+            m_action->setIcon(windowIcon());
+            break;
+        default:
+            break;
+    }
+    QMainWindow::changeEvent(e);
+}
+
+QDesignerWorkbench *QDesignerToolWindow::workbench() const
+{
+    return m_workbench;
+}
+
+QRect QDesignerToolWindow::geometryHint() const
+{
+    return QRect();
+}
+
+void QDesignerToolWindow::closeEvent(QCloseEvent *ev)
+{
+    if (m_saveSettings) {
+        ev->setAccepted(workbench()->handleClose());
+        /*if (ev->isAccepted() && qDesigner->mainWindow() == this)
+            QMetaObject::invokeMethod(qDesigner, "quit", Qt::QueuedConnection);  // We're going down!*/
+    } else {
+        QMainWindow::closeEvent(ev);
+    }
+}
+
+bool QDesignerToolWindow::saveSettingsOnClose() const
+{
+    return m_saveSettings;
+}
+
+void QDesignerToolWindow::setSaveSettingsOnClose(bool save)
+{
+    m_saveSettings = save;
+}
+
+Qt::DockWidgetArea QDesignerToolWindow::dockWidgetAreaHint() const
+{
+    return Qt::RightDockWidgetArea;
+}
+
diff --git a/src/designer/formdesigner/qdesigner_toolwindow.h b/src/designer/formdesigner/qdesigner_toolwindow.h
new file mode 100644 (file)
index 0000000..393e999
--- /dev/null
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef QDESIGNER_TOOLWINDOW_H
+#define QDESIGNER_TOOLWINDOW_H
+
+#include <QtCore/QPointer>
+#include <QtGui/QMainWindow>
+
+class QDesignerWorkbench;
+
+class QDesignerToolWindow: public QMainWindow
+{
+    Q_OBJECT
+public:
+    QDesignerToolWindow(QDesignerWorkbench *workbench, QWidget *parent = 0, Qt::WindowFlags flags = Qt::Window);
+    virtual ~QDesignerToolWindow();
+
+    QDesignerWorkbench *workbench() const;
+    QAction *action() const;
+
+    void setSaveSettingsOnClose(bool save);
+    bool saveSettingsOnClose() const;
+
+    virtual Qt::DockWidgetArea dockWidgetAreaHint() const;
+    virtual QRect geometryHint() const;
+
+private slots:
+    void showMe(bool);
+
+protected:
+    virtual void showEvent(QShowEvent *e);
+    virtual void hideEvent(QHideEvent *e);
+    virtual void changeEvent(QEvent *e);
+    virtual void closeEvent(QCloseEvent *e);
+
+private:
+    QDesignerWorkbench *m_workbench;
+    QAction *m_action;
+    bool m_saveSettings;
+};
+
+#endif // QDESIGNER_TOOLWINDOW_H
diff --git a/src/designer/formdesigner/qdesigner_widgetbox.cpp b/src/designer/formdesigner/qdesigner_widgetbox.cpp
new file mode 100644 (file)
index 0000000..eba6c56
--- /dev/null
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//#include "qdesigner.h"
+#include "qdesigner_widgetbox.h"
+#include "qdesigner_workbench.h"
+#include "qdesigner_settings.h"
+
+#include <QtDesigner/QtDesigner>
+#include <QtDesigner/QDesignerComponents>
+
+#include <QtCore/qdebug.h>
+
+QDesignerWidgetBox::QDesignerWidgetBox(QDesignerWorkbench *workbench)
+    : QDesignerToolWindow(workbench)
+{
+    setObjectName(QLatin1String("WidgetBox"));
+    QDesignerWidgetBoxInterface *widget = QDesignerComponents::createWidgetBox(workbench->core(), this);
+    widget->setFileName(QLatin1String(":/trolltech/widgetbox/widgetbox.xml"));
+    widget->load();
+    widget->setFileName(QDesignerSettings().defaultUserWidgetBoxXml());
+    widget->load();
+
+/*    int g, w;
+    for ( g=0; g< widget->categoryCount(); g++){
+       printf("cat %i=%s\n", g, widget->category( g ).name().toUtf8().data());
+       for ( w=0; w < widget->widgetCount( g ); w++ ){
+           printf("   w%i=%s\n", w, widget->widget( g, w ).name().toUtf8().data());
+       }
+    } 
+*/
+    // Удалим лишние группы и объекты
+    widget->removeCategory( 3 );
+    
+    workbench->core()->setWidgetBox(widget);
+
+    setCentralWidget(widget);
+
+    setWindowTitle(tr("Widget Box"));
+}
+
+QDesignerWidgetBox::~QDesignerWidgetBox()
+{
+}
+
+QRect QDesignerWidgetBox::geometryHint() const
+{
+    QRect g = workbench()->availableGeometry();
+
+    return QRect(workbench()->marginHint(), workbench()->marginHint(),
+                 g.width() * 1/6, g.height() * 5/6);
+}
+
+Qt::DockWidgetArea QDesignerWidgetBox::dockWidgetAreaHint() const
+{
+    return Qt::LeftDockWidgetArea;
+}
diff --git a/src/designer/formdesigner/qdesigner_widgetbox.h b/src/designer/formdesigner/qdesigner_widgetbox.h
new file mode 100644 (file)
index 0000000..e6a8697
--- /dev/null
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef QDESIGNER_WIDGETBOX_H
+#define QDESIGNER_WIDGETBOX_H
+
+#include "qdesigner_toolwindow.h"
+
+class QDesignerWorkbench;
+
+class QDesignerWidgetBox: public QDesignerToolWindow
+{
+    Q_OBJECT
+public:
+    QDesignerWidgetBox(QDesignerWorkbench *workbench);
+    virtual ~QDesignerWidgetBox();
+
+    virtual Qt::DockWidgetArea dockWidgetAreaHint() const;
+    virtual QRect geometryHint() const;
+};
+
+#endif // QDESIGNER_WIDGETBOX_H
diff --git a/src/designer/formdesigner/qdesigner_workbench.cpp b/src/designer/formdesigner/qdesigner_workbench.cpp
new file mode 100644 (file)
index 0000000..48461f2
--- /dev/null
@@ -0,0 +1,881 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+//#include "qdesigner.h"
+#include "qdesigner_workbench.h"
+#include "qdesigner_actions.h"
+#include "qdesigner_toolwindow.h"
+#include "qdesigner_formwindow.h"
+#include "qdesigner_settings.h"
+#include "qdesigner_widgetbox.h"
+#include "qdesigner_propertyeditor.h"
+#include "qdesigner_objectinspector.h"
+#include "qdesigner_signalsloteditor.h"
+#include "qdesigner_actioneditor.h"
+#include "qdesigner_resourceeditor.h"
+
+#include <QtDesigner/QtDesigner>
+#include <QtDesigner/QDesignerComponents>
+#include "private/qdesigner_integration_p.h"
+#include "private/pluginmanager_p.h"
+
+#include <QtGui/QDockWidget>
+#include <QtGui/QWorkspace>
+#include <QtGui/QCloseEvent>
+#include <QtGui/QDesktopWidget>
+#include <QtGui/QLabel>
+#include <QtGui/QMenu>
+#include <QtGui/QMenuBar>
+#include <QtGui/QToolBar>
+#include <QtGui/QActionGroup>
+#include <QtGui/QMessageBox>
+#include <QtGui/QHeaderView>
+#include <QtGui/QApplication>
+
+#include <QtCore/QVariant>
+#include <QtCore/QUrl>
+#include <QtCore/QPluginLoader>
+#include <QtCore/qdebug.h>
+
+QDesignerWorkbench::QDesignerWorkbench()
+    : m_mode(QDesignerWorkbench::NeutralMode), m_workspace(0)
+{
+    m_initializing = true;
+    initialize();
+
+    setUIMode(UIMode(/*QDesignerSettings().uiMode()*/DockedMode));
+    m_initializing = false;
+}
+
+QDesignerWorkbench::~QDesignerWorkbench()
+{
+    if (m_mode == DockedMode) {
+        Q_ASSERT(m_workspace != 0);
+        QMainWindow *mw = qobject_cast<QMainWindow*>(m_workspace->window());
+        Q_ASSERT(mw != 0);
+
+        QDesignerSettings settings;
+        settings.setMainWindowState(mw->saveState(2));
+    }
+
+    while (!m_toolWindows.isEmpty())
+        delete m_toolWindows.takeLast();
+}
+
+QDesignerWorkbench::UIMode QDesignerWorkbench::mode() const
+{
+    return m_mode;
+}
+
+void QDesignerWorkbench::addToolWindow(QDesignerToolWindow *toolWindow)
+{
+    Q_ASSERT(m_toolWindowExtras.contains(toolWindow) == false);
+    Q_ASSERT(toolWindow->windowTitle().isEmpty() == false);
+
+    m_toolWindows.append(toolWindow);
+
+    if (QAction *action = toolWindow->action()) {
+        Q_ASSERT(m_toolMenu->actions().isEmpty() == false);
+
+        QList<QAction*> lst = m_toolActions->actions();
+        QAction *before = lst.count() ? lst.last() : m_toolMenu->actions().first();
+        m_toolMenu->insertAction(before, action);
+        m_toolActions->addAction(action);
+    }
+}
+
+void QDesignerWorkbench::addFormWindow(QDesignerFormWindow *formWindow)
+{
+    Q_ASSERT(m_formWindowExtras.contains(formWindow) == false);
+    // ### Q_ASSERT(formWindow->windowTitle().isEmpty() == false);
+
+    m_formWindows.append(formWindow);
+    if (m_windowActions->actions().isEmpty())
+        m_windowMenu->addSeparator();
+
+    if (QAction *action = formWindow->action()) {
+        m_windowActions->addAction(action);
+        m_windowMenu->addAction(action);
+        action->setChecked(true);
+    }
+
+    m_actionManager->minimizeAction()->setEnabled(true);
+    m_actionManager->editWidgets()->trigger();
+}
+
+void QDesignerWorkbench::initialize()
+{
+    /*QObjectList list = QPluginLoader::staticInstances();
+    qDebug() << list.size();
+    for (int i=0; i<list.size(); i++)
+    {
+        qDebug() << list[i]->objectName() << list[i]->metaObject()->className();
+        qDebug() << qobject_cast<QDesignerCustomWidgetCollectionInterface *>(list[i]);
+    }*/
+
+    QDesignerSettings settings;
+    m_core = QDesignerComponents::createFormEditor(this);
+
+    (void) QDesignerComponents::createTaskMenu(core(), this);
+
+    initializeCorePlugins();
+    QDesignerComponents::initializePlugins(core());
+
+    m_toolActions = new QActionGroup(this);
+    m_toolActions->setExclusive(false);
+
+    m_windowActions = new QActionGroup(this);
+    m_windowActions->setExclusive(true);
+    connect(m_windowActions, SIGNAL(triggered(QAction*)), this, SLOT(formWindowActionTriggered(QAction*)));
+
+    m_actionManager = new QDesignerActions(this);
+
+    m_globalMenuBar = new QMenuBar;
+
+/*
+    m_fileMenu = m_globalMenuBar->addMenu(tr("&File"));
+    foreach (QAction *action, m_actionManager->fileActions()->actions()) {
+        m_fileMenu->addAction(action);
+        if (action->text() == QDesignerActions::tr("&Open Form...")) {
+            QMenu *recentFilesMenu = m_fileMenu->addMenu(tr("&Recent Forms"));
+            // Pop the "Recent Files" stuff in here.
+            foreach(QAction *recentAction, m_actionManager->recentFilesActions()->actions())
+                recentFilesMenu->addAction(recentAction);
+        }
+    }
+*/
+    m_editMenu = m_globalMenuBar->addMenu(tr("&Edit"));
+    foreach (QAction *action, m_actionManager->editActions()->actions()) {
+        m_editMenu->addAction(action);
+    }
+
+    m_editMenu->addSeparator();
+
+    foreach (QAction *action, m_actionManager->toolActions()->actions()) {
+        m_editMenu->addAction(action);
+    }
+
+    m_editMenu->addSeparator();
+    QMenu *menu = m_editMenu->addMenu(tr("User Interface &Mode"));
+    foreach (QAction *action, m_actionManager->uiMode()->actions())
+        menu->addAction(action);
+
+
+    m_formMenu = m_globalMenuBar->addMenu(tr("F&orm"));
+    foreach (QAction *action, m_actionManager->formActions()->actions()) {
+        m_formMenu->addAction(action);
+    }
+
+/*
+    QMenu *previewSubMenu = new QMenu(tr("Preview in"), m_formMenu);
+    m_formMenu->insertMenu(m_actionManager->previewFormAction(), previewSubMenu);
+
+    foreach (QAction *action, m_actionManager->styleActions()->actions()) {
+        previewSubMenu->addAction(action);
+    }
+*/
+    m_toolMenu = m_globalMenuBar->addMenu(tr("&Tools"));
+
+    m_toolMenu->addSeparator();
+
+    m_windowMenu = m_globalMenuBar->addMenu(tr("&Window"));
+    foreach (QAction *action, m_actionManager->windowActions()->actions()) {
+        m_windowMenu->addAction(action);
+    }
+
+/*
+    m_helpMenu = m_globalMenuBar->addMenu(tr("&Help"));
+    foreach (QAction *action, m_actionManager->helpActions()->actions()) {
+        m_helpMenu->addAction(action);
+    }
+*/
+    QDesignerToolWindow *tw = new QDesignerWidgetBox(this);
+    tw->setObjectName(QLatin1String("qt_designer_widgetbox"));
+    addToolWindow(tw);
+    tw = new QDesignerObjectInspector(this);
+    tw->setObjectName(QLatin1String("qt_designer_objectinspector"));
+    addToolWindow(tw);
+    tw = new QDesignerPropertyEditor(this);
+    tw->setObjectName(QLatin1String("qt_designer_propertyeditor"));
+    addToolWindow(tw);
+    tw = new QDesignerSignalSlotEditor(this);
+    tw->setObjectName(QLatin1String("qt_designer_signalsloteditor"));
+//    addToolWindow(tw);
+    tw = new QDesignerResourceEditor(this);
+    tw->setObjectName(QLatin1String("qt_designer_resourceeditor"));
+//    addToolWindow(tw);
+    tw = new QDesignerActionEditor(this);
+    tw->setObjectName(QLatin1String("qt_designer_actioneditor"));
+//    addToolWindow(tw);
+
+    m_integration = new qdesigner_internal::QDesignerIntegration(core(), this);
+
+    // create the toolbars
+    m_editToolBar = new QToolBar;
+    m_editToolBar->setObjectName(QLatin1String("editToolBar"));
+    m_editToolBar->setWindowTitle(tr("Edit"));
+    foreach (QAction *action, m_actionManager->editActions()->actions()) {
+        if (action->icon().isNull() == false)
+            m_editToolBar->addAction(action);
+    }
+
+    m_toolToolBar = new QToolBar;
+    m_toolToolBar->setObjectName(QLatin1String("toolsToolBar"));
+    m_toolToolBar->setWindowTitle(tr("Tools"));
+    foreach (QAction *action, m_actionManager->toolActions()->actions()) {
+        if (action->icon().isNull() == false)
+            m_toolToolBar->addAction(action);
+    }
+
+    m_formToolBar = new QToolBar;
+    m_formToolBar->setObjectName(QLatin1String("formToolBar"));
+    m_formToolBar->setWindowTitle(tr("Form"));
+    foreach (QAction *action, m_actionManager->formActions()->actions()) {
+        if (action->icon().isNull() == false)
+            m_formToolBar->addAction(action);
+    }
+
+    QMenu *toolbarMenu = m_toolMenu->addMenu(tr("Toolbars"));
+    toolbarMenu->addAction(m_editToolBar->toggleViewAction());
+    toolbarMenu->addAction(m_toolToolBar->toggleViewAction());
+    toolbarMenu->addAction(m_formToolBar->toggleViewAction());
+
+    m_geometries.clear();
+
+    emit initialized();
+
+    connect(m_core->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)),
+                this, SLOT(updateWindowMenu(QDesignerFormWindowInterface*)));
+}
+
+Qt::WindowFlags QDesignerWorkbench::magicalWindowFlags(const QWidget *widgetForFlags) const
+{
+    switch (m_mode) {
+        case TopLevelMode: {
+#ifdef Q_WS_MAC
+            if (qobject_cast<const QDesignerToolWindow *>(widgetForFlags))
+                return Qt::Tool;
+#else
+            Q_UNUSED(widgetForFlags);
+#endif
+            return Qt::Window;
+        }
+        case DockedMode:
+            Q_ASSERT(m_workspace != 0);
+            return Qt::Window | Qt::WindowShadeButtonHint | Qt::WindowSystemMenuHint | Qt::WindowTitleHint;
+        case NeutralMode:
+            return Qt::Window;
+        default:
+            Q_ASSERT(0);
+            return 0;
+    }
+}
+
+QWidget *QDesignerWorkbench::magicalParent() const
+{
+    switch (m_mode) {
+        case TopLevelMode:
+            return 0;
+        case DockedMode:
+            Q_ASSERT(m_workspace != 0);
+            return m_workspace;
+        case NeutralMode:
+            return 0;
+        default:
+            Q_ASSERT(0);
+            return 0;
+    }
+}
+
+void QDesignerWorkbench::switchToNeutralMode()
+{
+    if (m_mode == NeutralMode) {
+        return;
+    } else if (m_mode == DockedMode) {
+        Q_ASSERT(m_workspace != 0);
+        QMainWindow *mw = qobject_cast<QMainWindow*>(m_workspace->window());
+        QDesignerSettings settings;
+        settings.setMainWindowState(mw->saveState(2));
+    }
+
+    QPoint desktopOffset = QPoint(0, 0);
+    QPoint workspaceOffset = QPoint(0, 0);
+    if (m_mode == TopLevelMode)
+        desktopOffset = QApplication::desktop()->availableGeometry().topLeft();
+    else if (m_mode == DockedMode)
+        workspaceOffset = m_workspace->mapToGlobal(QPoint(0, 0));
+    m_mode = NeutralMode;
+
+    m_geometries.clear();
+    m_visibilities.clear();
+
+    foreach (QDesignerToolWindow *tw, m_toolWindows) {
+        m_visibilities.insert(tw, tw->isVisible());
+        if (tw->isVisible()) {
+            // use the actual geometry
+            QPoint pos = tw->window()->pos();
+            if (!tw->isWindow()) {
+                if (const QWidget *pw = tw->parentWidget()) {
+                    pos = pw->mapTo(tw->window(), QPoint(0, 0));
+                    pos += tw->window()->pos();
+                }
+
+            }
+            m_geometries.insert(tw, QRect(pos - desktopOffset, tw->size()));
+        }
+        tw->setSaveSettingsOnClose(false);
+
+        tw->setParent(0);
+    }
+
+    foreach (QDesignerFormWindow *fw, m_formWindows) {
+        if (fw->isVisible()) {
+            // use the actual geometry
+            QPoint pos = fw->window()->pos();
+            if (!fw->isWindow())
+                if (QWidget *p = fw->parentWidget())
+                    pos = p->pos(); // in workspace
+
+            m_geometries.insert(fw, QRect(pos - desktopOffset + workspaceOffset,
+                                            fw->size()));
+        }
+
+        fw->setParent(0);
+    }
+
+#ifndef Q_WS_MAC
+    m_globalMenuBar->setParent(0);
+#endif
+    m_editToolBar->setParent(0);
+    m_toolToolBar->setParent(0);
+    m_formToolBar->setParent(0);
+    m_core->setTopLevel(0);
+    /*qDesigner->*/setMainWindow(0);
+
+    if (m_workspace)
+        delete m_workspace->parentWidget();
+
+    m_workspace = 0;
+}
+
+void QDesignerWorkbench::switchToDockedMode()
+{
+    bool wasTopLevel = (m_mode == TopLevelMode);
+    if (m_mode == DockedMode)
+        return;
+
+    switchToNeutralMode();
+    m_mode = DockedMode;
+
+    QDesignerToolWindow *widgetBoxWrapper = 0;
+    if (0 != (widgetBoxWrapper = findToolWindow(core()->widgetBox()))) {
+        widgetBoxWrapper->action()->setEnabled(true);
+        widgetBoxWrapper->setWindowTitle(tr("Widget Box"));
+    }
+
+    Q_ASSERT(m_workspace == 0);
+
+    QDesignerSettings settings;
+    QDesignerToolWindow *mw = new QDesignerToolWindow(this); // Just to have a copy of
+    mw->setSaveSettingsOnClose(true);
+    mw->setObjectName(QLatin1String("MDIWindow"));
+    mw->setWindowTitle(tr("Qt Designer"));
+    m_workspace = new QWorkspace(mw);
+    m_workspace->setAcceptDrops(true);
+    m_workspace->installEventFilter(this);
+    m_workspace->setScrollBarsEnabled(true);
+    connect(m_workspace, SIGNAL(windowActivated(QWidget*)),
+            this, SLOT(activateWorkspaceChildWindow(QWidget*)));
+    mw->setCentralWidget(m_workspace);
+    m_core->setTopLevel(mw);
+    (void) mw->statusBar();
+    if (m_geometries.isEmpty()) {
+        settings.setGeometryFor(mw, qApp->desktop()->availableGeometry(0));
+    } else {
+        if (QDesignerToolWindow *widgetBox = findToolWindow(core()->widgetBox())) {
+            QRect r = m_geometries.value(widgetBox, QRect(0, 0, 200, 200));
+            mw->move(r.topLeft());
+        }
+        mw->setWindowState(mw->windowState() | Qt::WindowMaximized);
+    }
+
+#ifndef Q_WS_MAC
+    mw->setMenuBar(m_globalMenuBar);
+    m_globalMenuBar->show();
+#endif
+    mw->addToolBar(m_editToolBar);
+    mw->addToolBar(m_toolToolBar);
+    mw->addToolBar(m_formToolBar);
+    m_editToolBar->show();
+    m_toolToolBar->show();
+    m_formToolBar->show();
+
+    /*qDesigner->*/setMainWindow(mw);
+
+    foreach (QDesignerToolWindow *tw, m_toolWindows) {
+        if (wasTopLevel)
+            settings.saveGeometryFor(tw);
+        QDockWidget *dockWidget = magicalDockWidget(tw);
+        if (dockWidget == 0) {
+            dockWidget = new QDockWidget(mw);
+            dockWidget->setObjectName(tw->objectName() + QLatin1String("_dock"));
+            dockWidget->setWindowTitle(tw->windowTitle());
+            mw->addDockWidget(tw->dockWidgetAreaHint(), dockWidget);
+        }
+
+        dockWidget->setWidget(tw);
+    }
+
+    foreach (QDesignerToolWindow *tw, m_toolWindows) {
+        QDockWidget *dockWidget = magicalDockWidget(tw);
+        tw->setVisible(true);
+        dockWidget->setVisible(m_visibilities.value(tw, true));
+    }
+
+    mw->restoreState(settings.mainWindowState(), 2);
+
+    foreach (QDesignerFormWindow *fw, m_formWindows)
+        m_workspace->addWindow(fw, magicalWindowFlags(fw))->hide();
+    // will be shown in adjustFormPositions
+
+    changeBringToFrontVisiblity(false);
+
+    mw->show();
+
+    if (!m_initializing)
+        QMetaObject::invokeMethod(this, "adjustFormPositions", Qt::QueuedConnection);
+}
+
+bool QDesignerWorkbench::eventFilter(QObject *object, QEvent *event)
+{
+    if (object == m_workspace) {
+        if (event->type() == QEvent::DragEnter) {
+            QDragEnterEvent *e = static_cast<QDragEnterEvent*>(event);
+            if (e->mimeData()->hasFormat("text/uri-list")) {
+                e->acceptProposedAction();
+                return true;
+            }
+        } else if (event->type() == QEvent::Drop) {
+            QDropEvent *e = static_cast<QDropEvent*>(event);
+            if (!e->mimeData()->hasFormat("text/uri-list"))
+                return false;
+            foreach (QUrl url, e->mimeData()->urls()) {
+                QString fileName = url.toLocalFile();
+                if (fileName.endsWith(".ui"))
+                    readInForm(url.toLocalFile());
+                else
+                    QMessageBox::critical(m_workspace, tr("Opening Form"),
+                        tr("Cannot open file %1!").arg(fileName));
+            }
+            e->acceptProposedAction();
+            return true;
+        }
+    }
+    return false;
+}
+
+void QDesignerWorkbench::adjustFormPositions()
+{
+    if (m_workspace == 0)
+        return;
+
+    QPoint workspace_tl = m_workspace->mapToGlobal(QPoint(0, 0));
+
+    foreach (QDesignerFormWindow *fw, m_formWindows) {
+        QWidget *frame = fw->parentWidget();
+        if (frame == 0)
+            continue;
+        QRect g = m_geometries.value(fw, fw->geometryHint());
+        frame->move(g.topLeft() - workspace_tl);
+        fw->resize(g.size());
+        frame->show();
+    }
+}
+
+void QDesignerWorkbench::changeBringToFrontVisiblity(bool visible)
+{
+    QAction *btf = m_actionManager->bringToFrontAction();
+    QList<QAction *> actionList = m_actionManager->windowActions()->actions();
+    btf->setVisible(visible);
+    QAction *sep = actionList.at(actionList.indexOf(btf) - 1);
+    if (sep->isSeparator())
+        sep->setVisible(visible);
+}
+
+void QDesignerWorkbench::switchToTopLevelMode()
+{
+    if (m_mode == TopLevelMode)
+        return;
+
+    // make sure that the widgetbox is visible iff it is different from neutrol.
+    if (m_mode != NeutralMode) {
+        if (QDesignerToolWindow *widgetbox_tool = findToolWindow(core()->widgetBox())) {
+            if (!widgetbox_tool->action()->isChecked())
+                widgetbox_tool->action()->trigger();
+        }
+    }
+
+    switchToNeutralMode();
+    QPoint desktopOffset = QApplication::desktop()->availableGeometry().topLeft();
+    m_mode = TopLevelMode;
+
+    // The widget box is special, it gets the menubar and gets to be the main widget.
+
+    QDesignerToolWindow *widgetBoxWrapper = 0;
+    if (0 != (widgetBoxWrapper = findToolWindow(core()->widgetBox()))) {
+        m_core->setTopLevel(widgetBoxWrapper);
+#ifndef Q_WS_MAC
+        widgetBoxWrapper->setMenuBar(m_globalMenuBar);
+        widgetBoxWrapper->action()->setEnabled(false);
+        widgetBoxWrapper->setSaveSettingsOnClose(true);
+        /*qDesigner->*/setMainWindow(widgetBoxWrapper);
+        widgetBoxWrapper->setWindowTitle(tr("Qt Designer"));
+#endif
+        widgetBoxWrapper->addToolBar(m_editToolBar);
+        widgetBoxWrapper->addToolBar(m_toolToolBar);
+        widgetBoxWrapper->addToolBar(m_formToolBar);
+
+        widgetBoxWrapper->insertToolBarBreak(m_formToolBar);
+    }
+
+    QDesignerSettings settings;
+    bool found_visible_window = false;
+    foreach (QDesignerToolWindow *tw, m_toolWindows) {
+        tw->setParent(magicalParent(), magicalWindowFlags(tw));
+        settings.setGeometryFor(tw, tw->geometryHint());
+        tw->action()->setChecked(tw->isVisible());
+        found_visible_window |= tw->isVisible();
+    }
+
+    if (!m_toolWindows.isEmpty() && !found_visible_window)
+        m_toolWindows.first()->show();
+
+    changeBringToFrontVisiblity(true);
+
+    foreach (QDesignerFormWindow *fw, m_formWindows) {
+        fw->setParent(magicalParent(), magicalWindowFlags(fw));
+        QRect g = m_geometries.value(fw, fw->geometryHint());
+        fw->resize(g.size());
+        fw->move(g.topLeft() + desktopOffset);
+        fw->show();
+    }
+}
+
+QDesignerFormWindow *QDesignerWorkbench::createFormWindow()
+{
+    QDesignerFormWindow *formWindow = new QDesignerFormWindow(/*formWindow=*/ 0, this);
+
+    if (m_workspace) {
+        m_workspace->addWindow(formWindow, magicalWindowFlags(formWindow));
+    } else {
+        formWindow->setParent(magicalParent(), magicalWindowFlags(formWindow));
+    }
+
+    formWindow->setAttribute(Qt::WA_DeleteOnClose, true);
+
+    addFormWindow(formWindow);
+
+    QRect g = formWindow->geometryHint();
+    formWindow->resize(g.size());
+    formWindow->move(availableGeometry().center() - g.center());
+
+    if (m_workspace) {
+        m_workspace->setActiveWindow(formWindow);
+    }
+
+    return formWindow;
+}
+
+QDesignerFormWindowManagerInterface *QDesignerWorkbench::formWindowManager() const
+{
+    return m_core->formWindowManager();
+}
+
+QDesignerFormEditorInterface *QDesignerWorkbench::core() const
+{
+    return m_core;
+}
+
+int QDesignerWorkbench::toolWindowCount() const
+{
+    return m_toolWindows.count();
+}
+
+QDesignerToolWindow *QDesignerWorkbench::toolWindow(int index) const
+{
+    return m_toolWindows.at(index);
+}
+
+int QDesignerWorkbench::formWindowCount() const
+{
+    return m_formWindows.count();
+}
+
+QDesignerFormWindow *QDesignerWorkbench::formWindow(int index) const
+{
+    return m_formWindows.at(index);
+}
+
+QRect QDesignerWorkbench::availableGeometry() const
+{
+    if (m_workspace)
+        return m_workspace->geometry();
+
+    QDesktopWidget *desktop = QApplication::desktop();
+
+    QWidget *window = findToolWindow(core()->widgetBox());
+    if (window)
+        return desktop->availableGeometry(desktop->screenNumber(window));
+    return desktop->availableGeometry(0);
+}
+
+int QDesignerWorkbench::marginHint() const
+{
+    return 20;
+}
+
+void QDesignerWorkbench::activateWorkspaceChildWindow(QWidget *widget)
+{
+    if (QDesignerFormWindow *fw = qobject_cast<QDesignerFormWindow*>(widget)) {
+        core()->formWindowManager()->setActiveFormWindow(fw->editor());
+        m_workspace->setActiveWindow(widget);
+    }
+}
+
+void QDesignerWorkbench::removeToolWindow(QDesignerToolWindow *toolWindow)
+{
+    int index = m_toolWindows.indexOf(toolWindow);
+    if (index != -1) {
+        m_toolWindows.removeAt(index);
+        m_toolWindowExtras.remove(toolWindow);
+    }
+
+    if (QAction *action = toolWindow->action()) {
+        m_toolActions->removeAction(action);
+        //m_toolMenu->removeAction(action); // FIXME Зависает в этом месте при выходе из программы
+    }
+}
+
+void QDesignerWorkbench::removeFormWindow(QDesignerFormWindow *formWindow)
+{
+    int index = m_formWindows.indexOf(formWindow);
+    if (index != -1) {
+        m_formWindows.removeAt(index);
+        m_formWindowExtras.remove(formWindow);
+    }
+
+    if (QAction *action = formWindow->action()) {
+        m_windowActions->removeAction(action);
+        m_windowMenu->removeAction(action);
+    }
+
+    if (formWindowCount() == 0) {
+        m_actionManager->minimizeAction()->setEnabled(false);
+        QList<QAction *> actions = m_windowMenu->actions();
+        for (int i = actions.size() - 1; i >= 0; --i) {
+            QAction *act = actions.at(i);
+            if (act->isSeparator()) {
+                delete act;
+                break;
+            }
+        }
+    }
+}
+
+void QDesignerWorkbench::initializeCorePlugins()
+{
+    QList<QObject*> plugins = QPluginLoader::staticInstances();
+    plugins += core()->pluginManager()->instances();
+
+    foreach (QObject *plugin, plugins) {
+        if (QDesignerFormEditorPluginInterface *formEditorPlugin = qobject_cast<QDesignerFormEditorPluginInterface*>(plugin)) {
+            if (!formEditorPlugin->isInitialized())
+                formEditorPlugin->initialize(core());
+        }
+    }
+}
+
+void QDesignerWorkbench::saveSettings() const
+{
+    QDesignerSettings settings;
+    if (m_mode == DockedMode) {
+        if (qFindChild<QWorkspace *>(/*qDesigner->*/mainWindow())) {
+            settings.saveGeometryFor(/*qDesigner->*/mainWindow());
+            settings.setValue(/*qDesigner->*/mainWindow()->objectName() + QLatin1String("/visible"), false);
+        }
+    } else {
+        foreach (QDesignerToolWindow *tw, m_toolWindows) {
+            settings.saveGeometryFor(tw);
+        }
+    }
+}
+
+bool QDesignerWorkbench::readInForm(const QString &fileName) const
+{
+    return m_actionManager->readInForm(fileName);
+}
+
+bool QDesignerWorkbench::writeOutForm(QDesignerFormWindowInterface *formWindow, const QString &fileName) const
+{
+    return m_actionManager->writeOutForm(formWindow, fileName);
+}
+
+bool QDesignerWorkbench::saveForm(QDesignerFormWindowInterface *frm)
+{
+    return m_actionManager->saveForm(frm);
+}
+
+QDesignerToolWindow *QDesignerWorkbench::findToolWindow(QWidget *widget) const
+{
+    foreach (QDesignerToolWindow *toolWindow, m_toolWindows) {
+        if (toolWindow->centralWidget() == widget)
+            return toolWindow;
+    }
+
+    return 0;
+}
+
+QDesignerFormWindow *QDesignerWorkbench::findFormWindow(QWidget *widget) const
+{
+    foreach (QDesignerFormWindow *formWindow, m_formWindows) {
+        if (formWindow->centralWidget() == widget)
+            return formWindow;
+    }
+
+    return 0;
+}
+
+bool QDesignerWorkbench::handleClose()
+{
+    QList<QDesignerFormWindow *> dirtyForms;
+    foreach (QDesignerFormWindow *w, m_formWindows) {
+        if (w->editor()->isDirty())
+            dirtyForms << w;
+    }
+
+    if (dirtyForms.size()) {
+        if (dirtyForms.size() == 1) {
+            if (!dirtyForms.at(0)->close()) {
+                return false;
+            }
+        } else {
+            QMessageBox box(tr("Save Forms?"),
+                    tr("There are %1 forms with unsaved changes."
+                        " Do you want to review these changes before quitting?")
+                    .arg(dirtyForms.size()),
+                    QMessageBox::Warning,
+                    QMessageBox::Yes | QMessageBox::Default, QMessageBox::No,
+                    QMessageBox::Cancel | QMessageBox::Escape, 0);
+            box.setButtonText(QMessageBox::Yes, tr("Review Changes"));
+            box.setButtonText(QMessageBox::No, tr("Discard Changes"));
+            switch (box.exec()) {
+            case QMessageBox::Cancel:
+                return false;
+            case QMessageBox::Yes:
+               foreach (QDesignerFormWindow *fw, dirtyForms) {
+                   fw->show();
+                   fw->raise();
+                   if (!fw->close()) {
+                       return false;
+                   }
+               }
+               break;
+            case QMessageBox::No:
+              foreach (QDesignerFormWindow *fw, dirtyForms) {
+                  fw->editor()->setDirty(false);
+                  fw->setWindowModified(false);
+              }
+              break;
+            }
+        }
+    }
+
+    foreach (QDesignerFormWindow *fw, m_formWindows)
+        fw->close();
+
+    saveSettings();
+    return true;
+}
+
+QDesignerActions *QDesignerWorkbench::actionManager() const
+{
+    return m_actionManager;
+}
+
+void QDesignerWorkbench::setUIMode(UIMode mode)
+{
+    switch (mode) {
+        case TopLevelMode:
+            switchToTopLevelMode();
+            break;
+        case DockedMode:
+            switchToDockedMode();
+            break;
+
+        default: Q_ASSERT(0);
+    }
+}
+
+void QDesignerWorkbench::updateWindowMenu(QDesignerFormWindowInterface *fw)
+{
+    if (!fw)
+        return;
+    if (QDesignerFormWindow *dfw = qobject_cast<QDesignerFormWindow *>(fw->parentWidget()))
+        dfw->action()->setChecked(true);
+}
+
+void QDesignerWorkbench::formWindowActionTriggered(QAction *a)
+{
+    QWidget *widget = a->parentWidget();
+    Q_ASSERT(widget != 0);
+
+    if (m_mode == DockedMode) {
+        m_workspace->setActiveWindow(widget);
+    } else {
+        widget->setWindowState(widget->windowState() & ~Qt::WindowMinimized);
+        widget->activateWindow();
+        widget->raise();
+    }
+}
+
+void QDesignerWorkbench::showToolBars()
+{
+    m_toolToolBar->show();
+    m_formToolBar->show();
+    m_editToolBar->show();
+}
+
+void QDesignerWorkbench::closeAllToolWindows()
+{
+    foreach (QDesignerToolWindow *tw, m_toolWindows)
+        tw->hide();
+}
+
+QDockWidget *QDesignerWorkbench::magicalDockWidget(QWidget *widget) const
+{
+    if (!m_workspace)
+        return 0;
+
+    QDockWidget *dockWidget = qFindChild<QDockWidget*>(m_workspace->window(), widget->objectName() + QLatin1String("_dock"));
+    return dockWidget;
+}
diff --git a/src/designer/formdesigner/qdesigner_workbench.h b/src/designer/formdesigner/qdesigner_workbench.h
new file mode 100644 (file)
index 0000000..1b922b6
--- /dev/null
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef QDESIGNER_WORKBENCH_H
+#define QDESIGNER_WORKBENCH_H
+
+#include <QtCore/QObject>
+#include <QtCore/QPointer>
+#include <QtCore/QHash>
+#include <QtCore/QList>
+#include <QtCore/QRect>
+
+#include "qdesigner_toolwindow.h"
+
+class QDesigner;
+class QDesignerActions;
+//class QDesignerToolWindow;
+class QDesignerFormWindow;
+
+class QAction;
+class QActionGroup;
+class QDockWidget;
+class QMenu;
+class QMenuBar;
+class QVariant;
+class QToolBar;
+class QWorkspace;
+class QCloseEvent;
+
+class QDesignerFormEditorInterface;
+class QDesignerFormWindowInterface;
+class QDesignerFormWindowManagerInterface;
+
+namespace qdesigner_internal {
+class QDesignerIntegration;
+}
+
+class QDesignerWorkbench: public QObject
+{
+    Q_OBJECT
+public:
+    enum UIMode
+    {
+        NeutralMode,
+        TopLevelMode,
+        DockedMode
+    };
+
+public:
+    QDesignerWorkbench();
+    virtual ~QDesignerWorkbench();
+
+    UIMode mode() const;
+
+    QDesignerFormEditorInterface *core() const;
+
+    QDesignerToolWindow *findToolWindow(QWidget *widget) const;
+    QDesignerFormWindow *findFormWindow(QWidget *widget) const;
+
+    QDesignerFormWindow *createFormWindow();
+
+    int toolWindowCount() const;
+    QDesignerToolWindow *toolWindow(int index) const;
+
+    int formWindowCount() const;
+    QDesignerFormWindow *formWindow(int index) const;
+
+    QDesignerActions *actionManager() const;
+
+    QActionGroup *modeActionGroup() const;
+
+    QRect availableGeometry() const;
+    int marginHint() const;
+
+    void saveSettings() const;
+
+    bool readInForm(const QString &fileName) const;
+    bool writeOutForm(QDesignerFormWindowInterface *formWindow, const QString &fileName) const;
+    bool saveForm(QDesignerFormWindowInterface *fw);
+    bool handleClose();
+    void closeAllToolWindows();
+    //
+    QDesignerToolWindow *mainWindow() const { return m_mainWindow; };
+    void setMainWindow(QDesignerToolWindow *tw) { m_mainWindow = tw; };
+
+signals:
+    void modeChanged(UIMode mode);
+    void initialized();
+
+public slots:
+    void addToolWindow(QDesignerToolWindow *toolWindow);
+    void addFormWindow(QDesignerFormWindow *formWindow);
+    void removeToolWindow(QDesignerToolWindow *toolWindow);
+    void removeFormWindow(QDesignerFormWindow *formWindow);
+    void setUIMode(UIMode mode);
+
+// ### private slots:
+    void switchToNeutralMode();
+    void switchToDockedMode();
+    void switchToTopLevelMode();
+
+    void initializeCorePlugins();
+
+private slots:
+    void initialize();
+    void activateWorkspaceChildWindow(QWidget *widget);
+    void updateWindowMenu(QDesignerFormWindowInterface *fw);
+    void formWindowActionTriggered(QAction *a);
+    void showToolBars();
+    void adjustFormPositions();
+
+private:
+    QWidget *magicalParent() const;
+    Qt::WindowFlags magicalWindowFlags(const QWidget *widgetForFlags) const;
+    QDockWidget *magicalDockWidget(QWidget *widget) const;
+
+    QDesignerFormWindowManagerInterface *formWindowManager() const;
+    void changeBringToFrontVisiblity(bool visible);
+
+    bool eventFilter(QObject *object, QEvent *event);
+
+private:
+    QDesignerFormEditorInterface *m_core;
+    qdesigner_internal::QDesignerIntegration *m_integration;
+
+    QDesignerActions *m_actionManager;
+    QActionGroup *m_toolActions;
+    QActionGroup *m_windowActions;
+
+    QMenu *m_fileMenu;
+    QMenu *m_editMenu;
+    QMenu *m_formMenu;
+    QMenu *m_toolMenu;
+    QMenu *m_windowMenu;
+    QMenu *m_helpMenu;
+
+    QMenuBar *m_globalMenuBar;
+    QToolBar *m_toolToolBar;
+    QToolBar *m_formToolBar;
+    QToolBar *m_editToolBar;
+
+    UIMode m_mode;
+
+    QList<QDesignerToolWindow*> m_toolWindows;
+    QList<QDesignerFormWindow*> m_formWindows;
+
+    QWorkspace *m_workspace;
+    QHash<QWidget*, bool> m_visibilities;
+    QHash<QWidget*, QRect> m_geometries;
+
+    class ToolWindowExtra {};
+    class FormWindowExtra {};
+
+    QHash<QDesignerToolWindow*, ToolWindowExtra> m_toolWindowExtras;
+    QHash<QDesignerFormWindow*, FormWindowExtra> m_formWindowExtras;
+    bool m_initializing;
+    //
+    QPointer<QDesignerToolWindow> m_mainWindow;
+};
+
+#endif // QDESIGNER_WORKBENCH_H
diff --git a/src/designer/formdesigner/qrc_designer.cpp b/src/designer/formdesigner/qrc_designer.cpp
new file mode 100644 (file)
index 0000000..c4f3c91
--- /dev/null
@@ -0,0 +1,1198 @@
+/****************************************************************************
+** Resource object code
+**
+** Created: Sun Oct 26 23:47:57 2008
+**      by: The Resource Compiler for Qt version 4.3.0
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include <QtCore/qglobal.h>
+
+static const unsigned char qt_resource_data[] = {
+  // /home/user/src/ananas-qt4/src/designer/formdesigner/images/designer.png
+  0x0,0x0,0x39,0xf,
+  0x89,
+  0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
+  0x0,0x0,0x80,0x0,0x0,0x0,0x80,0x8,0x6,0x0,0x0,0x0,0xc3,0x3e,0x61,0xcb,
+  0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,
+  0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x38,0xc1,0x49,0x44,0x41,0x54,0x78,0xda,0xed,
+  0xbd,0x79,0x9c,0x1d,0x57,0x79,0x26,0xfc,0x9c,0x53,0x75,0xeb,0xde,0xee,0x56,0x4b,
+  0xad,0xc5,0x96,0x2c,0x4b,0x5e,0x24,0x6f,0x78,0x1,0xdb,0xb8,0xd,0x76,0x10,0x18,
+  0x8c,0x6d,0x30,0x1,0x87,0xc9,0x78,0x98,0x90,0x30,0x81,0x30,0x64,0x42,0x92,0x1,
+  0x9b,0x40,0x42,0x48,0x20,0x13,0x96,0xc,0x1f,0x99,0x2f,0x99,0x90,0x5f,0x2,0x18,
+  0x92,0xe1,0x73,0x20,0x33,0x59,0x60,0x62,0xc0,0xd8,0xd8,0xec,0x36,0xde,0xb0,0x65,
+  0x2d,0x96,0x6d,0x59,0x6a,0xed,0x4b,0x4b,0xea,0x4d,0xdd,0xf7,0xd6,0x76,0x96,0xf7,
+  0xfb,0xe3,0x9c,0x53,0x75,0xaa,0xfa,0xb6,0x36,0xb7,0x6c,0xd9,0xb2,0xfc,0x2b,0xd7,
+  0xbd,0xbd,0xdc,0xbe,0xb7,0x9e,0xe7,0x7d,0xde,0xf5,0x9c,0x62,0x44,0x84,0xa3,0xf9,
+  0xc7,0x18,0x7b,0x39,0x80,0x57,0x0,0xd8,0x9,0x60,0x17,0x80,0x9d,0x44,0x94,0xe1,
+  0xa5,0x7f,0x2f,0xc8,0x7f,0xe1,0xd1,0x82,0xbf,0x68,0x59,0xe3,0xb7,0x7e,0xf3,0xb,
+  0xb,0x6f,0xda,0xb7,0x45,0xc,0x6d,0x5f,0x27,0x86,0x56,0xdf,0x19,0xf,0x31,0xc6,
+  0xf6,0x59,0x42,0xec,0xb4,0x84,0x98,0x7c,0xe9,0xd2,0xbe,0x8,0x9,0x0,0xe0,0x15,
+  0x8b,0xce,0xe4,0x37,0xf5,0x2f,0xc,0x96,0xf6,0x2f,0xc,0x96,0x9e,0x33,0xd8,0x5a,
+  0x75,0xed,0x7b,0xfb,0x91,0xb4,0xd5,0xd8,0xc8,0x76,0x35,0xb4,0xf3,0x49,0xb1,0x65,
+  0xfd,0xf,0x93,0x21,0xc6,0xd8,0x36,0x4b,0x86,0x3,0x96,0x10,0xfb,0x5f,0xba,0xd4,
+  0x2f,0x70,0x2,0x30,0xc6,0x6,0x4f,0x3b,0x37,0x7a,0x4b,0x23,0xe2,0x4b,0xeb,0xdf,
+  0xeb,0x99,0x13,0x2c,0x58,0x7e,0x51,0xb0,0x60,0xf9,0x45,0xd1,0xe0,0xd5,0x37,0xf7,
+  0x15,0x84,0x18,0xd9,0x29,0xf7,0x6c,0xbc,0x3f,0x1d,0x62,0x8c,0x6d,0xad,0xb9,0x8c,
+  0x97,0x8,0xf1,0x42,0x22,0x0,0x63,0xac,0x37,0x6a,0xf1,0x1b,0x6,0x96,0xb0,0xeb,
+  0x8e,0xe4,0xe7,0x3d,0x42,0xe0,0xb2,0x37,0xf5,0xe2,0xdf,0xe7,0x3a,0x19,0xdb,0x25,
+  0x87,0x76,0x3f,0x23,0x87,0x3c,0x42,0xec,0xf7,0x8,0xb1,0xf3,0x25,0x28,0x4e,0x6c,
+  0x5,0xb8,0xfc,0xb4,0x73,0xc3,0x55,0x61,0xc8,0x17,0x1c,0xd3,0x1f,0x89,0x78,0xcf,
+  0xa9,0x2b,0xa2,0x8b,0x4f,0x5d,0x11,0x5d,0xec,0x8,0x31,0x79,0x40,0xef,0xd9,0x3b,
+  0x24,0x87,0x86,0x1e,0x4b,0x87,0x18,0x63,0x43,0x35,0x85,0x78,0x89,0x10,0x27,0xa,
+  0x1,0x18,0x63,0x4b,0xa2,0x16,0xbf,0x66,0xce,0x82,0x60,0xd5,0xac,0xfd,0xd1,0x88,
+  0xf7,0x2c,0x38,0x9d,0xaf,0x5c,0x70,0x7a,0xb8,0xf2,0xa2,0xd7,0xb6,0xf0,0xb6,0x5b,
+  0x7,0x30,0xb6,0x5b,0xe,0xd5,0x8,0xb1,0xff,0xa5,0x4c,0xe3,0xf8,0xff,0x63,0x87,
+  0x4b,0x3,0x19,0x63,0x6f,0x5a,0x79,0x79,0xf4,0xc9,0xde,0x79,0xc1,0xa0,0xfb,0xda,
+  0x3b,0x3f,0x53,0xa,0x41,0x2b,0xa,0x20,0x15,0x41,0x2a,0x3d,0xab,0x6f,0x6c,0x6a,
+  0x54,0xed,0xf1,0x33,0x8d,0xb1,0x61,0xb9,0xbd,0x16,0x58,0xbe,0x94,0x69,0x1c,0x6f,
+  0x2,0x30,0xc6,0xce,0x1f,0x38,0x25,0xf8,0xcd,0xe5,0x17,0x47,0x1f,0xf2,0xbf,0xee,
+  0x13,0x0,0x0,0x16,0xcc,0x69,0x42,0x28,0xc2,0x54,0x92,0x1f,0xb7,0x37,0xea,0x8,
+  0xb1,0x7f,0x9b,0xda,0xb3,0xfe,0x87,0xc9,0xd0,0xb6,0xb5,0xd9,0xb6,0x97,0x52,0xcf,
+  0xe3,0xef,0x2,0x5e,0xb1,0x78,0x45,0xe3,0xa6,0xc3,0xbd,0xc8,0x58,0x3b,0xc3,0xf9,
+  0xa7,0x2f,0xc0,0xe2,0x81,0x5e,0x74,0xb2,0x1c,0x52,0x69,0x1c,0xec,0xe4,0xc8,0xa5,
+  0x42,0x3b,0x11,0x68,0x67,0x2,0x5a,0xd3,0xb3,0x7a,0xa3,0x65,0xea,0x9,0xf8,0x99,
+  0x46,0x2d,0xf5,0xdc,0xff,0x52,0xa6,0x31,0x4b,0x4,0x60,0x8c,0xd,0x2e,0x5a,0xd6,
+  0xb8,0x26,0xea,0x65,0x2b,0x8f,0xe4,0x85,0x4e,0x9d,0xdb,0xf,0x6,0x60,0x4e,0xb3,
+  0x5,0x80,0x30,0xd0,0xdb,0x3,0x30,0x3,0x3a,0x11,0xa1,0x93,0x9,0x4b,0x8c,0xc,
+  0xed,0x54,0x20,0xcd,0x15,0xda,0xa9,0x38,0xe6,0x37,0xde,0x2d,0xf5,0x9c,0xda,0xaf,
+  0xf6,0xd4,0x32,0xd,0x17,0x43,0xec,0x7f,0x29,0xb0,0x3c,0xa,0x2,0x30,0xc6,0x2,
+  0x0,0x97,0x9e,0x72,0x36,0x7f,0xc7,0x91,0xbc,0xc8,0x40,0x5f,0xf,0x38,0xb,0x81,
+  0xc2,0x9d,0x90,0x3d,0xcc,0x63,0x6,0xc2,0x9c,0x26,0x37,0xc4,0xe8,0x6b,0x55,0xbe,
+  0x37,0xd1,0xc9,0xd1,0x4e,0x73,0x74,0x52,0x81,0x76,0x22,0x8f,0x99,0x14,0x3d,0x73,
+  0x82,0x5,0x3d,0x73,0x82,0x5,0x7e,0xa6,0xe1,0x52,0xcf,0x9d,0x4f,0xe5,0x7b,0x5e,
+  0xca,0x34,0x8e,0x4e,0x1,0xae,0x5a,0x76,0x61,0xe3,0x2d,0x47,0x9a,0xf6,0x35,0x1b,
+  0xd,0x10,0x71,0x4b,0x1e,0x8f,0x4,0x84,0xa,0xd8,0xd5,0x3,0x5,0x21,0xa6,0x93,
+  0xc2,0xa8,0xc4,0xb3,0x21,0x45,0x3d,0xf5,0x9c,0x21,0xd3,0x28,0x14,0xe2,0x64,0xcd,
+  0x34,0xc2,0x19,0x8a,0x3e,0xd7,0xcc,0x3b,0x25,0xbc,0xfe,0x48,0x5f,0xa4,0x19,0x36,
+  0x0,0xf0,0x42,0xee,0xcb,0x7f,0x74,0x8,0x52,0xd8,0xaf,0x11,0x59,0x57,0x51,0x1e,
+  0x3,0x7d,0x3d,0x96,0x14,0xe5,0x6b,0xcc,0x6,0x29,0x16,0x9c,0x1e,0x76,0x4d,0x3d,
+  0x87,0x37,0x89,0x3d,0xb6,0xa7,0xb1,0xfd,0x64,0x4b,0x3d,0xbb,0x29,0xc0,0xd5,0xa7,
+  0x9d,0x1b,0xae,0xe2,0x1c,0x3d,0x47,0xfa,0x22,0x73,0x5a,0x7d,0x0,0x85,0xd3,0xad,
+  0xdd,0x8b,0x1,0x7c,0x52,0x30,0xd6,0x85,0x4,0x38,0x84,0x5a,0x30,0x9f,0x14,0xe5,
+  0x6b,0x4d,0x74,0x32,0x1c,0xec,0xe4,0x68,0xa7,0xa2,0x88,0x2b,0x8e,0x95,0x10,0xd7,
+  0xbe,0xb7,0x7f,0x5a,0xea,0x79,0x32,0x34,0xb9,0xba,0x11,0xe0,0x15,0x73,0x17,0x5,
+  0xd7,0x1f,0xd5,0x8b,0xb0,0xb0,0x70,0x1,0x60,0xee,0xd4,0xc5,0xda,0xed,0x63,0x42,
+  0x1d,0xf0,0x9a,0x5a,0xd4,0x9,0x41,0x55,0x42,0x55,0x95,0xa2,0xa7,0x78,0x2e,0x95,
+  0x46,0x3b,0x15,0x38,0xd8,0xc9,0xad,0x62,0xc8,0xa3,0xaa,0x4f,0x1c,0x45,0x93,0x6b,
+  0x27,0x80,0x3,0x2f,0x86,0x4c,0x23,0x9c,0x9d,0x97,0xe1,0x0,0x82,0x8a,0xc4,0x93,
+  0x63,0x2,0xa8,0x20,0x5,0xdc,0x57,0xa9,0x8b,0xa5,0x5b,0x55,0xa0,0x1a,0xf8,0x15,
+  0xb5,0xa8,0xc5,0x14,0xac,0xa6,0x14,0x8d,0x80,0x63,0x7e,0x5f,0x88,0xf9,0x9e,0xfb,
+  0x48,0x85,0x34,0x81,0x66,0x22,0x6c,0xc0,0x79,0xe4,0xae,0x63,0xa6,0x26,0xd7,0xce,
+  0x27,0xc5,0x96,0x1d,0x6b,0xb3,0xdd,0x2f,0x86,0x26,0xd7,0xac,0x10,0xa0,0x19,0xb6,
+  0x40,0xc4,0xac,0xf9,0x13,0x18,0x63,0x55,0xcb,0x2e,0x80,0x63,0x16,0x3e,0xf2,0xd4,
+  0xe2,0xd0,0xa4,0x20,0x2a,0x15,0x84,0x79,0x44,0x71,0xae,0x85,0x99,0x72,0x56,0x55,
+  0x29,0xbc,0xa3,0xd5,0xe0,0x58,0x32,0x10,0x1,0x3,0x34,0x2d,0x9e,0x70,0x84,0x38,
+  0x52,0xd7,0x51,0x27,0xc4,0x8b,0xa1,0xc9,0x35,0x6b,0x4,0xb0,0xf8,0x5a,0x2b,0xee,
+  0xe6,0xcf,0x19,0x18,0x43,0x4d,0xda,0x9d,0x5a,0x1c,0x9a,0x14,0xc,0x5e,0xa0,0x48,
+  0xb5,0xd7,0x60,0x35,0xf2,0xb0,0x9a,0x5b,0xa9,0x90,0x42,0x57,0x82,0xcc,0x65,0xb,
+  0xcd,0x5f,0x4f,0x73,0x59,0xb8,0xe,0x47,0x8c,0x63,0xc9,0x34,0xe,0xd1,0xe4,0xda,
+  0x40,0x44,0x1b,0x5e,0xb4,0x4,0x20,0x70,0xf,0x1c,0xab,0x2,0xf0,0x54,0x60,0x5a,
+  0x30,0xe8,0xc9,0xf8,0xc,0x6a,0x41,0x9e,0xc5,0x53,0xcd,0x93,0x4c,0x73,0xb,0x8c,
+  0xe,0x1d,0x77,0x30,0xaa,0x12,0x8d,0x4a,0x32,0x30,0x68,0xf4,0x44,0x1c,0xad,0x28,
+  0xc2,0xa2,0xb9,0xbd,0xd3,0x54,0xc2,0xc4,0x13,0xf9,0x11,0xc5,0x12,0x33,0x35,0xb9,
+  0x9e,0x7e,0x20,0x7b,0x94,0x31,0xf6,0xa9,0x13,0x91,0x4,0xb3,0x43,0x0,0x62,0x55,
+  0xc0,0xdd,0xc5,0x2e,0xa4,0x99,0x95,0x2a,0x50,0xc9,0x39,0xa7,0xab,0x85,0x1,0x9d,
+  0x15,0x34,0x61,0x96,0x54,0x8c,0xd5,0x82,0x42,0x56,0x9,0x2d,0xa,0x86,0x30,0xf,
+  0x7c,0xb2,0xaf,0x67,0xfe,0x86,0xb6,0x3f,0xaf,0x4b,0xa5,0x2a,0x48,0xa4,0x8b,0xdf,
+  0xa3,0x5a,0x2a,0xba,0x6c,0xa1,0x8d,0x25,0x72,0x85,0x89,0x38,0xc3,0xc1,0x4e,0x86,
+  0x89,0x4e,0x7e,0xc4,0x6e,0x63,0xc1,0xe9,0xe1,0xca,0xb,0xae,0x6,0xbe,0xfd,0x97,
+  0xb8,0x8,0xc0,0x8b,0x8f,0x0,0x21,0xf,0x1,0x62,0x6,0xe3,0x12,0xb6,0x2,0x78,
+  0x56,0xd3,0xa,0xf2,0x64,0xbe,0xfc,0x25,0xe7,0xcb,0x51,0x95,0x79,0xc6,0xaa,0xca,
+  0xe0,0x81,0xce,0xea,0xcf,0x6b,0x59,0x5,0x2b,0xfe,0x1a,0x79,0xe0,0xea,0x82,0x40,
+  0x64,0xad,0xbf,0x42,0x4,0x18,0x22,0x50,0x97,0xfa,0x44,0xab,0x11,0x60,0xc9,0x40,
+  0x3,0x4b,0x6,0xfa,0x0,0x0,0x52,0x29,0x4c,0x74,0xf2,0x82,0x10,0xcf,0xa6,0xac,
+  0xfd,0x82,0x26,0x40,0x6f,0xb3,0xcf,0xa4,0x80,0x84,0x69,0x92,0xcf,0x3c,0xe1,0xad,
+  0x9,0xc4,0x34,0x35,0x20,0x46,0x60,0x15,0xec,0x59,0x19,0x3,0x58,0x22,0xb0,0x42,
+  0x1c,0x8c,0x22,0x30,0x54,0xdd,0x42,0x55,0x5d,0xaa,0xe9,0xa3,0xb,0x26,0xc9,0xb3,
+  0x74,0x82,0x6,0x15,0xa0,0x57,0xe3,0x84,0x6a,0xfc,0x50,0x8b,0x27,0x18,0x21,0xe4,
+  0x1,0x16,0xf5,0x37,0xac,0xdb,0x0,0x84,0x52,0x38,0x70,0x30,0x29,0x8,0x91,0x4b,
+  0x75,0x72,0x10,0xc0,0x18,0x67,0xd5,0xce,0x19,0xf9,0xd0,0x33,0xd4,0xf4,0xbc,0xb0,
+  0x56,0xf2,0xfd,0x79,0x91,0x45,0x58,0xb9,0x77,0x3e,0x9f,0x95,0x64,0xb1,0xdf,0x9d,
+  0x7e,0x66,0x1e,0xc7,0x98,0xa7,0x6,0xbe,0xd4,0x33,0x14,0xa0,0x3b,0x5,0x30,0x4,
+  0x30,0x67,0x46,0xe5,0x73,0x56,0xa8,0x85,0xae,0xc4,0xe,0xe5,0x7b,0x9d,0x4e,0x8a,
+  0x6,0xf,0xb0,0x74,0x7e,0x3,0x4b,0xe7,0x1b,0x82,0x8c,0x4e,0x26,0x78,0x6a,0xd7,
+  0x18,0xd4,0xb3,0xec,0x82,0xbe,0x30,0xea,0x0,0xae,0x8,0x54,0x91,0x79,0x56,0x2b,
+  0xf4,0x38,0x97,0xe0,0x11,0x83,0x15,0xee,0x1c,0xcc,0xa,0x75,0x1,0x3e,0x73,0x15,
+  0x6,0x6,0x10,0x3,0x67,0xe,0x74,0x6,0xc6,0x3c,0x42,0xb8,0xc7,0x4e,0x25,0xe0,
+  0x13,0xa7,0xea,0xeb,0xb,0x15,0x60,0x6,0x60,0xd,0x2,0x91,0x2e,0x94,0xc0,0x29,
+  0x0,0x81,0xa,0x42,0x80,0x69,0x2f,0x30,0x9d,0xde,0xcb,0x98,0x89,0x14,0xb,0xfb,
+  0x43,0xf4,0xf7,0x74,0x30,0xd1,0x49,0x5f,0xfc,0x4,0xa8,0x54,0x7a,0x19,0xf3,0xea,
+  0x3f,0xd3,0x74,0xdf,0xe4,0x7,0x8c,0xaa,0xc9,0x80,0x97,0x9,0x30,0xcf,0xab,0x73,
+  0xfb,0x98,0x33,0x3,0x7c,0x71,0x2e,0x80,0x67,0x15,0x2,0xb0,0x9a,0xa7,0x61,0xcc,
+  0xb7,0xdf,0xba,0xf4,0x13,0x18,0x69,0x10,0xd3,0xd0,0xf6,0x4c,0x64,0x68,0x1,0x72,
+  0x84,0xe0,0x96,0x34,0xba,0x4b,0xc9,0x9a,0xe,0x41,0xa,0xe3,0xcb,0xe6,0xb4,0x5a,
+  0x2f,0x7e,0x2,0x18,0xc1,0x64,0x75,0x9c,0xa7,0x1,0xf,0xcf,0x42,0x89,0x58,0x45,
+  0xb2,0x41,0xc6,0xfa,0x79,0x45,0xee,0x59,0x41,0x2,0x66,0xcf,0x1c,0x1c,0x8c,0x19,
+  0x22,0x70,0x17,0x7,0x30,0x86,0x80,0x31,0x4c,0x1c,0xcc,0x30,0xbc,0x3f,0x41,0x92,
+  0xa,0x8c,0x4d,0xa4,0x46,0x59,0x98,0x75,0x33,0x1c,0x68,0x35,0x39,0x6,0xe6,0x36,
+  0x31,0x6f,0x6e,0x84,0x53,0x17,0xb5,0x10,0x4,0xc,0x9c,0x69,0x68,0x22,0x30,0xa6,
+  0xa0,0x89,0x40,0x4c,0x3,0xa4,0xa0,0x99,0x21,0x1,0xa0,0xad,0x8b,0xd3,0x56,0x19,
+  0x6a,0xf5,0xd,0x6,0xb0,0x43,0x90,0x82,0x83,0x9f,0x1c,0x95,0x40,0xa2,0x5a,0xc,
+  0x30,0xcd,0x15,0x4c,0x27,0x6,0x63,0x2e,0x2c,0x60,0x35,0xe5,0x60,0x85,0x75,0x73,
+  0xc6,0x4b,0x2,0x38,0xe0,0x19,0x7,0xb7,0xa0,0x1f,0x18,0x49,0xb0,0x65,0xeb,0x14,
+  0x76,0xec,0x6a,0x23,0x17,0xba,0x7c,0x19,0xe6,0x3a,0x90,0xa5,0xef,0x37,0xf1,0x47,
+  0x5c,0x58,0xe8,0xc0,0xbc,0x26,0x56,0x9e,0x35,0xf,0x67,0x2e,0x9b,0x83,0xa0,0x11,
+  0x80,0x41,0x43,0x93,0xb2,0x65,0x6d,0x6d,0x95,0x40,0xd9,0x4f,0xc1,0xad,0xa,0xe8,
+  0xea,0x7,0x21,0x3a,0x24,0x29,0x9a,0x8d,0xd6,0xc9,0x42,0x80,0xe9,0x36,0xcf,0x66,
+  0x0,0xde,0x5,0x69,0x64,0x5d,0x4,0xb1,0x32,0xa0,0x43,0x1,0xb7,0xb3,0x78,0x7,
+  0xb8,0x3,0x9d,0x23,0xe0,0xc,0xdb,0xb7,0xb5,0xb1,0x76,0xfd,0x38,0x26,0xdb,0xd2,
+  0x2,0x1e,0x80,0x21,0xf4,0xb2,0x46,0xaf,0x40,0x44,0xa8,0xf6,0xc,0x2c,0x31,0x26,
+  0xc6,0x14,0x1e,0x1d,0x1f,0xc5,0xea,0x35,0x23,0x38,0xfb,0xcc,0xb9,0xb8,0xe8,0x82,
+  0xf9,0x68,0xf5,0x44,0xd0,0xd0,0x50,0xa4,0xc0,0xa0,0xa1,0xc0,0x4d,0xaa,0x48,0xda,
+  0x16,0xbb,0xf4,0xc,0xcd,0xac,0x6a,0x2c,0xe0,0xbe,0x1a,0x5,0xd1,0xc9,0x91,0x5,
+  0x68,0x9a,0x9e,0x82,0xf9,0xa4,0x60,0x95,0xdc,0x1c,0x95,0x68,0x9f,0x51,0x69,0xb6,
+  0xcc,0x4a,0x3c,0xb3,0x80,0x57,0x80,0x67,0xc,0xa3,0xa3,0x19,0x1e,0x79,0x64,0xc,
+  0x63,0x63,0xc2,0xb8,0x2,0x1e,0xd9,0x40,0x9f,0x81,0xf1,0x2,0xef,0xb2,0x3f,0x40,
+  0xf5,0x4a,0x20,0x15,0x19,0x0,0x40,0x60,0xda,0xf8,0xfc,0xa1,0x2d,0x31,0x76,0xee,
+  0x4c,0x70,0xfe,0x79,0x3,0xb8,0xf0,0x82,0x1,0x30,0x28,0x28,0x58,0x35,0x20,0x65,
+  0xc3,0x45,0xd,0x10,0xb7,0xbf,0xdb,0xc5,0x1d,0x90,0x9f,0x2,0x93,0x57,0x21,0x7d,
+  0x91,0x13,0x80,0x6a,0x9f,0xbf,0x5e,0xb,0xaa,0x25,0x1,0x60,0x64,0xc3,0x38,0x97,
+  0x1,0xb0,0x32,0xa9,0xb3,0x5e,0x1e,0xdc,0xfb,0x2f,0x60,0xc,0x21,0xe7,0x78,0xfc,
+  0xb1,0x71,0xac,0x5f,0x3f,0x5,0xce,0x39,0x38,0x8b,0xc,0x1,0x88,0x5b,0x45,0x61,
+  0x45,0xd6,0xc7,0xfc,0xc2,0x52,0xad,0x1e,0x40,0x15,0x1f,0xad,0x8b,0x33,0x48,0x23,
+  0xcf,0x8,0xeb,0xd6,0x1f,0xc4,0xee,0xdd,0x9,0xae,0xbc,0x62,0x11,0xfa,0xe7,0x9a,
+  0x29,0x27,0x2,0x7,0x41,0x81,0xd9,0x98,0x80,0x48,0xdb,0x17,0xd5,0x95,0xf,0x49,
+  0x5d,0x5a,0xdb,0x44,0xfc,0x24,0x73,0x1,0xb5,0xa0,0x9f,0x55,0xeb,0x3e,0xd6,0xdf,
+  0x3b,0xd9,0x47,0x25,0xb3,0x67,0x3e,0xf4,0x8c,0x81,0xb3,0x0,0x1,0xe7,0xc8,0x13,
+  0x85,0xbb,0xef,0xd9,0x8f,0xf1,0x31,0x85,0x20,0x68,0x15,0xc4,0x28,0x52,0x42,0xaa,
+  0xd5,0x1,0xa8,0x56,0x4,0xb2,0xcf,0xa9,0xa8,0x8,0xc2,0x3,0xdf,0x66,0x5,0x16,
+  0x5c,0xd,0x8d,0xd1,0x11,0x85,0xbb,0xee,0xda,0x87,0x57,0xbf,0x7a,0x21,0x96,0x9f,
+  0xd1,0xe3,0xd1,0x49,0x41,0xd9,0x92,0xb7,0x26,0xd7,0xee,0xf6,0x7d,0x3f,0xab,0xf4,
+  0x43,0x18,0x0,0xce,0x1a,0x27,0x9,0x1,0x66,0xc8,0x0,0xa8,0xc8,0xd5,0x7d,0x16,
+  0xb0,0xa2,0x58,0x54,0xa4,0x72,0x1e,0x5,0x18,0x63,0xe0,0x8,0xc0,0x19,0x47,0xfb,
+  0xa0,0xc0,0x77,0xef,0x18,0x83,0x14,0xc,0x41,0xd0,0xac,0x28,0x3,0x77,0xe4,0xf1,
+  0xdd,0x31,0xab,0x4d,0x18,0x79,0xe9,0x26,0xf7,0xdb,0xc8,0x45,0xb1,0xc7,0x94,0x83,
+  0xc9,0xba,0x5,0xe,0x65,0x2,0x3f,0xd2,0x78,0xf0,0x81,0x9,0x8c,0x8d,0xa,0xbc,
+  0xfc,0xb2,0x79,0x8,0x48,0xd9,0x56,0x93,0x82,0x32,0x14,0xb0,0x61,0x46,0x17,0x17,
+  0x30,0xad,0x7,0x72,0x32,0x54,0x2,0x67,0x28,0x76,0xd9,0xc,0xaf,0x8,0xf8,0x8a,
+  0x69,0x21,0x2,0x88,0x55,0xa1,0x37,0x96,0xcf,0x11,0xb0,0x0,0x81,0x3,0xff,0x9b,
+  0x63,0x50,0x2a,0x44,0x18,0x86,0xe0,0x2c,0x28,0x2,0xc2,0x92,0x38,0x55,0x3f,0x44,
+  0x5e,0x27,0x90,0x6a,0xfd,0x3,0x62,0x54,0x93,0x89,0x32,0x53,0x70,0x75,0x4b,0x22,
+  0xd,0x66,0x7d,0x3e,0x48,0xe1,0xe9,0x27,0x53,0x64,0x29,0x70,0xc5,0xab,0xe7,0x19,
+  0x67,0x41,0xc,0xc,0xaa,0x8c,0x63,0x48,0xa3,0x32,0xfc,0xe2,0x55,0x35,0x9,0xc0,
+  0xdc,0xd6,0xfc,0x93,0x23,0x6,0x38,0xa2,0x4d,0x46,0x18,0x2b,0x9b,0x43,0x8c,0x79,
+  0x35,0x3b,0x13,0xf4,0x95,0xc1,0x1f,0x47,0x7b,0x52,0xe0,0xce,0x7f,0x1d,0x87,0x94,
+  0xd,0x44,0x8d,0x6,0x2,0x16,0x22,0x60,0x41,0x11,0x1c,0x3a,0x2,0xb8,0xf6,0xb2,
+  0x3,0x8f,0x6c,0x4,0x4e,0x5d,0xd2,0xb3,0xa2,0x52,0xc8,0x0,0xc6,0x78,0x25,0x23,
+  0x71,0x69,0xa3,0xa9,0xfe,0x85,0x80,0xcd,0x2,0x80,0x0,0x5b,0x37,0xb,0xf4,0xf6,
+  0xc6,0xb8,0xf0,0x92,0x3e,0x68,0x26,0x6d,0xb1,0x8,0x36,0x45,0xe4,0x25,0xd1,0xca,
+  0x28,0xd0,0x73,0x7d,0x74,0x92,0xb8,0x80,0x2e,0xa9,0x5e,0x25,0x16,0x28,0x93,0x7e,
+  0x1b,0x9,0x5a,0x1f,0xe9,0xe5,0xfa,0xdc,0x5a,0x3e,0x29,0xc2,0x8f,0xee,0x9a,0x82,
+  0xc8,0x1a,0x8,0xc3,0x8,0x1c,0xd,0x6b,0xfd,0x41,0xe1,0xf3,0x4b,0xc5,0xb5,0xd5,
+  0x3b,0x22,0x7b,0xd6,0x96,0x8,0xb6,0xba,0x87,0xfa,0x78,0x19,0x3,0xe3,0x96,0x40,
+  0x36,0xcb,0xf0,0x9f,0x33,0xab,0xa,0xc,0xa1,0x51,0x1,0x84,0x0,0x4,0x9e,0x78,
+  0x3c,0x45,0x6f,0x6f,0x88,0x33,0x56,0xb4,0x40,0x8c,0x81,0x93,0xb2,0x24,0xd0,0x5e,
+  0x89,0xb9,0x1c,0x5c,0x20,0xd6,0xed,0x42,0xbc,0x68,0x9,0x60,0x0,0xa8,0xcb,0x2,
+  0x63,0xac,0x9a,0xc,0x54,0x52,0x3e,0x78,0x65,0x5c,0x56,0x54,0xf7,0xc2,0x80,0xe1,
+  0x47,0x77,0x4f,0x60,0xfc,0x0,0x43,0xd4,0x68,0xa2,0xc1,0x1b,0x8,0x83,0x46,0x21,
+  0xff,0x8c,0x95,0x25,0x26,0xd2,0x1a,0x9a,0x18,0xb4,0xd6,0xc5,0xa1,0xb4,0x82,0xd6,
+  0xa,0x9a,0x24,0x16,0x2f,0xd,0xb1,0xe4,0xf4,0x26,0x38,0x27,0xcc,0x5f,0xd0,0xc0,
+  0xe8,0x88,0x49,0x1d,0xc7,0x47,0x5,0xf6,0xf,0x4b,0x88,0xc,0xe0,0x3c,0x0,0xe7,
+  0x1,0x82,0x80,0x83,0x73,0x6e,0x88,0xc9,0x39,0xb8,0x2d,0x16,0x31,0xa6,0x1,0x16,
+  0x80,0x18,0xc7,0xea,0x87,0x12,0xcc,0x9b,0x1f,0xa1,0x7f,0x20,0xb0,0xb5,0xcf,0x72,
+  0xc8,0x85,0x48,0x57,0x9a,0x5f,0x27,0x3e,0xec,0xb3,0xec,0x2,0x4c,0x39,0x75,0xba,
+  0x2c,0x94,0x80,0x31,0x23,0xaf,0x1e,0xf8,0x3e,0x9,0xb8,0xad,0xf4,0x3d,0xbd,0x26,
+  0xc6,0xb6,0x67,0x8,0xcd,0xa8,0x85,0x46,0x10,0x21,0xc,0x1a,0x8,0x59,0x58,0x5,
+  0x9f,0xc,0xf8,0xa4,0x1,0xa5,0x34,0x94,0x96,0x90,0x4a,0x42,0x29,0x89,0x53,0x97,
+  0x72,0xac,0xbc,0xa0,0x85,0x73,0x2e,0xe8,0x31,0x3f,0xe7,0xf5,0x97,0x4f,0x3b,0xa3,
+  0x51,0x29,0x23,0xef,0xdb,0x9b,0x61,0xf3,0xc6,0x14,0x9b,0x9f,0xce,0x10,0x6,0xd,
+  0x4,0x21,0x10,0x4,0x1,0xc2,0x80,0x81,0xf1,0xc0,0x66,0x22,0x4,0xce,0x43,0x30,
+  0xa,0x20,0x64,0x8e,0x87,0x7f,0xd2,0xc6,0xf5,0xbf,0x34,0x0,0xe,0x6d,0x5d,0x4,
+  0xb3,0x75,0x5,0x56,0x19,0x7d,0xa7,0x93,0x89,0x0,0x20,0xe7,0x83,0xfd,0xd4,0xe,
+  0xc5,0x40,0xa7,0x9,0xf1,0xc,0xf8,0xac,0xfc,0xa1,0x5a,0x3b,0x97,0x21,0x8b,0x15,
+  0x7e,0xfe,0xd3,0x1c,0x8d,0xa0,0x7,0x8d,0xa0,0x89,0x30,0x88,0x10,0xf2,0x10,0x1,
+  0xf,0x8c,0x9a,0x10,0x8c,0xb4,0x6b,0x5,0xa5,0x8,0x52,0x29,0xe4,0x22,0x87,0x94,
+  0x39,0x6,0x16,0x69,0xc,0xae,0x9a,0x83,0xc5,0xa7,0x87,0xd0,0x44,0x10,0x4a,0x96,
+  0x59,0xbf,0xd7,0x56,0xe6,0x5e,0x89,0x79,0xd1,0x92,0x8,0xa7,0x9e,0xd6,0xc4,0x65,
+  0x83,0xa,0xf,0xdd,0x37,0x89,0xed,0x43,0x39,0xa2,0x46,0x4,0x44,0x1,0xc2,0x80,
+  0x83,0x7,0x36,0xe0,0x84,0x6,0x78,0x8,0xf0,0x0,0x93,0xa3,0x31,0x36,0xac,0x8e,
+  0x71,0xc1,0xa5,0x2d,0x30,0xa6,0x6d,0xc9,0xd7,0x4a,0x3f,0x95,0x7d,0xce,0x17,0x12,
+  0x3,0x66,0xa9,0x1d,0x4c,0x95,0x7e,0x1f,0x98,0xd7,0xd,0x64,0x7e,0x5d,0x88,0x57,
+  0x62,0x42,0x5f,0xfa,0x7f,0xfa,0xfd,0xe,0x94,0x88,0xd0,0x6a,0x19,0xf0,0x3,0x1e,
+  0x21,0xe0,0x46,0xfa,0x4d,0xdd,0x45,0x43,0x6b,0x18,0xf0,0x85,0x42,0x2e,0x4,0xb2,
+  0x3c,0xc3,0xcb,0x2e,0xb,0x30,0xf8,0xda,0xb9,0xd0,0xa4,0x91,0x2b,0x59,0xc4,0x3,
+  0x84,0xfa,0x44,0x2,0x2b,0x2,0x48,0xce,0x74,0x51,0x61,0x6c,0xf6,0x72,0xbc,0xe1,
+  0xcd,0xb,0xb0,0xe5,0x99,0xe,0x1e,0xfc,0x51,0x82,0x3c,0xe3,0x60,0x91,0x29,0x2d,
+  0x23,0x8,0xc0,0x59,0x68,0x49,0xc0,0x11,0x72,0xc2,0xfa,0x47,0xda,0x38,0xf3,0x9c,
+  0x26,0xc2,0x5e,0x6e,0x8b,0x43,0xcc,0xc6,0x1f,0x95,0xf1,0x97,0x17,0x8c,0x1b,0x98,
+  0x5,0x17,0x60,0x82,0xaf,0xba,0x2a,0x70,0xc6,0x2a,0xc5,0x5f,0x2a,0x82,0x0,0x42,
+  0x35,0x7,0x0,0xe,0xec,0xce,0xb1,0x6d,0x23,0xa1,0xb7,0x27,0xb2,0xd2,0x6f,0xe4,
+  0x9f,0x73,0x6e,0xad,0x9f,0x8c,0x8f,0x97,0x6,0xfc,0x4c,0xe4,0xc8,0xb2,0xc,0x57,
+  0x5f,0xdf,0xc4,0x8a,0xb,0x1b,0xc8,0x95,0x80,0x22,0xd3,0xd9,0x73,0x47,0x1,0x6,
+  0x95,0xad,0x62,0xee,0x95,0x99,0x3,0xce,0xa1,0x19,0x21,0xb0,0xd3,0x42,0x67,0x9f,
+  0xdb,0x8b,0xf9,0xb,0x1a,0xb8,0xf3,0x5f,0xa6,0x90,0x67,0x1c,0x1c,0x21,0x2,0x16,
+  0x82,0x7,0x1,0xc0,0x3,0x80,0x38,0xa2,0x80,0x20,0xb9,0xc2,0xea,0xfb,0x63,0x5c,
+  0x75,0x43,0x2f,0x14,0xe3,0xa5,0xa,0xc0,0x94,0xc4,0x5f,0x68,0x6e,0x60,0x56,0x6a,
+  0x95,0x85,0xd5,0x15,0xd6,0x67,0x81,0xa8,0xc,0x5e,0x52,0xd7,0xcb,0x12,0x86,0x84,
+  0x47,0x7e,0x9c,0x21,0xe4,0x4d,0x84,0xdc,0x82,0xcf,0x23,0x4,0xcc,0xa4,0x7f,0xc,
+  0x1c,0x20,0x6,0xad,0x8,0x52,0x2a,0xe4,0x79,0x8e,0x34,0xcd,0xf0,0xea,0xeb,0x42,
+  0x9c,0xf5,0xb2,0x10,0x42,0x29,0x8,0xad,0xcc,0x59,0x49,0x8,0xa5,0x20,0x95,0x82,
+  0x50,0x1a,0x52,0x29,0x48,0xd2,0x90,0x5a,0x41,0x6a,0x6d,0x49,0x62,0xe,0x13,0x30,
+  0x12,0x94,0xd6,0xf6,0x67,0x34,0xe6,0x2d,0xc,0x71,0xe3,0xbf,0xef,0x87,0xd2,0x19,
+  0xb2,0x4c,0x40,0x4a,0xd,0xd2,0x1c,0x8c,0x42,0xfb,0xde,0x5a,0x88,0xc2,0x16,0x76,
+  0x6f,0x61,0x98,0x18,0x51,0x45,0x3d,0xd2,0xc5,0x26,0x46,0xd,0x50,0x39,0x4e,0xa,
+  0x2,0x90,0x67,0x79,0x4,0x9f,0xc,0xba,0x42,0x8a,0x72,0xfe,0x83,0xc0,0x99,0xa9,
+  0xce,0xed,0xdb,0x99,0x61,0xcf,0x56,0x66,0x2c,0x3f,0x6c,0x9a,0x80,0x8c,0x37,0x4c,
+  0xf0,0xc5,0x2,0x90,0x66,0x50,0x52,0x1b,0xcb,0x4f,0x73,0x24,0x49,0x86,0x57,0xbf,
+  0x91,0xe3,0xec,0x97,0x5,0x6,0x70,0x2d,0xcb,0xb3,0x36,0x24,0x90,0xda,0x1c,0x4a,
+  0x2b,0xb,0xb4,0x3,0x9e,0xa,0x2,0xb8,0xb4,0x51,0xc3,0x12,0x82,0x14,0x94,0xd6,
+  0x18,0x58,0x18,0xe2,0xc6,0xff,0xd0,0xb,0xa5,0x53,0xe4,0x99,0x84,0x52,0xa6,0x9,
+  0xc4,0x59,0x88,0x30,0x88,0x6c,0x8c,0xd2,0x83,0x8d,0x8f,0x8b,0x4a,0xc7,0xd3,0xa8,
+  0x94,0xb9,0x6,0x4a,0x9b,0x43,0x9f,0xc,0x4,0x20,0xef,0xa2,0x96,0x17,0x57,0x97,
+  0xc5,0x19,0x6f,0x14,0x8b,0xd5,0xc6,0x47,0x38,0x7,0x9e,0x5a,0x2d,0xd0,0x8,0x9b,
+  0xf6,0x30,0xa,0x10,0x4,0x21,0x2,0x6e,0xac,0x9f,0xac,0xdf,0x17,0x42,0x22,0x4b,
+  0x73,0x9c,0x71,0x9e,0xc4,0xd9,0x17,0x5,0x16,0x70,0xb,0xbe,0x92,0xc6,0xda,0x95,
+  0x34,0x59,0x81,0xd6,0xc6,0xb2,0x5d,0x7a,0xe8,0xc6,0xbe,0x2c,0xf0,0xce,0x75,0x4d,
+  0x8c,0x8,0x3c,0x78,0xcf,0x54,0x45,0x15,0x24,0x29,0xc,0x2c,0xc,0x71,0xe5,0xeb,
+  0x2,0xa4,0x49,0x2,0x91,0x4b,0xbb,0xbb,0x49,0x80,0x80,0x47,0x68,0x4,0x4d,0x34,
+  0xc2,0x16,0xb6,0x3d,0x9,0xc4,0x53,0xba,0x92,0xf4,0x51,0xcd,0x18,0xa6,0xb9,0xc6,
+  0x17,0xaf,0xb,0x50,0x20,0x5b,0x43,0x27,0x6b,0x69,0xe4,0x5d,0xf4,0x6e,0xe3,0x53,
+  0xc,0x4,0x52,0x12,0x1b,0x7e,0xae,0x4d,0xce,0xdf,0x68,0x56,0xfd,0x3f,0xe3,0x0,
+  0x38,0xb4,0x26,0x48,0x21,0x91,0xa6,0x39,0x34,0x8b,0x31,0x78,0x6d,0xc3,0x4a,0xbc,
+  0x1,0x5c,0x28,0x65,0x25,0x5e,0x9a,0xb3,0xb3,0xe6,0x1a,0x19,0xfd,0xc1,0x24,0x6,
+  0x0,0x8a,0x70,0xcf,0x3f,0xc5,0x58,0xff,0x90,0xc4,0x13,0x8f,0xc4,0x5,0x91,0x9d,
+  0x6a,0xac,0xbc,0x28,0xc2,0xe2,0xe5,0x39,0xe2,0x4e,0x2,0x91,0x2b,0x90,0x66,0x8,
+  0x58,0x88,0x46,0xd8,0x44,0xb3,0xd1,0x83,0x46,0xa3,0x17,0x3b,0x37,0xa9,0xf2,0xf5,
+  0xec,0x67,0x2e,0x3e,0x3b,0x19,0xf2,0x9d,0x4,0x4,0xa0,0xa2,0xf2,0xa6,0xa1,0xc,
+  0x19,0xa0,0xab,0x6e,0xc0,0xeb,0xbe,0x15,0x4a,0xc0,0x80,0x2d,0x4f,0xe6,0x8,0xb9,
+  0x9,0xfc,0x1c,0xf8,0x41,0x10,0xda,0xaa,0x1f,0x7,0x29,0x94,0xd2,0xdf,0x49,0xf0,
+  0xca,0x6b,0x38,0x82,0x48,0x43,0x68,0x1,0x69,0x25,0xdf,0xc9,0xbd,0xb4,0xc0,0x29,
+  0x6d,0xdf,0x3,0x95,0xc3,0x1b,0x6e,0x20,0x84,0x31,0x3b,0xdb,0x23,0x8,0xdf,0xfe,
+  0x6a,0x8c,0x78,0xb2,0x81,0x28,0x6c,0xe1,0xc1,0xbb,0x73,0x8c,0xc,0xe7,0xa5,0xa,
+  0x68,0x5,0xa5,0x34,0x5e,0xfd,0xc6,0x8,0x53,0x53,0x1d,0xa4,0x49,0x6,0x25,0x34,
+  0x38,0x2,0x4,0x41,0x13,0x8d,0xb0,0x7,0xcd,0xb0,0x7,0x5b,0x9f,0xa0,0xca,0x82,
+  0x12,0x22,0xef,0x5a,0xd8,0xe3,0x45,0x4f,0x0,0xe5,0xd,0x4c,0x94,0x3e,0xdf,0x90,
+  0xa1,0x18,0xad,0x76,0x83,0x95,0x6e,0xb1,0x5,0x23,0x4,0x81,0xc6,0xa6,0x75,0xd2,
+  0x0,0xce,0x3,0xdb,0xf,0xe0,0xb6,0xc6,0x6f,0x82,0x3e,0xa5,0x14,0x44,0x2e,0x90,
+  0xa6,0x19,0x1a,0xbd,0x6d,0xac,0x7c,0x39,0x87,0x50,0xc2,0x4a,0xbf,0x80,0x54,0x2,
+  0x52,0xb,0x23,0xff,0x5a,0x41,0x59,0xe0,0x8d,0xe5,0x9b,0xc7,0xce,0xed,0x70,0x6,
+  0x4,0xc,0x68,0x84,0xc0,0x23,0xf7,0x64,0x38,0xb8,0xbf,0x89,0x56,0xd4,0x8b,0x66,
+  0xd4,0x83,0x66,0xa3,0xf,0xdf,0xfb,0x3f,0x9,0xd2,0x54,0xda,0x78,0xc0,0xb8,0x97,
+  0x9e,0x39,0x1c,0x2b,0x2e,0x12,0x48,0x93,0x14,0x52,0x9a,0x1,0x91,0x90,0x87,0x88,
+  0xc2,0x26,0xa2,0x46,0xb,0x53,0xa3,0x4d,0x74,0xe,0x52,0x2d,0x23,0xa2,0x93,0x8b,
+  0x0,0x42,0x25,0x26,0xf8,0xd1,0x54,0x89,0x7,0xaa,0x1,0xa0,0x2e,0xa7,0x6b,0xed,
+  0x8a,0xde,0x20,0xd4,0xd8,0xb8,0x46,0xba,0x19,0xdf,0x22,0x9f,0x56,0x36,0xda,0x17,
+  0x42,0x22,0xcb,0x72,0x24,0x49,0x8a,0x4e,0xa7,0x83,0x97,0xaf,0x82,0xb5,0x7a,0x53,
+  0xf9,0xab,0x58,0x3e,0x49,0x68,0x92,0xd0,0x64,0xac,0xdf,0x65,0x1c,0xa6,0x9c,0x6b,
+  0x62,0x8d,0x80,0x3,0x21,0x7,0x1e,0xba,0x3b,0xc5,0xa6,0xb5,0xd,0xf4,0xb4,0xfa,
+  0xd0,0x6a,0xf6,0xa2,0x15,0xf5,0xa0,0xd5,0xec,0x41,0xde,0x6e,0xe1,0x7,0xff,0xda,
+  0x81,0x26,0x65,0x55,0x40,0x42,0x68,0x81,0x2b,0xae,0x89,0xd0,0x6e,0x77,0x90,0x67,
+  0x39,0xb4,0x22,0x70,0x16,0x22,0x8,0x8c,0x72,0x44,0x61,0xb,0x3b,0x36,0x2a,0xdb,
+  0x55,0x2c,0xfb,0x10,0xa5,0xa,0xd0,0xc9,0x11,0x3,0x10,0x14,0x34,0x54,0xa9,0x6,
+  0xc5,0x85,0x50,0xde,0xcc,0x7d,0x39,0x77,0xf,0x68,0xec,0xdc,0x94,0xd9,0x89,0x19,
+  0x6b,0xf1,0x36,0xd8,0x53,0x4a,0x43,0xa,0x69,0xa,0x3d,0x69,0x8e,0x38,0x4e,0x20,
+  0x75,0x8c,0x73,0x5f,0xd1,0x28,0x22,0xfb,0xc2,0xdf,0x3b,0xd9,0x27,0x55,0xa4,0xa2,
+  0xf0,0xe5,0xde,0x1e,0x1,0x63,0x8,0x38,0xc3,0xd0,0xfa,0xc,0x1b,0x1e,0x6c,0xa0,
+  0xaf,0xa7,0xf,0xad,0x66,0xf,0xa2,0x46,0xcb,0xc4,0x1e,0x61,0x13,0x51,0xd4,0xc2,
+  0xf6,0xa7,0x19,0x1e,0xba,0xb7,0x3,0xa5,0x65,0x71,0xf4,0xf6,0x33,0x2c,0x3b,0xc7,
+  0xbc,0xf,0x21,0x25,0x88,0x80,0x80,0x7,0x8,0x82,0x10,0x8d,0x46,0x84,0x7d,0x3b,
+  0x6c,0x53,0xaa,0x70,0x85,0x36,0xfe,0xd0,0xa,0x4a,0xcb,0x93,0x24,0x8,0xb4,0x4d,
+  0x18,0x22,0x65,0x9a,0x34,0xe8,0x96,0x15,0x94,0xcb,0xb0,0x0,0x8d,0x1d,0x9b,0xf2,
+  0x22,0xc7,0x27,0x82,0xf9,0x3d,0xa5,0xa1,0xa4,0x84,0x90,0x12,0x79,0x66,0x8a,0x3d,
+  0x49,0x92,0xe0,0x9c,0x4b,0x7d,0x5f,0xef,0xfc,0xbd,0xb4,0xc0,0xab,0x92,0x6c,0x76,
+  0xb2,0xc7,0x58,0xbe,0x95,0x7d,0x6e,0xa4,0x7f,0xe7,0xc6,0xc,0xdf,0xfb,0xba,0x46,
+  0xab,0xd5,0x87,0x28,0xea,0x41,0x23,0x6c,0x22,0x8,0x4c,0xaa,0x69,0x66,0xff,0x38,
+  0x18,0x42,0x3c,0x74,0x77,0x8e,0x1d,0x9b,0x33,0xf3,0x77,0x6c,0x86,0x71,0xee,0xa5,
+  0x84,0xa9,0xc9,0x36,0xd2,0x38,0x45,0x9e,0xe7,0x90,0x52,0xdb,0x36,0x76,0x80,0x7d,
+  0xdb,0x5c,0x1e,0xa8,0x40,0x70,0x2e,0xc8,0xbc,0xb7,0x5c,0x25,0x27,0x7c,0x2d,0x60,
+  0x56,0x8,0x20,0x49,0x14,0x2a,0xa0,0x21,0x6d,0x20,0xa8,0xca,0xb8,0x0,0xe5,0x9c,
+  0x3d,0x31,0xd,0x1e,0x68,0xec,0xd9,0x26,0xad,0xbf,0x7,0xc8,0xba,0x10,0xa5,0x34,
+  0xa4,0xd4,0x90,0xb9,0x44,0x9e,0xb,0x64,0x69,0x86,0x24,0x4e,0xb1,0xe4,0x4c,0x66,
+  0x3,0x3c,0x63,0x95,0x5a,0x5b,0xb9,0x2f,0x2,0x3e,0x55,0xac,0xec,0x31,0x96,0x4f,
+  0x8,0xac,0xcf,0xf,0x18,0x70,0x70,0xbf,0xc0,0xdd,0xff,0x20,0xd0,0xd3,0xea,0x35,
+  0x8d,0xa6,0x30,0x42,0x10,0x4,0x45,0x9a,0xa9,0x95,0x86,0x52,0x1a,0x5a,0x6a,0x28,
+  0xa9,0xb1,0x71,0x4d,0xe2,0x91,0x4d,0x60,0xe9,0xd9,0x1c,0xed,0xf6,0x14,0x3a,0x71,
+  0x62,0xa,0x44,0xc2,0xf4,0x23,0x40,0xc,0x59,0x1c,0x60,0x6a,0x5c,0x16,0x9f,0xd5,
+  0xbc,0x2f,0x73,0xce,0x65,0x7a,0xc2,0x2b,0xc0,0xac,0xf4,0x2,0xa4,0x4a,0xc1,0x82,
+  0x66,0x31,0xd3,0xcf,0xad,0xad,0x33,0x68,0x10,0xb,0x8a,0x51,0x69,0x53,0x9a,0x35,
+  0x99,0xf3,0xc8,0x5e,0x93,0x5f,0x93,0x26,0x13,0xf0,0x49,0xd,0x6,0xb3,0xa0,0x52,
+  0x8,0x81,0x2c,0xcb,0x11,0xa7,0x29,0xd2,0x34,0xc1,0xd9,0x17,0x47,0xc8,0x95,0x84,
+  0x22,0x59,0x48,0xbe,0xd2,0x54,0x99,0xcd,0xe5,0x6e,0x32,0x18,0xa6,0x8b,0x17,0x70,
+  0x42,0xc0,0x1,0x52,0x1a,0xff,0xf8,0x97,0x31,0x9a,0xe1,0x7c,0xb4,0x5a,0xbd,0x88,
+  0x22,0x93,0x69,0x0,0x1c,0xa4,0xb5,0x9,0x34,0x6d,0x8d,0x21,0x49,0x52,0x9c,0x7a,
+  0xa6,0xc4,0x2f,0xdc,0xd4,0x3,0xa5,0x95,0x59,0x28,0xc2,0x2,0xf4,0x34,0x18,0x4e,
+  0x39,0x23,0x45,0x7c,0x30,0x46,0xab,0xd9,0x3,0x6a,0x2,0x5a,0x29,0x68,0x65,0xd2,
+  0xcb,0xc9,0x51,0x85,0x5,0x73,0xc,0xd1,0x4d,0x1c,0x62,0xea,0x10,0x4a,0xcb,0x13,
+  0xbe,0x26,0x3c,0x6b,0x75,0x0,0x63,0x89,0x12,0xe4,0xc9,0xb2,0xc9,0xe,0x6a,0x59,
+  0x2,0x34,0x78,0xa8,0xb0,0x6b,0x8b,0x32,0xd6,0x47,0x30,0xc5,0x1a,0xa5,0xa1,0xa4,
+  0x82,0x94,0x12,0x42,0x8,0xe3,0x2,0xd2,0xc,0xf3,0x16,0x49,0xb,0x78,0xe9,0xef,
+  0x4b,0xe9,0xb7,0xb2,0x4f,0x9e,0xec,0xf3,0x32,0xe2,0xd7,0x42,0xe1,0xeb,0x7f,0x3e,
+  0x5,0xc8,0x5e,0x34,0x9b,0xd6,0xf2,0x79,0x68,0x94,0x47,0x9b,0x25,0xde,0x79,0x26,
+  0x6c,0xa0,0x19,0x23,0x6c,0x25,0x78,0xf3,0x6f,0x34,0xa0,0xc8,0x64,0x17,0x26,0xdd,
+  0x14,0x90,0x4a,0x62,0xe1,0x69,0x2,0x9d,0x4e,0x8c,0x34,0xc9,0xac,0x1b,0x30,0x55,
+  0x42,0x22,0x60,0xdf,0x4e,0xa7,0x0,0xd2,0xcc,0xd,0x16,0xa,0x65,0x62,0x0,0xfd,
+  0x62,0x57,0x0,0xb2,0x3e,0xdf,0xc6,0xf2,0xe0,0x60,0x66,0x1,0x26,0x71,0x9b,0x9,
+  0xc0,0xdb,0x43,0xc8,0x5c,0xe,0x27,0xfb,0x5a,0x19,0xdf,0xaf,0xb5,0x82,0x84,0x89,
+  0x5,0xc,0x9,0x4c,0x1c,0x70,0xfa,0xa,0x6d,0xfd,0xbd,0xac,0x82,0xef,0x5a,0xd0,
+  0x76,0xc4,0x8b,0x31,0x20,0xe0,0xc,0x21,0x27,0x84,0x9c,0x10,0x45,0x84,0x6f,0xde,
+  0xd6,0xc1,0xd8,0x70,0x2f,0xe6,0xcd,0xeb,0x45,0x33,0x6a,0xa2,0xd1,0x68,0x98,0x71,
+  0x30,0x2,0x94,0x36,0x29,0x66,0x92,0x24,0xe8,0xb4,0x3b,0xc8,0xe5,0x14,0x7e,0xe9,
+  0xb7,0x2,0x84,0x2d,0x53,0x49,0x24,0x3b,0xcf,0xc0,0x58,0x8,0x49,0xc0,0xc2,0xd3,
+  0x8,0x4f,0x24,0x9,0xd2,0x2c,0xb3,0xb1,0x83,0xa9,0x51,0x28,0xa9,0x91,0x76,0x54,
+  0x19,0x0,0x6a,0x69,0x2a,0x8f,0x5a,0xd9,0xa9,0xa4,0x13,0xbb,0x33,0x34,0x2b,0x4,
+  0x10,0x2a,0x41,0xc0,0x2,0xdb,0xf3,0xb7,0x3b,0x86,0x92,0x6,0x43,0x60,0x67,0xeb,
+  0x19,0x8,0xb2,0x58,0x31,0xb7,0x69,0x7d,0xe,0xa5,0x94,0x91,0x51,0x2b,0xc3,0x4a,
+  0x2a,0x10,0x37,0xa4,0x10,0xc2,0xaa,0x40,0x2e,0xd0,0x37,0x60,0x82,0x2a,0xe7,0xf7,
+  0x5d,0x86,0xe1,0xfc,0xbd,0x1,0xc9,0xb5,0x77,0x8d,0xef,0xf,0x43,0xe0,0x5b,0x5f,
+  0x9e,0xc4,0xa6,0x35,0x4d,0xc,0xcc,0xeb,0x41,0xb3,0x11,0x21,0xc,0x4d,0x75,0x91,
+  0xc8,0x36,0x80,0xa4,0x44,0x9a,0x66,0xe8,0x74,0x62,0x1c,0x3c,0x38,0x81,0x6b,0x7f,
+  0x35,0xc3,0xa2,0x65,0x11,0x72,0x29,0x6d,0x31,0x89,0xec,0x50,0x88,0x86,0xd2,0xc0,
+  0xdc,0x5,0x84,0x34,0x49,0x91,0xa7,0x19,0x1a,0xa1,0xe9,0x54,0x2a,0x29,0xcd,0xe7,
+  0x20,0xab,0x74,0xd6,0xea,0x49,0x2b,0x28,0x22,0x28,0x92,0xe5,0xbe,0x13,0x2f,0x6e,
+  0x5,0x30,0xb9,0xb8,0x1b,0xf5,0x36,0xe3,0xda,0xdc,0xc,0x52,0x13,0x7,0x27,0xd,
+  0x4d,0x81,0xa7,0x4,0x12,0x52,0x28,0x48,0xa9,0x20,0x85,0x84,0x94,0xa,0x8c,0x29,
+  0x70,0x6e,0xca,0xa7,0x22,0x17,0x10,0xb9,0x71,0x3,0x52,0x8,0xdb,0x59,0x94,0x85,
+  0x7f,0x75,0x3b,0x7d,0x14,0xeb,0x89,0x58,0x80,0x80,0x1b,0xf9,0xf,0x3,0xc2,0xa3,
+  0xf7,0x76,0xb0,0xf6,0x3e,0x8e,0x81,0x79,0x7d,0x68,0x36,0x5b,0x8,0xc3,0x6,0x18,
+  0x98,0x9,0xf4,0x28,0x7,0xc8,0xc4,0x19,0x9d,0x76,0x7,0x63,0x63,0x63,0x18,0xbc,
+  0x21,0xc1,0xc5,0x57,0xb5,0x90,0x9,0x9,0x45,0xc2,0x10,0x0,0xe6,0xbd,0x72,0x46,
+  0xd0,0x9a,0x43,0x2a,0x81,0x38,0x26,0x24,0x69,0x86,0x46,0x23,0x2,0xe7,0x1c,0x79,
+  0x2e,0x20,0x72,0x89,0x2d,0xeb,0x53,0x5c,0x72,0x1d,0x83,0x26,0x61,0x7b,0x11,0x46,
+  0xad,0xa4,0x4a,0x8a,0x3a,0xc8,0x8b,0x9a,0x0,0x4a,0xb,0x68,0x2e,0x51,0xe,0x6b,
+  0x73,0x1b,0xf5,0x73,0x70,0xe2,0x16,0x7c,0x66,0xab,0x83,0xc,0x9a,0x24,0xa4,0x2c,
+  0xf,0x21,0xa5,0x1d,0xd8,0xe4,0x86,0x0,0x52,0x22,0x17,0x39,0x84,0x10,0x68,0xf4,
+  0xb8,0xdf,0xf1,0xa3,0x7d,0x5d,0x14,0xf6,0x19,0xe3,0xe0,0x5c,0x83,0x33,0x33,0xb0,
+  0xb1,0xee,0x67,0x53,0xf8,0xf6,0xdf,0x33,0xc,0xc,0xcc,0x43,0x23,0x6a,0x98,0x68,
+  0x9f,0x99,0xc5,0x1c,0x52,0x96,0x79,0x79,0x2e,0x4,0xd2,0x2c,0xc3,0xd2,0x15,0x9,
+  0xae,0xfd,0x77,0xbd,0x88,0xf3,0xdc,0x92,0x4c,0x42,0x41,0x15,0xe9,0x9b,0x22,0xd,
+  0x5,0x86,0x81,0x53,0x8,0x69,0x9a,0x21,0xcb,0x52,0xa4,0x91,0xc9,0x22,0x72,0x91,
+  0x23,0x17,0x2,0x4c,0xa,0x68,0x62,0x50,0x4a,0x98,0xf8,0x81,0x64,0x31,0xa3,0x78,
+  0xa2,0xb7,0x85,0x67,0x85,0x0,0xda,0x46,0xbf,0x8c,0xd9,0xa9,0x5d,0x28,0xd3,0x42,
+  0x45,0xe0,0x2f,0xc0,0x2,0x91,0x99,0xad,0xd7,0x24,0xad,0xcc,0x1b,0xf0,0x45,0x2e,
+  0xec,0x44,0xae,0x25,0x80,0x10,0xc5,0xf7,0x95,0x92,0x20,0x32,0x8b,0x32,0x0,0x5,
+  0x14,0xb5,0x4,0x3b,0x51,0xc4,0x61,0x97,0x8f,0x11,0xc6,0xf6,0xa6,0xf8,0xe6,0x17,
+  0x12,0xf4,0x34,0x17,0xd8,0x54,0x2f,0x34,0xe0,0x6b,0x82,0x14,0xd5,0x3d,0x7c,0x84,
+  0x90,0x50,0x52,0xe1,0xe9,0x35,0x2,0x1b,0xd7,0x29,0x2c,0xbb,0x80,0x17,0x41,0x9c,
+  0x9,0x66,0x1,0xed,0x76,0x15,0x21,0x6e,0x26,0x8e,0x72,0x53,0x9d,0x6c,0x46,0x39,
+  0x82,0x30,0x40,0x96,0xe5,0xc8,0xf3,0x1c,0x5c,0x8,0x68,0xed,0x14,0x20,0x87,0x56,
+  0x76,0xfe,0x40,0x2b,0x90,0x3e,0x3e,0x31,0x0,0x63,0x6c,0x3e,0x80,0x57,0xc2,0xdc,
+  0xc4,0xd3,0xfd,0x9b,0x84,0xd9,0x88,0x6a,0xd,0x11,0xc5,0xcf,0x19,0x1,0x40,0x1a,
+  0x8a,0x84,0x91,0x7d,0xe7,0x2,0xb4,0x86,0xe6,0x4,0x4d,0xa6,0xa3,0xa7,0x19,0x41,
+  0x73,0x4b,0x0,0x25,0x91,0x65,0x99,0x39,0xac,0x4f,0x25,0x22,0x70,0xce,0xa1,0xb5,
+  0x42,0x9e,0xe5,0xe6,0xc8,0x73,0x74,0x26,0x85,0x69,0x20,0x93,0x2c,0xad,0x9f,0x91,
+  0xb7,0x64,0x1c,0x8,0x38,0x47,0x67,0x3c,0xc3,0xff,0xbc,0x75,0x12,0x1,0xfa,0x11,
+  0xf6,0x86,0x36,0xcf,0xb7,0xe0,0xcb,0xe9,0x15,0x39,0x65,0xe3,0x8f,0x46,0x18,0xe1,
+  0xb6,0x4f,0x1e,0xc0,0x7f,0xf9,0x74,0xb,0xb,0xcf,0xe0,0x0,0x49,0x0,0xca,0x36,
+  0x91,0x6c,0x9d,0x2,0x12,0x7,0xf6,0x66,0xc8,0x52,0x8d,0x2c,0xcd,0x90,0x36,0x52,
+  0x4,0x41,0x80,0x34,0x4d,0x91,0xc4,0x9,0x58,0x5f,0x6,0x45,0x1,0x24,0xe5,0x50,
+  0xda,0xf4,0x2a,0x94,0xd2,0x86,0xbc,0x1a,0x50,0x6a,0xd6,0xc1,0x5f,0x2,0xe0,0xd2,
+  0x7b,0xbe,0xfa,0x77,0x1f,0xbb,0xf6,0xca,0xc1,0x55,0x24,0x25,0x20,0x5,0xe,0x4e,
+  0x4c,0x8c,0xfd,0xf8,0x91,0x47,0x1f,0xfd,0xbd,0xcf,0xff,0xf5,0x7d,0x8c,0xb1,0x1f,
+  0x3,0x58,0x7d,0x38,0x22,0xcc,0xda,0xea,0x45,0xa5,0x73,0x68,0x12,0xc6,0xa,0x48,
+  0x94,0xf5,0x79,0x2d,0xa1,0x21,0x6c,0xad,0x5e,0x82,0xc8,0xf6,0xf0,0x85,0x40,0x9e,
+  0x9b,0x6a,0x5f,0x9e,0xe7,0xde,0x61,0xbe,0x2e,0x84,0x30,0xa9,0x96,0x36,0x80,0x80,
+  0x19,0x5,0x60,0xac,0x3c,0x38,0xd3,0x66,0xa4,0x4b,0x48,0x7c,0xe9,0xe3,0x63,0xc8,
+  0x93,0x6,0x1a,0xd,0x23,0xcf,0xa6,0x42,0x69,0x82,0xbd,0xea,0xeb,0xe7,0xc5,0xeb,
+  0x13,0x11,0xc2,0x30,0x84,0x16,0x4d,0xdc,0xfe,0xb9,0x9,0x1b,0x87,0x28,0x70,0xfb,
+  0xfa,0xe6,0xef,0x99,0xbf,0xaf,0xad,0xac,0xbb,0xf7,0x9d,0xa6,0x29,0xd2,0x34,0x45,
+  0x96,0x65,0x58,0x7e,0xa1,0x82,0x52,0x19,0x94,0xca,0x21,0x75,0x6e,0xce,0x2a,0xb7,
+  0xfd,0x91,0xea,0x8e,0x76,0xb3,0x5,0xfe,0x83,0x5f,0xbf,0xfd,0x93,0x3e,0xf8,0x90,
+  0x12,0xf3,0x5a,0xad,0x5,0x6f,0xbb,0xfa,0xd5,0xd7,0xaf,0xff,0xfb,0x2f,0x7f,0xec,
+  0x1b,0x7f,0xfa,0xf1,0x8f,0x3,0xf8,0x65,0x7b,0xab,0xdf,0xe3,0xdd,0xb,0x30,0xa9,
+  0xa0,0xa2,0x12,0x68,0xe3,0xb,0x73,0x28,0x6b,0x15,0x8e,0x18,0x92,0x72,0x9c,0x77,
+  0x39,0x9f,0x1,0xfc,0x12,0x78,0x69,0x23,0xec,0x3,0x7b,0x32,0x80,0x99,0x95,0x3a,
+  0x6,0x78,0x6d,0xcb,0xbc,0xe6,0x88,0x22,0x8d,0xdb,0x3f,0x3b,0x8a,0xdd,0x43,0xc,
+  0x8d,0x46,0xc3,0xaa,0x88,0x2e,0xc0,0x77,0x80,0xd5,0xf,0x29,0xd,0xa0,0x9c,0x73,
+  0x34,0x9b,0x4d,0x1c,0xd8,0xd9,0xc0,0x6d,0x1f,0x1f,0x45,0x18,0x98,0x21,0xd5,0x86,
+  0x6d,0x1e,0x5,0xdc,0x54,0x16,0x47,0xf6,0x66,0x5,0xa9,0x94,0x52,0xb6,0x80,0x24,
+  0x20,0x84,0x80,0x92,0xc2,0x54,0x3b,0x48,0x17,0xa0,0x93,0x6d,0x7e,0x92,0x26,0x90,
+  0x9a,0x65,0xf0,0xbf,0x72,0xdb,0x27,0x7,0x2f,0xb8,0x60,0xd0,0x7,0x1f,0x52,0xc2,
+  0x3d,0x6f,0x71,0xd6,0xf3,0xb6,0x2b,0x2e,0xbf,0x7e,0xe7,0xff,0x77,0xdb,0x67,0x57,
+  0x5d,0x70,0xc1,0x3b,0x18,0x63,0xaf,0x39,0xee,0xa,0xe0,0xaf,0x10,0xad,0x2f,0x16,
+  0x25,0x6f,0x74,0x9c,0xec,0xe6,0xd,0xee,0x22,0x2a,0xa5,0x2a,0x80,0x3b,0x69,0x76,
+  0x9d,0xc4,0x5d,0x9b,0x73,0x4,0x8c,0x81,0x73,0x33,0xc8,0xe9,0x76,0x7,0x9,0x38,
+  0x43,0xd4,0x60,0xf8,0xc7,0xcf,0x8d,0x63,0xcd,0x4f,0x9,0xcd,0xa6,0xc9,0xf3,0xc3,
+  0x30,0x4,0xe7,0x36,0xdd,0x53,0xaa,0x20,0x5a,0x92,0x24,0x48,0xd3,0xd4,0x2b,0xe2,
+  0x18,0x54,0x82,0x20,0x40,0xb3,0xd9,0x44,0x5f,0x5f,0x1f,0x9e,0x79,0x34,0xc4,0x5d,
+  0x5f,0x9d,0x44,0x83,0x7,0x68,0x4,0x21,0x1a,0x41,0x80,0x6,0xf,0x10,0x72,0x8e,
+  0x91,0xbd,0xaa,0x78,0x5d,0xa7,0x4,0x8e,0x60,0x51,0x9f,0xb6,0x25,0x65,0xd8,0xda,
+  0x86,0x5b,0xbf,0x60,0x1e,0xcf,0xc6,0x4e,0x61,0x3e,0xf8,0xaf,0x5c,0xb9,0x72,0x46,
+  0xf0,0xdd,0x73,0x28,0x81,0xc5,0x73,0xe6,0x2c,0xbd,0xf3,0x8f,0x3e,0x72,0xeb,0xcd,
+  0x57,0x5d,0xf9,0xf6,0x99,0x48,0x10,0x1e,0x97,0xd0,0xb2,0x58,0x25,0xed,0x2d,0xce,
+  0xa2,0x72,0x26,0x28,0x17,0xc0,0xf2,0x73,0x19,0xc6,0xf7,0xca,0x82,0x0,0x4e,0xb6,
+  0xdd,0x5,0x76,0x85,0x98,0xdd,0x43,0xb2,0xd8,0x2c,0x22,0x60,0x64,0x7a,0xbb,0x30,
+  0x45,0x9f,0xef,0x7f,0x6d,0x12,0xf7,0x7f,0x5b,0xa2,0xb7,0xb7,0x17,0x8d,0x46,0x63,
+  0x9a,0xf4,0x3b,0x2b,0x77,0xc4,0x2,0x80,0x30,0xc,0x6d,0x39,0x38,0x28,0x96,0x84,
+  0x85,0x61,0x88,0x56,0xab,0x85,0xbe,0xbe,0x3e,0xdc,0x75,0xfb,0x1,0x9c,0x71,0x5e,
+  0x13,0xaf,0x78,0x8d,0x59,0x1a,0x1e,0x30,0x8e,0x46,0xc0,0xf0,0xd4,0xea,0xc,0x41,
+  0x30,0xaf,0x12,0x3f,0x38,0x2,0x2c,0x39,0x2b,0x80,0x56,0x76,0x26,0x52,0xc3,0xd6,
+  0x1a,0xc,0xf8,0x5a,0xd9,0xa5,0x86,0xb3,0x5,0xfe,0x8a,0x95,0x83,0x3a,0x4d,0xc0,
+  0x48,0x21,0x98,0xd3,0x57,0x5,0x5f,0xd8,0xb3,0x92,0x20,0x61,0x88,0xd0,0xe2,0xac,
+  0xe7,0xef,0xde,0xfb,0xeb,0xef,0x87,0xd2,0x6e,0xc2,0xfa,0xfe,0xe3,0xa3,0x0,0x33,
+  0x28,0x41,0x9,0x7c,0x39,0x35,0xa3,0x35,0xb0,0x68,0x29,0x2b,0x2e,0xa0,0xaf,0x0,
+  0x4e,0xbe,0x5d,0x94,0xf,0x4,0x58,0x73,0x7f,0x62,0x54,0xc0,0xee,0x14,0xc2,0x19,
+  0xc3,0x86,0xfb,0xdb,0xf8,0xd7,0xbf,0xed,0x20,0x8,0x82,0x2,0x4c,0x47,0x20,0x67,
+  0xf9,0x69,0x6a,0x66,0x9,0xe,0x1e,0x3c,0x88,0xb1,0xb1,0x51,0x8c,0x8d,0x8d,0x61,
+  0x72,0x72,0x12,0x9d,0x4e,0x7,0x69,0x9a,0x42,0x8,0x1,0xad,0x75,0x85,0x4,0xbd,
+  0xbd,0x73,0xf0,0xd5,0x3f,0x1b,0xc7,0xf0,0x16,0x85,0x28,0x8,0x11,0x5,0x1,0x44,
+  0xae,0xf1,0xd4,0xa3,0xb2,0xa2,0x2c,0xee,0xbd,0xb,0x91,0x63,0xe0,0x14,0xe,0x69,
+  0x7b,0x1a,0x86,0x70,0x46,0xf6,0xd,0x1,0xe8,0x59,0xa5,0x81,0xd3,0xc0,0xcf,0x12,
+  0xa8,0x24,0x86,0x18,0x19,0xeb,0x62,0xf9,0xe6,0x4c,0xc2,0x3e,0x57,0x46,0x9,0x9a,
+  0x9c,0xf5,0x7c,0xe5,0xdd,0xff,0xf1,0xfd,0x67,0x2d,0x1a,0xb8,0xa6,0x1e,0x13,0xf0,
+  0xe3,0x83,0x7f,0xf5,0xff,0xe5,0x98,0xb4,0x21,0x80,0x94,0xc0,0x19,0xe7,0x5,0x95,
+  0x5a,0x40,0x9d,0x4,0x4e,0x1,0x82,0x20,0xc0,0xc6,0xd5,0x39,0x2,0x6e,0x64,0xdf,
+  0xe4,0xfb,0x1c,0x4a,0x96,0x6f,0xbd,0x58,0x37,0x60,0x81,0x71,0xe0,0xc7,0x71,0x8c,
+  0xa9,0xa9,0x29,0x4c,0x4c,0x8c,0xe3,0xa3,0x7f,0xdd,0x83,0x4b,0x5e,0x13,0x63,0x7c,
+  0x7c,0x1c,0xed,0x76,0x1b,0x49,0x92,0x20,0xcb,0x32,0x48,0x29,0x8b,0xc,0x24,0x8a,
+  0x22,0xf4,0xf6,0xf6,0x82,0x64,0x2f,0x3e,0xff,0xd1,0x7d,0x90,0x9,0x43,0x14,0x86,
+  0x78,0x6a,0x75,0x7,0x1c,0xa6,0xf8,0xe3,0x2b,0x8c,0x10,0x2,0x61,0x2b,0xc7,0xdc,
+  0x85,0xdc,0x2e,0x53,0x23,0x28,0x85,0xd2,0x1d,0x28,0x32,0x18,0xc8,0x63,0x53,0x80,
+  0xba,0xec,0x1b,0xf0,0x13,0xe8,0x4e,0x8c,0x7c,0x62,0x1c,0xba,0xd3,0x29,0xc1,0x17,
+  0x2,0x50,0x2,0xe4,0x9e,0x2b,0x1,0x8,0x51,0xc6,0x5,0x60,0x3d,0x3f,0xbd,0xe5,
+  0x77,0xde,0xf,0xe0,0x15,0x8c,0xb1,0xde,0xe3,0xa7,0x0,0xf0,0x76,0xcd,0x73,0x7d,
+  0x80,0xc2,0xfa,0x51,0x8c,0x4c,0x9d,0x77,0x69,0x54,0x4,0x7d,0xee,0xf0,0x65,0xdb,
+  0x11,0x20,0xc,0x43,0x3c,0x78,0x77,0x82,0x80,0x73,0x7b,0x18,0xd9,0xbe,0xe2,0xda,
+  0x7e,0xbc,0xeb,0xf7,0xe7,0x16,0xbf,0xeb,0x7c,0x7d,0x9a,0xa6,0xa6,0xbe,0xdf,0xe9,
+  0x60,0x72,0x72,0x12,0x13,0x7,0x27,0xf0,0xae,0x8f,0xb4,0xb0,0xf8,0xec,0x0,0xff,
+  0xf9,0x63,0xb,0xb1,0x70,0x59,0x1b,0x13,0x13,0x13,0x15,0x25,0x70,0x69,0x62,0x10,
+  0x4,0x68,0xb5,0x5a,0xe8,0xef,0xef,0x47,0x67,0xbc,0x7,0x7f,0xf1,0xe1,0x7d,0x68,
+  0x4,0x1,0x7e,0x78,0xc7,0x14,0x5a,0xad,0x56,0xe1,0x62,0x7c,0x92,0x9d,0x79,0x21,
+  0x83,0x54,0xc6,0xea,0x95,0x34,0x4,0x50,0x52,0x43,0x4b,0x7,0xfe,0xb1,0x5,0x81,
+  0x55,0xcb,0x5f,0x31,0xa8,0xd3,0x4,0x2a,0x4e,0xa0,0xe3,0x18,0x22,0x89,0xa1,0xdb,
+  0x6d,0x74,0xb6,0x6e,0xb3,0xd2,0x2f,0x40,0x4a,0x58,0xd9,0x17,0x16,0x7c,0x5,0x52,
+  0xb2,0x54,0x2,0x29,0xb1,0xb8,0xaf,0x77,0xe9,0x3f,0xbf,0xe7,0x9d,0xbf,0x6,0xe0,
+  0xf2,0x59,0x27,0x0,0xcd,0xf0,0xc8,0x5f,0x27,0xa0,0xbd,0xf3,0xf9,0x97,0xb7,0xa0,
+  0xb4,0x9c,0x6,0xbe,0x53,0x0,0xe7,0x2,0xc2,0x30,0x44,0x16,0x73,0xfc,0xec,0xbb,
+  0x1d,0x4,0xde,0x8e,0x61,0x0,0xc3,0xeb,0xff,0xdd,0x3c,0xbc,0xe6,0x17,0xa3,0x4a,
+  0x36,0xe1,0x48,0x10,0xc7,0x31,0x3a,0x9d,0xe,0x5e,0x75,0x3,0xc3,0x95,0xd7,0xf7,
+  0x22,0x97,0x12,0x99,0x20,0xfc,0xe1,0xdf,0x9c,0x86,0x53,0x96,0x67,0xe8,0x74,0x3a,
+  0x88,0xe3,0xb8,0xf8,0x5d,0xa5,0x54,0x91,0x16,0x46,0x51,0x84,0xbe,0xbe,0x3e,0xc,
+  0x6d,0x20,0x7c,0xf6,0xf7,0x76,0x60,0xf5,0x8f,0x25,0x9a,0xcd,0xa6,0x2d,0x2a,0xe9,
+  0xc2,0xc5,0xe4,0x79,0x6e,0x9,0x60,0x6e,0x57,0x23,0xed,0x4c,0x83,0x52,0xb0,0x44,
+  0x20,0x68,0x9,0x48,0x79,0x74,0x5b,0x85,0x14,0xe0,0xdf,0x71,0x87,0xf5,0xf9,0xa9,
+  0xb1,0xfc,0xb8,0x3,0xd1,0xe9,0x40,0xb5,0x3b,0xc8,0xe3,0x36,0xda,0x5b,0xb6,0x22,
+  0xdd,0xb7,0xdf,0xf3,0xff,0xf6,0x10,0x12,0xa4,0xbc,0x80,0xd0,0x92,0x80,0x94,0xc2,
+  0xf5,0x2b,0xce,0x5e,0x75,0xd6,0x82,0xb9,0xd7,0x30,0xc6,0x9a,0xb3,0xaf,0x0,0xf5,
+  0x2d,0x74,0x51,0xae,0x90,0xd1,0x6e,0xf1,0x84,0x1d,0x9c,0xcc,0x32,0xe0,0x8a,0x6b,
+  0xa2,0xa,0xf8,0xce,0xfa,0x7d,0x5,0xe0,0x9c,0x23,0xc,0x43,0xdc,0xfb,0xcf,0x53,
+  0x65,0x26,0x60,0xb,0xce,0x44,0xc0,0x6f,0xfc,0xf1,0x29,0xb8,0xfa,0xc6,0xb0,0xc8,
+  0xcb,0x9d,0x2,0xc4,0x71,0x8c,0xb3,0x2f,0x51,0xf8,0xb5,0x8f,0x2c,0x44,0x26,0x25,
+  0x52,0x29,0x91,0x49,0x1,0x1e,0x31,0xbc,0xe7,0x63,0xf3,0x41,0x3c,0x46,0x1c,0xc7,
+  0x5,0x9,0xba,0xc5,0x3,0x73,0xe6,0xcc,0xc1,0x13,0xf,0x71,0xf4,0xf7,0xcf,0x43,
+  0x14,0x45,0x45,0xc,0xe0,0x2b,0xce,0x5,0x83,0x2d,0x48,0xa9,0x6c,0x3b,0xdb,0x80,
+  0xaf,0x3d,0xf0,0x95,0x34,0x81,0xe1,0xd1,0x82,0xff,0xd0,0x43,0xf,0x7d,0x72,0xf0,
+  0x92,0x8b,0x7,0x75,0x16,0x43,0x25,0xb1,0x1,0x3f,0xe9,0x40,0xc5,0x6d,0x88,0xb8,
+  0xd,0xd5,0xee,0x40,0xc4,0x6d,0xec,0x7f,0xf8,0x11,0xa8,0x38,0xae,0xc6,0x0,0x4a,
+  0x56,0xc1,0x97,0x6,0x7c,0x13,0x14,0xa2,0xe7,0x8f,0xdf,0xb0,0xea,0xa,0x0,0x17,
+  0x3f,0x27,0x31,0x40,0x25,0xf8,0xf3,0x56,0xcf,0x8,0x49,0x78,0xe5,0xeb,0x9b,0x5d,
+  0x5d,0x80,0xb3,0x46,0x27,0xcb,0x61,0x18,0x62,0xe7,0x26,0x85,0x9f,0xdd,0xd9,0x2e,
+  0x52,0x42,0x66,0x5a,0x81,0x90,0xa,0xf8,0x8d,0x3f,0x5e,0x84,0xab,0x6f,0xc,0x8a,
+  0x54,0x2f,0x4d,0x53,0xf4,0x2f,0x12,0x78,0xdf,0xa7,0x16,0x22,0x57,0x12,0x99,0x94,
+  0xc8,0x95,0x44,0xae,0x14,0x72,0xa5,0x70,0xda,0xd9,0xd,0x7c,0xec,0x4b,0xb,0xa,
+  0x12,0xb8,0x82,0x8e,0x1f,0xf,0x84,0x61,0x88,0x9e,0x9e,0x1e,0xcc,0x9d,0x3b,0x17,
+  0xbd,0xbd,0xbd,0x8,0xc3,0xd0,0xc6,0x2f,0x65,0x6d,0x61,0xd1,0x72,0x8d,0xfe,0x85,
+  0xc,0x52,0x12,0xa4,0x20,0xb,0xba,0x19,0x6e,0x51,0x2,0x76,0x2d,0x23,0x41,0x8a,
+  0x23,0x53,0x80,0xa,0xf8,0x83,0x83,0x83,0x2a,0xcf,0x4a,0xd9,0x8f,0x63,0xa8,0x76,
+  0x6c,0x15,0xc0,0x9c,0x45,0x1c,0x23,0x1e,0x1d,0xc7,0x96,0xef,0xdc,0x55,0x5,0x5f,
+  0x78,0xd2,0xaf,0x3c,0x42,0x58,0x76,0xbe,0xf1,0x8c,0x33,0x6,0x1,0x5c,0x78,0x9c,
+  0x63,0x80,0x72,0x95,0xae,0xf6,0xd7,0xb,0xda,0x43,0x11,0xe1,0xb2,0xd7,0xf5,0x16,
+  0x17,0xb3,0xa8,0xfc,0x75,0xc9,0x4,0xc2,0x30,0x44,0xa3,0xd1,0xc0,0x37,0x6e,0x1b,
+  0x47,0xda,0xa1,0x62,0xd7,0x50,0x77,0x55,0xa5,0x4,0x6e,0xfe,0xaf,0xb,0xb0,0x74,
+  0x5,0x21,0x4d,0x53,0x4,0x51,0x8e,0xdf,0xfc,0xcc,0x7c,0x34,0x7a,0x8,0xb9,0x94,
+  0xc5,0xba,0xc1,0x5c,0xda,0xf5,0x83,0x5a,0x61,0xf1,0x19,0x4d,0xfc,0xca,0x2d,0x73,
+  0x10,0xc7,0x71,0xa5,0x46,0xe0,0xc8,0xe7,0x2,0xd0,0x46,0xa3,0x51,0x14,0x98,0xfc,
+  0x20,0x33,0xcb,0x32,0xbc,0xf2,0xf5,0x91,0x1,0x5f,0x9a,0x51,0x36,0x25,0x6d,0x1c,
+  0x20,0xdc,0x2a,0x66,0xf3,0x58,0xab,0xc3,0x13,0x60,0x1a,0xf8,0xca,0x2c,0x55,0xd3,
+  0x9d,0x18,0x22,0xee,0x40,0xb5,0xdb,0x10,0x9d,0x29,0x63,0xf9,0x9d,0x36,0x44,0x1c,
+  0x23,0xef,0xc4,0xc8,0x93,0x18,0x7,0x47,0x47,0xb1,0xf9,0x8e,0xef,0x98,0x80,0x4f,
+  0x88,0xc2,0xe7,0x97,0x96,0xaf,0xe0,0x49,0x13,0x16,0xf7,0xf5,0x2c,0x5,0x70,0xea,
+  0xac,0x13,0x80,0xa6,0x15,0x2,0x50,0xc,0x84,0x54,0x49,0x60,0x2a,0x66,0x3c,0xc,
+  0x70,0xcd,0x2f,0x4d,0x57,0x1,0x3f,0x13,0xe0,0x9c,0x17,0x2a,0x30,0xbe,0x1f,0xf8,
+  0xda,0x5f,0x1c,0xb0,0xeb,0xf6,0xbd,0x85,0x99,0x0,0x9a,0xbd,0x1c,0x7f,0xf8,0xe5,
+  0x25,0x58,0x7e,0x1e,0xc3,0xcd,0xb7,0xf4,0x63,0xc9,0xd9,0xa1,0x5d,0x35,0x64,0x16,
+  0x87,0xa,0x55,0x2e,0x12,0x75,0xc7,0x6b,0x6e,0x9c,0x87,0x5f,0xfd,0x50,0x5f,0x11,
+  0xc,0xfa,0xae,0xc0,0x77,0x43,0x2e,0xf7,0x77,0xd5,0xbf,0x3c,0xcf,0x91,0x24,0x9,
+  0x2e,0x7a,0x55,0xcb,0x82,0x6f,0x82,0x3f,0xa3,0xc2,0x86,0x4,0x32,0x37,0xe0,0xcb,
+  0x9c,0xa0,0xf,0xa3,0x0,0xb6,0xb1,0x53,0x1,0x5f,0x8,0x1,0x31,0xa7,0xdf,0xc8,
+  0x7e,0xc7,0xfa,0xfe,0xb8,0xb4,0xfc,0x3c,0x8e,0x91,0x27,0x9,0xf2,0x34,0x85,0x88,
+  0x13,0xec,0xde,0xbe,0xb,0x8f,0x7e,0xf5,0x6b,0x10,0xed,0xa9,0x8a,0xcf,0xf7,0x2d,
+  0x1f,0x4a,0x81,0x54,0xb5,0x39,0x71,0x9c,0x15,0xa0,0xac,0x8,0x4c,0x5b,0x3c,0x49,
+  0x1a,0x42,0x6a,0xac,0x7a,0x6b,0x5f,0xa5,0xc,0xec,0x48,0x50,0x8f,0x3,0x1a,0x8d,
+  0x6,0x9a,0xcd,0x26,0x7e,0x7a,0x67,0x8c,0xfb,0xbe,0x33,0x59,0x54,0x5,0xfd,0xbd,
+  0x8,0x79,0x83,0xe3,0x63,0xff,0x6b,0x29,0xae,0xb8,0xbe,0xcf,0xcc,0xe4,0x91,0xf9,
+  0x3b,0xaa,0xb2,0x38,0xb4,0xfa,0x3e,0xde,0xf4,0x8e,0x45,0xf8,0x85,0x1b,0x1b,0xe8,
+  0x74,0x3a,0x48,0x92,0x64,0x9a,0x1a,0x95,0xf9,0xbe,0xa8,0xf4,0x1,0x6,0xaf,0x6d,
+  0x62,0x60,0x51,0x60,0xfd,0xbe,0xb6,0xd6,0x6e,0xa2,0x7f,0x67,0xf9,0x32,0x37,0x44,
+  0x90,0x87,0x48,0x3,0xad,0xe5,0xbf,0xea,0x9e,0xbb,0xbf,0xf1,0x31,0x7,0x7e,0xe1,
+  0x66,0x7a,0x7a,0x21,0x7b,0xe7,0x40,0x74,0xda,0x50,0x71,0x7,0xa2,0x6d,0xc1,0x4f,
+  0xaa,0xe0,0x9b,0xa6,0x5a,0x8a,0xe1,0x91,0x31,0x7c,0xff,0xb6,0xaf,0x61,0x6c,0x68,
+  0x93,0x4d,0xff,0x1c,0xf8,0x12,0x90,0x36,0x2b,0x30,0xe5,0xca,0xe3,0x58,0x9,0xf4,
+  0xef,0x18,0xe3,0x6a,0x0,0x76,0x73,0x45,0xb3,0xea,0x86,0x21,0x20,0x56,0x2c,0xde,
+  0x3c,0xfb,0xe2,0x16,0xce,0xbf,0x8c,0x63,0xf3,0xba,0xbc,0xd8,0xf,0xc0,0x29,0x87,
+  0xb,0xba,0x9c,0xa,0x44,0x51,0x4,0xad,0x35,0xbe,0xf4,0xa7,0x23,0x20,0x2,0x56,
+  0xfd,0x62,0xbf,0xd9,0xa9,0xab,0x58,0x1,0xe4,0xd6,0x84,0x50,0xd7,0xbd,0xb,0xfd,
+  0xad,0xe3,0xfd,0x25,0xdc,0x1f,0xf8,0xd4,0x32,0xec,0xdf,0xb3,0x5,0x9b,0xd7,0xc6,
+  0x85,0xaf,0xf7,0x6f,0x66,0xe5,0xdc,0x91,0xd6,0xba,0xe8,0x62,0x5e,0xfb,0xf6,0x45,
+  0xd6,0xfa,0x8d,0xfb,0xd5,0x56,0xfe,0x2b,0xe0,0x1b,0xff,0x6f,0x86,0x47,0xf,0x15,
+  0xed,0xdf,0xf3,0x95,0x4f,0x5e,0xf9,0xda,0x6b,0x6,0x7d,0x17,0x63,0x6,0x63,0x33,
+  0x88,0x73,0xce,0x45,0xb0,0x61,0x3d,0xe4,0x34,0xcb,0x4f,0x20,0x92,0xb4,0xe8,0xa8,
+  0xa6,0x22,0x47,0x96,0xe7,0x48,0x73,0x81,0xff,0xfb,0x4f,0xdf,0xc6,0x99,0xad,0x26,
+  0x6,0x6f,0x7c,0x3,0xe6,0x9e,0xb6,0x4,0x90,0x66,0x44,0xcd,0x2c,0xbe,0xd0,0xf8,
+  0xe1,0xd0,0xf6,0xfb,0x0,0xac,0x3d,0x2e,0x4,0x28,0x36,0xea,0x74,0xed,0x54,0xef,
+  0x82,0x6b,0xeb,0xa,0x94,0x26,0x28,0x66,0x2c,0x33,0xcd,0x3,0xfc,0xf2,0xfb,0xe7,
+  0xe2,0x53,0xef,0x1d,0xad,0x54,0xf4,0x1c,0x9,0xdc,0xd9,0x57,0x2,0xa5,0x14,0xbe,
+  0xf8,0xdf,0xf6,0x83,0x88,0xf0,0xda,0xb7,0xce,0x5,0x38,0x3,0x69,0xb7,0x7d,0xbc,
+  0x1d,0x13,0xb3,0x2b,0x90,0xfc,0xd7,0x73,0xae,0xc3,0x6c,0x14,0xe1,0xdd,0x7e,0x86,
+  0x2,0xfc,0xc9,0x5f,0xaf,0xc0,0x1f,0xfc,0xfa,0x10,0x26,0xf6,0xc9,0x69,0x44,0x74,
+  0xef,0xc3,0x2f,0x36,0x9,0x41,0x45,0xaa,0x67,0x80,0x7,0x64,0x8e,0x2a,0xf8,0x39,
+  0x41,0x66,0x4,0x29,0xa6,0x2b,0x40,0x5,0xfc,0xcb,0xce,0x19,0x54,0x76,0xb5,0x93,
+  0xf,0x7e,0x96,0x65,0x48,0xe7,0xe,0x20,0x58,0xb0,0x10,0x6c,0xff,0x7e,0x3,0x7c,
+  0x62,0x80,0xaf,0x80,0x9f,0x97,0xe0,0xa7,0x42,0x20,0x93,0x2,0x6b,0x26,0x52,0x3c,
+  0x7c,0xfb,0xbf,0xe0,0x4c,0x1e,0xe0,0xbc,0xfe,0x6,0x6,0x96,0x9e,0x6,0x95,0xa5,
+  0xf8,0xf9,0xde,0xbd,0x3f,0x7f,0xdf,0x81,0xce,0x9f,0x1,0x78,0xec,0xb8,0xf6,0x2,
+  0x9c,0x39,0x16,0x37,0x60,0xb1,0xa0,0x98,0xd9,0x0,0xd,0x45,0xdc,0xca,0xb3,0xc2,
+  0x8a,0x4b,0x7a,0x71,0xc1,0x2b,0x27,0xb0,0x69,0x4d,0x5e,0xd4,0xe7,0x5d,0x6,0xe0,
+  0xaa,0x6f,0x0,0xcc,0x3e,0xc1,0x96,0x4,0x5a,0x6b,0xfc,0xed,0x27,0x86,0xb1,0x6d,
+  0x63,0x82,0xff,0xf4,0xe1,0xc5,0xd6,0x99,0xe9,0xca,0x6,0xcd,0x8c,0xdc,0xde,0x7f,
+  0x28,0x76,0x8,0x9,0xec,0xee,0x20,0x26,0x9d,0xe4,0xf6,0x4e,0x24,0xc0,0xc3,0x3f,
+  0x19,0xc7,0xfe,0x3d,0x2,0x1,0x8c,0xaf,0x77,0x3b,0x93,0xf8,0xe0,0xbb,0x32,0x30,
+  0x0,0x7c,0xee,0x96,0x1d,0xf8,0xe8,0x6d,0xa7,0x43,0x31,0x82,0xb2,0x7e,0x5f,0x49,
+  0x40,0x38,0xd9,0xb7,0xe0,0x8b,0x8c,0xa0,0x6b,0x4,0x28,0xc1,0xff,0xf2,0x27,0xaf,
+  0xbc,0x6c,0xe5,0x20,0x28,0x87,0x52,0x12,0xb9,0xae,0x82,0x9f,0x65,0x26,0xa5,0x4d,
+  0x2f,0x1f,0xc4,0xdc,0x27,0xd6,0x43,0x24,0x9,0x44,0x9a,0x22,0x4f,0x92,0x2,0xfc,
+  0xcc,0x82,0x9f,0x59,0xf0,0x53,0x29,0x90,0x4a,0x13,0xf0,0x66,0x52,0x61,0x8d,0x16,
+  0x78,0xb8,0xd3,0x41,0xb2,0x77,0x1c,0xc3,0x44,0x3f,0xbf,0x97,0xe8,0x13,0x76,0x60,
+  0x64,0xfc,0xb8,0xc5,0x0,0xd3,0x62,0x1,0xcf,0x92,0x5c,0x6,0x60,0x46,0xa6,0xcc,
+  0x80,0x66,0x26,0x34,0x7e,0xeb,0x53,0xa7,0xa0,0xd1,0x92,0x5d,0x5b,0xc3,0x2e,0x32,
+  0xaf,0x2b,0x41,0x14,0x45,0xf8,0xee,0xd7,0xf,0xe2,0xc3,0x37,0xf,0x61,0xe3,0xea,
+  0x4,0xa1,0xed,0xdc,0x85,0x3c,0x28,0x3a,0x79,0x8d,0x20,0x40,0xc4,0x39,0x1a,0x1,
+  0x37,0x5f,0xb,0xcc,0xcf,0x4,0x76,0x2f,0xe2,0xb1,0x7d,0x39,0xfe,0xec,0xf7,0x9e,
+  0xc1,0x67,0x6f,0xdd,0x85,0xb4,0x53,0xa6,0x7a,0x7e,0x9f,0xa2,0x5e,0xa5,0x64,0x8c,
+  0x21,0x8d,0x9,0x7f,0xf3,0x87,0xbb,0x11,0x4f,0xaa,0x22,0xe8,0xab,0x83,0x2f,0x73,
+  0xa3,0xa,0x7e,0x1a,0x58,0xb5,0xfc,0x73,0x7,0x41,0x2,0xd0,0x2,0x94,0x8d,0x79,
+  0xe0,0xa7,0xb6,0x98,0x65,0xea,0x19,0x53,0x42,0x60,0xdb,0xd5,0xab,0x90,0xa,0x81,
+  0xdc,0xf9,0xfc,0x2c,0xb3,0x56,0x6f,0x2c,0x3f,0x11,0x8e,0x0,0x6,0xf8,0x44,0x2a,
+  0xc4,0x4a,0x23,0x53,0xa,0x9,0x11,0xf6,0x11,0x3d,0x71,0x2f,0xd1,0x67,0x2c,0xf8,
+  0xc3,0xc7,0x3d,0x8,0x74,0xbb,0x87,0xc1,0xeb,0x3,0x68,0x94,0x19,0x80,0x22,0xed,
+  0x45,0xe4,0xa,0x7d,0xf3,0x43,0xdc,0xfc,0xdb,0xfd,0x33,0xce,0x6,0xb8,0x8b,0x5f,
+  0x57,0x82,0x28,0x8a,0xb0,0x7b,0x48,0xe3,0x4f,0xde,0xb3,0x3,0x9f,0xfa,0xcf,0xdb,
+  0xb0,0xfe,0x81,0x4e,0x9,0x76,0x18,0x20,0xa,0x2,0x44,0x61,0x58,0x34,0x76,0xa2,
+  0x20,0x44,0x83,0x87,0xd8,0xbb,0x35,0xc5,0x6d,0x9f,0xd9,0x8e,0xf7,0x5e,0xf7,0x24,
+  0xee,0xff,0x6e,0x82,0x28,0x6a,0x16,0xb3,0x4,0x7e,0x8b,0xba,0xdb,0xe1,0xe6,0x8,
+  0xf6,0x6e,0x15,0xb8,0xfb,0xf6,0xf1,0x2,0x74,0x25,0xc,0xe8,0x86,0x8,0x80,0x70,
+  0xa,0x20,0xdd,0x6,0xa9,0x55,0xd9,0x7,0xe5,0x80,0xce,0x1,0x9d,0x81,0xe5,0x43,
+  0xa5,0xa4,0xa7,0xa6,0x7d,0xed,0x4a,0xda,0x71,0xa7,0x83,0xf1,0x9e,0x5e,0x3c,0x3d,
+  0xf8,0x6a,0xc4,0xc2,0x4c,0x53,0xa5,0x99,0x3,0x3f,0x2f,0x64,0xdf,0x14,0xbb,0x24,
+  0x52,0xa9,0x90,0x2a,0x8d,0x4c,0x6b,0x24,0x44,0x18,0xd3,0xb4,0xe7,0x1,0xa2,0x7f,
+  0x2,0xb0,0xd6,0x7,0xff,0xf8,0xb9,0x0,0x54,0x3,0xaf,0x22,0x16,0x28,0xea,0x2,
+  0x1a,0x4a,0x33,0x4,0x4c,0x43,0x32,0x6,0xae,0xcc,0xf8,0xf5,0x1b,0x6e,0x1e,0xc0,
+  0xc3,0xdf,0xef,0xe0,0xe9,0xc7,0xf2,0x4a,0x1c,0xe0,0x7c,0xb2,0x2f,0xcb,0x7e,0x95,
+  0xd0,0x91,0xe2,0xa9,0xc7,0x72,0x6c,0xf8,0xf9,0x6e,0xf4,0xcd,0x3,0xce,0xb9,0xb8,
+  0x89,0xf3,0x2f,0xeb,0x43,0xd8,0x0,0xce,0xb9,0xa4,0x17,0xdb,0x9e,0x4e,0x10,0x4f,
+  0x69,0xec,0xd8,0x9c,0x62,0xd7,0x50,0x8a,0x1d,0x9b,0xa4,0x5d,0xe4,0x19,0x21,0x6c,
+  0x84,0x95,0xd,0xa9,0xfc,0x72,0xb4,0x6b,0x34,0xf9,0x6d,0x60,0x3f,0x4d,0x7d,0xea,
+  0xe1,0x4,0x2f,0x7f,0x7d,0xb,0xac,0x69,0xc0,0x96,0x1e,0xf8,0x5,0x31,0xca,0x3a,
+  0x80,0x95,0xfd,0x73,0x6,0xa1,0x73,0x18,0x2,0x64,0x90,0x2a,0x46,0x3e,0xf2,0x39,
+  0xa8,0x9e,0x3f,0x45,0xaa,0xce,0xb7,0xe0,0xc7,0x68,0xb7,0x3b,0xe8,0x74,0x3a,0x45,
+  0x5f,0x63,0x2a,0x6a,0x62,0xcf,0x85,0x2f,0xc3,0xb9,0xf,0x3d,0xc,0x95,0x67,0xd6,
+  0xe7,0xcb,0xd2,0xf2,0x95,0x42,0xaa,0x14,0x12,0xa5,0x91,0x6a,0x85,0x94,0x8,0x63,
+  0x44,0x7b,0x7e,0x2,0xfa,0x42,0x1b,0xf8,0x16,0x11,0x6d,0x7b,0x6e,0xe6,0x1,0x6a,
+  0xc1,0x60,0xb1,0x81,0x92,0x5b,0x32,0x66,0xd3,0x33,0x49,0xc,0x4c,0x33,0x48,0xc6,
+  0xc0,0x94,0x2,0xcb,0x81,0x5b,0xff,0xf2,0x34,0x7c,0xf4,0xe6,0x1d,0x18,0x1b,0xce,
+  0x8a,0x7c,0xdc,0x59,0x7c,0x9d,0x4,0xae,0x50,0xe4,0x82,0x47,0x57,0xac,0x49,0xdb,
+  0x1a,0xeb,0x1e,0x10,0x58,0x73,0xff,0x98,0xfd,0xd9,0x11,0xdf,0xff,0x9a,0xce,0x9f,
+  0x1d,0xed,0x76,0x87,0x3,0xdb,0x55,0x3,0xfd,0x5a,0x80,0x7f,0xf8,0xf3,0x5,0x5a,
+  0x6b,0x5c,0xf5,0xd6,0x39,0x88,0x7a,0x19,0xe2,0x44,0x41,0x66,0xda,0x58,0x7d,0x6a,
+  0x5d,0x82,0x25,0x81,0x8d,0x47,0x5f,0xfe,0x57,0x9f,0xbd,0xe5,0x9c,0x2a,0xf8,0x39,
+  0xa4,0x8a,0x91,0x8e,0x7c,0xe,0xc8,0x27,0x30,0x27,0xfb,0x34,0xe,0x84,0xb7,0x21,
+  0xb6,0x8b,0x55,0x3a,0x9d,0xe,0x3a,0xed,0xe,0xda,0xed,0x29,0x4c,0x4d,0x4d,0xe1,
+  0xe0,0xc1,0x83,0x18,0xf,0x22,0x3c,0x75,0xee,0xb9,0xb8,0x78,0xdd,0x7a,0xcc,0xab,
+  0x80,0x6f,0x2c,0x3f,0xd1,0xa,0xa9,0xd6,0x6,0x7c,0xad,0xf7,0xfc,0x4,0x70,0xe0,
+  0xaf,0x7b,0xee,0x6,0x42,0x6a,0x2c,0x70,0x77,0xe0,0xd2,0x76,0x67,0x4d,0x46,0x0,
+  0xd3,0x66,0xd1,0x98,0xdb,0x4e,0xde,0xad,0x1b,0x6a,0x84,0x21,0x7e,0xff,0xaf,0x97,
+  0xe0,0xe3,0xef,0xda,0x8d,0x2c,0x36,0x20,0xf8,0x3d,0x7f,0x9f,0x4,0x3e,0xa8,0xe,
+  0x58,0xa7,0x6,0x75,0xf0,0xe0,0x65,0x4,0xfe,0xeb,0xf8,0x84,0xf2,0xd3,0xbd,0xba,
+  0xa5,0x77,0x6b,0x3d,0x9f,0x7e,0x4e,0x3,0x2f,0x7b,0x75,0xf,0x3a,0xb1,0x34,0xc0,
+  0xe7,0x4,0x91,0xe9,0x4a,0x3c,0x20,0x32,0xc2,0xc4,0xb0,0x8c,0xfe,0xe8,0x43,0xbf,
+  0xfe,0x86,0xdf,0x7d,0xef,0x4d,0x57,0x19,0x9f,0x6f,0x8,0xa0,0x40,0x5,0xf8,0xa4,
+  0x34,0xb8,0x1c,0xc6,0xbc,0xf4,0x2f,0x70,0x20,0x79,0x57,0x5,0xfc,0x83,0x93,0x93,
+  0x76,0xa6,0x61,0x1c,0x13,0x13,0xe3,0x18,0x9d,0x6c,0x63,0x7d,0xdf,0x1c,0x2c,0xc9,
+  0x5,0x2e,0x4d,0x33,0xf4,0x38,0xf0,0x95,0x7,0x3e,0xd1,0x61,0xc1,0x3f,0xee,0x4,
+  0x28,0x55,0x0,0x76,0x63,0x8,0xb3,0x64,0xcc,0xdc,0x62,0xc6,0xd4,0x4,0x98,0x36,
+  0x7b,0xf2,0x32,0x7b,0x2f,0x1,0xc6,0x14,0x16,0x2e,0x6f,0xe2,0x53,0xff,0xb0,0xc,
+  0x7f,0xfc,0x6b,0x3b,0x91,0xc5,0xa6,0x43,0xa7,0x94,0xaa,0x28,0x41,0xe5,0xef,0xd4,
+  0xc8,0xe0,0x48,0xe0,0x83,0xdf,0xed,0x67,0x7c,0xd0,0xfd,0xe7,0x3e,0xf8,0xab,0x6e,
+  0x9c,0x87,0xad,0xcf,0xb4,0xb1,0x7d,0x63,0x5e,0xf9,0xbd,0x46,0x93,0x70,0xdd,0x3b,
+  0xe7,0x21,0x4f,0x35,0xf2,0xcc,0xdc,0x71,0x24,0x4f,0x6d,0xe4,0x9f,0x97,0xe7,0xd1,
+  0x5d,0x12,0x37,0x5e,0x7d,0x7d,0xeb,0x93,0x1f,0x79,0xf7,0x55,0xd0,0xc2,0x58,0x3e,
+  0xe5,0x50,0xbc,0x17,0xe9,0xc8,0x5f,0x15,0xe0,0x93,0x24,0x90,0xd2,0x58,0xa0,0x7e,
+  0x80,0xfe,0xbc,0x89,0x7d,0x9d,0xd7,0xa1,0xdd,0x69,0x63,0xb2,0xe,0xfe,0xe8,0x28,
+  0xf6,0xef,0xdf,0x8f,0x4e,0xa7,0x83,0x27,0xb4,0xc2,0x6a,0x1e,0x40,0x43,0x22,0x22,
+  0xc2,0x80,0xd6,0x18,0x23,0xc2,0x88,0xd6,0x7b,0x8,0xf8,0x2,0xe,0x3,0xfe,0x73,
+  0x12,0x3,0xf8,0x77,0xec,0x98,0xee,0xa,0x34,0x14,0x99,0x7b,0x33,0xba,0x5d,0x45,
+  0x1d,0xb4,0x8b,0x96,0x37,0xf1,0xe9,0xaf,0x2d,0xc3,0x1f,0xfd,0xea,0x4e,0xa4,0x1d,
+  0x5d,0x14,0x83,0x7c,0x57,0xe0,0xc0,0xac,0x5b,0x68,0x3d,0x7f,0xef,0x76,0xae,0x3f,
+  0xae,0x4b,0xbc,0xd6,0x1a,0xab,0xde,0x3c,0x80,0x77,0xdd,0xba,0x14,0xed,0xa9,0xc,
+  0x7f,0xf0,0x2b,0xcf,0x20,0x6e,0x97,0xaa,0xb2,0xea,0x97,0x6,0x10,0xf5,0x31,0x74,
+  0x62,0x85,0x3c,0xd5,0x55,0xcb,0x77,0xe0,0xef,0x94,0x78,0xd3,0xab,0xae,0xc3,0xe7,
+  0x3e,0x72,0x6b,0x54,0x80,0xaf,0x33,0x28,0xde,0x87,0x74,0xe4,0xf3,0xa0,0xce,0x13,
+  0x15,0xf0,0xcd,0x41,0x58,0x11,0x7c,0xf,0x5b,0xd3,0x7e,0x4c,0x1e,0x5c,0x62,0xc1,
+  0x1f,0xc3,0xc4,0xc4,0x4,0x46,0x47,0x47,0x70,0x60,0xff,0x81,0xa2,0x74,0x9d,0x67,
+  0xb9,0x59,0x40,0x23,0x25,0xa6,0x94,0xc2,0x1,0xad,0xa1,0x89,0xf6,0xe0,0x8,0xc1,
+  0x3f,0xee,0x69,0xa0,0x9f,0x11,0xc0,0xeb,0xc,0xea,0x62,0x30,0x84,0xec,0x32,0x6a,
+  0x32,0xd9,0x80,0xd2,0x66,0xaf,0x3f,0x7b,0x2c,0x5c,0xde,0xc4,0xff,0xfb,0x7f,0xcf,
+  0xc2,0x19,0xe7,0xf1,0x4a,0x29,0xb6,0x5b,0xf7,0xb0,0x3e,0x55,0x54,0xf,0xd8,0xfc,
+  0x26,0x53,0x7d,0x18,0xb5,0x5e,0xee,0x95,0x4a,0xe2,0x3d,0x1f,0x3d,0xd,0xef,0xbc,
+  0x75,0x9,0xda,0x49,0xe,0x41,0x84,0xdf,0xf9,0xf4,0xe9,0x88,0x5a,0x86,0x20,0xa7,
+  0x9f,0x13,0xe1,0xa2,0xab,0x7a,0x91,0xa6,0xa,0x59,0xaa,0xac,0x2,0xe8,0x22,0xea,
+  0xf7,0xc1,0xff,0x1f,0x1f,0xfd,0x10,0xfc,0x80,0xcf,0x80,0xff,0x57,0xa0,0xce,0x7a,
+  0x90,0x9c,0xe,0x3e,0x49,0x8d,0x50,0xa7,0x78,0xfd,0xc2,0xff,0x8d,0x45,0xec,0x7b,
+  0x18,0x1f,0x1b,0xb7,0xe0,0x8f,0x62,0x64,0x64,0xc,0x6d,0xd7,0xb7,0xc8,0xb3,0x62,
+  0xf5,0x54,0xd1,0x46,0x3f,0x4a,0xf0,0x9f,0x1b,0x5,0xa8,0x5,0x84,0xe5,0x56,0xf2,
+  0xe5,0x46,0x8a,0x4a,0x97,0x6b,0xfd,0xa,0x99,0xb6,0x7b,0x6,0xf5,0x2d,0x8,0xf1,
+  0x89,0xff,0x75,0x16,0xbe,0xf9,0xc5,0xfd,0xf8,0xb7,0xbf,0x1b,0x2b,0x14,0xc0,0x77,
+  0x5,0x8c,0xcd,0xdc,0x6b,0xe9,0x66,0xe9,0x33,0x59,0x3e,0x11,0x61,0xc1,0xe2,0x10,
+  0xbf,0xfb,0x99,0xb3,0x70,0xea,0x19,0xd,0x74,0x52,0x1,0x91,0x6b,0x88,0x5c,0xa3,
+  0x67,0x41,0x88,0xb7,0xff,0xe6,0x22,0xfc,0xeb,0x17,0xf6,0xe3,0xda,0xff,0x38,0x80,
+  0x38,0x55,0x48,0x13,0x85,0x2c,0xf1,0xc1,0x37,0x2a,0x50,0x5,0xdf,0xf9,0x7c,0x61,
+  0xc0,0x3f,0xf0,0x57,0xa0,0xf8,0x9,0x3,0xbe,0x3,0xdd,0x3,0x9f,0x14,0x1,0x4a,
+  0xa3,0x1,0x89,0xb7,0xad,0x58,0x8d,0x30,0xd9,0x83,0x7f,0xd8,0xbc,0xc,0xa3,0xa3,
+  0xa3,0x98,0x9a,0x9a,0x2a,0xba,0x96,0x22,0xf7,0xfb,0x26,0xa,0x5a,0x1f,0x3d,0xf8,
+  0xcf,0x19,0x1,0xa6,0xbb,0x2,0x17,0x14,0x96,0x37,0x71,0xb2,0xf9,0xa1,0xb7,0xd9,
+  0xb2,0x4,0x51,0x60,0xa6,0x74,0x9a,0x1,0x7e,0xe5,0x43,0x4b,0x30,0xf8,0x86,0x7e,
+  0xfc,0xcf,0xdf,0xdf,0x85,0xfd,0xbb,0x64,0x25,0x88,0x9b,0x89,0x4,0x47,0x23,0xfd,
+  0x8c,0x11,0xde,0xfa,0x9e,0x53,0xf0,0xfa,0xb7,0x2f,0x40,0xd0,0x4,0xe2,0x54,0x20,
+  0xcf,0x35,0x72,0x4b,0x0,0x91,0x11,0x16,0x9f,0x13,0xe1,0xd7,0x3f,0xb1,0x4,0x1a,
+  0x84,0x34,0x91,0x48,0x9d,0xf5,0xa7,0x1a,0x22,0x35,0x96,0x3f,0x52,0x7,0x9f,0xb2,
+  0xd2,0xe7,0x3b,0xf0,0xb,0xe0,0xbb,0x83,0xef,0x7f,0xff,0x4d,0xe7,0xee,0xc6,0xd2,
+  0x68,0x4,0xff,0xfd,0x1b,0x73,0x70,0x20,0x95,0xc8,0xf2,0x1c,0x22,0xaf,0x59,0xfe,
+  0x31,0x82,0xff,0x9c,0x12,0xa0,0xb8,0xa7,0x13,0xb3,0x5,0x5b,0x1b,0xf,0x14,0x24,
+  0xd0,0x1a,0x60,0xf5,0x7a,0x81,0x59,0x5a,0xa6,0x88,0xa0,0x34,0xc7,0x59,0x97,0xf4,
+  0xe0,0x6f,0xee,0x3d,0x1f,0xf7,0x7d,0x6b,0x1c,0xff,0xfb,0xf3,0xc3,0x18,0xde,0x21,
+  0x8e,0x88,0x0,0x87,0x52,0x2,0x80,0xf0,0xba,0x9b,0x16,0xe0,0xc6,0xff,0x74,0xa,
+  0xfa,0x17,0x70,0x64,0xb9,0xb5,0xec,0x4c,0x23,0xcb,0x35,0x64,0xee,0x59,0x78,0x6e,
+  0xa,0x57,0x59,0xa6,0xcd,0x32,0xb1,0xc4,0x3c,0x76,0xdf,0x2b,0x2d,0xff,0x56,0x5b,
+  0xe0,0x71,0x1,0x5f,0xdd,0xf2,0xa7,0xcb,0x7e,0x37,0xf0,0x49,0x99,0x1d,0x34,0x2e,
+  0x59,0x1a,0xe3,0xeb,0xbf,0xd3,0xc1,0x57,0xbe,0xdd,0x83,0xdb,0x7e,0x22,0x91,0xd8,
+  0x8d,0x34,0x94,0xd2,0x0,0xf4,0x31,0x83,0xff,0xdc,0x2a,0xc0,0x34,0x12,0x68,0x73,
+  0xdf,0x3f,0x9f,0x4,0x30,0x1b,0x44,0xb8,0xb2,0x9,0x91,0xe9,0x22,0x6,0x44,0xd0,
+  0x3a,0x80,0xe2,0x1a,0x4a,0x73,0x5c,0x75,0xe3,0x0,0x56,0xbd,0x6d,0x3e,0x1e,0xfd,
+  0xe1,0x41,0x3c,0xf2,0x83,0x83,0x78,0xe0,0xee,0x83,0x68,0x1f,0x94,0x87,0x24,0x40,
+  0x85,0x4,0x20,0xac,0xbc,0xa8,0x17,0xaf,0x79,0xcb,0x7c,0xfc,0xc2,0x9b,0x7,0xc0,
+  0x22,0x86,0x3c,0x97,0x88,0x33,0x81,0x3c,0x57,0xc8,0x72,0x65,0xa2,0x7a,0xeb,0xdb,
+  0xd,0x9,0x8c,0x7f,0x77,0x16,0xef,0xbe,0x2f,0x52,0x5d,0xf8,0xfc,0x1b,0xa6,0xc9,
+  0x7e,0x69,0xf9,0x3a,0x7e,0xc2,0x74,0xe5,0x2a,0x41,0x5f,0xf5,0x8c,0xda,0xd7,0xa0,
+  0xed,0x63,0x4d,0xd8,0xbd,0x2b,0xc2,0x6b,0x75,0x7,0xab,0xae,0x36,0x53,0x47,0xd0,
+  0x84,0xf1,0x84,0xf6,0x7c,0xe0,0x31,0x7c,0x61,0x38,0x3d,0x36,0xf0,0x9f,0x73,0x2,
+  0xd4,0x49,0xe0,0xee,0xc6,0xe9,0x48,0x40,0x64,0x9e,0x12,0xb4,0xdd,0x52,0x90,0x95,
+  0x1,0x23,0x23,0x4,0x4e,0xd,0x88,0x20,0x34,0xc3,0xcb,0x57,0xf5,0xe3,0xd2,0xd7,
+  0xcd,0xc5,0x6f,0x7f,0xe6,0xc,0x6c,0x78,0xa4,0x8d,0xad,0x4f,0xc5,0x38,0xb0,0x3b,
+  0xc7,0xe6,0xf5,0x89,0xd9,0x2a,0x86,0x9b,0x45,0x28,0x20,0xa0,0x6f,0x6e,0x80,0xb3,
+  0xce,0x6f,0xe1,0x8c,0xb,0x7a,0x71,0xc1,0xe5,0x7d,0x68,0xf6,0x32,0x8,0xa1,0x91,
+  0xe7,0xa,0x69,0xa6,0x4b,0xe0,0x73,0x85,0x2c,0xd5,0x10,0xc2,0x44,0xf6,0x79,0x11,
+  0xd8,0x19,0x4b,0x37,0x11,0x3f,0x21,0xf3,0x52,0xbe,0x91,0x5d,0xc2,0x3,0x3f,0xaf,
+  0x81,0xff,0xf9,0xc3,0x80,0xaf,0x1,0x67,0xfd,0xd2,0xde,0xd,0xc5,0x7,0x5f,0x11,
+  0x76,0xef,0x8e,0xd0,0x79,0x2c,0x5,0x29,0xd3,0x5a,0x26,0x45,0x98,0x48,0x9f,0x3d,
+  0xf8,0xcf,0xb,0x1,0x7c,0x12,0x18,0x4b,0xd7,0x66,0x23,0x6,0x70,0x73,0x8b,0x17,
+  0x4d,0x45,0x65,0x88,0xdc,0x86,0x53,0x64,0xf6,0xf6,0x2f,0xb2,0x6,0x6e,0x17,0x88,
+  0x70,0xe,0xae,0x19,0x84,0x62,0x38,0xe7,0xb2,0x1e,0x9c,0x7b,0x79,0x6f,0x71,0x83,
+  0x2a,0x66,0x8b,0x4e,0x6e,0xb5,0x8e,0x22,0xb3,0x1d,0x8d,0x54,0x66,0x84,0x2b,0xce,
+  0x34,0x84,0x50,0x10,0x82,0x90,0xb,0xeb,0xcb,0x73,0x85,0x3c,0xf7,0xa5,0xdf,0x59,
+  0xbd,0x9,0xf0,0x84,0x2d,0xec,0x8,0xef,0xf9,0xe8,0x2e,0x81,0x1b,0xae,0xbc,0xe,
+  0xff,0xe3,0xf,0x6e,0xed,0xa,0x3e,0xd5,0xc1,0xd7,0x75,0x99,0xa7,0xd2,0xf2,0xbb,
+  0x80,0xbf,0x6b,0x77,0x84,0xd8,0x7,0x5f,0xce,0x1e,0xf8,0xcf,0x1b,0x1,0xea,0x24,
+  0x60,0xb6,0x49,0x64,0xf6,0x15,0x73,0xb7,0x74,0xd4,0xa6,0x95,0xac,0xed,0x7e,0x43,
+  0x76,0x93,0x7,0xce,0xcd,0x59,0x31,0x6,0x6e,0x3b,0x73,0xe5,0x9d,0x40,0x58,0x71,
+  0x7b,0x7a,0x86,0x72,0xe7,0x6e,0xb2,0x46,0x66,0x8,0xa0,0x21,0x85,0x19,0xe3,0xaa,
+  0x10,0x40,0x10,0x44,0xae,0x8c,0xe5,0xe7,0x64,0x83,0xbf,0x32,0xad,0x73,0xa,0x20,
+  0x3c,0x45,0x18,0xdd,0xa5,0x70,0x7d,0x1,0xbe,0x28,0x8,0xa0,0x82,0xc3,0x59,0x3e,
+  0x55,0x2d,0xdf,0x97,0x7d,0x8f,0x8,0x5,0xf8,0xd2,0xe,0x95,0xe8,0x2,0xfc,0x2f,
+  0xe,0xa7,0xf8,0xf6,0xb3,0x5,0xff,0x79,0x25,0xc0,0x74,0x25,0xf0,0xee,0xfc,0x4c,
+  0xce,0x25,0x58,0xe0,0xb,0x90,0x9,0x9c,0x18,0x34,0xab,0x2,0xef,0x6e,0x3c,0x55,
+  0xdc,0x9e,0xe,0xde,0x48,0xba,0x26,0x3b,0x8,0x43,0x76,0x45,0xf,0x15,0x73,0x7c,
+  0x22,0xd7,0x10,0xc2,0xde,0x82,0xc6,0x3e,0xce,0x9d,0xa5,0xbb,0x52,0x6e,0x41,0x4,
+  0x5d,0x92,0x41,0x0,0xa3,0xbb,0x14,0x6e,0x18,0x7c,0x23,0xfe,0xdc,0x7,0x9f,0xe,
+  0x7,0x7e,0x1d,0xec,0x2e,0x3e,0x5f,0x1b,0x9f,0x5f,0xb7,0x7c,0x68,0xc2,0x58,0x4c,
+  0x7b,0x3f,0xb8,0x1a,0xb7,0xd,0xa7,0xf8,0xe,0x80,0x75,0xb3,0x81,0xc1,0xf3,0x4a,
+  0x80,0xe9,0x31,0x81,0x7f,0xb,0xd6,0x72,0x9a,0x88,0x79,0x53,0x41,0xda,0x1e,0x66,
+  0xb2,0x7,0xde,0xad,0xe7,0x50,0x74,0x1d,0x99,0xbd,0x73,0xa7,0x73,0x1,0x6e,0xd5,
+  0xae,0x94,0x1a,0x5a,0xc1,0x10,0x40,0x11,0x84,0x23,0x82,0xd4,0x36,0x1e,0x20,0xab,
+  0xc,0x66,0xc6,0x4f,0xb8,0xc3,0x76,0xf8,0xdc,0xd4,0xcf,0xc8,0x4e,0x89,0x1b,0xae,
+  0x7c,0x23,0xfe,0xfc,0xf7,0xab,0x96,0xaf,0x49,0x21,0x1d,0x35,0xe0,0x93,0x9c,0x1e,
+  0xd4,0x4d,0x3,0xdf,0xf7,0xf9,0x15,0xcb,0x6f,0x94,0xe0,0x4b,0xf3,0x7b,0x63,0x9,
+  0xd,0x7f,0xf0,0x31,0x7c,0x65,0x5f,0x86,0x3b,0x1,0xac,0x9f,0xad,0xeb,0xff,0xbc,
+  0x13,0xc0,0xaf,0x16,0xba,0x5b,0xbc,0x12,0xc8,0xde,0x65,0x9c,0x55,0x5d,0x85,0x23,
+  0x1,0xe0,0xdd,0xe8,0xd1,0x2f,0x9,0xa3,0xb8,0x9d,0xbc,0xb9,0xb7,0xa0,0x21,0x81,
+  0x59,0xa9,0x63,0x17,0x6d,0x68,0x3,0xb2,0x19,0xe3,0xaa,0x2,0x2d,0xad,0xfc,0xbb,
+  0x71,0x2e,0xbf,0xa5,0x2b,0xec,0xd7,0x46,0x76,0x4a,0xbc,0x69,0xf0,0x8d,0xf8,0x5c,
+  0x1,0x7e,0x6,0x68,0x1,0x4d,0xa,0xc9,0xd8,0x97,0xa0,0x93,0x67,0x4a,0xf0,0xbb,
+  0x54,0xf9,0x48,0xcf,0x0,0xbe,0x8d,0xf6,0x77,0xed,0x6a,0x20,0x5e,0x9d,0x95,0xb2,
+  0x6f,0xc0,0xdf,0xf7,0x81,0xc7,0xf0,0xd5,0xfd,0x19,0xee,0x2,0xf0,0x44,0xd9,0xd2,
+  0x60,0x20,0x7a,0x76,0x3b,0x10,0x9d,0x10,0x4,0x98,0x49,0xd,0x1c,0x11,0xca,0x3a,
+  0x92,0xed,0x26,0x7a,0x64,0x70,0x4d,0x26,0xb8,0x7b,0x4,0x52,0x75,0x5d,0xa2,0xd6,
+  0xb0,0xab,0x76,0xcd,0x4e,0xe4,0x46,0x1,0xc,0x1,0x84,0x37,0xc8,0xe9,0xe6,0xfa,
+  0x2b,0xc3,0x9d,0xd2,0x8e,0x7b,0x9,0x82,0xca,0x9,0x23,0x3b,0x24,0x6e,0x28,0xc0,
+  0x77,0xc3,0x1c,0x47,0x8,0x7e,0x21,0xf3,0xb5,0x80,0xaf,0x2,0x7e,0x84,0x78,0x75,
+  0xe9,0xf3,0x49,0x11,0x46,0x13,0xda,0xff,0x81,0xc7,0xf0,0xf5,0x3,0x19,0xee,0x1,
+  0xf0,0x24,0x66,0xf9,0x86,0x64,0x27,0x14,0x1,0xea,0x6a,0x50,0x25,0x82,0xbd,0x1,
+  0xa5,0x53,0x5,0x8f,0xc,0x40,0xb9,0xfc,0xaa,0xe0,0x81,0x36,0xf,0xb4,0x25,0x81,
+  0x92,0x76,0xb3,0x6,0xab,0x4,0xbe,0x3b,0x50,0x56,0x6a,0xa5,0x1d,0xee,0x54,0x5d,
+  0x8e,0x91,0x5d,0x12,0xd7,0x5f,0x79,0x1d,0x3e,0xf7,0xe1,0x5b,0x3c,0xd9,0x3f,0x6,
+  0xf0,0xe5,0x21,0xc0,0xaf,0xa5,0x7a,0x23,0x31,0x8d,0x7c,0xe0,0x31,0xfc,0xf3,0x48,
+  0x8e,0xef,0x5b,0xf0,0x67,0xfd,0xdf,0x9,0x47,0x80,0xae,0x44,0x40,0x19,0x28,0x3a,
+  0x55,0x28,0x63,0x3,0xe6,0x6e,0xe0,0x59,0xfc,0x62,0xb9,0x14,0x1d,0xe5,0x3a,0x7d,
+  0x32,0x1b,0x3e,0x6a,0x65,0xa7,0x92,0x95,0x55,0x84,0x72,0x5,0x55,0xb1,0x96,0xaf,
+  0x5c,0xe1,0x63,0x48,0x31,0xb2,0x53,0xe0,0xba,0x57,0x3a,0xf0,0x7d,0xcb,0x97,0x48,
+  0xc6,0x6e,0x83,0x8e,0x9f,0x29,0xb,0x39,0x3e,0xf8,0xb2,0x4,0x18,0xf5,0xe7,0xba,
+  0x8b,0xe5,0x7b,0xe0,0x1f,0x88,0x69,0xf4,0x83,0x8f,0xe1,0x9b,0x23,0x39,0x7e,0x64,
+  0xc1,0x27,0xef,0x78,0xf1,0x13,0xa0,0x42,0x84,0x2e,0xaa,0x50,0xba,0x5,0x2a,0xef,
+  0x48,0xe7,0xee,0xde,0x49,0xcc,0x58,0x99,0x73,0x1,0xe4,0xb2,0x0,0x5b,0x54,0x92,
+  0x86,0x18,0xca,0x6e,0xdf,0xa2,0x25,0x95,0xcb,0xbb,0xa5,0x37,0xe5,0xab,0x8,0x23,
+  0x3b,0x4,0xde,0x78,0xf9,0x75,0xf8,0x7f,0x7e,0xcf,0x7,0xdf,0xdc,0x5e,0x66,0x3a,
+  0xf8,0x55,0x5f,0x3f,0xcd,0xf2,0xb,0x32,0x78,0xd1,0xbe,0x2f,0xfb,0xd2,0x6c,0x2b,
+  0xb3,0xaf,0x4d,0x63,0xb7,0x3c,0x8e,0x6f,0x8d,0x1a,0xf0,0x37,0xc0,0xed,0x8f,0x57,
+  0x25,0x0,0x3d,0x5b,0xff,0xff,0x82,0x20,0xc0,0x4c,0xad,0x65,0x7f,0x45,0x50,0x79,
+  0xef,0x46,0x37,0x81,0xac,0xad,0x1b,0xb0,0x2b,0x93,0xed,0x46,0x4d,0x64,0x37,0x70,
+  0xd0,0xf6,0xb6,0x6e,0xe5,0x2e,0x1e,0xc6,0xfa,0xdd,0xd9,0xa9,0xc1,0xf8,0x5e,0x85,
+  0x97,0x2d,0xbd,0xc4,0x3,0x3f,0xf3,0x2c,0xff,0xcb,0x87,0x6,0xdf,0xf,0xf8,0x54,
+  0xd,0x7c,0xe5,0xa5,0x7a,0xbe,0xcf,0x2f,0xc1,0xbf,0x63,0x34,0xc7,0xf,0x6d,0xc0,
+  0x27,0x0,0xc8,0x19,0x48,0x80,0x93,0x8a,0x0,0x5d,0x95,0xc1,0x23,0x6,0x79,0xf7,
+  0xa8,0x2c,0xc0,0x77,0xcf,0x6d,0xbf,0x89,0xdc,0xa1,0xcc,0x2,0x4e,0xd2,0x2e,0x50,
+  0xf4,0xf,0x6b,0xfd,0x3b,0x15,0xfd,0xd3,0x7f,0xbb,0x95,0x95,0x96,0x2f,0xad,0xcf,
+  0xff,0x72,0x17,0xd9,0xa7,0x43,0xe7,0xf9,0xba,0x7b,0xc0,0xa7,0x25,0xd9,0xb8,0x60,
+  0x1a,0xf8,0xeb,0x1,0x64,0x0,0xf2,0xe7,0x9a,0x0,0x6b,0xa7,0xc6,0xd4,0x7d,0xfd,
+  0xb,0x82,0x55,0x2f,0x64,0x46,0x50,0x37,0x42,0x68,0x14,0x7b,0x14,0xb9,0xaf,0x69,
+  0x45,0x45,0x96,0x30,0xba,0x4b,0xea,0xe1,0x2d,0x42,0x1f,0xd8,0x2a,0xd5,0xc4,0x3e,
+  0x45,0x57,0x5d,0xf9,0xda,0x70,0xf9,0x92,0xf9,0x61,0x29,0xfb,0x87,0xb0,0xfc,0x5a,
+  0xb5,0x6f,0x5a,0xd,0xc0,0xa9,0x81,0x26,0x6c,0x9d,0xea,0x85,0x78,0xac,0x6d,0x15,
+  0xc3,0x7c,0x6f,0x7f,0x87,0x46,0x6f,0x79,0x1c,0xff,0xe6,0x81,0x9f,0xda,0x23,0xb7,
+  0x2a,0xe0,0x13,0x0,0xb3,0x21,0xff,0x33,0x11,0xe0,0xb1,0x3d,0x1b,0xe5,0x3d,0xe7,
+  0xbe,0x2a,0xb8,0x82,0x73,0xf4,0xbc,0xe0,0x94,0xc1,0x5f,0x17,0xe8,0x9e,0xeb,0xf2,
+  0xeb,0x5,0x9,0x14,0x70,0x60,0x87,0xd4,0xbb,0x9f,0x14,0x6a,0xf7,0x26,0xa1,0x86,
+  0x37,0xe5,0x32,0x4f,0xc9,0xed,0x47,0xab,0x0,0x4,0x97,0x5f,0x76,0x59,0x2f,0xc0,
+  0x43,0x57,0xe4,0xf1,0xc1,0x27,0xa5,0x4d,0xa5,0x4f,0x1e,0x81,0xe5,0x6b,0x6d,0xfd,
+  0xbe,0x1,0x3f,0xbb,0xaf,0x63,0x9e,0x5b,0xe5,0xd8,0x1f,0xd3,0xc8,0x2d,0xab,0xf1,
+  0x8d,0x51,0x13,0xed,0x6f,0xb0,0x96,0x9f,0x79,0xe0,0xfb,0xa,0xa0,0x8f,0xab,0x2,
+  0x10,0xd1,0x38,0x63,0xec,0xc7,0x7,0xf,0xc8,0x2b,0xe6,0x2f,0xe,0x6f,0x3a,0xf1,
+  0x1,0x3f,0x2,0x15,0xb0,0x3f,0xb7,0xf3,0x89,0x5c,0x6d,0x7b,0x22,0x97,0x3b,0xd7,
+  0xe5,0x72,0xe7,0x53,0xb9,0xbb,0xa8,0xd2,0x5e,0x64,0x51,0x7b,0x85,0xfe,0xf7,0xff,
+  0xf6,0xfb,0x23,0xdd,0x98,0x84,0x66,0xd,0x64,0xc3,0x9f,0x86,0x8e,0x37,0x1a,0x80,
+  0xfd,0x74,0x4f,0x1f,0x89,0xec,0xd7,0xc0,0x4f,0xca,0xca,0xe0,0x48,0x4c,0x7,0x6e,
+  0x59,0x8d,0xff,0x33,0x92,0xe3,0x5e,0xb,0xbe,0xf0,0xe,0xe9,0x81,0xaf,0x66,0x1b,
+  0xfc,0x43,0xc5,0x0,0xf,0xee,0x7a,0x52,0xdc,0xd9,0xbf,0x90,0xaf,0xa,0x43,0xbe,
+  0xe0,0x85,0x20,0xff,0x95,0xd5,0xc0,0x4,0xa4,0x53,0x9a,0xb6,0xae,0xcd,0xe4,0xde,
+  0xcd,0x52,0x6f,0x5d,0x9b,0x89,0xed,0x6b,0x73,0xe1,0x59,0x94,0xb0,0x16,0x86,0x19,
+  0xfc,0x6a,0x70,0xf9,0xe5,0x97,0xcd,0x5d,0xbe,0xfc,0x74,0x2e,0xd5,0x62,0x88,0xad,
+  0xef,0xb3,0x96,0x4f,0x33,0x94,0x78,0x75,0xa5,0xc1,0xe3,0xc0,0x2f,0x8,0xa1,0x9,
+  0x5b,0xa6,0x7a,0x91,0xdf,0x6f,0xc1,0xb7,0xb7,0xca,0x19,0x89,0x69,0xff,0x7,0x1f,
+  0xc7,0xd7,0x47,0x72,0xdc,0x6d,0xc1,0xaf,0x3,0xae,0xba,0x59,0xfe,0x6c,0xc9,0xff,
+  0x8c,0x4,0x20,0x22,0xc5,0x18,0x5b,0x33,0xba,0x4b,0x7d,0x6b,0xf1,0x59,0xfc,0xdd,
+  0x2f,0x4,0xe9,0xcf,0x2c,0xe0,0xdb,0xd6,0xe4,0x72,0xcb,0x63,0x99,0xd8,0xbd,0x49,
+  0xb8,0xe0,0x29,0xf3,0xe,0x5d,0xbb,0xa0,0xa8,0x59,0x95,0x4b,0x2e,0xe6,0xbd,0xe7,
+  0x3d,0xef,0x8e,0xb4,0x92,0xd0,0x62,0x2,0x7a,0xea,0x81,0xc2,0xda,0x71,0xc8,0x9e,
+  0x7e,0x35,0xef,0xf7,0x65,0x3f,0xbf,0xaf,0x3,0x96,0xe8,0x22,0xda,0x1f,0x8d,0x69,
+  0xf8,0x96,0xc7,0x71,0xfb,0x81,0xb2,0xbc,0x5b,0x7,0x5b,0xd7,0x80,0xa7,0xd9,0x4a,
+  0xfd,0x8e,0x28,0xb,0x20,0xa2,0x9f,0x33,0xc6,0xee,0x9a,0x7f,0x6a,0xb8,0x2a,0xea,
+  0x65,0x2b,0x4f,0x34,0xc0,0xc7,0xf7,0x29,0xbd,0x6d,0x75,0x26,0xb7,0xae,0xcd,0xe5,
+  0x9e,0x8d,0xb9,0xd8,0xbd,0x51,0xe4,0xd6,0xc2,0x53,0xf,0x70,0xe5,0xc9,0xbc,0xee,
+  0x72,0x81,0xeb,0x8e,0x23,0x85,0xd9,0x72,0xfd,0xf4,0x5f,0x7c,0xcb,0x9b,0xce,0xd2,
+  0x5a,0x42,0xe5,0x63,0xd3,0x80,0xee,0x6,0xfe,0xf4,0x49,0x9e,0xaa,0xec,0xfb,0xe0,
+  0x8f,0xc5,0x34,0x7c,0xcb,0x6a,0xfc,0xbd,0xad,0xed,0xaf,0x9b,0x1,0x6c,0x5d,0x2f,
+  0xfe,0xcc,0x36,0xf8,0x47,0x92,0x6,0xae,0xdd,0xb7,0x45,0xdc,0xb1,0xfc,0xe2,0xe8,
+  0x43,0xcf,0x37,0xe0,0xc3,0x9b,0x84,0xda,0xbb,0x59,0xa8,0xad,0x6b,0x73,0x31,0xf4,
+  0x68,0x96,0x8f,0xed,0x91,0xc2,0x3,0xda,0x81,0x2e,0x3d,0x9f,0xae,0x6b,0x92,0xaa,
+  0xbb,0xc8,0x69,0x6,0x20,0x1,0x30,0x5,0x60,0xdc,0x3e,0x1e,0x78,0xef,0x7b,0x7f,
+  0x63,0xe5,0xa9,0xa7,0x2e,0xea,0x51,0x52,0x40,0xf1,0x45,0x20,0xbe,0x8,0xa4,0x86,
+  0x81,0x69,0x25,0x5e,0x9a,0x6,0x3e,0x79,0x1,0xdf,0x96,0xc9,0x9e,0x42,0xf6,0x1d,
+  0xf8,0xe3,0xa6,0xa5,0xeb,0xba,0x7a,0xeb,0x66,0x0,0x1c,0xc7,0x1b,0xf8,0x23,0x22,
+  0x0,0x11,0x6d,0x64,0x8c,0xdd,0xbb,0xf0,0xa0,0x5a,0xd5,0x3b,0x2f,0x18,0x7c,0xae,
+  0x1,0xdf,0xba,0x36,0x97,0x5b,0x1f,0xcf,0xc5,0xe6,0x9f,0xa7,0x79,0xd2,0xd6,0xce,
+  0x7f,0xa7,0x16,0xa8,0xcc,0x3,0x5b,0x75,0x9,0x9c,0xba,0x5,0x50,0x8e,0x2c,0xb1,
+  0x5,0xdd,0xbd,0xa6,0x7f,0x5e,0x74,0xd3,0x2f,0xbe,0xf9,0x54,0x25,0x85,0xb9,0x3,
+  0x88,0x14,0x50,0x8b,0xff,0x4,0xe1,0xd6,0x5b,0x41,0xaa,0xd3,0xa5,0xad,0xdb,0x1d,
+  0xfc,0xad,0x93,0x9e,0xcf,0xb7,0xbf,0x33,0x9e,0xd0,0xde,0xf,0xac,0xc6,0x6d,0xfb,
+  0xb2,0xa2,0x9f,0x4f,0x33,0x81,0x7e,0xbc,0x81,0x3f,0x9a,0x42,0xd0,0x9a,0xe1,0x21,
+  0x71,0xef,0x59,0x97,0x6,0x17,0x1f,0xcf,0xb4,0x70,0xeb,0xda,0x5c,0x6e,0x5b,0x93,
+  0xc9,0xbd,0xcf,0x48,0xe9,0x1,0x9e,0x79,0x80,0xe7,0x35,0xb,0x97,0xde,0xd7,0xea,
+  0x91,0xb3,0xff,0x38,0xf3,0x2c,0x3d,0xf7,0x8e,0x7a,0x50,0xe8,0x8e,0x39,0xaf,0xba,
+  0x6a,0x70,0xb9,0x52,0x8e,0x0,0x39,0x64,0x78,0xe,0xf2,0xd3,0x3e,0x81,0xe6,0xf6,
+  0x8f,0x3,0x2a,0xe9,0x12,0xf1,0xd7,0xc1,0xef,0x41,0xe6,0x83,0x6f,0x7,0x38,0x3f,
+  0xf8,0x38,0x6e,0xdb,0x97,0xe1,0x5b,0x28,0x87,0x39,0x68,0x5a,0xc5,0x9b,0x9e,0xdb,
+  0x1b,0xcc,0x1c,0x96,0x0,0x44,0x34,0xcc,0x18,0xbb,0xab,0x3d,0xa6,0xae,0x98,0xbb,
+  0x28,0xb8,0x7e,0xb6,0xfe,0xf0,0xb6,0x35,0xb9,0xd8,0xba,0x36,0x93,0x43,0x8f,0x65,
+  0x62,0xe8,0xd1,0xcc,0x81,0xe2,0x83,0x25,0x6a,0x60,0x77,0x3,0x2c,0xf7,0x88,0xe0,
+  0x7f,0xcd,0xbd,0x8e,0xa8,0x1,0x3e,0x13,0xe8,0xee,0xf5,0x4f,0xfb,0xc0,0xef,0xfe,
+  0xd6,0x99,0x51,0x23,0x68,0x2a,0x25,0xa0,0x44,0x6,0xa9,0x72,0xc8,0x3c,0x83,0xe4,
+  0xe7,0x23,0x3b,0xf5,0xc3,0x98,0xb3,0xe3,0xbf,0x3,0x2a,0xeb,0xe,0xbe,0x22,0x6c,
+  0x69,0x1b,0xcb,0x2f,0x7c,0xbe,0x2a,0xc0,0xff,0xd2,0x70,0x8a,0x3b,0x6c,0x91,0xe7,
+  0x79,0x3,0xfc,0x58,0x4b,0xc1,0xab,0xf7,0x6e,0x92,0xf7,0xf5,0xe,0xb0,0x2b,0x8e,
+  0x25,0x2d,0xcc,0x62,0x52,0xdb,0xd7,0xa7,0xf1,0xf6,0x35,0x22,0x7b,0xe6,0x91,0x54,
+  0xec,0x7a,0x4a,0xf8,0xf9,0xb7,0xb3,0x72,0xd5,0x5,0xf0,0x3a,0xd8,0xdd,0x24,0x5b,
+  0xd4,0x2c,0x7b,0xa6,0x9f,0x99,0x49,0x29,0x94,0xa7,0x2c,0x97,0xbd,0xfd,0x97,0x6f,
+  0x7a,0x59,0x1,0xbe,0x14,0x90,0x22,0x33,0x2a,0x20,0x53,0xe4,0xfc,0x7c,0x24,0xa7,
+  0xfc,0x17,0x2c,0xdc,0xf3,0x37,0x60,0x4a,0x55,0x66,0xf7,0x49,0x13,0xb6,0xb4,0x7b,
+  0xaa,0xd1,0xbe,0x22,0x8c,0xc7,0xb4,0xe7,0x83,0x6b,0xf0,0xc5,0xe1,0xd4,0x58,0xfe,
+  0xf3,0xd,0xf8,0x31,0x11,0x80,0x88,0x62,0xc6,0xd8,0xf7,0x26,0x86,0xe9,0xe2,0x45,
+  0xcb,0xf0,0x8e,0xc3,0xfd,0x7c,0x7b,0x5c,0xb7,0xc7,0x76,0x8a,0x83,0xdb,0xd6,0xe4,
+  0x13,0x4f,0x3d,0x90,0x76,0xb6,0xad,0xcb,0x5d,0x44,0xe,0x7b,0x26,0x94,0xeb,0x12,
+  0xb5,0xe7,0xa7,0x67,0x2,0xfc,0x50,0x20,0xe7,0x87,0x51,0x87,0x43,0xc5,0x6,0x7e,
+  0x8c,0x10,0x2c,0x5b,0xb6,0xf4,0xec,0x4b,0x2e,0x3a,0xff,0x3c,0x3,0x7e,0xe,0x77,
+  0x96,0x32,0x45,0x2e,0x32,0x48,0x91,0x41,0xe0,0x2,0xec,0x19,0x78,0x27,0x4e,0xdb,
+  0x7f,0xbb,0x9d,0xb,0xb0,0x96,0x9f,0xcd,0x41,0x7e,0xdf,0x54,0x3d,0xe0,0xdb,0xf3,
+  0xc1,0x35,0x47,0x36,0xbd,0xcb,0xe,0xb5,0xbe,0xed,0xc8,0x30,0xa2,0xe3,0xa9,0x0,
+  0x2e,0x2d,0xbc,0x73,0xde,0xa9,0xcd,0x55,0x0,0x96,0xfa,0xdf,0x8b,0x27,0xd5,0xc4,
+  0xbe,0x2d,0x72,0xfb,0xb6,0xf5,0x62,0xf7,0x86,0x1f,0x25,0xfb,0x76,0x3f,0x9d,0x8f,
+  0xd7,0x4a,0x98,0x1,0x80,0x7e,0x0,0xbd,0x0,0x5a,0xf6,0xef,0x72,0x2f,0xfa,0x55,
+  0x33,0x48,0xf9,0xe1,0xc0,0xee,0x26,0xe7,0x75,0xd7,0x51,0x7,0x5b,0xd6,0x48,0xe7,
+  0xb2,0x82,0xf3,0xdf,0xf7,0xbe,0x77,0x9f,0xab,0x44,0xe,0xa9,0x4,0xa4,0xaa,0x83,
+  0x9f,0x42,0xe4,0x9,0x84,0xc8,0x20,0xe8,0x42,0x6c,0xea,0xff,0x35,0xf4,0x74,0xbe,
+  0x3,0xe4,0x19,0xe,0xb0,0xf3,0xa0,0x37,0xad,0x45,0x6f,0x35,0xe0,0xab,0x80,0x5f,
+  0x3,0xb8,0xe,0x36,0x9b,0xe1,0x3c,0x53,0xc7,0xa3,0x5e,0xff,0x24,0xf7,0xfa,0x47,
+  0x4b,0x84,0xa3,0xed,0x6,0xae,0x1d,0xd9,0xae,0xef,0x98,0x1a,0x55,0x37,0xed,0xdb,
+  0x22,0x86,0xf6,0x6d,0x53,0x7b,0xd7,0xff,0x20,0xd9,0xba,0x7d,0x5d,0xb6,0x7,0xc0,
+  0x3e,0x0,0xa3,0x36,0x8f,0xe6,0x0,0xe6,0x1,0x98,0xeb,0x9d,0x73,0x1b,0x7d,0x37,
+  0xed,0xdf,0x75,0x5b,0x7,0xd4,0xad,0xbf,0x9b,0xac,0xcb,0x2e,0x8a,0x30,0x13,0xd8,
+  0x72,0x86,0x8a,0x9a,0xee,0x52,0x52,0xf5,0x53,0xc2,0x95,0xd7,0xbf,0xf1,0x75,0x97,
+  0x4a,0x99,0x19,0xf0,0x73,0x3,0xbe,0x74,0x96,0x9f,0x27,0x10,0x79,0x6,0x21,0x52,
+  0x88,0x2c,0x86,0x90,0x4b,0x31,0xc1,0xde,0x5,0xc1,0x62,0xa4,0x32,0x85,0x38,0x73,
+  0x5,0x54,0xf3,0x27,0xc9,0xe4,0x9a,0x9d,0x43,0x43,0x4f,0xd3,0x86,0xbf,0xdd,0x8c,
+  0xef,0xc2,0xec,0xc5,0xb7,0x81,0x31,0x16,0xd6,0xc0,0xe5,0x28,0xf7,0xc4,0x80,0xf7,
+  0x98,0x1d,0x2,0xf0,0x23,0x3a,0x18,0x63,0xec,0x68,0x48,0x10,0x1e,0xa5,0xcc,0xac,
+  0x63,0x8c,0x7d,0xf1,0xcf,0xde,0x3a,0xfc,0x20,0x80,0x5d,0x16,0xf0,0x3d,0x16,0xd8,
+  0xc8,0x5a,0x77,0x2f,0x80,0x3e,0xcf,0xc2,0xc9,0x2,0x94,0x0,0xe8,0xb1,0x3f,0x17,
+  0xd4,0x8,0x70,0x38,0x9f,0x2f,0xbb,0xf8,0xf2,0xba,0x75,0x77,0x2b,0xa1,0xaa,0x2e,
+  0x45,0x16,0xdd,0xa5,0xc8,0xd2,0x7f,0xc6,0xb2,0x65,0x17,0xcd,0x9f,0x3b,0x67,0x45,
+  0x1,0xbe,0x48,0x21,0x65,0x86,0x5c,0x64,0x10,0x79,0x6c,0x2c,0xdf,0x82,0x9f,0xe7,
+  0x29,0x84,0x48,0x20,0x44,0x8c,0x76,0x32,0x95,0x6c,0xd9,0xb4,0x6f,0xc3,0xda,0x27,
+  0xb7,0x6d,0xf8,0xd6,0x5d,0xdb,0x1f,0x7,0xb0,0x1b,0xc0,0x16,0x0,0x4f,0xdb,0x6b,
+  0xe0,0xae,0x45,0xfd,0xe8,0x46,0x84,0x3a,0xd8,0xda,0xbb,0x46,0x74,0x88,0x4a,0xa1,
+  0x9e,0xa1,0x23,0x32,0xeb,0xa,0x0,0xeb,0xcb,0xd6,0x59,0xbf,0xe5,0x3e,0x4c,0xe0,
+  0x81,0xe4,0x7f,0x28,0x67,0x75,0x2e,0xb2,0x6f,0x2,0x68,0x78,0xfe,0x9f,0x66,0xf0,
+  0xff,0x72,0x86,0xa6,0x88,0x98,0x41,0xce,0xe5,0x61,0x2e,0x4e,0xb7,0x8b,0xea,0x5f,
+  0xec,0xb3,0x2f,0xbf,0xe4,0x92,0xb,0xef,0xb9,0xe7,0x27,0x78,0xcb,0x5b,0x5e,0x6b,
+  0x2c,0xbf,0x2,0x7e,0x6a,0xac,0x3f,0xb3,0x8f,0x45,0x82,0x67,0x86,0x76,0x3d,0xb9,
+  0x6e,0xdd,0xd0,0x93,0x77,0xfd,0x60,0xdd,0x53,0xa3,0xa3,0x53,0x6b,0x1,0x6c,0xb7,
+  0x87,0x73,0x6f,0xa7,0xd8,0xeb,0xe2,0x3e,0x6f,0xe8,0x5d,0x2b,0xee,0x19,0x8,0xf3,
+  0x62,0x21,0x5d,0x73,0x89,0xea,0x10,0xaa,0x26,0xbb,0x90,0xa6,0x88,0x27,0x8e,0x54,
+  0x5,0x9e,0xed,0x40,0x88,0xbb,0xa0,0xcc,0xbe,0xa1,0x3a,0x9b,0xb5,0x97,0x8b,0x3b,
+  0x95,0xf0,0xe5,0x90,0x6a,0x1f,0x48,0xce,0x20,0xe9,0xea,0x30,0x4d,0x12,0x75,0x18,
+  0xb,0xef,0x26,0xa5,0xfe,0x67,0x78,0xd9,0xf2,0xe5,0xcb,0xae,0x58,0xb7,0xf6,0x69,
+  0x2c,0x98,0xdf,0x8b,0xcb,0x2e,0x3b,0x17,0xb9,0xf3,0xf9,0x79,0x6a,0xac,0x3f,0x8b,
+  0xb1,0x65,0xc7,0xee,0xad,0xf,0x3d,0xfc,0xc4,0xda,0x6f,0xdf,0xf5,0xf0,0x33,0x23,
+  0x23,0x53,0xcf,0x58,0x15,0xdc,0x63,0xff,0x5e,0x3,0xc0,0x59,0xde,0x67,0x6c,0xd8,
+  0x23,0xb4,0x47,0xd0,0xc5,0xe2,0xeb,0x80,0x77,0x53,0x3f,0x3f,0x9d,0xe5,0xf6,0xec,
+  0xf7,0x30,0x98,0xa7,0x26,0x45,0x79,0xfb,0x48,0x49,0xf0,0xac,0x8,0x40,0x44,0x64,
+  0x63,0x8f,0x3a,0x9,0xe0,0x45,0xfc,0xee,0x43,0xb8,0xb,0x12,0x1c,0xe2,0x2,0xa8,
+  0x2e,0xec,0x57,0x33,0x4,0x6d,0x75,0x59,0x9f,0xc9,0x2f,0x76,0xb,0x9a,0xe0,0x59,
+  0xe0,0x69,0x17,0x9c,0x77,0xde,0x2b,0x9b,0xcd,0x68,0xe9,0xc1,0xc9,0x49,0xfc,0xfd,
+  0xed,0xff,0x86,0x95,0x3f,0x5d,0x84,0x77,0xdc,0x7c,0x2d,0x7a,0x7a,0x22,0xec,0xd9,
+  0x33,0xbc,0xef,0x67,0xf,0xad,0x7d,0xe2,0xbb,0x77,0xff,0x6c,0xcb,0x33,0x9b,0xf7,
+  0x6c,0x6,0xb0,0xd3,0xc6,0x3b,0xdc,0x82,0x7d,0x8e,0x55,0xb6,0xc8,0x53,0xb8,0xc8,
+  0xfb,0xac,0x3e,0xf0,0xbe,0xd1,0x48,0xcf,0x38,0x44,0xad,0x6,0xe2,0x97,0xb7,0x51,
+  0x23,0x76,0x60,0xcf,0x3e,0xe0,0xec,0x58,0xdb,0xc4,0xb3,0x35,0x12,0x46,0x5d,0xfc,
+  0x90,0xef,0xdf,0xb3,0x2e,0x56,0x80,0x5a,0x16,0xa0,0xba,0xd4,0xec,0x9f,0x2d,0xe0,
+  0xd4,0x85,0xb0,0xbe,0xc5,0x34,0x0,0x5c,0x7e,0xe9,0x85,0x97,0x5c,0x99,0x67,0xb9,
+  0xdd,0x7a,0x35,0xc3,0x4f,0x1f,0x58,0x37,0xf9,0x8f,0xff,0x72,0xd7,0xd6,0x25,0x4b,
+  0x16,0x6c,0x18,0x1a,0xda,0x39,0xc,0x60,0x2f,0x80,0x9,0xfb,0x7e,0xe6,0x1,0x58,
+  0x6c,0xe3,0x1d,0x7,0xba,0x23,0x40,0xe4,0x49,0x7e,0x30,0xc3,0xe7,0x14,0x35,0xc0,
+  0x53,0xaf,0x3c,0xed,0xc7,0x4d,0x8e,0x20,0x41,0xcd,0x6d,0x74,0xb,0x1e,0x51,0x23,
+  0x2,0x3b,0x52,0x15,0x78,0xd6,0x4,0xa8,0xa9,0x40,0x9d,0x14,0xaa,0xcb,0x87,0x60,
+  0xde,0x1b,0xa5,0xda,0xc5,0xa9,0xcb,0xf8,0xb3,0x6,0xbc,0x5b,0xca,0x6d,0x3f,0xb7,
+  0xb,0x5a,0x2f,0x3e,0x75,0xd1,0x82,0xb,0xe3,0x38,0xce,0xb6,0xed,0xd8,0xb1,0xe9,
+  0xe9,0xcd,0x9b,0xb7,0x1f,0x9c,0x9c,0x1c,0x1,0x30,0x39,0x34,0xd4,0x19,0xb3,0xaf,
+  0xb9,0x8,0xc0,0xb2,0x1a,0xe8,0x3e,0xe0,0x61,0xd,0x24,0xd4,0x14,0x4e,0xd6,0x80,
+  0x4f,0x6a,0xa9,0xb0,0xb2,0xaf,0x23,0xba,0xbc,0xd6,0x4c,0x19,0xc2,0x8c,0x25,0x85,
+  0xa3,0x51,0x83,0x59,0x51,0x80,0x1a,0x9,0xa8,0xb,0xeb,0xf9,0x51,0x44,0xbc,0xb3,
+  0xd,0x78,0xb7,0xb,0xe4,0x82,0xb3,0x3e,0x0,0x3b,0xee,0x7b,0xf8,0xa1,0x7,0x1f,
+  0x5f,0xbf,0x7e,0x8f,0x6d,0x10,0x25,0xf6,0x7b,0x73,0xac,0xbc,0xf7,0x74,0x1,0xde,
+  0x97,0xf7,0xa0,0xcb,0x67,0xf2,0x55,0xcd,0xf7,0xe5,0xac,0x6,0xf6,0xa1,0xb2,0x81,
+  0x13,0xaa,0x14,0x7c,0x34,0x24,0x80,0x67,0xcd,0xbc,0x16,0xa4,0xe0,0x10,0x4,0x38,
+  0x54,0xb0,0xf6,0x6c,0x0,0xef,0x56,0x6d,0x73,0x24,0x8,0x1,0x6c,0x7e,0x7c,0xfd,
+  0xfa,0x6f,0xda,0xf7,0xbc,0x18,0xc0,0x42,0x0,0xf3,0x6d,0xe1,0x6a,0x8e,0x5,0xdd,
+  0x27,0x40,0xe0,0x59,0x2f,0xab,0x65,0x34,0xbe,0x7c,0xc3,0xab,0x78,0x1e,0xae,0x8,
+  0x44,0xc7,0x92,0xc2,0x9d,0x50,0x4,0xe8,0x42,0x2,0xaa,0xa5,0x39,0x6c,0x6,0x2,
+  0x60,0x86,0xc8,0x7c,0xd6,0xbb,0x64,0xde,0xfb,0xab,0xc7,0x27,0x43,0x16,0xf8,0x96,
+  0x27,0xcb,0xae,0xa9,0xd4,0xf2,0x2c,0xbf,0xe5,0x45,0xf9,0xc1,0xc,0xb2,0xef,0xe7,
+  0xeb,0x7e,0xea,0xaa,0xba,0xc4,0x3b,0xca,0xcb,0xf1,0x8f,0xd4,0xdd,0x1d,0x49,0x3c,
+  0xf6,0xfc,0x10,0x60,0x6,0x12,0x1c,0xaa,0xbc,0x39,0xd3,0x48,0xe7,0xf1,0xec,0x92,
+  0x91,0x27,0xcd,0x1d,0xcf,0x57,0x27,0xb6,0x8a,0xe9,0x2c,0xbf,0xcf,0x2b,0x5d,0xb7,
+  0x6a,0x44,0xf0,0x63,0x80,0x7a,0x9a,0x17,0x78,0x9f,0xc5,0x7,0xdd,0x77,0x5,0xf9,
+  0xc,0x45,0x2c,0x7d,0x88,0x34,0x96,0xe,0x37,0x3f,0x50,0x37,0x9c,0xe3,0x9e,0x6,
+  0x1e,0x49,0x63,0xa2,0x46,0x86,0x59,0x6f,0x66,0x1c,0x23,0x1,0xa4,0x67,0x6d,0xae,
+  0x4a,0x39,0xe1,0x81,0xdc,0xea,0x22,0xfd,0x2d,0x2f,0xe2,0xef,0x46,0x86,0x46,0x4d,
+  0x1d,0x78,0xad,0xdf,0x41,0xb5,0x3a,0x47,0xee,0x65,0x0,0x59,0xad,0xec,0x5d,0x27,
+  0xc5,0x91,0xa6,0xb6,0xcf,0xaf,0xb,0x78,0x9e,0x81,0x3d,0x9a,0xf7,0xe3,0x54,0xca,
+  0x59,0x60,0xea,0x49,0x7a,0xe8,0x9d,0xc3,0x5a,0x51,0xa7,0xe1,0x59,0xbe,0x9f,0xf3,
+  0xb7,0xec,0xe3,0x66,0x97,0x2,0x50,0x3d,0xc0,0x9b,0xa9,0xfa,0x59,0x1f,0x6f,0x13,
+  0xb5,0x86,0x9a,0xef,0x2e,0xe8,0x10,0xd6,0x7f,0x62,0x11,0xe0,0x44,0xfd,0x47,0x54,
+  0xdc,0xcf,0x53,0x7b,0xb5,0x1,0x56,0xb,0x5a,0x59,0xcd,0x9a,0x3,0xaf,0xac,0xdb,
+  0xf0,0x88,0xd2,0xf0,0xce,0x51,0xed,0x6b,0x7e,0xd0,0xc8,0xbb,0x4,0x8d,0xdd,0x2a,
+  0xa1,0xdd,0x1a,0x5f,0xaa,0x4b,0xba,0x3c,0x23,0xf0,0xcf,0x55,0x29,0xf8,0xc5,0x42,
+  0x86,0x69,0x41,0x56,0x2d,0x63,0xe8,0xd6,0xb5,0xe3,0x35,0x62,0x4,0x5d,0x48,0x12,
+  0x74,0xe9,0x1,0x4,0xb5,0xec,0x1,0xb5,0xf4,0xb7,0x1e,0x28,0xce,0x54,0x21,0x3d,
+  0x54,0xbf,0xe3,0xc8,0x33,0xa3,0x13,0x4c,0xa1,0x5f,0x30,0xff,0x3c,0xd5,0xa8,0x93,
+  0x24,0xf0,0x4a,0xcd,0xbc,0xb,0x59,0xd8,0x21,0xea,0x22,0xf5,0x5a,0x2,0x75,0x29,
+  0x8c,0xcd,0x4,0xfc,0x31,0x2d,0x1c,0xf9,0xff,0x1,0x1f,0xdc,0x76,0xde,0x36,0x49,
+  0xe6,0xd2,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
+    // /home/user/src/ananas-qt4/src/designer/formdesigner/templates/forms/Dialog_with_Buttons_Bottom.ui
+  0x0,0x0,0x2,0x72,
+  0x0,
+  0x0,0x8,0xb0,0x78,0x9c,0xb5,0x55,0x4d,0x8f,0xd3,0x30,0x10,0xbd,0x23,0xf1,0x1f,
+  0xa2,0x9e,0xe0,0x42,0xda,0xa6,0xfb,0x29,0x37,0x87,0x85,0x43,0x25,0x90,0x60,0x25,
+  0x24,0xce,0x5e,0x77,0x48,0xcc,0x26,0x76,0xe4,0x38,0x34,0xd9,0x5f,0x8f,0xbf,0x93,
+  0xb8,0xad,0x56,0xb0,0xcb,0x29,0x33,0xcf,0xe3,0x37,0x33,0xcf,0xf6,0x4,0x75,0x34,
+  0xf9,0xd,0xa2,0xa5,0x9c,0x6d,0x17,0x9b,0xf,0xcb,0x45,0x92,0xbf,0x7d,0x93,0x20,
+  0xdc,0xc9,0x92,0x8b,0x1c,0xa5,0xce,0xd0,0x18,0xe1,0x75,0xd,0x4c,0x2a,0xd0,0x5b,
+  0x1a,0x85,0xbe,0xe1,0x42,0xd6,0x98,0x8,0xae,0x56,0xa6,0x9e,0xd9,0x53,0xe1,0xb6,
+  0xcd,0x3f,0x51,0x5c,0xf1,0x42,0xed,0x33,0x9e,0xc6,0xf,0x74,0x5f,0x80,0x4c,0xc,
+  0xb0,0x5d,0xdc,0xdb,0x80,0x45,0xc2,0x70,0xd,0xdb,0x85,0xf7,0x74,0x64,0x82,0x1a,
+  0xc1,0x1b,0x10,0x72,0x70,0x8b,0x5,0xf0,0x1a,0xa4,0x18,0xdc,0x72,0x82,0x4,0x10,
+  0x69,0xcd,0x4,0xf5,0xf9,0x12,0xa5,0xbd,0xf7,0x6,0xed,0xd,0xde,0x53,0x29,0x65,
+  0x99,0x6f,0x96,0xa,0xb3,0xa6,0xc3,0x4b,0xa0,0x45,0x29,0xf3,0x4c,0x2f,0x38,0xdb,
+  0x12,0xa7,0x81,0x19,0xa5,0xbe,0x88,0x93,0x25,0x1d,0x28,0xdb,0xf3,0xc3,0x77,0x2a,
+  0x2b,0x8,0x55,0xb5,0x52,0x50,0x56,0x84,0xce,0x9d,0x7b,0x8a,0x2c,0x92,0xe2,0x87,
+  0x71,0xbd,0x14,0x15,0x1e,0x78,0x27,0x3d,0xe6,0xb8,0x9f,0x51,0x64,0x26,0x89,0xd6,
+  0x64,0x3d,0x11,0x45,0xab,0xb2,0xbe,0x98,0xe8,0xe2,0x85,0xc9,0x2e,0x56,0x73,0x61,
+  0x46,0x65,0xb2,0xb9,0x30,0x53,0x65,0xe2,0x6e,0x12,0x64,0x2b,0xe,0xed,0xec,0xee,
+  0x78,0xff,0xc5,0x40,0x63,0x79,0x51,0xfd,0x35,0x16,0x5,0x65,0x61,0x39,0x41,0xac,
+  0xab,0x1f,0x40,0xe8,0xc3,0x73,0x96,0x4f,0x3b,0x4f,0x75,0x44,0xd4,0x36,0x98,0x28,
+  0x95,0x8f,0x99,0x2e,0x9f,0x65,0xa2,0x12,0xea,0xb0,0x4b,0xf3,0x84,0xd8,0xe3,0x34,
+  0x5c,0x50,0x75,0xf9,0xb1,0x54,0x4f,0x66,0x4c,0xa5,0xc2,0x40,0xe5,0xc8,0xef,0xe5,
+  0xed,0xed,0x4e,0x45,0x3c,0x71,0x15,0x52,0xa9,0x7,0xa1,0xc1,0xc0,0x14,0xe7,0x3d,
+  0xd1,0x3,0x7d,0x82,0x1d,0x65,0x72,0xc6,0xac,0xc1,0xd1,0xf5,0x27,0xb6,0xca,0xe2,
+  0x13,0x9b,0x1e,0xda,0x2a,0x3a,0x34,0x93,0x7e,0x46,0x74,0x5c,0x8d,0xa,0x98,0xb6,
+  0x8e,0xd2,0x89,0x2c,0x73,0x89,0xa2,0x4b,0xfb,0xad,0x6b,0xcb,0xbb,0x4e,0x4a,0xad,
+  0x88,0x13,0xe9,0xd1,0xfb,0x67,0x5b,0x95,0xd0,0x47,0x6d,0xda,0x47,0xf2,0xf5,0xf3,
+  0xec,0xbd,0x9c,0x2b,0xd5,0x96,0xf0,0xa,0xa5,0x12,0xcc,0x8,0x54,0xff,0x5c,0xee,
+  0x47,0xb3,0xfd,0x65,0x25,0xa3,0xd4,0x3e,0x1b,0x37,0x20,0xc6,0xb8,0x99,0xdd,0xd0,
+  0xbe,0xc6,0xcd,0xcf,0x8e,0x11,0x7d,0xf7,0xd4,0xb4,0x8d,0x0,0x1d,0x23,0xa0,0xe5,
+  0x9d,0x20,0xd0,0xa6,0x6e,0x66,0x33,0x6,0x66,0xb5,0xb5,0xdc,0x23,0xe0,0x7,0x15,
+  0xb0,0xbd,0x3a,0x71,0x7f,0x5e,0xaa,0xf,0xb,0xb8,0x55,0x5a,0x30,0x5c,0xe5,0xa4,
+  0xa2,0xe4,0x11,0xf6,0xef,0xde,0xeb,0x2b,0x64,0x90,0x30,0x7b,0x81,0xaa,0xdf,0x47,
+  0x98,0x73,0x1,0x70,0xdb,0x2b,0x2e,0x73,0x4c,0x8,0x34,0xd2,0xec,0xd5,0xae,0x5d,
+  0x29,0xd5,0x1d,0x6f,0xc3,0x8,0x56,0x4e,0x22,0x87,0x46,0xdf,0x7f,0x53,0x7d,0x85,
+  0x1f,0xa0,0x9a,0xbc,0x63,0x35,0xc3,0xae,0xae,0xe3,0x21,0x96,0x4d,0x86,0x7b,0xaa,
+  0x29,0x4e,0xd0,0xed,0xa1,0x95,0x94,0x99,0xb7,0x7a,0xcc,0x79,0x73,0x19,0x53,0x6e,
+  0x4e,0x53,0x5a,0xdb,0x29,0x98,0x46,0x12,0x9e,0x95,0x74,0x7a,0xaf,0xfe,0x83,0xac,
+  0x2,0x7e,0xa9,0xac,0x2f,0x94,0x35,0xbb,0xbc,0x79,0x75,0x59,0x57,0x57,0x31,0xe7,
+  0xf5,0xfa,0xef,0x75,0x9d,0xfa,0x3a,0x2,0xa5,0x1d,0x55,0x9f,0x3f,0x70,0x8d,0x7e,
+  0x64,
+    // /home/user/src/ananas-qt4/src/designer/formdesigner/templates/forms/Dialog_with_Buttons_Right.ui
+  0x0,0x0,0x2,0x78,
+  0x0,
+  0x0,0x8,0xab,0x78,0x9c,0xb5,0x55,0x4d,0x6f,0xd4,0x30,0x10,0xbd,0x23,0xf1,0x1f,
+  0xac,0x3d,0xc1,0x85,0xec,0x57,0x77,0x69,0xe5,0xcd,0xa1,0x70,0x40,0x2,0x9,0x2a,
+  0x55,0xe5,0xec,0x7a,0x87,0xc4,0x34,0xb1,0x23,0xc7,0x61,0x13,0x7e,0x3d,0xb6,0x63,
+  0x7b,0x9d,0x8f,0xaa,0x2a,0x85,0x53,0x66,0xde,0xd8,0xe3,0x37,0x6f,0xec,0x9,0x6e,
+  0x18,0xfa,0x5,0xb2,0x66,0x82,0x1f,0x16,0xdb,0x77,0xcb,0x5,0x4a,0x5f,0xbf,0x42,
+  0x98,0x34,0x2a,0x17,0x32,0xc5,0x89,0x33,0xc,0x46,0x45,0x59,0x2,0x57,0x1a,0xf4,
+  0x96,0x41,0xa1,0xad,0x84,0x54,0x25,0xa1,0x52,0xe8,0x48,0xec,0xd9,0x3d,0x5,0xa9,
+  0xeb,0xf4,0x23,0x23,0x85,0xc8,0xf4,0x3e,0xeb,0x19,0xfc,0xc4,0x8e,0x19,0x28,0x64,
+  0x81,0xc3,0xe2,0xa6,0x5f,0xb0,0x40,0x9c,0x94,0x70,0x58,0x78,0xcf,0xac,0x44,0xb8,
+  0x92,0xa2,0x2,0xa9,0x3a,0x17,0xcc,0x40,0x94,0xa0,0x64,0xe7,0xc2,0x8,0x4b,0xa0,
+  0xaa,0x37,0x11,0x6e,0xd3,0x25,0x4e,0x5a,0xef,0x75,0xc6,0xeb,0xbc,0xa7,0x8f,0x54,
+  0x79,0xba,0x5d,0x6a,0xac,0x37,0x1d,0x9e,0x3,0xcb,0x72,0x95,0x6e,0x4c,0xc0,0xd9,
+  0x7d,0xe2,0x24,0x64,0xc6,0x89,0x27,0x31,0x4b,0xe9,0xc4,0xf8,0x51,0x9c,0x6e,0x99,
+  0x2a,0x20,0xb0,0xaa,0x95,0x64,0x3c,0xb,0x95,0x3b,0x77,0x2e,0xd9,0x48,0x8a,0xef,
+  0xd6,0xf5,0x52,0x14,0xa4,0x13,0x8d,0xf2,0x98,0xcb,0xfd,0x84,0x22,0x3,0x49,0x8c,
+  0x26,0xb6,0xb4,0x36,0x0,0x5d,0xba,0x8e,0x74,0xf1,0xc2,0xec,0xf7,0x43,0x5d,0x82,
+  0x30,0xab,0xe5,0x6e,0x28,0x4c,0xac,0xcc,0xb8,0x1a,0x84,0x7b,0xc6,0xa1,0x9c,0xbb,
+  0x6b,0xd1,0x7e,0xb1,0xd0,0x99,0xde,0x88,0x7f,0x49,0x64,0xc6,0x78,0x8,0x23,0xcc,
+  0x9b,0xf2,0x1e,0xa4,0x69,0x9e,0xb3,0xfc,0xb1,0xc3,0xa3,0x26,0x89,0xea,0x8a,0x50,
+  0xad,0xf2,0x34,0xd3,0xee,0xc9,0x4c,0x4c,0x41,0x19,0xb,0x12,0x77,0xe4,0x5b,0x53,
+  0xe7,0xd7,0x8d,0x52,0x82,0xfb,0xae,0x88,0x7,0xef,0xfb,0x3d,0x13,0x2e,0xa,0x5a,
+  0x15,0x85,0xc3,0x85,0xf8,0xfa,0x79,0x70,0x19,0x66,0xd9,0x20,0xdb,0x9,0x4d,0x21,
+  0xd0,0x8d,0xe8,0x3d,0x93,0x2a,0x25,0x9c,0x42,0xf1,0xd7,0x74,0x3f,0xd8,0xed,0xff,
+  0x94,0xb2,0xe9,0x52,0xe8,0xc4,0x94,0x89,0x90,0x4c,0x8f,0x16,0xa2,0xd8,0x80,0xaf,
+  0x9e,0x33,0xba,0x83,0xe9,0x8d,0xba,0xba,0xba,0xd3,0x8b,0x19,0x25,0x9a,0x94,0x85,
+  0x1e,0xa7,0x34,0xbd,0x1f,0xec,0x37,0x7c,0x62,0x7c,0x54,0xa8,0x6,0xcf,0xae,0x7f,
+  0xd,0xeb,0xd1,0x94,0x88,0x1f,0xc4,0x76,0x34,0x28,0xfa,0xd3,0x7,0x79,0xe6,0xf4,
+  0x19,0xd4,0x1d,0xeb,0x83,0x93,0xfe,0xcd,0xb8,0xe9,0x70,0xd6,0x71,0x60,0x57,0xac,
+  0x2d,0x49,0xf5,0xa3,0xe1,0xd4,0x48,0xa3,0x47,0xed,0x8,0x30,0x6b,0x24,0xd4,0xa2,
+  0x91,0x14,0xea,0xc4,0xd,0x6c,0xce,0xc1,0x46,0xeb,0x3e,0xf7,0x19,0xf0,0x53,0xa,
+  0xf8,0x51,0x73,0xf2,0xf7,0x59,0x93,0xec,0x1,0x17,0x65,0x19,0x27,0x45,0x4a,0xb,
+  0x46,0x1f,0xe0,0xf8,0xe6,0xad,0x29,0xd2,0x22,0x61,0xf0,0x2,0xd3,0xff,0x8e,0x30,
+  0xe4,0x2,0xe0,0xb6,0x17,0x42,0xa5,0x84,0x52,0xa8,0x94,0xdd,0x6b,0xdc,0x3e,0x92,
+  0xeb,0x26,0xd4,0x61,0xfe,0x6a,0x7,0xa9,0xae,0x32,0xd,0xb2,0xec,0xb,0x72,0xf,
+  0x45,0xf4,0x88,0xf5,0x0,0xbb,0x58,0xd,0x7,0xd8,0xe6,0x7d,0x34,0xd8,0x13,0x93,
+  0x61,0x26,0xdb,0x11,0x6a,0xc5,0xb8,0xbd,0x49,0xd3,0x94,0xeb,0xcd,0x66,0x34,0x13,
+  0x2f,0xe7,0x53,0xf6,0xb6,0x13,0x30,0x19,0x29,0xf8,0xa8,0xa2,0xf1,0xb3,0xfb,0xf,
+  0xaa,0x4a,0xf8,0xa9,0x4f,0x7d,0xa9,0xaa,0x9b,0xd1,0x6f,0x61,0xb7,0x7b,0xa9,0xaa,
+  0xab,0xcb,0xfd,0x30,0xe5,0x6a,0x7d,0xf1,0x7c,0x59,0x63,0xdf,0xac,0xc0,0x49,0xc3,
+  0xf4,0xe7,0xf,0xe0,0x1d,0x7c,0xd5,
+    // /home/user/src/ananas-qt4/src/designer/formdesigner/templates/forms/Main_Window.ui
+  0x0,0x0,0x2,0xc7,
+  0x3c,
+  0x75,0x69,0x20,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x3d,0x22,0x34,0x2e,0x30,0x22,
+  0x20,0x3e,0xd,0xa,0x20,0x3c,0x61,0x75,0x74,0x68,0x6f,0x72,0x3e,0x3c,0x2f,0x61,
+  0x75,0x74,0x68,0x6f,0x72,0x3e,0xd,0xa,0x20,0x3c,0x63,0x6f,0x6d,0x6d,0x65,0x6e,
+  0x74,0x3e,0x3c,0x2f,0x63,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x3e,0xd,0xa,0x20,0x3c,
+  0x65,0x78,0x70,0x6f,0x72,0x74,0x6d,0x61,0x63,0x72,0x6f,0x3e,0x3c,0x2f,0x65,0x78,
+  0x70,0x6f,0x72,0x74,0x6d,0x61,0x63,0x72,0x6f,0x3e,0xd,0xa,0x20,0x3c,0x63,0x6c,
+  0x61,0x73,0x73,0x3e,0x4d,0x61,0x69,0x6e,0x57,0x69,0x6e,0x64,0x6f,0x77,0x3c,0x2f,
+  0x63,0x6c,0x61,0x73,0x73,0x3e,0xd,0xa,0x20,0x3c,0x77,0x69,0x64,0x67,0x65,0x74,
+  0x20,0x63,0x6c,0x61,0x73,0x73,0x3d,0x22,0x51,0x4d,0x61,0x69,0x6e,0x57,0x69,0x6e,
+  0x64,0x6f,0x77,0x22,0x20,0x6e,0x61,0x6d,0x65,0x3d,0x22,0x4d,0x61,0x69,0x6e,0x57,
+  0x69,0x6e,0x64,0x6f,0x77,0x22,0x20,0x3e,0xd,0xa,0x20,0x20,0x3c,0x70,0x72,0x6f,
+  0x70,0x65,0x72,0x74,0x79,0x20,0x6e,0x61,0x6d,0x65,0x3d,0x22,0x6f,0x62,0x6a,0x65,
+  0x63,0x74,0x4e,0x61,0x6d,0x65,0x22,0x20,0x3e,0xd,0xa,0x20,0x20,0x20,0x3c,0x73,
+  0x74,0x72,0x69,0x6e,0x67,0x20,0x6e,0x6f,0x74,0x72,0x3d,0x22,0x74,0x72,0x75,0x65,
+  0x22,0x20,0x3e,0x4d,0x61,0x69,0x6e,0x57,0x69,0x6e,0x64,0x6f,0x77,0x3c,0x2f,0x73,
+  0x74,0x72,0x69,0x6e,0x67,0x3e,0xd,0xa,0x20,0x20,0x3c,0x2f,0x70,0x72,0x6f,0x70,
+  0x65,0x72,0x74,0x79,0x3e,0xd,0xa,0x20,0x20,0x3c,0x70,0x72,0x6f,0x70,0x65,0x72,
+  0x74,0x79,0x20,0x6e,0x61,0x6d,0x65,0x3d,0x22,0x67,0x65,0x6f,0x6d,0x65,0x74,0x72,
+  0x79,0x22,0x20,0x3e,0xd,0xa,0x20,0x20,0x20,0x3c,0x72,0x65,0x63,0x74,0x3e,0xd,
+  0xa,0x20,0x20,0x20,0x20,0x3c,0x78,0x3e,0x30,0x3c,0x2f,0x78,0x3e,0xd,0xa,0x20,
+  0x20,0x20,0x20,0x3c,0x79,0x3e,0x30,0x3c,0x2f,0x79,0x3e,0xd,0xa,0x20,0x20,0x20,
+  0x20,0x3c,0x77,0x69,0x64,0x74,0x68,0x3e,0x38,0x30,0x30,0x3c,0x2f,0x77,0x69,0x64,
+  0x74,0x68,0x3e,0xd,0xa,0x20,0x20,0x20,0x20,0x3c,0x68,0x65,0x69,0x67,0x68,0x74,
+  0x3e,0x36,0x30,0x30,0x3c,0x2f,0x68,0x65,0x69,0x67,0x68,0x74,0x3e,0xd,0xa,0x20,
+  0x20,0x20,0x3c,0x2f,0x72,0x65,0x63,0x74,0x3e,0xd,0xa,0x20,0x20,0x3c,0x2f,0x70,
+  0x72,0x6f,0x70,0x65,0x72,0x74,0x79,0x3e,0xd,0xa,0x20,0x20,0x3c,0x70,0x72,0x6f,
+  0x70,0x65,0x72,0x74,0x79,0x20,0x6e,0x61,0x6d,0x65,0x3d,0x22,0x77,0x69,0x6e,0x64,
+  0x6f,0x77,0x54,0x69,0x74,0x6c,0x65,0x22,0x20,0x3e,0xd,0xa,0x20,0x20,0x20,0x3c,
+  0x73,0x74,0x72,0x69,0x6e,0x67,0x3e,0x4d,0x61,0x69,0x6e,0x57,0x69,0x6e,0x64,0x6f,
+  0x77,0x3c,0x2f,0x73,0x74,0x72,0x69,0x6e,0x67,0x3e,0xd,0xa,0x20,0x20,0x3c,0x2f,
+  0x70,0x72,0x6f,0x70,0x65,0x72,0x74,0x79,0x3e,0xd,0xa,0x20,0x20,0x3c,0x77,0x69,
+  0x64,0x67,0x65,0x74,0x20,0x63,0x6c,0x61,0x73,0x73,0x3d,0x22,0x51,0x4d,0x65,0x6e,
+  0x75,0x42,0x61,0x72,0x22,0x20,0x6e,0x61,0x6d,0x65,0x3d,0x22,0x6d,0x65,0x6e,0x75,
+  0x62,0x61,0x72,0x22,0x20,0x2f,0x3e,0xd,0xa,0x20,0x20,0x3c,0x77,0x69,0x64,0x67,
+  0x65,0x74,0x20,0x63,0x6c,0x61,0x73,0x73,0x3d,0x22,0x51,0x57,0x69,0x64,0x67,0x65,
+  0x74,0x22,0x20,0x6e,0x61,0x6d,0x65,0x3d,0x22,0x63,0x65,0x6e,0x74,0x72,0x61,0x6c,
+  0x77,0x69,0x64,0x67,0x65,0x74,0x22,0x20,0x2f,0x3e,0xd,0xa,0x20,0x20,0x3c,0x77,
+  0x69,0x64,0x67,0x65,0x74,0x20,0x63,0x6c,0x61,0x73,0x73,0x3d,0x22,0x51,0x53,0x74,
+  0x61,0x74,0x75,0x73,0x42,0x61,0x72,0x22,0x20,0x6e,0x61,0x6d,0x65,0x3d,0x22,0x73,
+  0x74,0x61,0x74,0x75,0x73,0x62,0x61,0x72,0x22,0x20,0x2f,0x3e,0xd,0xa,0x20,0x3c,
+  0x2f,0x77,0x69,0x64,0x67,0x65,0x74,0x3e,0xd,0xa,0x20,0x3c,0x70,0x69,0x78,0x6d,
+  0x61,0x70,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x3e,0x3c,0x2f,0x70,0x69,0x78,
+  0x6d,0x61,0x70,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x3e,0xd,0xa,0x20,0x3c,
+  0x63,0x6f,0x6e,0x6e,0x65,0x63,0x74,0x69,0x6f,0x6e,0x73,0x2f,0x3e,0xd,0xa,0x3c,
+  0x2f,0x75,0x69,0x3e,0xd,0xa,
+    // /home/user/src/ananas-qt4/src/designer/formdesigner/templates/forms/Widget.ui
+  0x0,0x0,0x2,0x18,
+  0x3c,
+  0x75,0x69,0x20,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x3d,0x22,0x34,0x2e,0x30,0x22,
+  0x20,0x3e,0xd,0xa,0x20,0x3c,0x61,0x75,0x74,0x68,0x6f,0x72,0x3e,0x3c,0x2f,0x61,
+  0x75,0x74,0x68,0x6f,0x72,0x3e,0xd,0xa,0x20,0x3c,0x63,0x6f,0x6d,0x6d,0x65,0x6e,
+  0x74,0x3e,0x3c,0x2f,0x63,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x3e,0xd,0xa,0x20,0x3c,
+  0x65,0x78,0x70,0x6f,0x72,0x74,0x6d,0x61,0x63,0x72,0x6f,0x3e,0x3c,0x2f,0x65,0x78,
+  0x70,0x6f,0x72,0x74,0x6d,0x61,0x63,0x72,0x6f,0x3e,0xd,0xa,0x20,0x3c,0x63,0x6c,
+  0x61,0x73,0x73,0x3e,0x46,0x6f,0x72,0x6d,0x3c,0x2f,0x63,0x6c,0x61,0x73,0x73,0x3e,
+  0xd,0xa,0x20,0x3c,0x77,0x69,0x64,0x67,0x65,0x74,0x20,0x63,0x6c,0x61,0x73,0x73,
+  0x3d,0x22,0x51,0x57,0x69,0x64,0x67,0x65,0x74,0x22,0x20,0x6e,0x61,0x6d,0x65,0x3d,
+  0x22,0x46,0x6f,0x72,0x6d,0x22,0x20,0x3e,0xd,0xa,0x20,0x20,0x3c,0x70,0x72,0x6f,
+  0x70,0x65,0x72,0x74,0x79,0x20,0x6e,0x61,0x6d,0x65,0x3d,0x22,0x6f,0x62,0x6a,0x65,
+  0x63,0x74,0x4e,0x61,0x6d,0x65,0x22,0x20,0x3e,0xd,0xa,0x20,0x20,0x20,0x3c,0x73,
+  0x74,0x72,0x69,0x6e,0x67,0x20,0x6e,0x6f,0x74,0x72,0x3d,0x22,0x74,0x72,0x75,0x65,
+  0x22,0x20,0x3e,0x46,0x6f,0x72,0x6d,0x3c,0x2f,0x73,0x74,0x72,0x69,0x6e,0x67,0x3e,
+  0xd,0xa,0x20,0x20,0x3c,0x2f,0x70,0x72,0x6f,0x70,0x65,0x72,0x74,0x79,0x3e,0xd,
+  0xa,0x20,0x20,0x3c,0x70,0x72,0x6f,0x70,0x65,0x72,0x74,0x79,0x20,0x6e,0x61,0x6d,
+  0x65,0x3d,0x22,0x67,0x65,0x6f,0x6d,0x65,0x74,0x72,0x79,0x22,0x20,0x3e,0xd,0xa,
+  0x20,0x20,0x20,0x3c,0x72,0x65,0x63,0x74,0x3e,0xd,0xa,0x20,0x20,0x20,0x20,0x3c,
+  0x78,0x3e,0x30,0x3c,0x2f,0x78,0x3e,0xd,0xa,0x20,0x20,0x20,0x20,0x3c,0x79,0x3e,
+  0x30,0x3c,0x2f,0x79,0x3e,0xd,0xa,0x20,0x20,0x20,0x20,0x3c,0x77,0x69,0x64,0x74,
+  0x68,0x3e,0x34,0x30,0x30,0x3c,0x2f,0x77,0x69,0x64,0x74,0x68,0x3e,0xd,0xa,0x20,
+  0x20,0x20,0x20,0x3c,0x68,0x65,0x69,0x67,0x68,0x74,0x3e,0x33,0x30,0x30,0x3c,0x2f,
+  0x68,0x65,0x69,0x67,0x68,0x74,0x3e,0xd,0xa,0x20,0x20,0x20,0x3c,0x2f,0x72,0x65,
+  0x63,0x74,0x3e,0xd,0xa,0x20,0x20,0x3c,0x2f,0x70,0x72,0x6f,0x70,0x65,0x72,0x74,
+  0x79,0x3e,0xd,0xa,0x20,0x20,0x3c,0x70,0x72,0x6f,0x70,0x65,0x72,0x74,0x79,0x20,
+  0x6e,0x61,0x6d,0x65,0x3d,0x22,0x77,0x69,0x6e,0x64,0x6f,0x77,0x54,0x69,0x74,0x6c,
+  0x65,0x22,0x20,0x3e,0xd,0xa,0x20,0x20,0x20,0x3c,0x73,0x74,0x72,0x69,0x6e,0x67,
+  0x3e,0x46,0x6f,0x72,0x6d,0x3c,0x2f,0x73,0x74,0x72,0x69,0x6e,0x67,0x3e,0xd,0xa,
+  0x20,0x20,0x3c,0x2f,0x70,0x72,0x6f,0x70,0x65,0x72,0x74,0x79,0x3e,0xd,0xa,0x20,
+  0x3c,0x2f,0x77,0x69,0x64,0x67,0x65,0x74,0x3e,0xd,0xa,0x20,0x3c,0x70,0x69,0x78,
+  0x6d,0x61,0x70,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x3e,0x3c,0x2f,0x70,0x69,
+  0x78,0x6d,0x61,0x70,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x3e,0xd,0xa,0x20,
+  0x3c,0x63,0x6f,0x6e,0x6e,0x65,0x63,0x74,0x69,0x6f,0x6e,0x73,0x2f,0x3e,0xd,0xa,
+  0x3c,0x2f,0x75,0x69,0x3e,0xd,0xa,
+  
+};
+
+static const unsigned char qt_resource_name[] = {
+  // trolltech
+  0x0,0x9,
+  0x6,0x33,0x5c,0xb8,
+  0x0,0x74,
+  0x0,0x72,0x0,0x6f,0x0,0x6c,0x0,0x6c,0x0,0x74,0x0,0x65,0x0,0x63,0x0,0x68,
+    // designer
+  0x0,0x8,
+  0xc,0x9f,0xe9,0x82,
+  0x0,0x64,
+  0x0,0x65,0x0,0x73,0x0,0x69,0x0,0x67,0x0,0x6e,0x0,0x65,0x0,0x72,
+    // templates
+  0x0,0x9,
+  0x4,0x72,0x7f,0x43,
+  0x0,0x74,
+  0x0,0x65,0x0,0x6d,0x0,0x70,0x0,0x6c,0x0,0x61,0x0,0x74,0x0,0x65,0x0,0x73,
+    // images
+  0x0,0x6,
+  0x7,0x3,0x7d,0xc3,
+  0x0,0x69,
+  0x0,0x6d,0x0,0x61,0x0,0x67,0x0,0x65,0x0,0x73,
+    // designer.png
+  0x0,0xc,
+  0x9,0x9c,0x68,0x87,
+  0x0,0x64,
+  0x0,0x65,0x0,0x73,0x0,0x69,0x0,0x67,0x0,0x6e,0x0,0x65,0x0,0x72,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
+    // forms
+  0x0,0x5,
+  0x0,0x6d,0x69,0x43,
+  0x0,0x66,
+  0x0,0x6f,0x0,0x72,0x0,0x6d,0x0,0x73,
+    // Dialog_with_Buttons_Bottom.ui
+  0x0,0x1d,
+  0x5,0xfa,0x5f,0xf9,
+  0x0,0x44,
+  0x0,0x69,0x0,0x61,0x0,0x6c,0x0,0x6f,0x0,0x67,0x0,0x5f,0x0,0x77,0x0,0x69,0x0,0x74,0x0,0x68,0x0,0x5f,0x0,0x42,0x0,0x75,0x0,0x74,0x0,0x74,0x0,0x6f,
+  0x0,0x6e,0x0,0x73,0x0,0x5f,0x0,0x42,0x0,0x6f,0x0,0x74,0x0,0x74,0x0,0x6f,0x0,0x6d,0x0,0x2e,0x0,0x75,0x0,0x69,
+    // Dialog_with_Buttons_Right.ui
+  0x0,0x1c,
+  0xb,0x3b,0x86,0x39,
+  0x0,0x44,
+  0x0,0x69,0x0,0x61,0x0,0x6c,0x0,0x6f,0x0,0x67,0x0,0x5f,0x0,0x77,0x0,0x69,0x0,0x74,0x0,0x68,0x0,0x5f,0x0,0x42,0x0,0x75,0x0,0x74,0x0,0x74,0x0,0x6f,
+  0x0,0x6e,0x0,0x73,0x0,0x5f,0x0,0x52,0x0,0x69,0x0,0x67,0x0,0x68,0x0,0x74,0x0,0x2e,0x0,0x75,0x0,0x69,
+    // Main_Window.ui
+  0x0,0xe,
+  0x4,0xbe,0x2a,0xd9,
+  0x0,0x4d,
+  0x0,0x61,0x0,0x69,0x0,0x6e,0x0,0x5f,0x0,0x57,0x0,0x69,0x0,0x6e,0x0,0x64,0x0,0x6f,0x0,0x77,0x0,0x2e,0x0,0x75,0x0,0x69,
+    // Widget.ui
+  0x0,0x9,
+  0xa,0xdc,0xce,0x59,
+  0x0,0x57,
+  0x0,0x69,0x0,0x64,0x0,0x67,0x0,0x65,0x0,0x74,0x0,0x2e,0x0,0x75,0x0,0x69,
+  
+};
+
+static const unsigned char qt_resource_struct[] = {
+  // :
+  0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1,
+  // :/trolltech
+  0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x2,
+  // :/trolltech/designer
+  0x0,0x0,0x0,0x18,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x3,
+  // :/trolltech/designer/templates
+  0x0,0x0,0x0,0x2e,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x6,
+  // :/trolltech/designer/images
+  0x0,0x0,0x0,0x46,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x5,
+  // :/trolltech/designer/images/designer.png
+  0x0,0x0,0x0,0x58,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,
+  // :/trolltech/designer/templates/forms
+  0x0,0x0,0x0,0x76,0x0,0x2,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x7,
+  // :/trolltech/designer/templates/forms/Main_Window.ui
+  0x0,0x0,0x1,0x4,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x3e,0x5,
+  // :/trolltech/designer/templates/forms/Dialog_with_Buttons_Bottom.ui
+  0x0,0x0,0x0,0x86,0x0,0x1,0x0,0x0,0x0,0x1,0x0,0x0,0x39,0x13,
+  // :/trolltech/designer/templates/forms/Widget.ui
+  0x0,0x0,0x1,0x26,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x40,0xd0,
+  // :/trolltech/designer/templates/forms/Dialog_with_Buttons_Right.ui
+  0x0,0x0,0x0,0xc6,0x0,0x1,0x0,0x0,0x0,0x1,0x0,0x0,0x3b,0x89,
+
+};
+
+int qInitResources_designer()
+{
+    extern bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
+    qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data);
+    return 1;
+}
+Q_CONSTRUCTOR_FUNCTION(qInitResources_designer)
+int qCleanupResources_designer()
+{
+    extern bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
+    qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data);
+    return 1;
+}
+Q_DESTRUCTOR_FUNCTION(qCleanupResources_designer)
diff --git a/src/designer/formdesigner/qtdesigner.pri b/src/designer/formdesigner/qtdesigner.pri
new file mode 100644 (file)
index 0000000..f0a1d3e
--- /dev/null
@@ -0,0 +1,44 @@
+######################################################################
+# Automatically generated by qmake (2.00a) ?? 20. ??? 19:33:50 2006
+######################################################################
+
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += formwindowsettings.h \
+           newform.h \
+           plugindialog.h \
+           qdesigner_actioneditor.h \
+           qdesigner_actions.h \
+           qdesigner_formwindow.h \
+           qdesigner_objectinspector.h \
+           qdesigner_pch.h \
+           qdesigner_propertyeditor.h \
+           qdesigner_resourceeditor.h \
+           qdesigner_settings.h \
+           qdesigner_signalsloteditor.h \
+           qdesigner_toolwindow.h \
+           qdesigner_widgetbox.h \
+           qdesigner_workbench.h \
+           saveformastemplate.h
+FORMS += formwindowsettings.ui \
+         newform.ui \
+         plugindialog.ui \
+         saveformastemplate.ui
+SOURCES += formwindowsettings.cpp \
+           newform.cpp \
+           plugindialog.cpp \
+           qdesigner_actioneditor.cpp \
+           qdesigner_actions.cpp \
+           qdesigner_formwindow.cpp \
+           qdesigner_objectinspector.cpp \
+           qdesigner_propertyeditor.cpp \
+           qdesigner_resourceeditor.cpp \
+           qdesigner_settings.cpp \
+           qdesigner_signalsloteditor.cpp \
+           qdesigner_toolwindow.cpp \
+           qdesigner_widgetbox.cpp \
+           qdesigner_workbench.cpp \
+           saveformastemplate.cpp
+RESOURCES += designer.qrc
diff --git a/src/designer/formdesigner/qtdesigner.pro b/src/designer/formdesigner/qtdesigner.pro
new file mode 100644 (file)
index 0000000..680e3da
--- /dev/null
@@ -0,0 +1,15 @@
+include ( qtdesigner.pri )
+include ( ../../ananas.pri )
+
+TEMPLATE = lib
+TARGET   = qt4designer
+
+INCLUDEPATH += 
+
+DEFINES  += 
+
+LIBS += -lQtDesignerComponents
+
+
+DESTDIR = ../../../lib
+DLLDESTDIR = ../../../bin
diff --git a/src/designer/formdesigner/saveformastemplate.cpp b/src/designer/formdesigner/saveformastemplate.cpp
new file mode 100644 (file)
index 0000000..3cfec23
--- /dev/null
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include "saveformastemplate.h"
+#include "qdesigner_settings.h"
+
+#include <QtCore/QFile>
+#include <QtGui/QFileDialog>
+#include <QtGui/QMessageBox>
+
+#include <QtDesigner/abstractformwindow.h>
+
+SaveFormAsTemplate::SaveFormAsTemplate(QDesignerFormWindowInterface *formWindow, QWidget *parent)
+    : QDialog(parent, Qt::Sheet),
+      m_formWindow(formWindow)
+{
+    ui.setupUi(this);
+
+    ui.templateNameEdit->setText(formWindow->mainContainer()->objectName());
+    ui.templateNameEdit->selectAll();
+
+    ui.templateNameEdit->setFocus();
+
+    QDesignerSettings settings;
+    QStringList paths = settings.formTemplatePaths();
+    ui.categoryCombo->addItems(paths);
+    ui.categoryCombo->addItem(tr("Add path..."));
+    m_addPathIndex = ui.categoryCombo->count() - 1;
+    connect(ui.templateNameEdit, SIGNAL(textChanged(QString)),
+            this, SLOT(updateOKButton(QString)));
+    connect(ui.categoryCombo, SIGNAL(activated(int)), this, SLOT(checkToAddPath(int)));
+}
+
+SaveFormAsTemplate::~SaveFormAsTemplate()
+{
+}
+
+void SaveFormAsTemplate::on_okButton_clicked()
+{
+    QString templateFileName = ui.categoryCombo->currentText() + QLatin1Char('/') + ui.templateNameEdit->text();
+    if (!templateFileName.endsWith(QLatin1String(".ui")))
+        templateFileName.append(QLatin1String(".ui"));
+    QFile file(templateFileName);
+
+    if (file.exists()) {
+        if (QMessageBox::information(m_formWindow, tr("Template Exists"),
+                                 tr("A template with the name %1 already exits\n"
+                                    "Do you want overwrite the template?").arg(ui.templateNameEdit->text()),
+                                 tr("Overwrite Template"), tr("Cancel"), QString(), 1, 1) == 1) {
+            return;
+        }
+    }
+
+    while (!file.open(QFile::WriteOnly)) {
+        if (QMessageBox::information(m_formWindow, tr("Open Error"),
+            tr("There was an error opening template %1 for writing. Reason: %2").arg(ui.templateNameEdit->text()).arg(file.errorString()),
+            tr("Try again"), tr("Cancel"), QString(), 0, 1) == 1) {
+            return;
+        }
+    }
+
+    QByteArray ba = m_formWindow->contents().toUtf8();
+    while (file.write(ba) != ba.size()) {
+        if (QMessageBox::information(m_formWindow, tr("Write Error"),
+            tr("There was an error writing the template %1 to disk. Reason: %2").arg(ui.templateNameEdit->text()).arg(file.errorString()),
+            tr("Try again"), tr("Cancel"), QString(), 0, 1) == 1) {
+                file.close();
+                file.remove();
+                return;
+            }
+            file.reset();
+    }
+    // update the list of places too...
+    QStringList sl;
+    for (int i = 0; i < m_addPathIndex; ++i)
+        sl << ui.categoryCombo->itemText(i);
+
+    QDesignerSettings().setFormTemplatePaths(sl);
+
+    accept();
+}
+
+void SaveFormAsTemplate::on_cancelButton_clicked()
+{
+    reject();
+}
+
+void SaveFormAsTemplate::updateOKButton(const QString &str)
+{
+    ui.okButton->setEnabled(!str.isEmpty());
+}
+
+void SaveFormAsTemplate::checkToAddPath(int itemIndex)
+{
+    if (itemIndex != m_addPathIndex)
+        return;
+
+    QString dir = QFileDialog::getExistingDirectory(this,
+                                                    tr("Pick a directory to save templates in"));
+    if (dir.isEmpty()) {
+        ui.categoryCombo->setCurrentIndex(0);
+        return;
+    }
+
+    ui.categoryCombo->insertItem(m_addPathIndex, dir);
+    ui.categoryCombo->setCurrentIndex(m_addPathIndex);
+    ++m_addPathIndex;
+}
diff --git a/src/designer/formdesigner/saveformastemplate.h b/src/designer/formdesigner/saveformastemplate.h
new file mode 100644 (file)
index 0000000..45d0b57
--- /dev/null
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
+**
+** This file is part of the Qt Designer of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License version 2.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of
+** this file.  Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+** http://www.trolltech.com/products/qt/opensource.html
+**
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://www.trolltech.com/products/qt/licensing.html or contact the
+** sales department at sales@trolltech.com.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef SAVEFORMASTEMPLATE_H
+#define SAVEFORMASTEMPLATE_H
+
+#include "ui_saveformastemplate.h"
+
+class QDesignerFormWindowInterface;
+
+class SaveFormAsTemplate: public QDialog
+{
+    Q_OBJECT
+public:
+    SaveFormAsTemplate(QDesignerFormWindowInterface *formWindow, QWidget *parent = 0);
+    virtual ~SaveFormAsTemplate();
+
+private slots:
+    void on_okButton_clicked();
+    void on_cancelButton_clicked();
+    void updateOKButton(const QString &str);
+    void checkToAddPath(int itemIndex);
+
+private:
+    Ui::SaveFormAsTemplate ui;
+    QDesignerFormWindowInterface *m_formWindow;
+    int m_addPathIndex;
+};
+
+#endif // SAVEFORMASTEMPLATE_H
diff --git a/src/designer/formdesigner/saveformastemplate.ui b/src/designer/formdesigner/saveformastemplate.ui
new file mode 100644 (file)
index 0000000..5b30435
--- /dev/null
@@ -0,0 +1,248 @@
+<ui version="4.0" >\r
+ <author></author>\r
+  <comment>*********************************************************************\r
+**\r
+** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.\r
+**\r
+** This file is part of the Qt Designer of the Qt Toolkit.\r
+**\r
+** This file may be used under the terms of the GNU General Public\r
+** License version 2.0 as published by the Free Software Foundation\r
+** and appearing in the file LICENSE.GPL included in the packaging of\r
+** this file.  Please review the following information to ensure GNU\r
+** General Public Licensing requirements will be met:\r
+** http://www.trolltech.com/products/qt/opensource.html\r
+**\r
+** If you are unsure which license is appropriate for your use, please\r
+** review the following information:\r
+** http://www.trolltech.com/products/qt/licensing.html or contact the\r
+** sales department at sales@trolltech.com.\r
+**\r
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE\r
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
+**\r
+*********************************************************************</comment>\r
+ <exportmacro></exportmacro>\r
+ <class>SaveFormAsTemplate</class>\r
+ <widget class="QDialog" name="SaveFormAsTemplate" >\r
+  <property name="geometry" >\r
+   <rect>\r
+    <x>0</x>\r
+    <y>0</y>\r
+    <width>391</width>\r
+    <height>149</height>\r
+   </rect>\r
+  </property>\r
+  <property name="windowTitle" >\r
+   <string>Save Form As Template...</string>\r
+  </property>\r
+  <layout class="QVBoxLayout" >\r
+   <property name="margin" >\r
+    <number>9</number>\r
+   </property>\r
+   <property name="spacing" >\r
+    <number>6</number>\r
+   </property>\r
+   <item>\r
+    <layout class="QGridLayout" >\r
+     <property name="margin" >\r
+      <number>1</number>\r
+     </property>\r
+     <property name="spacing" >\r
+      <number>6</number>\r
+     </property>\r
+     <item row="0" column="1" >\r
+      <widget class="QLineEdit" name="templateNameEdit" >\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>67</x>\r
+         <y>1</y>\r
+         <width>285</width>\r
+         <height>22</height>\r
+        </rect>\r
+       </property>\r
+       <property name="text" >\r
+        <string/>\r
+       </property>\r
+       <property name="echoMode" >\r
+        <enum>QLineEdit::Normal</enum>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+     <item row="1" column="1" >\r
+      <widget class="QComboBox" name="categoryCombo" >\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>67</x>\r
+         <y>29</y>\r
+         <width>285</width>\r
+         <height>26</height>\r
+        </rect>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+     <item row="1" column="0" >\r
+      <widget class="QLabel" name="label_2" >\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>1</x>\r
+         <y>29</y>\r
+         <width>60</width>\r
+         <height>26</height>\r
+        </rect>\r
+       </property>\r
+       <property name="frameShape" >\r
+        <enum>QFrame::NoFrame</enum>\r
+       </property>\r
+       <property name="frameShadow" >\r
+        <enum>QFrame::Plain</enum>\r
+       </property>\r
+       <property name="text" >\r
+        <string>&amp;Category:</string>\r
+       </property>\r
+       <property name="textFormat" >\r
+        <enum>Qt::AutoText</enum>\r
+       </property>\r
+       <property name="buddy" >\r
+        <cstring>categoryCombo</cstring>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+     <item row="0" column="0" >\r
+      <widget class="QLabel" name="label" >\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>1</x>\r
+         <y>1</y>\r
+         <width>60</width>\r
+         <height>22</height>\r
+        </rect>\r
+       </property>\r
+       <property name="frameShape" >\r
+        <enum>QFrame::NoFrame</enum>\r
+       </property>\r
+       <property name="frameShadow" >\r
+        <enum>QFrame::Plain</enum>\r
+       </property>\r
+       <property name="text" >\r
+        <string>&amp;Name:</string>\r
+       </property>\r
+       <property name="textFormat" >\r
+        <enum>Qt::AutoText</enum>\r
+       </property>\r
+       <property name="buddy" >\r
+        <cstring>templateNameEdit</cstring>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+    </layout>\r
+   </item>\r
+   <item>\r
+    <spacer>\r
+     <property name="geometry" >\r
+      <rect>\r
+       <x>9</x>\r
+       <y>71</y>\r
+       <width>373</width>\r
+       <height>20</height>\r
+      </rect>\r
+     </property>\r
+     <property name="orientation" >\r
+      <enum>Qt::Vertical</enum>\r
+     </property>\r
+     <property name="sizeHint" >\r
+      <size>\r
+       <width>20</width>\r
+       <height>40</height>\r
+      </size>\r
+     </property>\r
+    </spacer>\r
+   </item>\r
+   <item>\r
+    <widget class="QFrame" name="horizontalLine" >\r
+     <property name="geometry" >\r
+      <rect>\r
+       <x>9</x>\r
+       <y>97</y>\r
+       <width>373</width>\r
+       <height>3</height>\r
+      </rect>\r
+     </property>\r
+     <property name="frameShape" >\r
+      <enum>QFrame::HLine</enum>\r
+     </property>\r
+     <property name="frameShadow" >\r
+      <enum>QFrame::Sunken</enum>\r
+     </property>\r
+    </widget>\r
+   </item>\r
+   <item>\r
+    <layout class="QHBoxLayout" >\r
+     <property name="margin" >\r
+      <number>1</number>\r
+     </property>\r
+     <property name="spacing" >\r
+      <number>6</number>\r
+     </property>\r
+     <item>\r
+      <spacer>\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>1</x>\r
+         <y>1</y>\r
+         <width>197</width>\r
+         <height>32</height>\r
+        </rect>\r
+       </property>\r
+       <property name="orientation" >\r
+        <enum>Qt::Horizontal</enum>\r
+       </property>\r
+       <property name="sizeHint" >\r
+        <size>\r
+         <width>40</width>\r
+         <height>20</height>\r
+        </size>\r
+       </property>\r
+      </spacer>\r
+     </item>\r
+     <item>\r
+      <widget class="QPushButton" name="okButton" >\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>204</x>\r
+         <y>1</y>\r
+         <width>81</width>\r
+         <height>32</height>\r
+        </rect>\r
+       </property>\r
+       <property name="text" >\r
+        <string>OK</string>\r
+       </property>\r
+       <property name="default" >\r
+        <bool>true</bool>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+     <item>\r
+      <widget class="QPushButton" name="cancelButton" >\r
+       <property name="geometry" >\r
+        <rect>\r
+         <x>291</x>\r
+         <y>1</y>\r
+         <width>81</width>\r
+         <height>32</height>\r
+        </rect>\r
+       </property>\r
+       <property name="text" >\r
+        <string>Cancel</string>\r
+       </property>\r
+      </widget>\r
+     </item>\r
+    </layout>\r
+   </item>\r
+  </layout>\r
+ </widget>\r
+ <pixmapfunction></pixmapfunction>\r
+ <resources/>\r
+ <connections/>\r
+</ui>\r
diff --git a/src/designer/formdesigner/templates/forms/Dialog_with_Buttons_Bottom.ui b/src/designer/formdesigner/templates/forms/Dialog_with_Buttons_Bottom.ui
new file mode 100644 (file)
index 0000000..d7e4572
--- /dev/null
@@ -0,0 +1,100 @@
+<ui version="4.0" >\r
+ <author></author>\r
+ <comment></comment>\r
+ <exportmacro></exportmacro>\r
+ <class>Dialog</class>\r
+ <widget class="QDialog" name="Dialog" >\r
+  <property name="geometry" >\r
+   <rect>\r
+    <x>0</x>\r
+    <y>0</y>\r
+    <width>400</width>\r
+    <height>300</height>\r
+   </rect>\r
+  </property>\r
+  <property name="windowTitle" >\r
+   <string>Dialog</string>\r
+  </property>\r
+  <widget class="QWidget" name="layoutWidget" >\r
+   <property name="geometry" >\r
+    <rect>\r
+     <x>20</x>\r
+     <y>250</y>\r
+     <width>351</width>\r
+     <height>33</height>\r
+    </rect>\r
+   </property>\r
+   <layout class="QHBoxLayout" >\r
+    <property name="margin" >\r
+     <number>0</number>\r
+    </property>\r
+    <property name="spacing" >\r
+     <number>6</number>\r
+    </property>\r
+    <item>\r
+     <spacer>\r
+      <property name="orientation" >\r
+       <enum>Qt::Horizontal</enum>\r
+      </property>\r
+      <property name="sizeHint" >\r
+       <size>\r
+        <width>131</width>\r
+        <height>31</height>\r
+       </size>\r
+      </property>\r
+     </spacer>\r
+    </item>\r
+    <item>\r
+     <widget class="QPushButton" name="okButton" >\r
+      <property name="text" >\r
+       <string>OK</string>\r
+      </property>\r
+     </widget>\r
+    </item>\r
+    <item>\r
+     <widget class="QPushButton" name="cancelButton" >\r
+      <property name="text" >\r
+       <string>Cancel</string>\r
+      </property>\r
+     </widget>\r
+    </item>\r
+   </layout>\r
+  </widget>\r
+ </widget>\r
+ <pixmapfunction></pixmapfunction>\r
+ <resources/>\r
+ <connections>\r
+  <connection>\r
+   <sender>okButton</sender>\r
+   <signal>clicked()</signal>\r
+   <receiver>Dialog</receiver>\r
+   <slot>accept()</slot>\r
+   <hints>\r
+    <hint type="sourcelabel" >\r
+     <x>278</x>\r
+     <y>253</y>\r
+    </hint>\r
+    <hint type="destinationlabel" >\r
+     <x>96</x>\r
+     <y>254</y>\r
+    </hint>\r
+   </hints>\r
+  </connection>\r
+  <connection>\r
+   <sender>cancelButton</sender>\r
+   <signal>clicked()</signal>\r
+   <receiver>Dialog</receiver>\r
+   <slot>reject()</slot>\r
+   <hints>\r
+    <hint type="sourcelabel" >\r
+     <x>369</x>\r
+     <y>253</y>\r
+    </hint>\r
+    <hint type="destinationlabel" >\r
+     <x>179</x>\r
+     <y>282</y>\r
+    </hint>\r
+   </hints>\r
+  </connection>\r
+ </connections>\r
+</ui>\r
diff --git a/src/designer/formdesigner/templates/forms/Dialog_with_Buttons_Right.ui b/src/designer/formdesigner/templates/forms/Dialog_with_Buttons_Right.ui
new file mode 100644 (file)
index 0000000..00e2ca7
--- /dev/null
@@ -0,0 +1,100 @@
+<ui version="4.0" >\r
+ <author></author>\r
+ <comment></comment>\r
+ <exportmacro></exportmacro>\r
+ <class>Dialog</class>\r
+ <widget class="QDialog" name="Dialog" >\r
+  <property name="geometry" >\r
+   <rect>\r
+    <x>0</x>\r
+    <y>0</y>\r
+    <width>400</width>\r
+    <height>300</height>\r
+   </rect>\r
+  </property>\r
+  <property name="windowTitle" >\r
+   <string>Dialog</string>\r
+  </property>\r
+  <widget class="QWidget" name="layoutWidget" >\r
+   <property name="geometry" >\r
+    <rect>\r
+     <x>300</x>\r
+     <y>20</y>\r
+     <width>77</width>\r
+     <height>106</height>\r
+    </rect>\r
+   </property>\r
+   <layout class="QVBoxLayout" >\r
+    <property name="margin" >\r
+     <number>0</number>\r
+    </property>\r
+    <property name="spacing" >\r
+     <number>6</number>\r
+    </property>\r
+    <item>\r
+     <widget class="QPushButton" name="okButton" >\r
+      <property name="text" >\r
+       <string>OK</string>\r
+      </property>\r
+     </widget>\r
+    </item>\r
+    <item>\r
+     <widget class="QPushButton" name="cancelButton" >\r
+      <property name="text" >\r
+       <string>Cancel</string>\r
+      </property>\r
+     </widget>\r
+    </item>\r
+    <item>\r
+     <spacer>\r
+      <property name="orientation" >\r
+       <enum>Qt::Vertical</enum>\r
+      </property>\r
+      <property name="sizeHint" >\r
+       <size>\r
+        <width>20</width>\r
+        <height>40</height>\r
+       </size>\r
+      </property>\r
+     </spacer>\r
+    </item>\r
+   </layout>\r
+  </widget>\r
+ </widget>\r
+ <pixmapfunction></pixmapfunction>\r
+ <resources/>\r
+ <connections>\r
+  <connection>\r
+   <sender>okButton</sender>\r
+   <signal>clicked()</signal>\r
+   <receiver>Dialog</receiver>\r
+   <slot>accept()</slot>\r
+   <hints>\r
+    <hint type="sourcelabel" >\r
+     <x>351</x>\r
+     <y>38</y>\r
+    </hint>\r
+    <hint type="destinationlabel" >\r
+     <x>233</x>\r
+     <y>29</y>\r
+    </hint>\r
+   </hints>\r
+  </connection>\r
+  <connection>\r
+   <sender>cancelButton</sender>\r
+   <signal>clicked()</signal>\r
+   <receiver>Dialog</receiver>\r
+   <slot>reject()</slot>\r
+   <hints>\r
+    <hint type="sourcelabel" >\r
+     <x>330</x>\r
+     <y>66</y>\r
+    </hint>\r
+    <hint type="destinationlabel" >\r
+     <x>197</x>\r
+     <y>125</y>\r
+    </hint>\r
+   </hints>\r
+  </connection>\r
+ </connections>\r
+</ui>\r
diff --git a/src/designer/formdesigner/templates/forms/Main_Window.ui b/src/designer/formdesigner/templates/forms/Main_Window.ui
new file mode 100644 (file)
index 0000000..8b85924
--- /dev/null
@@ -0,0 +1,27 @@
+<ui version="4.0" >\r
+ <author></author>\r
+ <comment></comment>\r
+ <exportmacro></exportmacro>\r
+ <class>MainWindow</class>\r
+ <widget class="QMainWindow" name="MainWindow" >\r
+  <property name="objectName" >\r
+   <string notr="true" >MainWindow</string>\r
+  </property>\r
+  <property name="geometry" >\r
+   <rect>\r
+    <x>0</x>\r
+    <y>0</y>\r
+    <width>800</width>\r
+    <height>600</height>\r
+   </rect>\r
+  </property>\r
+  <property name="windowTitle" >\r
+   <string>MainWindow</string>\r
+  </property>\r
+  <widget class="QMenuBar" name="menubar" />\r
+  <widget class="QWidget" name="centralwidget" />\r
+  <widget class="QStatusBar" name="statusbar" />\r
+ </widget>\r
+ <pixmapfunction></pixmapfunction>\r
+ <connections/>\r
+</ui>\r
diff --git a/src/designer/formdesigner/templates/forms/Widget.ui b/src/designer/formdesigner/templates/forms/Widget.ui
new file mode 100644 (file)
index 0000000..c8f4991
--- /dev/null
@@ -0,0 +1,24 @@
+<ui version="4.0" >\r
+ <author></author>\r
+ <comment></comment>\r
+ <exportmacro></exportmacro>\r
+ <class>Form</class>\r
+ <widget class="QWidget" name="Form" >\r
+  <property name="objectName" >\r
+   <string notr="true" >Form</string>\r
+  </property>\r
+  <property name="geometry" >\r
+   <rect>\r
+    <x>0</x>\r
+    <y>0</y>\r
+    <width>400</width>\r
+    <height>300</height>\r
+   </rect>\r
+  </property>\r
+  <property name="windowTitle" >\r
+   <string>Form</string>\r
+  </property>\r
+ </widget>\r
+ <pixmapfunction></pixmapfunction>\r
+ <connections/>\r
+</ui>\r
diff --git a/src/designer/images/a-system.png b/src/designer/images/a-system.png
new file mode 100644 (file)
index 0000000..6638dff
Binary files /dev/null and b/src/designer/images/a-system.png differ
diff --git a/src/designer/images/action_g.png b/src/designer/images/action_g.png
new file mode 100644 (file)
index 0000000..4a50b3d
Binary files /dev/null and b/src/designer/images/action_g.png differ
diff --git a/src/designer/images/actions.png b/src/designer/images/actions.png
new file mode 100644 (file)
index 0000000..6046836
Binary files /dev/null and b/src/designer/images/actions.png differ
diff --git a/src/designer/images/arrow_down.png b/src/designer/images/arrow_down.png
new file mode 100644 (file)
index 0000000..3269dec
Binary files /dev/null and b/src/designer/images/arrow_down.png differ
diff --git a/src/designer/images/arrow_left.png b/src/designer/images/arrow_left.png
new file mode 100644 (file)
index 0000000..1529c9b
Binary files /dev/null and b/src/designer/images/arrow_left.png differ
diff --git a/src/designer/images/arrow_right.png b/src/designer/images/arrow_right.png
new file mode 100644 (file)
index 0000000..37f489c
Binary files /dev/null and b/src/designer/images/arrow_right.png differ
diff --git a/src/designer/images/arrow_up.png b/src/designer/images/arrow_up.png
new file mode 100644 (file)
index 0000000..a124ead
Binary files /dev/null and b/src/designer/images/arrow_up.png differ
diff --git a/src/designer/images/cat.png b/src/designer/images/cat.png
new file mode 100644 (file)
index 0000000..3c1ae0f
Binary files /dev/null and b/src/designer/images/cat.png differ
diff --git a/src/designer/images/cat_g.png b/src/designer/images/cat_g.png
new file mode 100644 (file)
index 0000000..9e6bc8e
Binary files /dev/null and b/src/designer/images/cat_g.png differ
diff --git a/src/designer/images/columns.png b/src/designer/images/columns.png
new file mode 100644 (file)
index 0000000..52d6fda
Binary files /dev/null and b/src/designer/images/columns.png differ
diff --git a/src/designer/images/d_editdelete.png b/src/designer/images/d_editdelete.png
new file mode 100644 (file)
index 0000000..7fc2c40
Binary files /dev/null and b/src/designer/images/d_editdelete.png differ
diff --git a/src/designer/images/designer-splash-en.png b/src/designer/images/designer-splash-en.png
new file mode 100644 (file)
index 0000000..0bd4739
Binary files /dev/null and b/src/designer/images/designer-splash-en.png differ
diff --git a/src/designer/images/designer-splash-ru.png b/src/designer/images/designer-splash-ru.png
new file mode 100644 (file)
index 0000000..8c449ea
Binary files /dev/null and b/src/designer/images/designer-splash-ru.png differ
diff --git a/src/designer/images/dimensions.png b/src/designer/images/dimensions.png
new file mode 100644 (file)
index 0000000..52d6fda
Binary files /dev/null and b/src/designer/images/dimensions.png differ
diff --git a/src/designer/images/doc.png b/src/designer/images/doc.png
new file mode 100644 (file)
index 0000000..61334f2
Binary files /dev/null and b/src/designer/images/doc.png differ
diff --git a/src/designer/images/doc_g.png b/src/designer/images/doc_g.png
new file mode 100644 (file)
index 0000000..fa0639b
Binary files /dev/null and b/src/designer/images/doc_g.png differ
diff --git a/src/designer/images/doc_h.png b/src/designer/images/doc_h.png
new file mode 100644 (file)
index 0000000..c304a03
Binary files /dev/null and b/src/designer/images/doc_h.png differ
diff --git a/src/designer/images/editcopy.png b/src/designer/images/editcopy.png
new file mode 100644 (file)
index 0000000..4a7c257
Binary files /dev/null and b/src/designer/images/editcopy.png differ
diff --git a/src/designer/images/editcut.png b/src/designer/images/editcut.png
new file mode 100644 (file)
index 0000000..5690a3c
Binary files /dev/null and b/src/designer/images/editcut.png differ
diff --git a/src/designer/images/editdelete.png b/src/designer/images/editdelete.png
new file mode 100644 (file)
index 0000000..feb3242
Binary files /dev/null and b/src/designer/images/editdelete.png differ
diff --git a/src/designer/images/editedit.png b/src/designer/images/editedit.png
new file mode 100644 (file)
index 0000000..bff902d
Binary files /dev/null and b/src/designer/images/editedit.png differ
diff --git a/src/designer/images/editpaste.png b/src/designer/images/editpaste.png
new file mode 100644 (file)
index 0000000..059c1f9
Binary files /dev/null and b/src/designer/images/editpaste.png differ
diff --git a/src/designer/images/editrename.png b/src/designer/images/editrename.png
new file mode 100644 (file)
index 0000000..1204738
Binary files /dev/null and b/src/designer/images/editrename.png differ
diff --git a/src/designer/images/editsep.png b/src/designer/images/editsep.png
new file mode 100644 (file)
index 0000000..d311198
Binary files /dev/null and b/src/designer/images/editsep.png differ
diff --git a/src/designer/images/element.png b/src/designer/images/element.png
new file mode 100644 (file)
index 0000000..52d6fda
Binary files /dev/null and b/src/designer/images/element.png differ
diff --git a/src/designer/images/field.png b/src/designer/images/field.png
new file mode 100644 (file)
index 0000000..265c4cc
Binary files /dev/null and b/src/designer/images/field.png differ
diff --git a/src/designer/images/filenew.png b/src/designer/images/filenew.png
new file mode 100644 (file)
index 0000000..8159fa0
Binary files /dev/null and b/src/designer/images/filenew.png differ
diff --git a/src/designer/images/fileopen.png b/src/designer/images/fileopen.png
new file mode 100644 (file)
index 0000000..8f5e7f3
Binary files /dev/null and b/src/designer/images/fileopen.png differ
diff --git a/src/designer/images/filesave.png b/src/designer/images/filesave.png
new file mode 100644 (file)
index 0000000..78adfbf
Binary files /dev/null and b/src/designer/images/filesave.png differ
diff --git a/src/designer/images/form.png b/src/designer/images/form.png
new file mode 100644 (file)
index 0000000..d4e263c
Binary files /dev/null and b/src/designer/images/form.png differ
diff --git a/src/designer/images/form_g.png b/src/designer/images/form_g.png
new file mode 100644 (file)
index 0000000..99cfdcb
Binary files /dev/null and b/src/designer/images/form_g.png differ
diff --git a/src/designer/images/function.png b/src/designer/images/function.png
new file mode 100644 (file)
index 0000000..c286f9a
Binary files /dev/null and b/src/designer/images/function.png differ
diff --git a/src/designer/images/group.png b/src/designer/images/group.png
new file mode 100644 (file)
index 0000000..52d6fda
Binary files /dev/null and b/src/designer/images/group.png differ
diff --git a/src/designer/images/help.png b/src/designer/images/help.png
new file mode 100644 (file)
index 0000000..f57e722
Binary files /dev/null and b/src/designer/images/help.png differ
diff --git a/src/designer/images/hi22-action-project_open.png b/src/designer/images/hi22-action-project_open.png
new file mode 100644 (file)
index 0000000..0dfd194
Binary files /dev/null and b/src/designer/images/hi22-action-project_open.png differ
diff --git a/src/designer/images/hi22-action-run.png b/src/designer/images/hi22-action-run.png
new file mode 100644 (file)
index 0000000..70271db
Binary files /dev/null and b/src/designer/images/hi22-action-run.png differ
diff --git a/src/designer/images/information.png b/src/designer/images/information.png
new file mode 100644 (file)
index 0000000..06a942b
Binary files /dev/null and b/src/designer/images/information.png differ
diff --git a/src/designer/images/journ.png b/src/designer/images/journ.png
new file mode 100644 (file)
index 0000000..4d92109
Binary files /dev/null and b/src/designer/images/journ.png differ
diff --git a/src/designer/images/journ_g.png b/src/designer/images/journ_g.png
new file mode 100644 (file)
index 0000000..8739e8d
Binary files /dev/null and b/src/designer/images/journ_g.png differ
diff --git a/src/designer/images/m_menu.png b/src/designer/images/m_menu.png
new file mode 100644 (file)
index 0000000..ba6a690
Binary files /dev/null and b/src/designer/images/m_menu.png differ
diff --git a/src/designer/images/msg_error.png b/src/designer/images/msg_error.png
new file mode 100644 (file)
index 0000000..901b8b6
Binary files /dev/null and b/src/designer/images/msg_error.png differ
diff --git a/src/designer/images/msg_fatal.png b/src/designer/images/msg_fatal.png
new file mode 100644 (file)
index 0000000..901b8b6
Binary files /dev/null and b/src/designer/images/msg_fatal.png differ
diff --git a/src/designer/images/msg_info.png b/src/designer/images/msg_info.png
new file mode 100644 (file)
index 0000000..f3c275f
Binary files /dev/null and b/src/designer/images/msg_info.png differ
diff --git a/src/designer/images/msg_warning.png b/src/designer/images/msg_warning.png
new file mode 100644 (file)
index 0000000..901b8b6
Binary files /dev/null and b/src/designer/images/msg_warning.png differ
diff --git a/src/designer/images/object.png b/src/designer/images/object.png
new file mode 100644 (file)
index 0000000..a7d5d9a
Binary files /dev/null and b/src/designer/images/object.png differ
diff --git a/src/designer/images/p_menus.png b/src/designer/images/p_menus.png
new file mode 100644 (file)
index 0000000..cd6a360
Binary files /dev/null and b/src/designer/images/p_menus.png differ
diff --git a/src/designer/images/play.png b/src/designer/images/play.png
new file mode 100644 (file)
index 0000000..dfc0048
Binary files /dev/null and b/src/designer/images/play.png differ
diff --git a/src/designer/images/playprev.png b/src/designer/images/playprev.png
new file mode 100644 (file)
index 0000000..d2a72b4
Binary files /dev/null and b/src/designer/images/playprev.png differ
diff --git a/src/designer/images/print.png b/src/designer/images/print.png
new file mode 100644 (file)
index 0000000..b03cafd
Binary files /dev/null and b/src/designer/images/print.png differ
diff --git a/src/designer/images/project.png b/src/designer/images/project.png
new file mode 100644 (file)
index 0000000..1837c0a
Binary files /dev/null and b/src/designer/images/project.png differ
diff --git a/src/designer/images/qsa.png b/src/designer/images/qsa.png
new file mode 100644 (file)
index 0000000..9f0f797
Binary files /dev/null and b/src/designer/images/qsa.png differ
diff --git a/src/designer/images/redo.png b/src/designer/images/redo.png
new file mode 100644 (file)
index 0000000..05cbcdf
Binary files /dev/null and b/src/designer/images/redo.png differ
diff --git a/src/designer/images/reg.png b/src/designer/images/reg.png
new file mode 100644 (file)
index 0000000..bab93ce
Binary files /dev/null and b/src/designer/images/reg.png differ
diff --git a/src/designer/images/reg_g.png b/src/designer/images/reg_g.png
new file mode 100644 (file)
index 0000000..da52b84
Binary files /dev/null and b/src/designer/images/reg_g.png differ
diff --git a/src/designer/images/regs.png b/src/designer/images/regs.png
new file mode 100644 (file)
index 0000000..cbc4419
Binary files /dev/null and b/src/designer/images/regs.png differ
diff --git a/src/designer/images/regs_g.png b/src/designer/images/regs_g.png
new file mode 100644 (file)
index 0000000..20b41fd
Binary files /dev/null and b/src/designer/images/regs_g.png differ
diff --git a/src/designer/images/report.png b/src/designer/images/report.png
new file mode 100644 (file)
index 0000000..0c4bb0c
Binary files /dev/null and b/src/designer/images/report.png differ
diff --git a/src/designer/images/report_g.png b/src/designer/images/report_g.png
new file mode 100644 (file)
index 0000000..04a49b1
Binary files /dev/null and b/src/designer/images/report_g.png differ
diff --git a/src/designer/images/resourses.png b/src/designer/images/resourses.png
new file mode 100644 (file)
index 0000000..52d6fda
Binary files /dev/null and b/src/designer/images/resourses.png differ
diff --git a/src/designer/images/script.png b/src/designer/images/script.png
new file mode 100644 (file)
index 0000000..3b46132
Binary files /dev/null and b/src/designer/images/script.png differ
diff --git a/src/designer/images/scriptnew.png b/src/designer/images/scriptnew.png
new file mode 100644 (file)
index 0000000..f9008bf
Binary files /dev/null and b/src/designer/images/scriptnew.png differ
diff --git a/src/designer/images/scriptobject.png b/src/designer/images/scriptobject.png
new file mode 100644 (file)
index 0000000..6dfd96b
Binary files /dev/null and b/src/designer/images/scriptobject.png differ
diff --git a/src/designer/images/searchfind.png b/src/designer/images/searchfind.png
new file mode 100644 (file)
index 0000000..272aef6
Binary files /dev/null and b/src/designer/images/searchfind.png differ
diff --git a/src/designer/images/separator.png b/src/designer/images/separator.png
new file mode 100644 (file)
index 0000000..ed6f369
Binary files /dev/null and b/src/designer/images/separator.png differ
diff --git a/src/designer/images/submenu.png b/src/designer/images/submenu.png
new file mode 100644 (file)
index 0000000..ac57159
Binary files /dev/null and b/src/designer/images/submenu.png differ
diff --git a/src/designer/images/table.png b/src/designer/images/table.png
new file mode 100644 (file)
index 0000000..3d73517
Binary files /dev/null and b/src/designer/images/table.png differ
diff --git a/src/designer/images/table_g.png b/src/designer/images/table_g.png
new file mode 100644 (file)
index 0000000..b6042e4
Binary files /dev/null and b/src/designer/images/table_g.png differ
diff --git a/src/designer/images/toolbar.png b/src/designer/images/toolbar.png
new file mode 100644 (file)
index 0000000..b47aa63
Binary files /dev/null and b/src/designer/images/toolbar.png differ
diff --git a/src/designer/images/undo.png b/src/designer/images/undo.png
new file mode 100644 (file)
index 0000000..cbcda87
Binary files /dev/null and b/src/designer/images/undo.png differ
diff --git a/src/designer/images/webform.png b/src/designer/images/webform.png
new file mode 100644 (file)
index 0000000..781874a
Binary files /dev/null and b/src/designer/images/webform.png differ
diff --git a/src/designer/images/webform_g.png b/src/designer/images/webform_g.png
new file mode 100644 (file)
index 0000000..91c0e21
Binary files /dev/null and b/src/designer/images/webform_g.png differ
diff --git a/src/designer/interfacetree.cpp b/src/designer/interfacetree.cpp
new file mode 100644 (file)
index 0000000..8f47ec8
--- /dev/null
@@ -0,0 +1,359 @@
+/****************************************************************************
+** $Id: interfacetree.cpp,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Code file of the Interface Tree of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <q3listview.h>
+#include <q3header.h>
+#include <q3popupmenu.h>
+#include <qlabel.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <QPixmap>
+
+#include "acfg.h"
+#include "interfacetree.h"
+#include "mainform.h"
+#include "deditcommand.h"
+#include "dedittoolbar.h"
+#include "awindowslist.h"
+
+extern MainForm *mainform;
+extern QPixmap rcIcon(const char *name);
+extern void set_Icon(Q3ListViewItem *item, const char *name);
+
+InterfaceListViewItem::InterfaceListViewItem( Q3ListView *parent, aCfg * cfgmd, aCfgItem cfgobj, const QString &name )
+: ananasListViewItem( parent, cfgmd, cfgobj, name )
+{
+       id = md->id(obj);
+       if ( ( id ) && ( md->objClass(obj) != md_separator ) ) setRenameEnabled(0, true);
+       aCfgItem comaction, active;
+       QPixmap pix;
+       int idd;
+
+       comaction = md->findChild( obj, md_comaction, 0 );
+       idd = md->text( comaction ).toInt();
+       active = md->findChild( md->find( idd ), md_active_picture, 0 );
+       pix.loadFromData( md->binary( active ) );
+       setPixmap( 0, pix );
+       pix = 0;
+};
+
+InterfaceListViewItem::InterfaceListViewItem( ananasListViewItem *parent, ananasListViewItem
+                                               *after, aCfg * cfgmd, aCfgItem cfgobj, const QString &name )
+: ananasListViewItem( parent, after, cfgmd, cfgobj, name )
+{
+       id = md->id( obj );
+       if ( ( id ) && ( md->objClass(obj) != md_separator ) ) setRenameEnabled(0, true);
+
+       aCfgItem comaction, active;
+       int idd;
+       QPixmap pix;
+
+       comaction = md->findChild( obj, md_comaction, 0 );
+       idd = md->text( comaction ).toInt();
+       active = md->findChild( md->find( idd ), md_active_picture, 0 );
+       pix.loadFromData( md->binary( active ) );
+       setPixmap( 0, pix );
+       pix = 0;
+};
+
+void
+InterfaceListViewItem::loadTree()
+{
+       QString                         oclass;
+       aCfgItem                        cobj;
+
+       clearTree();
+
+       if ( !md ) return;
+       cobj = md->firstChild ( obj );
+       while ( !cobj.isNull() )
+       {
+               oclass = md->objClass ( cobj );
+               if ( oclass == md_submenu || oclass == md_popupmenu || oclass == md_toolbar )
+               {
+                       loadSubmenu ( this, getLastChild(), cobj );
+               }
+               oclass = md->objClass ( cobj );
+               if ( oclass == md_command )
+               {
+                       loadCommand ( this, getLastChild(), cobj );
+               }
+               oclass = md->objClass ( cobj );
+               if ( oclass == md_separator )
+               {
+                       loadSeparator ( this, getLastChild(), cobj );
+               }
+               cobj = md->nextSibling ( cobj );
+       }
+};
+
+void
+InterfaceListViewItem::loadSubmenu ( ananasListViewItem * parent, ananasListViewItem *after, aCfgItem child )
+{
+       InterfaceListViewItem * mparent;
+       QString                         oclass;
+       aCfgItem                        cobj;
+
+       mparent = new InterfaceListViewItem( parent, after, md, child, QString::null );
+       mparent->setPixmap(0, rcIcon("submenu.png"));
+       cobj = md->firstChild ( mparent->obj );
+       while ( !cobj.isNull() )
+       {
+               oclass = md->objClass ( cobj );
+               if ( oclass == md_submenu  || oclass == md_toolbar )
+               {
+                       loadSubmenu ( mparent, mparent->getLastChild(), cobj );
+               }
+               oclass = md->objClass ( cobj );
+               if ( oclass == md_command )
+               {
+                       loadCommand ( mparent, mparent->getLastChild(), cobj );
+               }
+               oclass = md->objClass ( cobj );
+               if ( oclass == md_separator )
+               {
+                       loadSeparator ( mparent, mparent->getLastChild(), cobj );
+               }
+               cobj = md->nextSibling ( cobj );
+       }
+};
+
+void
+InterfaceListViewItem::loadCommand ( ananasListViewItem * parent, ananasListViewItem *after, aCfgItem child )
+{
+       new InterfaceListViewItem(  parent, after, md, child, QString::null );
+};
+
+void
+InterfaceListViewItem::loadSeparator ( ananasListViewItem * parent, ananasListViewItem *after, aCfgItem child )
+{
+       InterfaceListViewItem   *newitem;
+       newitem = new InterfaceListViewItem( parent, after, md,child,QObject::tr("-------------------") );
+       newitem->setPixmap(0, rcIcon("separator.png"));
+
+};
+
+void
+InterfaceListViewItem::newCommand ()
+{
+       aCfgItem                        newobj;
+       InterfaceListViewItem   *newitem;//, *par;
+       QString                         oclass = md->objClass( obj );
+
+/*     par = (InterfaceListViewItem *)this->parent();
+       if ( par->text( 0 ) != QObject::tr("Interface") ) obj = md->findChild( obj, md_toolbars );
+*/     if ( oclass == md_popupmenu || oclass == md_submenu ||
+               oclass == md_mainmenu || oclass == md_toolbar )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insert( obj, md_command, QObject::tr("New Command") );
+               newitem = new InterfaceListViewItem( this, getLastChild(), md, newobj );
+//             newitem->setSelected( TRUE );
+               newitem->edit();
+       };
+}
+
+void
+InterfaceListViewItem::newSubmenu ()
+{
+       aCfgItem                        newobj;
+       InterfaceListViewItem   *newitem;
+       QString                         oclass = md->objClass( obj );
+
+       if ( oclass == md_submenu || oclass ==  md_mainmenu ||
+               oclass == md_toolbars || oclass == md_popupmenus || oclass == md_popupmenu )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               if ( oclass == md_popupmenus ) newobj = md->insert( obj, md_popupmenu, QObject::tr("New Popup menu") );
+               else
+               if ( oclass == md_toolbars ) newobj = md->insert( obj, md_toolbar, QObject::tr("New tool bar") );
+               else
+               newobj = md->insert( obj, md_submenu, QObject::tr("New Submenu") );
+               newitem = new InterfaceListViewItem( this, getLastChild(), md, newobj );
+               newitem->setPixmap(0, rcIcon("submenu.png"));
+//             newitem->setSelected( TRUE );
+       };
+
+}
+
+void
+InterfaceListViewItem::newSeparator ()
+{
+       aCfgItem                        newobj;
+       InterfaceListViewItem   *newitem;
+       QString                         oclass = md->objClass( obj );
+
+       if ( oclass == md_submenu || oclass == md_mainmenu || oclass == md_popupmenu )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insert( obj, md_separator );
+               newitem = new InterfaceListViewItem( this, getLastChild(), md, newobj, QObject::tr("-------------------") );
+               newitem->setPixmap(0, rcIcon("separator.png"));
+//             newitem->setSelected( TRUE );
+
+       };
+}
+
+void
+InterfaceListViewItem::edit ()
+{
+    QWorkspace *ws = mainform->ws;
+    aWindowsList *wl = mainform->wl;
+    QString oclass = md->objClass( obj );
+    int objid = md->id( obj );
+    if ( wl->find( objid ) ) {
+       wl->get( objid )->setFocus();
+       return;
+    }
+
+    if ( oclass == md_command )
+    {
+       dEditCommand * e = new dEditCommand ( ws, 0, Qt::WDestructiveClose );
+       wl->insert( objid, e );
+       editor = e;
+       QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+       e->setData( this );
+       e->show();
+       //--mainform->addTab(++mainform->lastTabId,e->name());
+       mainform->addTab(e);
+       return;
+    }
+}
+
+
+InterfaceTreeView::InterfaceTreeView ( QWidget *parent, aCfg *cfgmd )
+: ananasTreeView ( parent, cfgmd )
+{
+       InterfaceListViewItem *mainmenu, *toolbars, *popups;
+       aCfgItem iface, item;
+       iface = md->find ( mdc_interface );
+       if ( iface.isNull() ) iface = md->insert( md->find ( mdc_root ), md_interface, QString::null, -1 );
+       item = md->find ( iface, md_toolbars );
+       if ( item.isNull() ) item = md->insert( iface, md_toolbars, QString::null, -1 );
+       toolbars = new InterfaceListViewItem ( this, md, item, QObject::tr ( "Toolbars" ) );
+       toolbars->setPixmap(0, rcIcon("toolbar.png"));
+       toolbars->loadTree();
+       toolbars->setOpen ( TRUE );
+       item = md->find ( iface, md_mainmenu );
+       if ( item.isNull() ) item = md->insert( iface, md_mainmenu, QString::null, -1 );
+       mainmenu = new InterfaceListViewItem ( this, md, item, QObject::tr ( "Main menu" ) );
+       mainmenu->setPixmap(0, rcIcon("m_menu.png"));
+       mainmenu->loadTree();
+       mainmenu->setOpen ( TRUE );
+       item = md->find ( iface, md_popupmenus );
+       if ( item.isNull() ) item = md->insert( iface, md_popupmenus, QString::null, -1 );
+       popups = new InterfaceListViewItem ( this, md, item, QObject::tr ( "Popup menus" ) );
+       popups->setPixmap(0, rcIcon("p_menus.png"));
+       popups->loadTree();
+       popups->setOpen ( TRUE );
+       connect( this, SIGNAL( contextMenuRequested( Q3ListViewItem*, const QPoint&, int) ), this, SLOT(ContextMenu() ) );
+       connect( this, SIGNAL( returnPressed( Q3ListViewItem*) ), this, SLOT( itemEdit() ) );
+       connect( this, SIGNAL( doubleClicked( Q3ListViewItem*) ), this, SLOT( itemEdit() ) );
+};
+
+
+void
+InterfaceTreeView::ContextMenu()
+{
+       Q3PopupMenu *m=new Q3PopupMenu( this, "PopupMenu" );
+       Q_CHECK_PTR(m);
+
+/*     QLabel *caption = new QLabel( "<font color=darkblue><u><b>" "Context Menu</b></u></font>", this );
+       caption->setAlignment( Qt::AlignCenter );
+       m->insertItem( caption );
+       m->insertItem( tr("&Rename"), this, SLOT( itemRename() ), CTRL+Key_R);
+       m->insertItem( tr("&Edit"),  this, SLOT( itemEdit() ), CTRL+Key_E );
+       m->insertItem( tr("&Delete"), this, SLOT( itemDelete() ), CTRL+Key_D );
+       m->insertItem( tr("&MoveUp"), this, SLOT( itemMoveUp() ), CTRL+Key_U );
+       m->insertItem( tr("&MoveDown"), this, SLOT( itemMoveDown() ), CTRL+Key_M );
+*/
+       ananasTreeView::ContextMenuAdd( m );
+       m->insertItem( tr("&New Submenu"),  this, SLOT( itemNewSubmenu() ), Qt::CTRL+Qt::Key_N );
+       m->insertItem( tr("New &Command"),  this, SLOT( itemNewCommand() ), Qt::CTRL+Qt::Key_C );
+       m->insertItem( tr("New &Separator"),  this, SLOT( itemNewSeparator() ), Qt::CTRL+Qt::Key_S );
+       m->exec( QCursor::pos() );
+       delete m;
+};
+
+void
+InterfaceTreeView::itemNewSubmenu()
+{
+       InterfaceListViewItem *i = (InterfaceListViewItem *) selectedItem();
+       if ( i )
+               i->newSubmenu();
+};
+
+void
+InterfaceTreeView::itemNewCommand()
+{
+       InterfaceListViewItem *i = (InterfaceListViewItem *) selectedItem();
+       if ( i )
+               i->newCommand();
+};
+
+void
+InterfaceTreeView::itemNewSeparator()
+{
+       InterfaceListViewItem *i = (InterfaceListViewItem *) selectedItem();
+       if ( i )
+               i->newSeparator();
+};
+
+void
+InterfaceTreeView::itemDelete()
+{
+       deleteItem();
+};
+
+void
+InterfaceTreeView::itemMoveUp()
+{
+       moveUpItem();
+};
+
+void
+InterfaceTreeView::itemMoveDown()
+{
+       moveDownItem();
+};
+
+void
+InterfaceTreeView::itemEdit()
+{
+       InterfaceListViewItem *i = (InterfaceListViewItem *) selectedItem();
+       if ( i ) i->edit();
+};
+void
+InterfaceTreeView::itemRename()
+{
+       renameItem();
+}
+
diff --git a/src/designer/interfacetree.h b/src/designer/interfacetree.h
new file mode 100644 (file)
index 0000000..f9e452c
--- /dev/null
@@ -0,0 +1,74 @@
+/****************************************************************************
+** $Id: interfacetree.h,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Header file of the Interface Tree of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef INTERFACETREE_H
+#define INTERFACETREE_H
+#include <q3listview.h>
+#include <q3intdict.h>
+//#include "acfg.h"
+#include "atreeitems.h"
+
+class QWidget;
+
+class InterfaceListViewItem : public ananasListViewItem
+{
+public:
+       InterfaceListViewItem( Q3ListView *parent, aCfg * cfgmd, aCfgItem cfgobj, const QString &name = QString::null );
+       InterfaceListViewItem( ananasListViewItem *parent, ananasListViewItem *after, aCfg * cfgmd, aCfgItem cfgobj,
+                                               const QString &name = QString::null );
+       void loadTree();
+       void newCommand ();
+       void newSubmenu ();
+       void newSeparator ();
+       void edit ();
+private:
+       void loadSubmenu ( ananasListViewItem * parent, ananasListViewItem *after, aCfgItem child );
+       void loadCommand ( ananasListViewItem * parent, ananasListViewItem *after, aCfgItem  child );
+       void loadSeparator ( ananasListViewItem * parent, ananasListViewItem *after, aCfgItem  child);
+};
+
+class InterfaceTreeView : public ananasTreeView
+{
+    Q_OBJECT
+public:
+       InterfaceTreeView( QWidget *parent, aCfg *cfgmd );
+
+public slots:
+       void ContextMenu();
+       void itemNewSubmenu();
+       void itemNewCommand();
+       void itemNewSeparator();
+       void itemDelete();
+       void itemEdit();
+       void itemMoveUp ();
+       void itemMoveDown ();
+       void itemRename();
+
+};
+
+#endif //INTERFACETREE_H
diff --git a/src/designer/main.cpp b/src/designer/main.cpp
new file mode 100644 (file)
index 0000000..97c73fe
--- /dev/null
@@ -0,0 +1,195 @@
+/****************************************************************************
+** $Id: main.cpp,v 1.5 2008/12/05 21:11:54 leader Exp $
+**
+** Main file of Ananas Designer application
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <aapplication.h>
+#include <qtranslator.h>
+#include <qsplashscreen.h>
+#include <qtextcodec.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <q3mimefactory.h>
+#include "alog.h"
+#include "ananas.h"
+#include "mainform.h"
+#include "dselectdb.h"
+#include "formdesigner.h"
+
+MainForm *mainform = 0;
+aWindowsList *mainformwl = 0;
+QWorkspace *mainformws = 0;
+//QApplication *application = 0;
+QTranslator *translator = 0, tr_app(0), tr_lib(0), tr_plugins(0);
+aFormDesigner *formdesigner = 0;
+QString lang="en",
+       rcfile="",
+       username="",
+       userpassword="";
+
+
+int setTranslator(QString lang)
+{
+        QString langdir;
+#ifdef Q_OS_WIN32
+       langdir = qApp->applicationDirPath()+"/translations/";
+#else
+       langdir = "/usr/share/ananas4/translations/";
+#endif
+       tr_app.load( langdir+"ananas-designer-"+lang+".qm",".");
+       tr_lib.load( langdir+"ananas-lib-"+lang+".qm",".");
+       tr_plugins.load( langdir+"ananas-plugins-"+lang+".qm",".");
+       return 0;
+}
+
+int
+parseCommandLine( int argc, char **argv )
+{
+       QString param, name, value;
+       int i;
+       char *s, locale[50]="en";
+
+       strncpy( locale, QTextCodec::locale(), sizeof( locale ) );
+       s = strchr( locale, '_' );
+       if ( s ) {
+           *s = 0;
+       }
+        lang = locale;
+        setTranslator( lang );
+//     printf("locale=%s\n", locale );
+       QString str_ru=QString::null, str_en=QString::null;
+       bool lang_setted = false;
+       bool help_setted = false;
+       for ( i=1; i<argc; i++)
+       {
+           param = argv[i];
+           name = param.section("=",0,0).lower();
+           value = param.section("=",1);
+           if (param == "--help")
+           {
+                   str_ru = "Использование: ananas-designer [--help] [--lang=<LANG>] [--rc=<RC_PATH>]\n";
+                   str_ru+= "LANG=ru|en\n";
+                   str_ru+= "RC_PATH=путь к *.rc файлу описания бизнес схемы\n";
+
+                   str_en = "Usage: ananas-designer [--help] [--lang=<LANG>] [--rc=<RC_PATH>]\n";
+                   str_en+= "LANG=ru|en\n";
+                   str_en+= "RC_PATH=path to *.rc file of paticular business scheme\n";
+                   help_setted = true;
+
+           }
+           if (name == "--lang") {
+               lang = value;
+               lang_setted = true;
+               setTranslator( lang );
+           }
+           if (name == "--rc") rcfile = value;
+       }
+       if(help_setted)
+       {
+               if(lang == "ru")
+               {
+                       printf("%s",(const char*)str_ru.local8Bit());
+               }
+               else
+               {
+                       printf("%s",str_en.ascii());
+               }
+               return 1;
+       }
+       return 0;
+}
+
+
+int main( int argc, char ** argv )
+{
+       AApplication app ( argc, argv, AApplication::Designer );
+       MainForm *w = new MainForm();
+//#ifndef _Windows
+        QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF8") );
+//#endif
+
+    // Для QSettings
+       app.setOrganizationName("ananasgroup");
+        app.setApplicationName("ananas");
+
+       mainform = w;
+       mainformws = mainform->ws;
+       mainformwl = mainform->wl;
+//     application = &app;
+//     dSelectDB dselectdb;
+       int rc;
+       QPixmap pixmap;
+
+       if ( parseCommandLine( argc, argv ) ) return 1;
+       qApp->installTranslator( &tr_lib );
+       qApp->installTranslator( &tr_plugins );
+       qApp->installTranslator( &tr_app );
+       pixmap = QPixmap( ":/images/designer-splash-"+lang+".png" );
+       if ( pixmap.isNull() )
+#ifdef Q_OS_WIN32
+       pixmap = QPixmap( qApp->applicationDirPath()+"/designer-splash-"+lang+".png" );
+       qApp->addLibraryPath( qApp->applicationDirPath() );
+#else
+       pixmap = QPixmap( "/usr/share/ananas4/designer/locale/designer-splash-"+lang+".png" );
+//     qApp->addLibraryPath( "/usr/lib/ananas4/" );
+       qApp->setLibraryPaths( QStringList() <<"/usr/lib/ananas4/" );
+#endif
+       foreach (QString path, app.libraryPaths())
+           printf("%s\n", path.toUtf8().data());
+     
+       if ( pixmap.isNull() )
+       pixmap = QPixmap( ":/images/designer-splash-en.png" );
+       QSplashScreen *splash = new QSplashScreen( pixmap );
+       if ( ananas_login( rcfile, username, userpassword, 0, AApplication::Designer ) ){
+               splash->show();
+               splash->message( QObject::tr("Init application"), Qt::AlignBottom, Qt::white );
+               w->rcfile = rcfile;
+               qApp->setMainWidget( w );
+               splash->message( QObject::tr("Init forms designer"), Qt::AlignBottom, Qt::white  );
+               formdesigner = new aFormDesigner();
+
+               //--formdesigner->reparent( mainformws, 0, QPoint( 5, 5 ), false );
+//             mainformws->addWindow(formdesigner);
+               formdesigner->setCaption( QObject::tr("Dialog forms designer") );
+               formdesigner->hide();
+               w->show();
+               splash->clear();
+                       splash->finish( w );
+                       delete splash;
+               qApp->connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
+               mainform->configOpen();
+//             QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF8") );
+
+               rc = app.exec();
+               if( w ) delete w;
+               w=0;
+               aLog::close();
+               ananas_logout();
+               return rc;
+       }
+       aLog::close();
+       return 0;
+}
diff --git a/src/designer/mainform.cpp b/src/designer/mainform.cpp
new file mode 100644 (file)
index 0000000..ab3be19
--- /dev/null
@@ -0,0 +1,496 @@
+#include "mainform.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "qtoolbutton.h"
+
+#include <qapplication.h>
+#include <qsettings.h>
+#include "q3filedialog.h"
+#include "qstatusbar.h"
+#include "qmessagebox.h"
+#include <qapplication.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include <Q3Frame>
+#include <Q3PopupMenu>
+
+#include "ananas.h"
+//#include "adatabase.h"
+//#include "acfgrc.h"
+#include "cfgform.h"
+//#include "messageswindow.h"
+#include "dselectdb.h"
+#include "alog.h"
+
+//#include "qananastable.h"
+
+extern CfgForm *configform;
+//extern QApplication *application;
+extern void messageproc(int n, const char *msg);
+
+/*
+ *  Constructs a MainForm as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+MainForm::MainForm(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+MainForm::~MainForm()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void MainForm::languageChange()
+{
+    retranslateUi(this);
+}
+
+void MainForm::filePrint()
+{
+
+}
+
+void MainForm::fileExit()
+{
+//    cfg_done();
+}
+
+void MainForm::editUndo()
+{
+
+}
+
+void MainForm::editRedo()
+{
+
+}
+
+void MainForm::editCut()
+{
+
+}
+
+void MainForm::editCopy()
+{
+
+}
+
+void MainForm::editPaste()
+{
+
+}
+
+void MainForm::editFind()
+{
+
+}
+
+void MainForm::helpIndex()
+{
+
+}
+
+void MainForm::helpContents()
+{
+
+}
+
+void MainForm::helpAbout()
+{
+    QMessageBox::about( this, tr("About Ananas.Designer"),
+                       tr("<h4>Ananas.Designer %1</h4> is a programm<br>"
+                          "for adjusting accounting automation system<br><br>"
+                          "Copyright 2003-2006 Leader Infotech, Valery Grazdankin <br>"
+                          "Copyright 2003-2006 Project Ananas, Andrey Paskal, Grigory Panov, Andrey Strelnikov<br>"
+                          "License: GPL<br><br>"
+                          "technical support:<br>"
+                          "lider-infotech@narod.ru<br>"
+                          "app@linux.ru.net<br>"
+                          "Web sites:<br>"
+                          "<a href=\"http://ananas.lrn.ru\">http://ananas.lrn.ru</a><br>"
+                          "<a href=\"http://www.leaderit.ru\">http://www.leaderit.ru</a>"
+                          "<br><br>Avalable extensions:<br>%2").arg(ananas_libversion()).arg( ""/*--AExtensionFactory::keys().join(", ")*/) );
+}
+
+
+void MainForm::init()
+{
+
+
+    setName("ananas-designer_mainwindow");
+    rcfile="";
+    windowsMenu = new Q3PopupMenu( this );
+    windowsMenu->setCheckable( TRUE );
+    connect( windowsMenu, SIGNAL( aboutToShow() ),
+            this, SLOT( windowsMenuAboutToShow() ) );
+    menuBar()->insertItem( tr("&Windows"), windowsMenu );
+
+    menuBar()->insertSeparator();
+    Q3PopupMenu * help = new Q3PopupMenu( this );
+    menuBar()->insertItem( tr("&Help"), help );
+
+    help->insertItem( tr("&About"), this, SLOT(helpAbout()), Qt::Key_F1);
+  //  help->insertItem( tr("&Test"), this, SLOT(helpTest()));
+    //    help->insertItem( "About &Qt", this, SLOT(aboutQt()));
+    help->insertSeparator();
+    //    help->insertItem( trUtf8("Что &это"), this, SLOT(whatsThis()), SHIFT+Key_F1);
+
+
+    //--designer_settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
+    //--designer_settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
+
+//    QStringList lst = settings.entryList("/engine");
+    QSettings designer_settings;
+    designer_settings.beginGroup("/designer");
+    bool maximize = designer_settings.readBoolEntry( "/maximize", 0 );
+    int width = designer_settings.readNumEntry( "/geometry/width", 600 );
+    int height = designer_settings.readNumEntry( "/geometry/height", 480 );
+    int offset_x = designer_settings.readNumEntry( "/geometry/x", 0 );
+    int offset_y = designer_settings.readNumEntry( "/geometry/y", 0 );
+    designer_settings.endGroup();
+    resize( QSize(width, height) );//  .expandedTo(minimumSizeHint()) );
+    move(offset_x,offset_y);
+    if(maximize)
+    {
+//        setWindowState(windowState() ^ WindowMaximized);
+    }
+
+    setIcon( rcIcon("a-system.png"));
+    setCaption(tr("Ananas: Designer"));
+    Q3VBox* vb = new Q3VBox( this );
+    vb->setFrameStyle( Q3Frame::StyledPanel | Q3Frame::Sunken );
+    ws = new QWorkspace( vb );
+    wl = new aWindowsList();
+    ws->setScrollBarsEnabled( TRUE );
+    setCentralWidget( vb );
+    cfgform=NULL;
+
+    MessagesWindow *msgWindow = new MessagesWindow( this ); // , WDestructiveClose );
+    moveDockWindow( msgWindow, Qt::DockBottom );
+    setMessageHandler( TRUE );
+    msgWindow->hide();
+    tbMetadata->setShown( FALSE );
+    tbActions->setShown( FALSE );
+    tbInterface->setShown( FALSE );
+    tbRights->setShown( FALSE );
+    tbLanguages->setShown( FALSE );
+    tbImageCollection->setShown( FALSE );
+    TBToolbar->setShown( FALSE );
+    tbTabs->setShown( FALSE );
+    lastTabId = 0;
+    configSaveAction->setVisible( FALSE );
+}
+
+void MainForm::configNew()
+{
+       CfgForm *cf = cfgForm();
+       if (cf)
+       {
+               if ( !cf->close() ) return; // close configuration form if opened
+       }
+       cf = new CfgForm(ws, 0, Qt::WDestructiveClose); // create new cfgform
+       if ( cf )
+       {
+               cf->init( rcfile, TRUE ); // initialization NEW configuration
+               connectSignals( cf );
+               cf->ws=ws;
+               cf->show();
+               ((QWidget*)cf->parent())->move(0,0);
+               //--addTab(++lastTabId,cf->name());
+               addTab(cf);
+       }
+}
+
+void MainForm::configOpen()
+{
+       CfgForm *cf = cfgForm();
+       if ( cf )
+       {
+               if ( !cf->close() ) return;
+       }
+       if ( rcfile.isEmpty()) return;
+       cf = new CfgForm( ws, 0, Qt::WDestructiveClose);
+       if ( cf )
+       {
+               cf->init( rcfile, FALSE );      //      initialization configuration
+               connectSignals( cf );
+               cf->ws=ws;
+               cf->show();
+               ((QWidget*)cf->parent())->move(0,0);
+               //--addTab(++lastTabId,cf->name());
+               addTab(cf);
+    }
+}
+
+void MainForm::configSave()
+{
+    emit tosave();
+    CfgForm *cf = cfgForm();
+    if ( cf ) cf->save();      //      get configuration form and save its data
+}
+
+void MainForm::configSaveAs()
+{
+}
+
+
+
+void MainForm::fileOpen()
+{
+
+}
+
+void MainForm::fileSave()
+{
+
+}
+
+void MainForm::fileSaveAs()
+{
+
+}
+
+void MainForm::fileNew()
+{
+
+}
+
+void MainForm::windowsMenuActivated( int id )
+{
+    QWidget* w = ws->windowList().at( id );
+    if ( w ) w->showNormal();
+    w->setFocus();
+}
+
+
+void MainForm::windowsMenuAboutToShow()
+{
+    windowsMenu->clear();
+    int cascadeId = windowsMenu->insertItem(tr("&Cascade"), ws, SLOT(cascade() ) );
+    int tileId = windowsMenu->insertItem(tr("&Tile"), ws, SLOT(tile() ) );
+    int horTileId = windowsMenu->insertItem(tr("Tile &horizontal"), this, SLOT(tileHorizontal() ) );
+    if ( ws->windowList().isEmpty() ) {
+       windowsMenu->setItemEnabled( cascadeId, FALSE );
+       windowsMenu->setItemEnabled( tileId, FALSE );
+       windowsMenu->setItemEnabled( horTileId, FALSE );
+    }
+    windowsMenu->insertSeparator();
+    QWidgetList windows = ws->windowList();
+    for ( int i = 0; i < int( windows.count() ); ++i ) {
+       int id = windowsMenu->insertItem(windows.at(i)->caption(), this, SLOT( windowsMenuActivated( int ) ) );
+       windowsMenu->setItemParameter( id, i );
+       windowsMenu->setItemChecked( id, ws->activeWindow() == windows.at(i) );
+    }
+}
+
+void MainForm::tileHorizontal()
+{
+    // primitive horizontal tiling
+    QWidgetList windows = ws->windowList();
+    if ( !windows.count() )
+       return;
+
+    int heightForEach = ws->height() / windows.count();
+    int y = 0;
+    for ( int i = 0; i < int(windows.count()); ++i ) {
+       QWidget *window = windows.at(i);
+       if ( window->windowState() == Qt::WindowMaximized ) {
+           // prevent flicker
+           window->hide();
+           window->showNormal();
+       }
+       int preferredHeight = window->minimumHeight()+window->parentWidget()->baseSize().height();
+       int actHeight = QMAX(heightForEach, preferredHeight);
+
+       window->parentWidget()->setGeometry( 0, y, ws->width(), actHeight );
+       y += actHeight;
+    }
+}
+
+
+void MainForm::closeEvent( QCloseEvent *e )
+{
+    if (configform)
+    {
+       if (!configform->close())
+       {
+           e->ignore();
+           return;
+       }
+    }
+
+    QSettings designer_settings;
+    designer_settings.beginGroup("/designer");
+//     designer_settings.writeEntry( "/maximize", windowState()&WindowMaximized ? true: false);
+       designer_settings.writeEntry( "/geometry/width", width() );
+       designer_settings.writeEntry( "/geometry/height", height() );
+       designer_settings.writeEntry( "/geometry/x", pos().x() );
+       designer_settings.writeEntry( "/geometry/y", pos().y() );
+       designer_settings.endGroup();
+       //aLog::print(aLog::Debug,"exit");
+    Q3MainWindow::closeEvent( e );
+}
+
+
+void MainForm::connectSignals( CfgForm *cf )
+{
+    connect(objNewFormAction, SIGNAL(activated()), cf, SLOT(newForm()));
+    connect(objNewTableAction, SIGNAL(activated()), cf, SLOT(newTable()));
+    connect(objNewFieldAction, SIGNAL(activated()), cf, SLOT(newField()));
+    connect(objRenameAction, SIGNAL(activated()), cf->mdtree, SLOT(itemRename()));
+    connect(objNewObjAction, SIGNAL(activated()), cf->mdtree, SLOT(itemNew()));
+    connect(objEditAction, SIGNAL(activated()), cf->mdtree, SLOT(itemEdit()));
+    connect(objDeleteAction, SIGNAL(activated()), cf->mdtree, SLOT(itemDelete()));
+}
+
+
+void MainForm::getMd( aCfg **md )
+{
+       CfgForm *cf = cfgForm();
+       if ( !cf ) return;
+       *md = &cf->cfg;
+}
+
+/*!
+Get current configuration form
+*/
+CfgForm *
+MainForm::cfgForm()
+{
+       CfgForm *res = 0;
+       QWidgetList windows = ws->windowList();
+       for ( int i = 0; i < int( windows.count() ); ++i ) {
+               if ( strcmp( windows.at(i)->className(),"CfgForm") == 0 ){
+                       res = ( CfgForm *) windows.at(i);
+                       break;
+               }
+       }
+       return res;
+}
+
+
+QWidget *
+MainForm::activeWindow()
+{
+       return ws->activeWindow();
+}
+
+
+int MainForm::getId()
+{
+    return  lastFormId;
+}
+
+
+void MainForm::addTab(int uid, const QString& winName )
+{
+    QWidgetList windows = ws->windowList();
+    QToolButton* bt;
+
+    QString S = winName;
+    for ( int i = 0; i < int( windows.count() ); i++ ) {
+               if( !strcmp(windows.at(i)->name(), S.ascii()))
+               {
+                       windows.at(i)->setName(QString(windows.at(i)->name()+QString("_%1").arg(uid)));
+                       //ixmap pixmap(*windows.at(i)->icon());
+                       bt = new QToolButton(QIcon(),
+                                            windows.at(i)->caption(),
+                                            "",
+                                            windows.at(i),
+                                            SLOT(setFocus( )),
+                                            tbTabs,
+                                            windows.at(i)->name() );
+
+                       bt->setUsesTextLabel ( true );
+//                     bt->setAutoRaise ( true );
+               //      aLog::print(aLog::Debug, QString("button name = %1").arg(bt->name()));
+                       break;
+
+               }
+/*             if( windows.at(i)->isShown() and !strcmp(windows.at(i)->name(),"designer_mainwindow"))
+               {
+
+                       bt = new QToolButton(QIconSet(),
+                                            windows.at(i)->caption(),
+                                            "",
+                                            windows.at(i),
+                                            SLOT(setFocus( )),
+                                            tbTabs,
+                                            windows.at(i)->name() );
+
+                       bt->setUsesTextLabel ( true );
+//                     bt->setAutoRaise ( true );
+                       printf("button name = %s\n",bt->name());
+                       break;
+               }
+               */
+       }
+   // }
+//    if(windows.count()>1)
+    if(tbTabs->queryList ("QToolButton").size() > 0)
+    {
+       //    tbTabs->show();
+
+       tbTabs->setShown( true );
+    }
+    else
+    {
+       //   tbTabs->hide();
+       tbTabs->setShown( false );
+    }
+}
+
+
+void MainForm::removeTab(const  QString &winName )
+{
+//     int ind = winName.findRev("_");
+//     printf("winName = %s\n",winName.ascii());
+//     QString str = winName;
+//     str = str.remove(ind,winName.length()-ind);
+       QObject *button = tbTabs->child( winName );
+       if(button)
+       {
+
+//             printf("deletes tab\n");
+               delete button;
+               button = NULL;
+       }
+
+}
+
+
+void MainForm::closeChildWindows()
+{
+
+    QWidgetList windows = ws->windowList();
+    for ( int i = 0; i < int( windows.count() ); i++ )
+    {
+ if(    windows.at(i)->className() != "CfgForm")
+ {
+  windows.at(i)->close();
+ }
+    }
+}
+
+
+void MainForm::fileNewAction_activated()
+{
+
+}
diff --git a/src/designer/mainform.h b/src/designer/mainform.h
new file mode 100644 (file)
index 0000000..aa0937b
--- /dev/null
@@ -0,0 +1,80 @@
+#ifndef MAINFORM_H
+#define MAINFORM_H
+
+#include "ui_mainform.h"
+
+
+class MainForm : public Q3MainWindow, public Ui::MainForm
+{
+    Q_OBJECT
+
+public:
+    MainForm(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~MainForm();
+
+    QLabel *msg;
+    QWorkspace *ws;
+    CfgForm *cfgform;
+    QString rcfile;
+    aCfg *md;
+    int lastFormId;
+    int lastTabId;
+    aWindowsList *wl;
+    //--QSettings designer_settings;
+
+    virtual CfgForm * cfgForm();
+    virtual QWidget * activeWindow();
+
+public slots:
+    virtual void filePrint();
+    virtual void fileExit();
+    virtual void editUndo();
+    virtual void editRedo();
+    virtual void editCut();
+    virtual void editCopy();
+    virtual void editPaste();
+    virtual void editFind();
+    virtual void helpIndex();
+    virtual void helpContents();
+    virtual void helpAbout();
+    virtual void init();
+    virtual void configNew();
+    virtual void configOpen();
+    virtual void configSave();
+    virtual void configSaveAs();
+    virtual void fileOpen();
+    virtual void fileSave();
+    virtual void fileSaveAs();
+    virtual void fileNew();
+    virtual void connectSignals( CfgForm * cf );
+    virtual void getMd( aCfg * * md );
+    virtual int getId();
+    virtual void addTab( int uid, const QString & winName );
+    // -- Help for add to workspace
+    virtual void addTab(QWidget* window) {
+        ws->addWindow(window);
+        window->show();
+        addTab(++lastTabId, window->objectName());
+    };
+    virtual void removeTab( const QString & winName );
+    virtual void closeChildWindows();
+    virtual void fileNewAction_activated();
+
+signals:
+    void tosave();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    Q3PopupMenu *windowsMenu;
+
+private slots:
+    virtual void windowsMenuActivated( int id );
+    virtual void windowsMenuAboutToShow();
+    virtual void tileHorizontal();
+    virtual void closeEvent( QCloseEvent * e );
+
+};
+
+#endif // MAINFORM_H
diff --git a/src/designer/mainform.ui b/src/designer/mainform.ui
new file mode 100644 (file)
index 0000000..bc8ef5e
--- /dev/null
@@ -0,0 +1,1391 @@
+<ui version="4.0" >
+ <class>MainForm</class>
+ <widget class="Q3MainWindow" name="MainForm" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>677</width>
+    <height>570</height>
+   </rect>
+  </property>
+  <property name="sizePolicy" >
+   <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="font" >
+   <font/>
+  </property>
+  <property name="windowTitle" >
+   <string>Ananas: Designer</string>
+  </property>
+  <widget class="QWidget" name="widget" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>54</y>
+     <width>677</width>
+     <height>516</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="Q3ToolBar" name="Toolbar" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>105</width>
+     <height>30</height>
+    </rect>
+   </property>
+   <property name="label" >
+    <string/>
+   </property>
+   <addaction name="configNewAction" />
+   <addaction name="configOpenAction" />
+   <addaction name="configSaveAction" />
+  </widget>
+  <widget class="Q3ToolBar" name="tbInterface" >
+   <property name="geometry" >
+    <rect>
+     <x>105</x>
+     <y>0</y>
+     <width>135</width>
+     <height>30</height>
+    </rect>
+   </property>
+   <property name="label" >
+    <string/>
+   </property>
+   <addaction name="objInterfaceNewCommandAction" />
+   <addaction name="objInterfaceNewSubmenuAction" />
+   <addaction name="objInterfaceNewSeparatorAction" />
+   <addaction name="objInterfaceEditAction" />
+  </widget>
+  <widget class="Q3ToolBar" name="tbMetadata" >
+   <property name="geometry" >
+    <rect>
+     <x>240</x>
+     <y>0</y>
+     <width>75</width>
+     <height>30</height>
+    </rect>
+   </property>
+   <property name="label" >
+    <string/>
+   </property>
+   <addaction name="objMetadataNewAction" />
+   <addaction name="objMetadataEditAction" />
+  </widget>
+  <widget class="Q3ToolBar" name="tbActions" >
+   <property name="geometry" >
+    <rect>
+     <x>315</x>
+     <y>0</y>
+     <width>105</width>
+     <height>30</height>
+    </rect>
+   </property>
+   <property name="label" >
+    <string/>
+   </property>
+   <addaction name="objActionsNewAction" />
+   <addaction name="objActionsNewGroupAction" />
+   <addaction name="objActionsEditAction" />
+  </widget>
+  <widget class="Q3ToolBar" name="tbRights" >
+   <property name="geometry" >
+    <rect>
+     <x>420</x>
+     <y>0</y>
+     <width>105</width>
+     <height>30</height>
+    </rect>
+   </property>
+   <property name="label" >
+    <string/>
+   </property>
+   <addaction name="objRoleNewAction" />
+   <addaction name="objRoleEditAction" />
+   <addaction name="objRoleClearAction" />
+  </widget>
+  <widget class="Q3ToolBar" name="tbLanguages" >
+   <property name="geometry" >
+    <rect>
+     <x>525</x>
+     <y>0</y>
+     <width>105</width>
+     <height>30</height>
+    </rect>
+   </property>
+   <property name="label" >
+    <string/>
+   </property>
+   <addaction name="objLanguagesNewAction" />
+   <addaction name="objLanguagesEditAction" />
+   <addaction name="objLanguagesClearAction" />
+  </widget>
+  <widget class="Q3ToolBar" name="tbImageCollection" >
+   <property name="geometry" >
+    <rect>
+     <x>630</x>
+     <y>0</y>
+     <width>45</width>
+     <height>30</height>
+    </rect>
+   </property>
+   <property name="label" >
+    <string/>
+   </property>
+   <addaction name="objImageCollectionAddAction" />
+  </widget>
+  <widget class="Q3ToolBar" name="TBToolbar" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>30</y>
+     <width>135</width>
+     <height>30</height>
+    </rect>
+   </property>
+   <property name="label" >
+    <string/>
+   </property>
+   <addaction name="objTBRenameAction" />
+   <addaction name="objTBMoveUpAction" />
+   <addaction name="objTBMoveDownAction" />
+   <addaction name="objTBDeleteAction" />
+  </widget>
+  <widget class="Q3ToolBar" name="tbTabs" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>60</y>
+     <width>19</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="movingEnabled" >
+    <bool>true</bool>
+   </property>
+   <property name="newLine" >
+    <bool>true</bool>
+   </property>
+   <property name="label" >
+    <string>Tabs</string>
+   </property>
+  </widget>
+  <widget class="QMenuBar" name="menubar" >
+   <property name="enabled" >
+    <bool>true</bool>
+   </property>
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>677</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <property name="defaultUp" >
+    <bool>false</bool>
+   </property>
+   <widget class="QMenu" name="fileMenu" >
+    <property name="title" >
+     <string>&amp;File</string>
+    </property>
+    <addaction name="fileNewAction" />
+    <addaction name="fileSaveAction" />
+    <addaction name="fileOpenAction" />
+    <addaction name="separator" />
+    <addaction name="filePrintAction" />
+    <addaction name="separator" />
+    <addaction name="fileExitAction" />
+   </widget>
+   <widget class="QMenu" name="editMenu" >
+    <property name="title" >
+     <string>&amp;Edit</string>
+    </property>
+    <addaction name="editUndoAction" />
+    <addaction name="editRedoAction" />
+    <addaction name="separator" />
+    <addaction name="editCutAction" />
+    <addaction name="editCopyAction" />
+    <addaction name="editPasteAction" />
+    <addaction name="separator" />
+    <addaction name="editFindAction" />
+   </widget>
+   <widget class="QMenu" name="ConfigurationMenu" >
+    <property name="title" >
+     <string>Configuration</string>
+    </property>
+    <addaction name="configOpenAction" />
+    <addaction name="configSaveAction" />
+    <addaction name="separator" />
+    <addaction name="configNewAction" />
+   </widget>
+   <widget class="QMenu" name="ObjectMenu" >
+    <property name="title" >
+     <string>Object</string>
+    </property>
+    <addaction name="objEditAction" />
+    <addaction name="objRenameAction" />
+    <addaction name="objDeleteAction" />
+    <addaction name="separator" />
+    <addaction name="objNewObjAction" />
+    <addaction name="objNewFieldAction" />
+    <addaction name="objNewFormAction" />
+    <addaction name="objNewTableAction" />
+   </widget>
+   <addaction name="fileMenu" />
+   <addaction name="editMenu" />
+   <addaction name="ConfigurationMenu" />
+   <addaction name="ObjectMenu" />
+  </widget>
+  <action name="fileNewAction" >
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>&amp;New</string>
+   </property>
+   <property name="iconText" >
+    <string>&amp;New</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+N</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>fileNewAction</string>
+   </property>
+  </action>
+  <action name="fileOpenAction" >
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>&amp;Open...</string>
+   </property>
+   <property name="iconText" >
+    <string>&amp;Open...</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+O</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>fileOpenAction</string>
+   </property>
+  </action>
+  <action name="fileSaveAction" >
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>&amp;Save</string>
+   </property>
+   <property name="iconText" >
+    <string>&amp;Save</string>
+   </property>
+   <property name="whatsThis" >
+    <string>actFileSave</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+S</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>fileSaveAction</string>
+   </property>
+  </action>
+  <action name="fileSaveAsAction" >
+   <property name="text" >
+    <string>Save &amp;as...</string>
+   </property>
+   <property name="iconText" >
+    <string>Save &amp;as...</string>
+   </property>
+   <property name="shortcut" >
+    <string/>
+   </property>
+   <property name="name" stdset="0" >
+    <string>fileSaveAsAction</string>
+   </property>
+  </action>
+  <action name="filePrintAction" >
+   <property name="enabled" >
+    <bool>false</bool>
+   </property>
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>&amp;Print</string>
+   </property>
+   <property name="iconText" >
+    <string>&amp;Print</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+P</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>filePrintAction</string>
+   </property>
+  </action>
+  <action name="fileExitAction" >
+   <property name="text" >
+    <string>E&amp;xit</string>
+   </property>
+   <property name="iconText" >
+    <string>E&amp;xit</string>
+   </property>
+   <property name="shortcut" >
+    <string/>
+   </property>
+   <property name="name" stdset="0" >
+    <string>fileExitAction</string>
+   </property>
+  </action>
+  <action name="editUndoAction" >
+   <property name="enabled" >
+    <bool>false</bool>
+   </property>
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>Undo</string>
+   </property>
+   <property name="iconText" >
+    <string>Undo</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+Z</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>editUndoAction</string>
+   </property>
+  </action>
+  <action name="editRedoAction" >
+   <property name="enabled" >
+    <bool>false</bool>
+   </property>
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>Redo</string>
+   </property>
+   <property name="iconText" >
+    <string>Redo</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+Y</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>editRedoAction</string>
+   </property>
+  </action>
+  <action name="editCutAction" >
+   <property name="enabled" >
+    <bool>false</bool>
+   </property>
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>Cut</string>
+   </property>
+   <property name="iconText" >
+    <string>Cut</string>
+   </property>
+   <property name="toolTip" >
+    <string>Вырезать</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+X</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>editCutAction</string>
+   </property>
+  </action>
+  <action name="editCopyAction" >
+   <property name="enabled" >
+    <bool>false</bool>
+   </property>
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>Copy</string>
+   </property>
+   <property name="iconText" >
+    <string>Copy</string>
+   </property>
+   <property name="toolTip" >
+    <string>Копировать</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+C</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>editCopyAction</string>
+   </property>
+  </action>
+  <action name="editPasteAction" >
+   <property name="enabled" >
+    <bool>false</bool>
+   </property>
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>Paste</string>
+   </property>
+   <property name="iconText" >
+    <string>Paste</string>
+   </property>
+   <property name="toolTip" >
+    <string>Вставить</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+V</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>editPasteAction</string>
+   </property>
+  </action>
+  <action name="editFindAction" >
+   <property name="enabled" >
+    <bool>false</bool>
+   </property>
+   <property name="icon" >
+    <iconset/>
+   </property>
+   <property name="text" >
+    <string>Find</string>
+   </property>
+   <property name="iconText" >
+    <string>Find</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+F</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>editFindAction</string>
+   </property>
+  </action>
+  <action name="helpContentsAction" >
+   <property name="text" >
+    <string>&amp;Содержание...</string>
+   </property>
+   <property name="iconText" >
+    <string>Содержание</string>
+   </property>
+   <property name="shortcut" >
+    <string/>
+   </property>
+   <property name="name" stdset="0" >
+    <string>helpContentsAction</string>
+   </property>
+  </action>
+  <action name="helpIndexAction" >
+   <property name="text" >
+    <string>&amp;Индекс...</string>
+   </property>
+   <property name="iconText" >
+    <string>Индекс</string>
+   </property>
+   <property name="shortcut" >
+    <string/>
+   </property>
+   <property name="name" stdset="0" >
+    <string>helpIndexAction</string>
+   </property>
+  </action>
+  <action name="helpAboutAction" >
+   <property name="text" >
+    <string>&amp;О программе</string>
+   </property>
+   <property name="iconText" >
+    <string>О программе</string>
+   </property>
+   <property name="shortcut" >
+    <string/>
+   </property>
+   <property name="name" stdset="0" >
+    <string>helpAboutAction</string>
+   </property>
+  </action>
+  <action name="new_itemAction" >
+   <property name="text" >
+    <string>new item</string>
+   </property>
+   <property name="iconText" >
+    <string>new item</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>new_itemAction</string>
+   </property>
+  </action>
+  <action name="new_itemAction_2" >
+   <property name="text" >
+    <string>new item</string>
+   </property>
+   <property name="iconText" >
+    <string>new item</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>new_itemAction_2</string>
+   </property>
+  </action>
+  <action name="configurationnew_itemAction" >
+   <property name="text" >
+    <string>Image Collection</string>
+   </property>
+   <property name="iconText" >
+    <string>Image Collection</string>
+   </property>
+   <property name="name" stdset="0" >
+    <string>configurationnew_itemAction</string>
+   </property>
+  </action>
+  <actiongroup name="configGroup" >
+   <action name="configNewAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/filenew.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New</string>
+    </property>
+    <property name="iconText" >
+     <string>New</string>
+    </property>
+    <property name="toolTip" >
+     <string>Create new configuration</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>configNewAction</string>
+    </property>
+   </action>
+   <action name="configOpenAction" >
+    <property name="checked" >
+     <bool>false</bool>
+    </property>
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/hi22-action-project_open.png</iconset>
+    </property>
+    <property name="text" >
+     <string>&amp;Open</string>
+    </property>
+    <property name="iconText" >
+     <string>&amp;Open</string>
+    </property>
+    <property name="toolTip" >
+     <string>Open configuration</string>
+    </property>
+    <property name="statusTip" >
+     <string>Open configuration</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>configOpenAction</string>
+    </property>
+   </action>
+   <action name="configSaveAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/filesave.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Save</string>
+    </property>
+    <property name="iconText" >
+     <string>Save</string>
+    </property>
+    <property name="toolTip" >
+     <string>Save configuration</string>
+    </property>
+    <property name="shortcut" >
+     <string>Ctrl+S</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>configSaveAction</string>
+    </property>
+   </action>
+   <action name="config_DBCreateAction" >
+    <property name="text" >
+     <string>Создать/обновить БД</string>
+    </property>
+    <property name="iconText" >
+     <string>Создать/обновить БД</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>config_DBCreateAction</string>
+    </property>
+   </action>
+   <property name="name" stdset="0" >
+    <string>configGroup</string>
+   </property>
+  </actiongroup>
+  <actiongroup name="formGroup" >
+   <action name="NewButtonAction" >
+    <property name="text" >
+     <string>Новая кнопка</string>
+    </property>
+    <property name="iconText" >
+     <string>Новая кнопка</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>NewButtonAction</string>
+    </property>
+   </action>
+   <action name="NewAttributeAction" >
+    <property name="text" >
+     <string>Новый атрибут</string>
+    </property>
+    <property name="iconText" >
+     <string>Новый атрибут</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>NewAttributeAction</string>
+    </property>
+   </action>
+   <action name="NewFieldAction" >
+    <property name="text" >
+     <string>Новое поле</string>
+    </property>
+    <property name="iconText" >
+     <string>Новое поле</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>NewFieldAction</string>
+    </property>
+   </action>
+   <property name="name" stdset="0" >
+    <string>formGroup</string>
+   </property>
+  </actiongroup>
+  <actiongroup name="objectGroup" >
+   <action name="objNewFormAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/form.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New form</string>
+    </property>
+    <property name="iconText" >
+     <string>New form</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objNewFormAction</string>
+    </property>
+   </action>
+   <action name="objDeleteAction" >
+    <property name="text" >
+     <string>Delete</string>
+    </property>
+    <property name="iconText" >
+     <string>Delete</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objDeleteAction</string>
+    </property>
+   </action>
+   <action name="objNewFieldAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/field.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New field</string>
+    </property>
+    <property name="iconText" >
+     <string>New field</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objNewFieldAction</string>
+    </property>
+   </action>
+   <action name="objRenameAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editrename.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Rename</string>
+    </property>
+    <property name="iconText" >
+     <string>Rename</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objRenameAction</string>
+    </property>
+   </action>
+   <action name="objEditAction" >
+    <property name="text" >
+     <string>Edit</string>
+    </property>
+    <property name="iconText" >
+     <string>Edit</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objEditAction</string>
+    </property>
+   </action>
+   <action name="objNewTableAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/table.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New table</string>
+    </property>
+    <property name="iconText" >
+     <string>New table</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objNewTableAction</string>
+    </property>
+   </action>
+   <action name="objNewObjAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/object.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New in group</string>
+    </property>
+    <property name="iconText" >
+     <string>New in group</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objNewObjAction</string>
+    </property>
+   </action>
+   <action name="objTBDeleteAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editdelete.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Delete</string>
+    </property>
+    <property name="iconText" >
+     <string>Delete</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objTBDeleteAction</string>
+    </property>
+   </action>
+   <action name="objMetadataNewAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/doc.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New</string>
+    </property>
+    <property name="iconText" >
+     <string>New</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objMetadataNewAction</string>
+    </property>
+   </action>
+   <action name="objTBRenameAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editrename.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Rename</string>
+    </property>
+    <property name="iconText" >
+     <string>Rename</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objTBRenameAction</string>
+    </property>
+   </action>
+   <action name="objTBMoveUpAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/arrow_up.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Move Up</string>
+    </property>
+    <property name="iconText" >
+     <string>Move Up</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objTBMoveUpAction</string>
+    </property>
+   </action>
+   <action name="objTBMoveDownAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/arrow_down.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Move Down</string>
+    </property>
+    <property name="iconText" >
+     <string>Move Down</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objTBMoveDownAction</string>
+    </property>
+   </action>
+   <action name="objMetadataEditAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editedit.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Edit</string>
+    </property>
+    <property name="iconText" >
+     <string>Edit</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objMetadataEditAction</string>
+    </property>
+   </action>
+   <action name="objActionsNewGroupAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/function.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New Group</string>
+    </property>
+    <property name="iconText" >
+     <string>New Group</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objActionsNewGroupAction</string>
+    </property>
+   </action>
+   <action name="objActionsNewAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/filenew.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New</string>
+    </property>
+    <property name="iconText" >
+     <string>New</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objActionsNewAction</string>
+    </property>
+   </action>
+   <action name="objActionsEditAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editedit.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Action</string>
+    </property>
+    <property name="iconText" >
+     <string>Action</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objActionsEditAction</string>
+    </property>
+   </action>
+   <action name="objInterfaceNewSubmenuAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/report_g.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New Submenu</string>
+    </property>
+    <property name="iconText" >
+     <string>New Submenu</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objInterfaceNewSubmenuAction</string>
+    </property>
+   </action>
+   <action name="objInterfaceNewCommandAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/report.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New Command</string>
+    </property>
+    <property name="iconText" >
+     <string>New Command</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objInterfaceNewCommandAction</string>
+    </property>
+   </action>
+   <action name="objInterfaceNewSeparatorAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editsep.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New Separator</string>
+    </property>
+    <property name="iconText" >
+     <string>New Separator</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objInterfaceNewSeparatorAction</string>
+    </property>
+   </action>
+   <action name="objInterfaceEditAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editedit.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Edit</string>
+    </property>
+    <property name="iconText" >
+     <string>Edit</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objInterfaceEditAction</string>
+    </property>
+   </action>
+   <action name="objInterfaceRenameAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editrename.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Rename</string>
+    </property>
+    <property name="iconText" >
+     <string>Rename</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objInterfaceRenameAction</string>
+    </property>
+   </action>
+   <action name="objLanguagesNewAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/filenew.png</iconset>
+    </property>
+    <property name="text" >
+     <string>New</string>
+    </property>
+    <property name="iconText" >
+     <string>New</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objLanguagesNewAction</string>
+    </property>
+   </action>
+   <action name="objLanguagesEditAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editedit.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Edit</string>
+    </property>
+    <property name="iconText" >
+     <string>Edit</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objLanguagesEditAction</string>
+    </property>
+   </action>
+   <action name="objLanguagesClearAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editcut.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Clear dead aliases</string>
+    </property>
+    <property name="iconText" >
+     <string>Clear dead aliases</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objLanguagesClearAction</string>
+    </property>
+   </action>
+   <action name="objImageCollectionAddAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/filenew.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Add</string>
+    </property>
+    <property name="iconText" >
+     <string>Add</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objImageCollectionAddAction</string>
+    </property>
+   </action>
+   <action name="objRoleNewAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/doc.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Add new role</string>
+    </property>
+    <property name="iconText" >
+     <string>Add new role</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objRoleNewAction</string>
+    </property>
+   </action>
+   <action name="objRoleClearAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editcut.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Clear dead roles</string>
+    </property>
+    <property name="iconText" >
+     <string>Clear dead roles</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objRoleClearAction</string>
+    </property>
+   </action>
+   <action name="objRoleEditAction" >
+    <property name="icon" >
+     <iconset resource="designer.qrc" >:/images/editedit.png</iconset>
+    </property>
+    <property name="text" >
+     <string>Edit role</string>
+    </property>
+    <property name="iconText" >
+     <string>Edit role</string>
+    </property>
+    <property name="name" stdset="0" >
+     <string>objRoleEditAction</string>
+    </property>
+   </action>
+   <property name="name" stdset="0" >
+    <string>objectGroup</string>
+   </property>
+  </actiongroup>
+ </widget>
+ <layoutdefault spacing="5" margin="5" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>Q3ToolBar</class>
+   <extends>Q3Frame</extends>
+   <header>q3listview.h</header>
+  </customwidget>
+  <customwidget>
+   <class>Q3MainWindow</class>
+   <extends>QWidget</extends>
+   <header>q3mainwindow.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >qworkspace.h</include>
+  <include location="local" >q3vbox.h</include>
+  <include location="local" >cfgform.h</include>
+  <include location="local" >q3popupmenu.h</include>
+  <include location="local" >awindowslist.h</include>
+  <include location="local" >qsettings.h</include>
+ </includes>
+ <resources>
+  <include location="designer.qrc" />
+ </resources>
+ <connections>
+  <connection>
+   <sender>fileSaveAsAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>fileSaveAs()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>filePrintAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>filePrint()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fileExitAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>editUndoAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>editUndo()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>editRedoAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>editRedo()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>editCutAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>editCut()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>editCopyAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>editCopy()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>editPasteAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>editPaste()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>editFindAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>editFind()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>helpIndexAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>helpIndex()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>helpContentsAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>helpContents()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>helpAboutAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>helpAbout()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>configNewAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>configNew()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>configOpenAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>configOpen()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>configSaveAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>configSave()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>objTBDeleteAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>fileOpen()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fileNewAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>configNew()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fileOpenAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>configOpen()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>fileSaveAction</sender>
+   <signal>activated()</signal>
+   <receiver>MainForm</receiver>
+   <slot>configSave()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/designer/mdtree.cpp b/src/designer/mdtree.cpp
new file mode 100644 (file)
index 0000000..3650a1d
--- /dev/null
@@ -0,0 +1,1190 @@
+/****************************************************************************
+** $Id: mdtree.cpp,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Code file of the Metadata Tree of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <q3listview.h>
+#include <qlabel.h>
+#include <qpixmap.h>
+#include <q3popupmenu.h>
+#include <qstatusbar.h>
+#include <qlineedit.h>
+#include <qmessagebox.h>
+#include <q3valuelist.h>
+#include <qimage.h>
+#include <qbitmap.h>
+#include <q3dragobject.h>
+#include <q3header.h>
+#include <qfont.h>
+#include <qcursor.h>
+#include <qlayout.h>
+
+#include "adatabase.h"
+#include "mainform.h"
+#include "deditfield.h"
+#include "deditcfg.h"
+#include "deditdoc.h"
+#include "deditreport.h"
+#include "deditdialog.h"
+#include "deditcat.h"
+#include "deditireg.h"
+#include "deditareg.h"
+#include "deditjournal.h"
+#include "deditwebform.h"
+#include "deditcolumns.h"
+#include "awindowslist.h"
+
+//#include "acfg.h"
+#include "acfgrc.h"
+
+#include "mdtree.h"
+
+extern MainForm *mainform;
+extern QPixmap rcIcon(const char *name);
+//extern void set_Icon(QListViewItem *item, const char *name);
+
+
+
+aListViewItem::aListViewItem(ananasListViewItem *parent, ananasListViewItem *after, aCfg *cfgmd,  aCfgItem cfgobj, const QString &name )
+: ananasListViewItem( parent, after, cfgmd, cfgobj, name )
+{
+       loadTree();
+}
+
+
+
+aListViewItem::aListViewItem(Q3ListView *parent, aCfg *cfgmd,  aCfgItem cfgobj, const QString &name )
+: ananasListViewItem( parent, cfgmd, cfgobj, name )
+{
+       loadTree();
+}
+
+
+aListViewItem::~aListViewItem()
+{
+
+}
+
+
+QString
+aListViewItem::text( int column ) const
+{
+       return Q3ListViewItem::text( column );
+//     if ( obj.isNull() ) return QObject::tr("Unknown object context");
+       if ( !id ) return Q3ListViewItem::text( column );
+       switch ( column ) {
+       case 0: return md->attr( obj, mda_name );
+       default:
+               return "";
+       }
+}
+
+int
+aListViewItem::compare( Q3ListViewItem *i, int col, bool accending ) const
+{
+       int id1 = 0, id2 = 0;
+       aListViewItem *ai = (aListViewItem *) i;
+       id1 = md->order( obj );
+       id2 = ai->md->order( ai->obj );
+       if ( md == ai->md && md->parent( obj ) == ai->md->parent( ai->obj ) && col ==0 && accending ) {
+               if ( id1 < id2 ) return -1;
+               if ( id1 == id2 ) return 0;
+               return 1;
+       }
+       return 1;
+}
+
+
+void
+aListViewItem::setup()
+{
+       Q3ListViewItem::setup();
+}
+
+
+/*!
+Update metadata tree for the object context.
+*/
+void
+aListViewItem::update()
+{
+
+}
+
+
+void
+aListViewItem::loadTree()
+{
+       aListViewItem *item, *nextitem;
+       QString oclass, ldclass="";
+       int i, n;
+       aCfgItem cobj;
+
+       // clear tree
+       item = (aListViewItem *) firstChild();
+        while( item ) {
+               nextitem = (aListViewItem *) item->nextSibling();
+               delete item;
+               item = nextitem;
+        }
+       if ( !md ) return;
+       if (id) setRenameEnabled(0, true);
+       oclass = md->objClass( obj );
+       if ( oclass == md_metadata ){
+               cobj = md->find ( mdc_metadata );
+               setPixmap(0, rcIcon("project.png"));
+               setOpen(true);
+               cobj = md->find ( obj, md_catalogues, 0 );
+               if ( cobj.isNull() )
+               {
+                       cobj = md->insert( obj, md_catalogues, QString::null, -1 );
+               }
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Catalogues") );
+               cobj = md->find ( obj, md_documents, 0 );
+               if ( cobj.isNull() )
+               {
+                       cobj = md->insert( obj, md_documents, QString::null, -1 );
+               }
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Documents") );
+               cobj = md->find ( obj, md_reports, 0 );
+               if ( cobj.isNull() )
+               {
+                       cobj = md->insert( obj, md_reports, QString::null, -1 );
+               }
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Reports") );
+               cobj = md->find ( obj, md_journals, 0 );
+               if ( cobj.isNull() )
+               {
+                       cobj = md->insert( obj, md_journals, QString::null, -1 );
+               }
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Journals") );
+               cobj = md->find ( obj, md_registers, 0 );
+               if ( cobj.isNull() )
+               {
+                       cobj = md->insert( obj, md_registers, QString::null, -1 );
+               }
+               cobj = md->find ( obj, md_iregisters, 0 );
+               if ( cobj.isNull() )
+               {
+                       cobj = md->insert( md->find (obj, md_registers, 0 ), md_iregisters, QString::null, -1 );
+               }
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Information registers") );
+               cobj = md->find ( obj, md_aregisters, 0 );
+               if ( cobj.isNull() )
+               {
+                       cobj = md->insert( md->find (obj, md_registers, 0 ), md_aregisters, QString::null, -1 );
+               }
+               new aListViewItem( this, getLastChild(), md, cobj, QObject::tr("Accumulation registers") );
+       }
+       if ( oclass == md_catalogues ){
+               setPixmap(0, rcIcon("cat_g.png") );
+               ldclass = md_catalogue;
+       }
+       if ( oclass == md_documents ){
+               setPixmap(0, rcIcon("doc_g.png"));
+               ldclass = md_document;
+       }
+       if ( oclass == md_reports ){
+               setPixmap(0, rcIcon("report_g.png"));
+               ldclass = md_report;
+       }
+       if ( oclass == md_journals ){
+               setPixmap(0, rcIcon("journ_g.png"));
+               ldclass = md_journal;
+       }
+       if ( oclass == md_iregisters ){
+               setPixmap(0, rcIcon("reg_g.png"));
+               ldclass = md_iregister;
+       }
+       if ( oclass == md_aregisters ){
+               setPixmap(0, rcIcon("regs_g.png"));
+               ldclass = md_aregister;
+       }
+       if ( !ldclass.isEmpty() ) {
+//             printf("%s\n",(const char *) md->toString().local8Bit() );
+               n = md->count( obj, ldclass );
+//             printf(" objclass=%s ldclass = %s count = %d\n", (const char *) oclass, (const char *) ldclass, n);
+               for ( i = 0; i<n; i++ ) {
+                       cobj = md->find( obj, ldclass, i );
+                       if ( !cobj.isNull() ) {
+//                             printf("%d ok\n", i);
+//                             new aListViewItem( this, md, md->find( obj, ldclass, i ), QString::null );
+                               new aListViewItem( this, getLastChild(), md,  cobj, QString::null );
+                       }
+               }
+       }
+
+       if ( oclass == md_tables ){
+               setPixmap(0, rcIcon("table_g.png"));
+               return;
+       }
+       if ( oclass == md_forms ){
+               setPixmap(0, rcIcon("form_g.png"));
+               return;
+       }
+       if ( oclass == md_form ){
+               setPixmap(0, rcIcon("form.png"));
+               return;
+       }
+       if ( oclass == md_webforms ){
+               setPixmap(0, rcIcon("webform_g.png"));
+               return;
+       }
+       if ( oclass == md_webform ){
+               setPixmap(0, rcIcon("webform.png"));
+               return;
+       }
+       if ( oclass == md_table )
+       {
+               setPixmap(0, rcIcon("table.png"));
+               return;
+       }
+
+// elements
+       if ( oclass == md_catalogue ){
+               setPixmap(0, rcIcon("cat.png"));
+               loadCatalogue ();
+               return;
+       }
+       if ( oclass == md_document ){
+               setPixmap(0, rcIcon("doc.png"));
+               loadDocument ();
+               return;
+       }
+       if ( oclass == md_aregister ){
+               setPixmap(0, rcIcon("regs.png"));
+               loadARegister ();
+               return;
+       }
+       if ( oclass == md_iregister ){
+               setPixmap(0, rcIcon("reg.png"));
+               loadIRegister ();
+               return;
+       }
+       if ( oclass == md_journal ){
+               setPixmap(0, rcIcon("journ.png"));
+               loadJournal ();
+               return;
+       }
+       if ( oclass == md_report ){
+               setPixmap(0, rcIcon("report.png"));
+               loadReport ();
+               return;
+       }
+       if ( oclass == md_field ){
+               setPixmap(0, rcIcon("field.png"));
+               return;
+       }
+       if ( oclass == md_header )
+       {
+               setPixmap(0, rcIcon("doc_h.png"));
+               return;
+       }
+       if ( oclass == md_element)
+       {
+               setPixmap(0, rcIcon("element.png"));
+               return;
+       }
+    if( oclass == md_columns )
+       {
+               setPixmap(0, rcIcon("columns.png"));
+               return;
+       }
+       if ( oclass == md_resources )
+       {
+               setPixmap(0, rcIcon("resourses.png"));
+               return;
+       }
+       if ( oclass == md_dimensions )
+       {
+               setPixmap(0, rcIcon("dimensions.png"));
+               return;
+       }
+       if ( oclass == md_information )
+       {
+               setPixmap(0, rcIcon("information.png"));
+               return;
+       }
+       if (oclass == md_group)
+       {
+               setPixmap(0, rcIcon("group.png"));
+               return;
+       }
+}
+
+void
+aListViewItem::loadDocument ()
+{
+       int             n, i;
+       aCfgItem        cobj;
+       aListViewItem   *tparent, *fparent;
+
+       fparent = new aListViewItem( this, getLastChild(), md, md->find(obj, md_header, 0), QObject::tr("Header") );
+       loadFields ( fparent );
+
+       tparent = new aListViewItem( this, getLastChild(), md, md->find(obj, md_tables, 0), QObject::tr("Tables") );
+       n = md->count ( obj, md_table );
+       for ( i = 0; i < n; i++ )
+       {
+               cobj = md->find(  obj, md_table, i  );
+               if ( !cobj.isNull() )
+               {
+                       fparent = new aListViewItem( tparent, tparent->getLastChild(), md, cobj, QString::null );
+                       loadFields ( fparent );
+               }
+       }
+       loadForms ( this );
+       loadWebForms ( this );
+}
+
+/*void
+aListViewItem::loadTable ()
+{
+       int             n, i;
+       QString         ldclass;
+       aCfgItem        cobj;
+
+}*/
+
+void
+aListViewItem::loadFields (aListViewItem *parent)
+{
+       int             n, i;
+       aCfgItem        cobj;
+
+       n = md->count ( parent->obj, md_field );
+       for ( i = 0; i < n; i++ )
+       {
+               cobj = md->find(  parent->obj, md_field, i  );
+               if ( !cobj.isNull() )
+               {
+                       new aListViewItem( parent, parent->getLastChild(), md, cobj, QString::null );
+               }
+       }
+}
+
+void
+aListViewItem::loadForms (aListViewItem *parent)
+{
+       int             n, i;
+       aCfgItem        cobj, gobj;
+       aListViewItem   *fparent;
+
+       gobj = md->find(obj, md_forms, 0);
+       if ( gobj.isNull() ) gobj = md->insert( obj, md_forms, QString::null, -1 );
+       fparent = new aListViewItem( parent, getLastChild(), md, gobj, QObject::tr("Forms") );
+       n = md->count ( fparent->obj, md_form );
+       for ( i = 0; i < n; i++ )
+       {
+               cobj = md->find(  fparent->obj, md_form, i  );
+               if ( !cobj.isNull() )
+               {
+                       new aListViewItem( fparent, getLastChild(), md, cobj, QString::null );
+               }
+       }
+}
+
+void
+aListViewItem::loadWebForms (aListViewItem *parent)
+{
+       int             n, i;
+       aCfgItem        cobj, gobj;
+       aListViewItem   *fparent;
+
+       gobj = md->find(obj, md_webforms, 0);
+       if ( gobj.isNull() ) gobj = md->insert( obj, md_webforms, QString::null, -1 );
+       fparent = new aListViewItem( parent, getLastChild(), md, md->find(obj, md_webforms, 0), QObject::tr("Web forms") );
+       n = md->count ( fparent->obj, md_webform );
+       for ( i = 0; i < n; i++ )
+       {
+               cobj = md->find(  fparent->obj, md_webform, i  );
+               if ( !cobj.isNull() )
+               {
+                       new aListViewItem( fparent, getLastChild(), md, cobj, QString::null );
+               }
+       }
+}
+
+void
+aListViewItem::loadJournal ()
+{
+       aListViewItem   *fparent;
+
+       fparent = new aListViewItem( this, getLastChild(), md, md->find(obj, md_columns, 0), QObject::tr("Columns") );
+       loadColumns( fparent );
+       loadForms ( this );
+       loadWebForms ( this );
+}
+
+void
+aListViewItem::loadIRegister ()
+{
+       aListViewItem   *fparent;
+
+       fparent = new aListViewItem( this, getLastChild(), md, md->find(obj, md_resources, 0), QObject::tr("Resources") );
+       loadFields ( fparent );
+       fparent = new aListViewItem( this, getLastChild(), md, md->find(obj, md_dimensions, 0), QObject::tr("Dimensions") );
+       loadFields ( fparent );
+       fparent = new aListViewItem( this, getLastChild(), md, md->find(obj, md_information, 0), QObject::tr("Information") );
+       loadFields ( fparent );
+}
+
+void
+aListViewItem::loadARegister ()
+{
+       aListViewItem   *fparent;
+
+       fparent = new aListViewItem( this, getLastChild(), md, md->find(obj, md_resources, 0), QObject::tr("Resources") );
+       loadFields ( fparent );
+       fparent = new aListViewItem( this, getLastChild(), md, md->find(obj, md_dimensions, 0), QObject::tr("Dimensions") );
+       loadFields ( fparent );
+       fparent = new aListViewItem( this, getLastChild(), md, md->find(obj, md_information, 0), QObject::tr("Information") );
+       loadFields ( fparent );
+}
+
+void
+aListViewItem::loadCatalogue ()
+{
+       aListViewItem   *fparent;
+       aCfgItem i;
+
+       i = md->find(obj, md_element, 0);
+       if ( i.isNull() ) i = md->insert( obj, md_element, QString::null, -1 );
+       fparent = new aListViewItem( this, getLastChild(), md, i, QObject::tr("Element") );
+       loadFields ( fparent );
+       i = md->find(obj, md_group, 0);
+       if ( i.isNull() ) i = md->insert( obj, md_group, QString::null, -1 );
+       fparent = new aListViewItem( this, getLastChild(), md, i, QObject::tr("Group") );
+       loadFields ( fparent );
+       loadForms ( this );
+       loadWebForms ( this );
+}
+
+void aListViewItem::loadReport ()
+{
+       loadForms ( this );
+       loadWebForms ( this );
+}
+
+void
+aListViewItem::loadColumns ( aListViewItem *parent )
+{
+       int i,n;
+       aCfgItem        cobj;
+
+       n = md->count ( parent->obj, md_column );
+       for ( i =  0; i < n; i++)
+       {
+               cobj = md->find(  parent->obj, md_column, i  );
+               if ( !cobj.isNull() )
+               {
+                       new aListViewItem( parent, getLastChild(), md, cobj, QString::null );
+               }
+       }
+}
+
+
+/*
+*edit selected object
+*/
+
+void
+aListViewItem::edit()
+{
+    QWorkspace *ws = mainform->ws;
+    aWindowsList *wl = mainform->wl;
+    QString oclass = md->objClass( obj );
+    int objid = md->id( obj );
+    if ( wl->find( objid ) ) {
+       wl->get( objid )->setFocus();
+       return;
+    }
+
+       if ( oclass == md_metadata )
+       {
+           dEditCfg *e = new dEditCfg( ws, 0, Qt::WDestructiveClose );
+           wl->insert( objid, e );
+           editor = e;
+           QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+           e->setData( this );
+           e->show();
+          // mainform->addTab();
+           //--mainform->addTab(++mainform->lastTabId,e->name());
+           mainform->addTab(e);
+           e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+               e->parentWidget()->frameSize().height());
+           return;
+       }
+//     if ( !md || !id ) return;
+       if ( oclass == md_document)
+       {
+           dEditDoc *e = new dEditDoc( ws, 0, Qt::WDestructiveClose );
+           wl->insert( objid, e );
+           editor = e;
+           QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+           e->setData( this );
+           e->show();
+           //--mainform->addTab(++mainform->lastTabId,e->name());
+           mainform->addTab(e);
+           e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+               e->parentWidget()->frameSize().height());
+           return;
+       };
+       if ( oclass == md_iregister)
+       {
+           dEditIReg *e = new dEditIReg( ws, 0, Qt::WDestructiveClose );
+           wl->insert( objid, e );
+           editor = e;
+           QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+           e->setData( this );
+           e->show();
+           //mainform->updateTabs();
+           //--mainform->addTab(++mainform->lastTabId,e->name());
+           mainform->addTab(e);
+           e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+               e->parentWidget()->frameSize().height());
+           return;
+       };
+       if ( oclass == md_aregister)
+       {
+           dEditAReg *e = new dEditAReg( ws, 0, Qt::WDestructiveClose );
+           wl->insert( objid, e );
+           editor = e;
+           QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+           e->setData( this );
+           e->show();
+           //mainform->updateTabs();
+           //--mainform->addTab(++mainform->lastTabId,e->name());
+           mainform->addTab(e);
+           e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+               e->parentWidget()->frameSize().height());
+           return;
+       };
+       if ( oclass == md_catalogue)
+       {
+           dEditCat *e = new dEditCat( ws, 0, Qt::WDestructiveClose );
+           wl->insert( objid, e );
+           editor = e;
+           QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+           e->setData( this );
+           e->show();
+          // mainform->updateTabs();
+           //--mainform->addTab(++mainform->lastTabId,e->name());
+           mainform->addTab(e);
+           e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+               e->parentWidget()->frameSize().height());
+           return;
+       };
+       if ( oclass == md_field )
+       {
+           dEditField *e = new dEditField( ws, 0, Qt::WDestructiveClose );
+           wl->insert( objid, e );
+           editor = e;
+           QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+           e->setData( this );
+           e->show();
+           //mainform->updateTabs();
+           //--mainform->addTab(++mainform->lastTabId,e->name());
+           mainform->addTab(e);
+           e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+               e->parentWidget()->frameSize().height());
+           return;
+       };
+       if ( oclass == md_report )
+       {
+           dEditReport *e = new dEditReport( ws, 0, Qt::WDestructiveClose );
+           wl->insert( objid, e );
+           editor = e;
+           QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+           e->setData( this );
+           e->show();
+           //mainform->updateTabs();
+           //--mainform->addTab(++mainform->lastTabId,e->name());
+           mainform->addTab(e);
+           e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+               e->parentWidget()->frameSize().height());
+           return;
+       };
+       if ( oclass == md_journal )
+       {
+           dEditJournal *e = new dEditJournal( ws, 0, Qt::WDestructiveClose );
+           wl->insert( objid, e );
+           editor = e;
+           QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+           e->setData( this );
+           e->show();
+           //mainform->updateTabs();
+           //--mainform->addTab(++mainform->lastTabId, e->name());
+           mainform->addTab(e);
+           e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+               e->parentWidget()->frameSize().height());
+           return;
+       };
+       if ( oclass == md_form )
+       {
+           dEditDialog *e = new dEditDialog( ws, 0, Qt::WDestructiveClose );
+           wl->insert( objid, e );
+           editor = e;
+           e->setData( this );
+           QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+           e->show();
+           //mainform->updateTabs();
+           //--mainform->addTab(++mainform->lastTabId,e->name());
+           mainform->addTab(e);
+           e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+               e->parentWidget()->frameSize().height());
+           return;
+       };
+       if ( oclass == md_webform )
+       {
+           dEditWebForm *e = new dEditWebForm( ws, 0, Qt::WDestructiveClose );
+           wl->insert( objid, e );
+           editor = e;
+           QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+           e->setData( this );
+           e->show();
+           //mainform->updateTabs();
+           //--mainform->addTab(++mainform->lastTabId,e->name());
+           mainform->addTab(e);
+           e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+               e->parentWidget()->frameSize().height());
+           return;
+       };
+       if ( oclass == md_column )
+       {
+           dEditColumns *e = new dEditColumns( ws, 0, Qt::WDestructiveClose );
+           wl->insert( objid, e );
+           editor = e;
+           QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) );
+           e->setData( this );
+           e->show();
+           //mainform->updateTabs();
+           //--mainform->addTab(++mainform->lastTabId,e->name());
+           mainform->addTab(e);
+           e->parentWidget()->setGeometry(0,0,e->parentWidget()->frameSize().width(),
+               e->parentWidget()->frameSize().height());
+           return;
+       }
+}
+
+void aListViewItem::newObject()
+{
+       QString oclass = md->objClass( obj );
+//     printf("oclass = %s\n",( const char *) oclass );
+       if (    oclass == md_header || oclass == md_table ||
+               oclass == md_element || oclass == md_group ||
+               oclass == md_resources || oclass == md_dimensions || oclass == md_information ||
+               oclass == md_columns )
+                       newField();
+       if ( oclass == md_documents ) newDocument();
+       if ( oclass == md_catalogues ) newCatalogue();
+       if ( oclass == md_journals ) newJournal();
+       if ( oclass == md_iregisters ) newIRegister();
+       if ( oclass == md_aregisters ) newARegister();
+       if ( oclass == md_reports ) newReport();
+       if ( oclass == md_forms ) newForm();
+       if ( oclass == md_webforms ) newWebForm();
+       if ( oclass == md_tables ) newTable();
+       if ( oclass == md_columns ) newColumn();
+}
+
+void aListViewItem::saveItem()
+{
+
+       //md->saveOneObject()
+       QString oclass = md->objClass( obj );
+       if (    oclass == md_field ||
+               oclass == md_document ||
+               oclass == md_catalogue ||
+               oclass == md_journal ||
+               oclass == md_iregister ||
+               oclass == md_aregister ||
+               oclass == md_report ||
+               oclass == md_webform ||
+               oclass == md_form ||
+               oclass == md_table)
+       {
+
+               QString fname;
+               Q3FileDialog fd( QString::null,
+                       QObject::tr("any files (*)"),
+                       0, 0, TRUE );
+               fd.setMode(Q3FileDialog::AnyFile);
+//             fd.addFilter(tr(" (*.bsa)"));
+               fd.setSelection( oclass + md->attr(obj,mda_id) );
+               if ( fd.exec() == QDialog::Accepted )
+               {
+                       fname = QDir::convertSeparators(fd.selectedFile());
+                       md->saveOneObject(obj,fname);
+               }
+       }
+}
+
+void aListViewItem::loadItem()
+{
+
+       QString oclass = md->objClass( obj );
+
+       if (    oclass == md_header ||
+               oclass == md_table ||
+               oclass == md_element ||
+               oclass == md_group ||
+               oclass == md_resources ||
+               oclass == md_dimensions ||
+               oclass == md_information ||
+               oclass == md_columns ||
+               oclass == md_documents ||
+               oclass == md_catalogues ||
+               oclass == md_journals ||
+               oclass == md_iregisters ||
+               oclass == md_aregisters ||
+               oclass == md_reports ||
+               oclass == md_forms ||
+               oclass == md_webforms ||
+               oclass == md_tables ||
+               oclass == md_columns )
+       {
+
+               QString fname;
+               Q3FileDialog fd( QString::null,
+                       QObject::tr("any files (*)"),
+                       0, 0, TRUE );
+               fd.setMode(Q3FileDialog::ExistingFiles);
+               aCfgItem loadObj;
+//             fd.addFilter(tr(" (*.bsa)"));
+//             fd.setSelection( QDir::convertSeparators(eCfgName->text()));
+               if ( fd.exec() == QDialog::Accepted )
+               {
+                       fname = QDir::convertSeparators(fd.selectedFile());
+                       // load object from file
+                       // aCfgItem loadObj = c.loadOneObject("catalogue_copy.xml");
+                       // change name
+                       // c.setAttr(loadObj, mda_name, "CATALOGUE1 COPY!!!");
+                       // append to cfg
+                       // c.importCfgItem( c.find(c.find(0), md_catalogues) , loadObj);
+                       //
+                       loadObj = md->loadOneObject(fname);
+                       if(loadObj.isNull())
+                       {
+                               return;
+                       }
+                       else
+                       {
+                               md->setAttr(loadObj, mda_name, QString("%1_copy").arg(md->attr(loadObj, mda_name)));
+                               QString loclass = md->objClass(loadObj);
+                               if ( loclass==md_field  &&
+                                               (oclass == md_header || oclass == md_table ||
+                                               oclass == md_element || oclass == md_group ||
+                                               oclass == md_resources || oclass == md_dimensions ||
+                                               oclass == md_information || oclass == md_columns ))
+                               {
+                                       aCfgItem newobj = md->importCfgItem( obj, loadObj );
+                                       aListViewItem *newitem = new aListViewItem( this, getLastChild(), md, newobj );
+//                                     newitem->setOpen( TRUE );
+                               }
+                               if ( loclass==md_document &&  oclass == md_documents )
+                               {
+                                       //md->importCfgItem( obj, loadObj );
+                                       aCfgItem newobj = md->importCfgItem( obj, loadObj );
+                                       aListViewItem *newitem = new aListViewItem( this, getLastChild(), md, newobj );
+                               }
+                               if ( loclass==md_catalogue && oclass == md_catalogues )
+                               {
+                                       aCfgItem newobj = md->importCfgItem( obj, loadObj );
+                                       aListViewItem *newitem = new aListViewItem( this, getLastChild(), md, newobj );
+                               }
+                               if ( loclass==md_journal && oclass == md_journals )
+                               {
+                                       aCfgItem newobj = md->importCfgItem( obj, loadObj );
+                                       aListViewItem *newitem = new aListViewItem( this, getLastChild(), md, newobj );
+                               }
+                               if ( loclass==md_iregister && oclass == md_iregisters )
+                               {
+                                       aCfgItem newobj = md->importCfgItem( obj, loadObj );
+                                       aListViewItem *newitem = new aListViewItem( this, getLastChild(), md, newobj );
+                               }
+                               if ( loclass==md_aregister &&  oclass == md_aregisters )
+                               {
+                                       aCfgItem newobj = md->importCfgItem( obj, loadObj );
+                                       aListViewItem *newitem = new aListViewItem( this, getLastChild(), md, newobj );
+                               }
+                               if ( loclass==md_report && oclass == md_reports )
+                               {
+                                       aCfgItem newobj = md->importCfgItem( obj, loadObj );
+                                       aListViewItem *newitem = new aListViewItem( this, getLastChild(), md, newobj );
+                               }
+                               if ( loclass==md_form &&  oclass == md_forms )
+                               {
+                                       aCfgItem newobj = md->importCfgItem( obj, loadObj );
+                                       aListViewItem *newitem = new aListViewItem( this, getLastChild(), md, newobj );
+                               }
+                               if ( loclass==md_webform && oclass == md_webforms )
+                               {
+                                       aCfgItem newobj = md->importCfgItem( obj, loadObj );
+                                       aListViewItem *newitem = new aListViewItem( this, getLastChild(), md, newobj );
+                               }
+                               if ( loclass==md_table &&  oclass == md_tables )
+                               {
+                                       aCfgItem newobj = md->importCfgItem( obj, loadObj );
+                                       aListViewItem *newitem = new aListViewItem( this, getLastChild(), md, newobj );
+                               }
+                       }
+               }
+       }
+}
+
+
+void
+aListViewItem::newField()
+{
+       aListViewItem *newitem;
+       aCfgItem newobj;
+
+       QString oclass = md->objClass( obj );
+       if (oclass == md_header || oclass == md_table ||
+               oclass == md_element || oclass == md_group ||
+               oclass == md_resources || oclass == md_dimensions || oclass == md_information)
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insert( obj, md_field, QObject::tr("New field") );
+               newitem = new aListViewItem( this, getLastChild(), md, newobj );
+//             newitem->setSelected( TRUE );
+               newitem->edit();
+       }
+}
+
+
+void
+aListViewItem::newDocument()
+{
+       aListViewItem *newitem;
+       aCfgItem newobj;
+
+       if ( md->objClass( obj ) == md_documents ) {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insertDocument(  QObject::tr("New document") );
+/*             md->insert( newobj, md_header, QString::null, -1 );
+               md->insert( newobj, md_tables, QString::null, -1 );
+               md->insert( newobj, md_forms, QString::null, -1 );
+               md->insert( newobj, md_webforms, QString::null, -1 );
+*/             newitem = new aListViewItem( this, getLastChild(), md, newobj );
+//             newitem->setSelected( TRUE );
+               newitem->setOpen( TRUE );
+               newitem->edit();
+       }
+}
+
+
+void
+aListViewItem::newCatalogue()
+{
+       aListViewItem *newitem;
+       aCfgItem newobj;
+
+       if ( md->objClass( obj ) == md_catalogues ) {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insertCatalogue( QObject::tr("New catalogue") );
+/*             md->insert( newobj, md_element, QString::null, -1 );
+               md->insert( newobj, md_group, QString::null, -1 );
+               md->insert( newobj, md_forms, QString::null, -1 );
+               md->insert( newobj, md_webforms, QString::null, -1 );*/
+               newitem = new aListViewItem( this, getLastChild(), md, newobj );
+//             newitem->setSelected( TRUE );
+               newitem->setOpen( TRUE );
+               newitem->edit();
+       }
+}
+
+void
+aListViewItem::newJournal()
+{
+       aListViewItem *newitem;
+       aCfgItem newobj;
+
+       if ( md->objClass( obj ) == md_journals ) {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insertJournal( QObject::tr("New journal") );
+/*             md->insert( newobj, md_columns, QString::null, -1 );
+               md->insert( newobj, md_forms, QString::null, -1 );
+               md->insert( newobj, md_webforms, QString::null, -1 );*/
+               newitem = new aListViewItem( this, getLastChild(), md, newobj );
+//             newitem->setSelected( TRUE );
+               newitem->setOpen( TRUE );
+               newitem->edit();
+       }
+}
+
+void
+aListViewItem::newIRegister()
+{
+       aListViewItem *newitem;
+       aCfgItem newobj;
+
+       if ( md->objClass( obj ) == md_iregisters )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insertIRegister(  QObject::tr("New information register") );
+/*             md->insert( newobj, md_resources, QString::null, -1 );
+               md->insert( newobj, md_dimensions, QString::null, -1 );
+               md->insert( newobj, md_information, QString::null, -1 );*/
+               newitem = new aListViewItem( this, getLastChild(), md, newobj );
+//             newitem->setSelected( TRUE );
+               newitem->setOpen( TRUE );
+               newitem->edit();
+       }
+}
+
+void
+aListViewItem::newARegister()
+{
+       aListViewItem *newitem;
+       aCfgItem newobj;
+
+       if ( md->objClass( obj ) == md_aregisters )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insertARegister( QObject::tr("New accumulation register") );
+/*             md->insert( newobj, md_resources, QString::null, -1 );
+               md->insert( newobj, md_dimensions, QString::null, -1 );
+               md->insert( newobj, md_information, QString::null, -1 );*/
+               newitem = new aListViewItem( this, getLastChild(), md, newobj );
+//             newitem->setSelected( TRUE );
+               newitem->setOpen( TRUE );
+               newitem->edit();
+       }
+}
+
+void
+aListViewItem::newReport()
+{
+       aListViewItem *newitem;
+       aCfgItem newobj;
+
+       if ( md->objClass( obj ) == md_reports )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insert( obj, md_report, QObject::tr("New report") );
+               md->insert( newobj, md_forms, QString::null, -1 );
+               md->insert( newobj, md_webforms, QString::null, -1 );
+               newitem = new aListViewItem( this, getLastChild(), md, newobj );
+//             newitem->setSelected( TRUE );
+               newitem->setOpen( TRUE );
+               newitem->edit();
+       }
+}
+
+void
+aListViewItem::newForm()
+{
+       aListViewItem *newitem;
+       aCfgItem newobj;
+
+       if ( md->objClass( obj ) == md_forms )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insert( obj, md_form, QObject::tr("New form") );
+               newitem = new aListViewItem( this, getLastChild(), md, newobj );
+//             newitem->setSelected( TRUE );
+               newitem->setOpen( TRUE );
+               newitem->edit();
+       }
+}
+
+void
+aListViewItem::newWebForm()
+{
+       aListViewItem *newitem;
+       aCfgItem newobj;
+
+       if ( md->objClass( obj ) == md_webforms )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insert( obj, md_webform, QObject::tr("New web form") );
+               newitem = new aListViewItem( this, getLastChild(), md, newobj );
+//             newitem->setSelected( TRUE );
+               newitem->setOpen( TRUE );
+               newitem->edit();
+       }
+}
+
+void
+aListViewItem::newTable()
+{
+       aListViewItem *newitem;
+       aCfgItem newobj;
+
+       if ( md->objClass( obj ) == md_tables )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insert( obj, md_table, QObject::tr("New Table") );
+               newitem = new aListViewItem( this, getLastChild(), md, newobj );
+//             newitem->setSelected( TRUE );
+               newitem->setOpen( TRUE );
+               newitem->edit();
+       }
+}
+
+void
+aListViewItem::newColumn()
+{
+       aListViewItem *newitem;
+       aCfgItem newobj;
+
+       if ( md->objClass( obj ) == md_columns )
+       {
+               setSelected( FALSE );
+               setOpen( TRUE );
+               newobj = md->insert( obj, md_column, QObject::tr("New Column") );
+               newitem = new aListViewItem( this, getLastChild(), md, newobj );
+               newitem->edit();
+       }
+}
+
+aMetadataTreeView::aMetadataTreeView(  QWidget *parent, aCfg *cfgmd )
+:ananasTreeView( parent, cfgmd )
+{
+       aListViewItem *conf;
+
+       if ( !md ) return;
+       conf = new aListViewItem( this, md, md->find( mdc_metadata ), md->info( mda_name ));
+       conf->setOpen( TRUE );
+       connect( this, SIGNAL( contextMenuRequested( Q3ListViewItem*, const QPoint&, int) ), this, SLOT(ContextMenu() ) );
+       connect( this, SIGNAL( returnPressed( Q3ListViewItem* ) ), this, SLOT( itemEdit() ) );
+       connect( this, SIGNAL( doubleClicked( Q3ListViewItem* ) ), this, SLOT( itemEdit() ) );
+       connect( this, SIGNAL( collapsed( Q3ListViewItem* ) ), this, SLOT( on_collapsed( Q3ListViewItem* ) ) );
+}
+
+void
+aMetadataTreeView::on_collapsed( Q3ListViewItem * item )
+{
+       aListViewItem *i = (aListViewItem *) item;
+       if ( i )
+       {
+               QString oclass = md->objClass( i->obj );
+               if ( oclass == md_metadata ) setOpen( i, true );
+       }
+}
+
+
+void
+aMetadataTreeView::ContextMenu()
+{
+
+       Q3PopupMenu *m=new Q3PopupMenu( this, "PopupMenu" );
+       Q_CHECK_PTR(m);
+
+/*     QLabel *caption = new QLabel( "<font color=darkblue><u><b>"
+               "Context Menu</b></u></font>", this );
+               caption->setAlignment( Qt::AlignCenter );
+       m->insertItem( caption );
+       m->insertItem( "&New",  this, SLOT( itemNew() ), CTRL+Key_N );
+               m->insertItem( "&Rename", this, SLOT( itemRename() ), CTRL+Key_O);
+               m->insertItem( "&Edit",  this, SLOT( itemEdit() ), CTRL+Key_N );
+       m->insertItem( "&Delete", this, SLOT( itemDelete() ), CTRL+Key_O );*/
+
+               ContextMenuAdd(m);
+               m->insertItem( tr("&New"),  this, SLOT( itemNew() ), Qt::CTRL+Qt::Key_N );
+               m->exec( QCursor::pos() );
+               delete m;
+}
+
+
+void
+aMetadataTreeView::itemRename()
+{
+       renameItem();
+}
+
+void
+aMetadataTreeView::itemNew()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               //if ( i->id == 0 )
+                        i->newObject();
+       }
+}
+
+
+void
+aMetadataTreeView::itemDelete()
+{
+       deleteItem();
+}
+
+
+void
+aMetadataTreeView::itemEdit()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               i->edit();
+       }
+}
+
+void
+aMetadataTreeView::itemSave()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               i->saveItem();
+       }
+}
+
+void
+aMetadataTreeView::itemLoad()
+{
+       aListViewItem *i = (aListViewItem *) selectedItem();
+       if ( i )
+       {
+               i->loadItem();
+       }
+}
+void
+aMetadataTreeView::itemMoveUp()
+{
+       moveUpItem();
+}
+
+void
+aMetadataTreeView::itemMoveDown()
+{
+
+       moveDownItem();
+}
diff --git a/src/designer/mdtree.h b/src/designer/mdtree.h
new file mode 100644 (file)
index 0000000..a7efc9f
--- /dev/null
@@ -0,0 +1,115 @@
+/****************************************************************************
+** $Id: mdtree.h,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Header file of the Metadata Tree of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef MDTREE_H
+#define MDTREE_H
+#include <q3listview.h>
+#include <q3intdict.h>
+#include "acfg.h"
+#include "formdesigner.h"
+#include "atreeitems.h"
+
+extern aFormDesigner *formdesigner;
+//#include "cfg.h"
+class QWidget;
+
+class aListViewItem : public ananasListViewItem
+{
+public:
+/*     int id;
+       aCfgItem obj;
+       QWidget *editor;
+       aCfg *md;
+*/
+       aListViewItem(ananasListViewItem *parent, ananasListViewItem *after, aCfg * cfgmd, aCfgItem cfgobj, const QString &name = QString::null );
+//     aListViewItem(QListViewItem *parent, aCfg * cfgmd, aCfgItem cfgobj, const QString &name = QString::null );
+       aListViewItem(Q3ListView *parent, aCfg * cfgmd, aCfgItem obj, const QString &name = QString::null );
+       ~aListViewItem();
+       QString text( int column ) const;
+       void loadTree();
+       void setup();
+       void update();
+       void edit();
+       void newObject();
+       void newField();
+       void newDocument();
+       void newCatalogue();
+       void newJournal();
+       void newIRegister();
+       void newARegister();
+       void newReport();
+       void newForm();
+       void newWebForm();
+       void newTable();
+       void newColumn();
+       void saveItem();
+       void loadItem();
+
+
+protected:
+//     virtual void okRename( int col );
+       virtual int compare( Q3ListViewItem *i, int col, bool accending ) const;
+private:
+       void loadDocument ();
+       void loadJournal ();
+       void loadIRegister ();
+       void loadARegister ();
+       void loadCatalogue ();
+       void loadReport ();
+       void loadFields (aListViewItem *parent);
+       void loadForms (aListViewItem *parent);
+       void loadWebForms (aListViewItem *parent);
+       void loadColumns ( aListViewItem *parent );
+};
+
+
+class aMetadataTreeView : public ananasTreeView
+{
+       Q_OBJECT
+public:
+//     aCfg *md;
+
+       aMetadataTreeView( QWidget *parent, aCfg *cfgmd );
+
+public slots:
+       void ContextMenu();
+       void itemNew();
+       void itemEdit();
+       void itemMoveUp();//не работает, проверить поиск элементов  в визуальном дереве
+       void itemMoveDown();//не работает, проверить поиск элементов  в визуальном дереве
+       void itemDelete();
+       void itemRename();
+       void itemSave();
+       void itemLoad();
+private slots:
+       void on_collapsed( Q3ListViewItem *item );
+private:
+       Q3IntDict<QWidget> editors;
+};
+
+#endif
diff --git a/src/designer/pixmappreview.h b/src/designer/pixmappreview.h
new file mode 100644 (file)
index 0000000..2dd995b
--- /dev/null
@@ -0,0 +1,51 @@
+/****************************************************************************
+** $Id: pixmappreview.h,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Ffile of the Pixmap preview of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef PIXMAPPREVIEW_H
+#define PIXMAPPREVIEW_H
+
+#include <qlabel.h>
+#include <qpixmap.h>
+#include <q3filedialog.h>
+#include <qinputdialog.h>
+
+class PixmapPreview : public QLabel, public Q3FilePreview
+{
+    Q_OBJECT
+public:
+    PixmapPreview( QWidget *parent=0 ) : QLabel( parent ) {}
+    void previewUrl( const Q3Url &u )
+    {
+       QString path = u.path();
+       QPixmap pix( path );
+       if ( pix.isNull() ) setText( tr("This is not a pixmap") );
+       else setPixmap( pix );
+    }
+};
+
+#endif
diff --git a/src/designer/roleeditor.cpp b/src/designer/roleeditor.cpp
new file mode 100644 (file)
index 0000000..4eeb035
--- /dev/null
@@ -0,0 +1,135 @@
+/****************************************************************************
+** $Id: roleeditor.cpp,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Code file of the Alias editor of Ananas
+** Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <q3header.h>
+#include "roleeditor.h"
+#include "acfg.h"
+
+
+aRoleEditor::aRoleEditor( aCfg *c, aCfgItem o, Q3Table *t, const char *p )
+{
+    ac = c;
+    obj = o;
+    tRoles = t;
+    tRoles->setNumRows( 0 );
+    tRoles->setNumCols( 1 );
+    tRoles->horizontalHeader()->setLabel( 0, tr("Read") );
+    parent = p;
+    if ( !strcmp( parent, md_document ) ) {
+       tRoles->setNumCols( 5 );
+       tRoles->horizontalHeader()->setLabel( 1, tr("Write") );
+       tRoles->horizontalHeader()->setLabel( 2, tr("Delete") );
+       tRoles->horizontalHeader()->setLabel( 3, tr("Turn On") );
+       tRoles->horizontalHeader()->setLabel( 4, tr("Turn Off") );
+    }
+    if ( !strcmp( parent, md_catalogue ) ) {
+       tRoles->setNumCols( 3 );
+       tRoles->horizontalHeader()->setLabel( 1, tr("Write") );
+       tRoles->horizontalHeader()->setLabel( 2, tr("Delete") );
+    }
+
+}
+
+aRoleEditor::~aRoleEditor()
+{
+}
+
+void
+aRoleEditor::setData()
+{
+    int i, j, n;
+    aCfgItem orole, roles, role;
+    QString rolename, right;
+
+    roles = ac->find( ac->find( mdc_root ), md_roles, 0 );
+    roleCount = ac->count( roles, md_role );
+    n = ac->countChild( obj, md_role );
+    tRoles->setNumRows( roleCount );
+    for ( i = 0; i < roleCount; i++ ) {
+       role = ac->findChild( roles, md_role, i );
+       rolename = ac->attr( role, mda_name );
+       tRoles->verticalHeader()->setLabel( i, rolename );
+       Q3CheckTableItem *r = new Q3CheckTableItem( tRoles, QString::null );
+       tRoles->setItem( i, 0, r );
+       Q3CheckTableItem *w = new Q3CheckTableItem( tRoles, QString::null );
+       Q3CheckTableItem *d = new Q3CheckTableItem( tRoles, QString::null );
+       Q3CheckTableItem *on = new Q3CheckTableItem( tRoles, QString::null );
+       Q3CheckTableItem *off = new Q3CheckTableItem( tRoles, QString::null );
+       if ( !strcmp( parent, md_catalogue ) ) {
+               tRoles->setItem( i, 1, w );
+               tRoles->setItem( i, 2, d );
+           }
+       if ( !strcmp( parent, md_document ) ) {
+               tRoles->setItem( i, 1, w );
+               tRoles->setItem( i, 2, d );
+               tRoles->setItem( i, 3, on );
+               tRoles->setItem( i, 4, off );
+           }
+       for ( j = 0; j < n; j++) {
+           orole = ac->findChild( obj, md_role, j );
+           if ( rolename == ac->attr( orole, mda_name ) ) {
+               right = ac->attr( orole, mda_rights );
+               if ( right.find( "-r" ) > -1 ) r->setChecked( TRUE );
+               if ( right.find( "-w" ) > -1 ) w->setChecked( TRUE );
+               if ( right.find( "-d" ) > -1 ) d->setChecked( TRUE );
+               if ( right.find( "-on" ) > -1 ) on->setChecked( TRUE );
+               if ( right.find( "-off" ) > -1 ) off->setChecked( TRUE );
+           }
+       }
+    }
+}
+
+void aRoleEditor::updateMD()
+{
+    int i;
+    aCfgItem role;
+
+    do {
+       role = ac->findChild( obj, md_role, 0 ) ;
+       if ( !role.isNull() ) ac->remove( role );
+    } while ( !role.isNull() );
+    for ( i = 0; i < tRoles->numRows(); i++ ) {
+       QString right;
+       Q3CheckTableItem *q;
+       role = ac->insert( obj, md_role, tRoles->text( i, 0 ), -1 );
+       ac->setAttr( role, mda_name, tRoles->verticalHeader()->label( i ));
+       q = (Q3CheckTableItem *)tRoles->item( i, 4 );
+       if ( q ) if ( q->isChecked() ) right.insert( 0, "-off" );
+       q = (Q3CheckTableItem *)tRoles->item( i, 3 );
+       if ( q ) if ( q->isChecked() ) right.insert( 0, "-on" );
+       q = (Q3CheckTableItem *)tRoles->item( i, 2 );
+       if ( q ) if ( q->isChecked() ) right.insert( 0, "-d" );
+       q = (Q3CheckTableItem *)tRoles->item( i, 1 );
+       if ( q ) if ( q->isChecked() ) right.insert( 0, "-w" );
+       q = (Q3CheckTableItem *)tRoles->item( i, 0 );
+       if ( q ) if ( q->isChecked() ) right.insert( 0, "-r" );
+       ac->setAttr( role, mda_rights, right );
+    }
+}
+
diff --git a/src/designer/roleeditor.h b/src/designer/roleeditor.h
new file mode 100644 (file)
index 0000000..9a65241
--- /dev/null
@@ -0,0 +1,55 @@
+/****************************************************************************
+** $Id: roleeditor.h,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Header file of the Alias editor of Ananas
+** Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ROLEDITOR_H
+#define ROLEDITOR_H
+
+#include <q3table.h>
+#include <qobject.h>
+#include "acfg.h"
+
+class aRoleEditor : public QObject
+{
+       Q_OBJECT
+public:
+    aCfg *ac;
+    aCfgItem obj;
+    Q3Table *tRoles;
+    int roleCount;
+
+    aRoleEditor( aCfg *c, aCfgItem o, Q3Table *tRoles, const char *p );
+    ~aRoleEditor();
+
+    void setData();
+    void updateMD( );//aCfgItem o );
+private:
+    const char *parent;
+};
+
+#endif
diff --git a/src/designer/templates/inputform.tpl b/src/designer/templates/inputform.tpl
new file mode 100644 (file)
index 0000000..df62376
--- /dev/null
@@ -0,0 +1,22 @@
+<ui version="4.0" stdsetdef="1" >
+  <author></author>
+  <comment></comment>
+  <exportmacro></exportmacro>
+  <class>AForm</class>
+  <widget class="Q3MainWindow" name="AForm" >
+    <property name="geometry" >
+      <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>500</width>
+        <height>381</height>
+      </rect>
+    </property>
+    <property name="windowTitle" >
+      <string>New form</string>
+    </property>
+    <widget class="QWidget" />
+  </widget>
+  <layoutdefault spacing="5" margin="5" />
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+</ui>
diff --git a/src/designer/templates/inputform.ui.tpl b/src/designer/templates/inputform.ui.tpl
new file mode 100644 (file)
index 0000000..1587630
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>AForm</class>
+<widget class="QMainWindow">
+    <property name="name">
+        <cstring>AForm</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>500</width>
+            <height>381</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>New form</string>
+    </property>
+</widget>
+<toolbars>
+</toolbars>
+<layoutdefaults spacing="5" margin="5"/>
+</UI>
diff --git a/src/designer/templates/inputformcat.tpl b/src/designer/templates/inputformcat.tpl
new file mode 100644 (file)
index 0000000..be95ae7
--- /dev/null
@@ -0,0 +1,30 @@
+<ui version="4.0" stdsetdef="1" >
+  <author></author>
+  <comment></comment>
+  <exportmacro></exportmacro>
+  <class>Catalogue</class>
+  <widget class="wCatalogue" name="Catalogue" >
+    <property name="Id" >
+      <number>0</number>
+    </property>
+    <property name="Name" >
+      <cstring>$$$name$$$</cstring>
+    </property>
+    <property name="geometry" >
+      <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>500</width>
+        <height>381</height>
+      </rect>
+    </property>
+    <property name="caption" >
+      <string>$$$caption$$$</string>
+    </property>
+  </widget>
+  <layoutdefault spacing="5" margin="5" />
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+  <includes>
+    <include location="local" >wcatalogue.h</include>
+  </includes>
+</ui>
diff --git a/src/designer/templates/inputformcat.ui.tpl b/src/designer/templates/inputformcat.ui.tpl
new file mode 100644 (file)
index 0000000..7257f82
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>Catalogue</class>
+<widget class="wCatalogue" row="0" column="0">
+    <property name="name">
+        <cstring>Catalogue</cstring>
+    </property>
+    <property name="Id">
+       <number>$$$id$$$</number>
+    </property>
+    <property name="Name">
+       <cstring>$$$name$$$</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>500</width>
+            <height>381</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>$$$caption$$$</string>
+    </property>
+</widget>
+<toolbars>
+</toolbars>
+<layoutdefaults spacing="5" margin="5"/>
+<includehints>
+    <includehint>wcatalogue.h</includehint>
+</includehints>
+</UI>
diff --git a/src/designer/templates/inputformdoc.tpl b/src/designer/templates/inputformdoc.tpl
new file mode 100644 (file)
index 0000000..e7f19c5
--- /dev/null
@@ -0,0 +1,30 @@
+<ui version="4.0" stdsetdef="1" >
+  <author></author>
+  <comment></comment>
+  <exportmacro></exportmacro>
+  <class>Document</class>
+  <widget class="wDocument" name="Document" >
+    <property name="Id" >
+      <number>0</number>
+    </property>
+    <property name="Name" >
+      <cstring>$$$name$$$</cstring>
+    </property>
+    <property name="geometry" >
+      <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>500</width>
+        <height>378</height>
+      </rect>
+    </property>
+    <property name="caption" >
+      <string>$$$caption$$$</string>
+    </property>
+  </widget>
+  <layoutdefault spacing="5" margin="5" />
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+  <includes>
+    <include location="local" >wdocument.h</include>
+  </includes>
+</ui>
diff --git a/src/designer/templates/inputformdoc.ui.tpl b/src/designer/templates/inputformdoc.ui.tpl
new file mode 100644 (file)
index 0000000..ebd70ba
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>Document</class>
+<widget class="wDocument">
+    <property name="name">
+        <cstring>Document</cstring>
+    </property>
+    <property name="Id">
+        <number>$$$id$$$</number>
+    </property>            
+    <property name="Name">
+        <cstring>$$$name$$$</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>500</width>
+            <height>378</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>$$$caption$$$</string>
+    </property>
+</widget>
+<toolbars>
+</toolbars>
+<layoutdefaults spacing="5" margin="5"/>
+<includehints>
+    <includehint>wdocument.h</includehint>
+</includehints>
+</UI>
diff --git a/src/designer/templates/inputformjourn.tpl b/src/designer/templates/inputformjourn.tpl
new file mode 100644 (file)
index 0000000..b0e32e4
--- /dev/null
@@ -0,0 +1,30 @@
+<ui version="4.0" stdsetdef="1" >
+  <author></author>
+  <comment></comment>
+  <exportmacro></exportmacro>
+  <class>Journal</class>
+  <widget class="wJournal" name="Journal" >
+    <property name="Id" >
+      <number>0</number>
+    </property>
+    <property name="Name" >
+      <cstring>$$$name$$$</cstring>
+    </property>
+    <property name="geometry" >
+      <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>500</width>
+        <height>378</height>
+      </rect>
+    </property>
+    <property name="caption" >
+      <string>$$$caption$$$</string>
+    </property>
+  </widget>
+  <layoutdefault spacing="5" margin="5" />
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+  <includes>
+    <include location="local" >wjournal.h</include>
+  </includes>
+</ui>
diff --git a/src/designer/templates/inputformjourn.ui.tpl b/src/designer/templates/inputformjourn.ui.tpl
new file mode 100644 (file)
index 0000000..a7ea9a3
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>Journal</class>
+<widget class="wJournal">
+    <property name="name">
+        <cstring>Journal</cstring>
+    </property>
+    <property name="Id">
+        <number>$$$id$$$</number>
+    </property>            
+    <property name="Name">
+        <cstring>$$$name$$$</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>500</width>
+            <height>378</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>$$$caption$$$</string>
+    </property>
+</widget>
+<toolbars>
+</toolbars>
+<layoutdefaults spacing="5" margin="5"/>
+<includehints>
+    <includehint>wjournal.h</includehint>
+</includehints>
+</UI>
diff --git a/src/designer/templates/inputformrep.tpl b/src/designer/templates/inputformrep.tpl
new file mode 100644 (file)
index 0000000..8007c73
--- /dev/null
@@ -0,0 +1,30 @@
+<ui version="4.0" stdsetdef="1" >
+  <author></author>
+  <comment></comment>
+  <exportmacro></exportmacro>
+  <class>Report</class>
+  <widget class="wReport" name="Report" >
+    <property name="Id" >
+      <number>0</number>
+    </property>
+    <property name="Name" >
+      <cstring>$$$name$$$</cstring>
+    </property>
+    <property name="geometry" >
+      <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>500</width>
+        <height>378</height>
+      </rect>
+    </property>
+    <property name="caption" >
+      <string>$$$caption$$$</string>
+    </property>
+  </widget>
+  <layoutdefault spacing="5" margin="5" />
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+  <includes>
+    <include location="local" >wreport.h</include>
+  </includes>
+</ui>
diff --git a/src/designer/templates/inputformrep.ui.tpl b/src/designer/templates/inputformrep.ui.tpl
new file mode 100644 (file)
index 0000000..a1358b9
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>Report</class>
+<widget class="wReport">
+    <property name="name">
+        <cstring>Report</cstring>
+    </property>
+    <property name="Id">
+        <number>$$$id$$$</number>
+    </property>            
+    <property name="Name">
+        <cstring>$$$name$$$</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>500</width>
+            <height>378</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>$$$caption$$$</string>
+    </property>
+</widget>
+<toolbars>
+</toolbars>
+<layoutdefaults spacing="5" margin="5"/>
+<includehints>
+    <includehint>wreport.h</includehint>
+</includehints>
+</UI>
diff --git a/src/extensions/README b/src/extensions/README
new file mode 100644 (file)
index 0000000..34a7165
--- /dev/null
@@ -0,0 +1,44 @@
+ANANAS EXTENSIONS SYSTEM
+author: Valery Grazdankin, Leader InfoTech
+
+Ananas engine finding extentions
+in 'extensions' directory 
+below application path directory (by default).
+For Linux will be moving to /usr/share/ananas/extensions
+
+SHORT WAY FOR CREATE EXTENSION:
+
+1. Define object with AExtension parent
+2. In constructor of the object call AExtension constructor
+   with Extension name string parameter. For example:
+   
+   AExtensionMy::AExtensionMy() : AExtension("MyExtension")
+   {
+   ...
+   } 
+   This name will be used in Ananas script for 'new'
+   operator without parameters, for example: 
+   
+   Ext = new MyExtension();
+   
+3. Define public slots: 
+    it will be functions, callable from Ananas script.
+4. Define Q_PROPERTY ( see demo )
+    it will be object variables
+5. 
+   At end of extension implementation (*.cpp) file define and export 
+   AnanasExtensionPlugin object for the extension, using template: 
+
+   #include <aextensionplugin.h>   
+   typedef AExtensionPlugin<extension_object_name> plugin_object_name;
+   A_EXPORT_PLUGIN( plugin_object_name )
+
+   For example:
+
+   #include <aextensionplugin.h>   
+   typedef AExtensionPlugin<AExtensionMy> AExtensionMyPlugin;
+   A_EXPORT_PLUGIN( AExtensionMyPlugin )
+
+6. Compile plugin
+7. Move it to Ananas extensions directory.
+8. USE IT AND ENJOY
diff --git a/src/extensions/example/aextexample.cpp b/src/extensions/example/aextexample.cpp
new file mode 100644 (file)
index 0000000..cd50b73
--- /dev/null
@@ -0,0 +1,62 @@
+/****************************************************************************
+** $Id: aextexample.cpp,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Extension object implementation file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2006 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2006 Valery Grazdankin, Orenburg.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "aextexample.h"
+#include "acfg.h"
+
+AExtExample::AExtExample()
+    : AExtension("AExtExample")
+{
+    startTimer( 5000 );
+}
+
+
+
+AExtExample::~AExtExample()
+{
+}
+
+void 
+AExtExample::PrintMessage( const QString &msg )
+{
+    setLastMessage( msg );
+    cfg_message(0, "AExtTest MSG:%s\n", (const char *) msg);
+}
+
+void 
+AExtExample::timerEvent( QTimerEvent * )
+{
+    emit event("10");
+}
+
+#include <aextensionplugin.h>
+typedef AExtensionPlugin<AExtExample> AExtExamplePlugin;
+A_EXPORT_PLUGIN( AExtExamplePlugin )
diff --git a/src/extensions/example/aextexample.h b/src/extensions/example/aextexample.h
new file mode 100644 (file)
index 0000000..752e295
--- /dev/null
@@ -0,0 +1,64 @@
+/****************************************************************************
+** $Id: aextexample.h,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Extension object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AEXTEXAMPLE_H
+#define AEXTEXAMPLE_H
+
+#include "aextension.h"
+
+/**
+ * \en
+ * Class for work with extensions
+ * \_en
+ * \ru
+ * \_ru
+ */
+class  ANANAS_EXPORT AExtExample : public AExtension
+{
+    Q_OBJECT
+    Q_PROPERTY( QString lastMessage READ getLastMessage WRITE setLastMessage )
+
+public:
+
+    AExtExample();
+    ~AExtExample();
+public:
+    QString getLastMessage() const { return vMessage;};
+    void setLastMessage( const QString &v ){ vMessage = v;};
+
+public slots:
+    void PrintMessage( const QString &msg );
+protected:
+    void timerEvent( QTimerEvent * );
+private:
+    QString vMessage;
+};
+
+#endif //AEXTEXAMPLE_H
diff --git a/src/extensions/example/example.pro b/src/extensions/example/example.pro
new file mode 100644 (file)
index 0000000..adfeb02
--- /dev/null
@@ -0,0 +1,17 @@
+include(../../lib/lib.pri)
+TARGET    = aextexample
+SOURCES        += aextexample.cpp 
+HEADERS        += aextexample.h 
+include ( ../../ananas.pri )
+shared {
+win32:DEFINES+= ANANAS_DLL
+} else {
+win32:DEFINES   += ANANAS_NO_DLL
+}
+TEMPLATE       =lib
+LIBS   += -L../../../lib -lananas4
+CONFIG         += plugin
+INCLUDEPATH    += ../../lib 
+LANGUAGE       = C++
+DESTDIR                = ..
+#win32:DLLDESTDIR      = ..
diff --git a/src/extensions/extensions.pro b/src/extensions/extensions.pro
new file mode 100644 (file)
index 0000000..bf22596
--- /dev/null
@@ -0,0 +1,6 @@
+TEMPLATE = subdirs
+SUBDIRS  = example 
+SUBDIRS += text 
+SUBDIRS += xml
+SUBDIRS += meta
+#unix:SUBDIRS += te
diff --git a/src/extensions/meta/aext_meta.cpp b/src/extensions/meta/aext_meta.cpp
new file mode 100644 (file)
index 0000000..625a9be
--- /dev/null
@@ -0,0 +1,217 @@
+/****************************************************************************
+** $Id: aext_meta.cpp,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Extension object implementation file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2006 Andrey Paskal
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+//#include <qtextstream.h>
+#include <qdom.h>
+#include <qstringlist.h> 
+
+#include "aext_meta.h"
+#include "adatabase.h"
+#include <aextensionplugin.h>
+
+/**
+ *\en
+ *     Create object.
+ *\_en \ru
+ *     Создает объект.
+ *\_ru
+ */
+AExtMeta::AExtMeta()
+    : AExtension("Meta")
+{
+}
+
+
+/**
+ *\en
+ *     Destroy object.
+ *\_en \ru
+ *     Уничтожает объект.
+ *\_ru
+ */
+AExtMeta::~AExtMeta()
+{
+}
+
+/**
+ * \en
+ * \_en 
+ * \ru
+ *     \brief Возвращает имя класса бизнес объекта по идентификатору класса, присвоенному классу в метаданных.
+ *
+ *     Имя класса может быть например "Справочник товаров", "Справочник счетов".
+ *     \param id - идентификатор класса в метаданных
+ *     \return имя класса в бизнес схеме
+ *
+ *     Пример использования
+ *     \code
+ *     meta = new Meta();
+ *     sys.Message(0,"id=129, Class name = "+meta.GetClassName(129));
+ *     \endcode
+ *
+ *     \see GetBaseClassName(...)
+ * \_ru
+ */
+QString
+AExtMeta::GetClassName(const long &id)
+{
+    return db->cfg.attr(db->cfg.find(id),"name");
+}
+
+
+/**
+ * \en
+ * \_en 
+ * \ru
+ *     \brief Возвращает имя базового класса бизнес объекта по идентификатору класса, присвоенному классу в метаданных.
+ *
+ *     Имя базового класса может быть, например "catalogue", "document", "aregister", "iregister","journal", "report".
+ *     \param id - идентификатор класса в метаданных
+ *     \return имя базового класса в бизнес схеме
+ *
+ *     Пример использования
+ *     \code
+ *     meta = new Meta();
+ *     sys.Message(0,"id=129, Base class name = "+meta.GetBaseClassName(129));
+ *     \endcode
+ *
+ *     \see GetClassName(...)
+ * \_ru
+ */
+QString
+AExtMeta::GetBaseClassName(const long &id)
+{
+    return db->cfg.objClass(id);
+}
+
+/**
+ * \en
+ * \_en 
+ * \ru
+ *     \brief Возвращает имя базового класса бизнес объекта по уникальному идентификатору
+ *     бизнес объекта в базе данных.
+ *     
+ *     Имя базового класса может быть, например "catalogue", "document", "aregister", "iregister","journal", "report".
+ *     \param id - уникальный идентификатор бизнес обхъекта в базе данных
+ *     \return имя базового класса в бизнес схеме
+ *
+ *     Пример использования
+ * \code
+ *     meta = new Meta();
+ *     sys.Message(0,"uid=6, base class name ="+meta.GetBaseClassNameByObjectUid(6));
+ * \endcode
+ * \see GetClassNameByObjectUid(...)
+ * \_ru
+ */
+QString
+AExtMeta::GetBaseClassNameByObjectUid(const long &id)
+{
+    return db->cfg.objClass(db->uidType(id));
+}
+
+/**
+ * \en
+ * \_en 
+ * \ru
+ *     \brief Возвращает имя класса бизнес объекта по уникальному идентификатору бизнес объекта в базе данных
+ *
+ *     Имя класса может быть например "Справочник товаров", "Справочник счетов".
+ *     \param id - уникальный идентификатор бизнес объекта в базе данных
+ *     \return имя класса в бизнес схеме
+ *     
+ *     Пример использования
+ * \code
+ *     meta = new Meta();
+ *     sys.Message(0,"uid=6, class name ="+meta.GetClassNameByObjectUid(6));
+ * \endcode
+ * \see GetBaseClassNameByObjectUid(...)
+ * \_ru
+ */
+QString
+AExtMeta::GetClassNameByObjectUid(const long &id)
+{
+    return db->cfg.attr(db->cfg.find(db->uidType(id)),"name");
+}
+
+/**
+ * \en
+ * \_en 
+ * \ru
+ *     \brief Возвращает количество бизнес объектов указанного класса в бизнес схеме.
+ *
+ *     Имя класса может быть, например, "catalogue", "document".
+ *     \param className - Имя класса
+ *     \return количество бизнес объектов
+ *     
+ *     Пример использования
+ * \code
+ *     meta = new Meta();
+ * \endcode
+ * \_ru
+ */
+int
+AExtMeta::CountByClassName(const QString &className) {
+       return db->cfg.count(db->cfg.find(mdc_root),className);
+}
+
+/**
+ * \en
+ * \_en 
+ * \ru
+ *     \brief Возвращает список имен бизнес объектов указанного класса в бизнес схеме.
+ *
+ *     Имя класса может быть, например, "catalogue", "document".
+ *     TODO: Требуется проверить возможность передачи возвращаемого значения в Скрипт. Возможно списки и не поддерживаются.
+ *     \param className - Имя класса
+ *     \return Список названий
+ *     
+ *     Пример использования
+ * \code
+ *     meta = new Meta();
+ * \endcode
+ * \_ru
+ */
+QStringList
+AExtMeta::ListByClassName(const QString &className) {
+       QStringList sList;
+       QDomNodeList nodeList=db->cfg.find(mdc_root).elementsByTagName(className);
+       int i,cnt = nodeList.count();
+       for (i=0; i<cnt; i++) 
+       {
+               QDomElement el= nodeList.item(i).toElement();
+               if (!el.isNull()) 
+               {
+                       sList+=el.attribute("name");
+               }
+       }
+       return sList;
+}
+
+typedef AExtensionPlugin<AExtMeta> AExtMetaPlugin;
+A_EXPORT_PLUGIN( AExtMetaPlugin )
diff --git a/src/extensions/meta/aext_meta.h b/src/extensions/meta/aext_meta.h
new file mode 100644 (file)
index 0000000..187438c
--- /dev/null
@@ -0,0 +1,77 @@
+/****************************************************************************
+** $Id: aext_meta.h,v 1.1 2008/11/05 21:16:27 leader Exp $
+**
+** Extension object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2006 Andrey Paskal
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AEXT_META_H
+#define AEXT_META_H
+
+
+
+#include "aextension.h"
+#include "acfg.h"
+
+/**
+ * \en
+ *     Class for work with meta data API from Ananas Script.
+ * \_en
+ * \ru
+ *     \brief Предоставляет доступ к интервейсу метаданных из Ананас скрипта.
+ *
+ *     Пример использования функций GetBaseClassName, GetClassName, GetBaseClassNameByObjectUid, 
+ *     GetClassNameByObjectUid
+ * \code
+ *     meta = new Meta();
+ *     sys.Message(0,"class id = 129, base class name ="+meta.GetBaseClassName(129));
+ *     sys.Message(0,"class id =129, class name ="+meta.GetClassName(129));
+ *     sys.Message(0,"uid=6, base class name ="+meta.GetBaseClassNameByObjectUid(6));
+ *     sys.Message(0,"uid=6, class name ="+meta.GetClassNameByObjectUid(6));
+ * \endcode
+ *
+ * \_ru
+ */
+class  ANANAS_EXPORT AExtMeta : public AExtension
+{
+    Q_OBJECT
+
+public:
+
+    AExtMeta();
+    ~AExtMeta();
+public:
+
+public slots:
+       QString GetBaseClassName(const long &ClassId);
+       QString GetClassName(const long &ClassId);
+       QString GetBaseClassNameByObjectUid(const long &ObjectUid);
+       QString GetClassNameByObjectUid(const long &ObjectUid);
+       int     CountByClassName(const QString &className);
+       QStringList ListByClassName(const QString &className);
+};
+
+
+#endif //AEXT_META_H
diff --git a/src/extensions/meta/meta.pro b/src/extensions/meta/meta.pro
new file mode 100644 (file)
index 0000000..6a84db6
--- /dev/null
@@ -0,0 +1,16 @@
+include(../../lib/lib.pri)
+TARGET    = aext_meta
+SOURCES        += aext_meta.cpp 
+HEADERS        += aext_meta.h 
+include ( ../../ananas.pri )
+shared {
+win32:DEFINES+= ANANAS_DLL
+} else {
+win32:DEFINES   += ANANAS_NO_DLL
+}
+TEMPLATE       =lib
+LIBS   += -L../../../lib -lananas4
+CONFIG         += plugin
+INCLUDEPATH    += ../../lib 
+LANGUAGE       = C++
+DESTDIR                = ..
diff --git a/src/extensions/te/README b/src/extensions/te/README
new file mode 100644 (file)
index 0000000..dfc6489
--- /dev/null
@@ -0,0 +1,55 @@
+Ananas script examples for trade equipment drivers:
+TEDisplayVF2029, TEReaderBarcode
+
+1.global module:
+
+var TradeEq = 0;   // global trade equipment manager
+var TEDisplay = 0; // Display object
+var TEReader = 0;  // Reader object
+
+// EVENTS GLOBAL HANDLER
+function on_event( src, data )
+{
+    sys.Message(1,"Global module: on_event from "+src+" data="+data);
+}
+
+function on_systemstart()
+{
+    TradeEq = new TradeEquipment();
+    TEDisplay = TradeEq.newDriver("TEDisplayVF2029");
+    if (TEDisplay) {
+      TEDisplay.setPortBaudRate(12); //9600
+      TEDisplay.setPortNumberAndInit(2); // COM2
+    }
+    TEReader = TradeEq.newDriver("TEReaderBarcode");
+    if (TEReader) {
+        TEReader.PortNumber = 1;
+        TEReader.PortBaudRate = 9600;
+        TEReader.startDriver();
+   }
+}
+
+2.Document module
+
+// 
+function on_formstart(){
+    TEReader.clearBuffer(); // clear unprocessed barcodescodes
+}
+       
+// DISPLAY TEXT ON ROW CHANGED.
+function on_tablerow( name ){
+    print("Table "+name+" row changed");
+    TEDisplay.showText("ROW CHANGED","line1","scroll/left");
+}
+
+// EVENTS DOCUMENT HANDLER     
+function on_event( src, data )
+{
+    sys.Message(1,"Document module: on_event from "+src+" data="+data);
+    if (src=="TradeEquipment") {
+    // NEED CHECK 'data' VALUE FOR READER EVENT FILTERS
+        bc = TEReader.text();
+         SetValue("Barcode", bc); // SET FIELD VALUE TO BARCODE READED
+         TEReader.next();
+     }
+}
diff --git a/src/extensions/te/aextte.cpp b/src/extensions/te/aextte.cpp
new file mode 100644 (file)
index 0000000..fc128a6
--- /dev/null
@@ -0,0 +1,99 @@
+/****************************************************************************
+** $Id: aextte.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Extension object implementation file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2006 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2006 Valery Grazdankin, Orenburg.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include <qlibrary.h>
+
+#include "aextte.h"
+#include "acfg.h"
+#include "teglobal.h"
+#include "tebase.h"
+
+AExtTE::AExtTE()
+    : AExtension("TradeEquipment")
+{
+    telib = 0;
+    te_drivers = 0;
+    te_driverExists = 0;
+    te_createDriverObject = 0;
+    telib = new QLibrary("tradeequip");
+    if (telib) {
+           telib->load();
+           te_drivers = (p_te_drivers) telib->resolve( "te_drivers" );
+           te_driverExists = (p_te_driverExists) telib->resolve( "te_driverExists" );
+           te_createDriverObject = (p_te_createDriverObject) telib->resolve( "te_createDriverObject" );
+    }
+}
+
+
+
+AExtTE::~AExtTE()
+{
+    if (telib) delete telib;
+}
+
+
+QStringList
+AExtTE::drivers( const QString &baseclass )
+{
+    QStringList l;
+    if (te_drivers) l = te_drivers( baseclass );
+    return l;
+}
+
+bool 
+AExtTE::driverExists( const QString &name )
+{
+    if (te_driverExists) return te_driverExists( name, QString::null );
+    return false;
+}
+
+
+QObject * 
+AExtTE::newDriver( const QString &name )
+{
+    TEBase *te = 0;
+    if (te_createDriverObject) {
+       te =  te_createDriverObject( name );
+       connect( te, SIGNAL( deviceEvent(int) ), this, SLOT( deviceEvent(int)));
+    }
+    return ( QObject *) te;
+    
+}
+
+void 
+AExtTE::deviceEvent( int eventCode )
+{
+    const QObject *obj = sender();
+    emit event(QString(obj->name())+"::");
+}
+
+#include <aextensionplugin.h>
+typedef AExtensionPlugin<AExtTE> ATEPlugin;
+A_EXPORT_PLUGIN( ATEPlugin )
diff --git a/src/extensions/te/aextte.h b/src/extensions/te/aextte.h
new file mode 100644 (file)
index 0000000..bd9d82c
--- /dev/null
@@ -0,0 +1,71 @@
+/****************************************************************************
+** $Id: aextte.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Extension object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AEXTTE_H
+#define AEXTTE_H
+
+#include "aextension.h"
+class TEBase;
+class QLibrary;
+
+typedef QStringList (*p_te_drivers)( const QString &  );
+typedef bool (*p_te_driverExists)( const QString &,  const QString & );
+typedef TEBase *(*p_te_createDriverObject)( const QString &className );    
+
+/**
+ * \en
+ * Class for work with Trade Equipment drivers
+ * \_en
+ * \ru
+ * \_ru
+ */
+class  ANANAS_EXPORT AExtTE : public AExtension
+{
+    Q_OBJECT
+
+public:
+
+    AExtTE();
+    ~AExtTE();
+
+public slots:
+    QStringList drivers( const QString &baseclass );
+    bool driverExists( const QString &name );
+    QObject *newDriver( const QString &name );
+protected slots:
+    void deviceEvent( int eventCode );
+private:
+    QLibrary *telib;
+    p_te_drivers te_drivers;
+    p_te_driverExists te_driverExists;
+    p_te_createDriverObject te_createDriverObject;
+};
+
+#endif //AEXTTE_H
diff --git a/src/extensions/te/te.pro b/src/extensions/te/te.pro
new file mode 100644 (file)
index 0000000..ffca994
--- /dev/null
@@ -0,0 +1,27 @@
+TARGET    = aextte
+SOURCES        += aextte.cpp 
+HEADERS        += aextte.h 
+include ( ../../ananas.pri )
+shared {
+    win32:DEFINES+= ANANAS_DLL
+} else {
+    win32:DEFINES   += ANANAS_NO_DLL
+}
+TEMPLATE       =lib
+CONFIG += plugin
+INCLUDEPATH    += ../../lib 
+LIBS   += -L../../lib -lananas
+LANGUAGE       = C++
+
+unix {
+    INCLUDEPATH        += /usr/include/tradeequip
+#    LIBS += -L/usr/lib -ltradeequip
+}
+
+win32 {
+    INCLUDEPATH        += d:\src\tradeequip\src\lib
+#    LIBS += -L/src/tradeequip/lib -ltradeequip
+}
+
+DESTDIR                = ..
+#win32:DLLDESTDIR      = ..
diff --git a/src/extensions/text/aexttext.cpp b/src/extensions/text/aexttext.cpp
new file mode 100644 (file)
index 0000000..95f3cf6
--- /dev/null
@@ -0,0 +1,203 @@
+/****************************************************************************
+** $Id: aexttext.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Extension object implementation file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2006 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2006 Valery Grazdankin, Orenburg.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qtextcodec.h>
+#include "aexttext.h"
+#include "acfg.h"
+#include <QTextStream>
+#include <QTextCodec>
+
+/*!
+\en
+    \class AExtText aexttext.h
+    \brief The AExtText is Ananas extension class for work with text files.
+\_en \ru
+    \class AExtText aexttext.h
+    \brief Класс расширения Ананас AExtText предназначен для работы с текстовыми файлами.
+
+    Поддерживает работу с файлами в различных кодировках,
+    режимах:
+    RO - Только чтение
+    WO - Только запись
+    RW - чтение/запись
+    A  - добавление к концу файла.
+\_ru
+*/
+
+
+// \param cmd (in) command text.
+// \return - result.
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+AExtText::AExtText()
+    : AExtension("Text")
+{
+       text = new QTextStream( &file );
+       setCodec("UTF-8");
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+AExtText::~AExtText()
+{
+       delete text;
+}
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+int
+AExtText::open( const QString &filename, const QString &mode )
+{
+       QIODevice::OpenMode m = QIODevice::ReadOnly;
+       file.close();
+       file.setName( filename );
+       if ( mode == "WO" ) m = QIODevice::WriteOnly;
+       if ( mode == "RW" ) m = QIODevice::ReadWrite;
+       if ( mode == "A" ) m = QIODevice::Append;
+       if ( file.open( m ) ) return 0;
+       return 1;
+}
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+void
+AExtText::close()
+{
+       file.close();
+}
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+QString
+AExtText::readLine()
+{
+       return text->readLine();
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+void
+AExtText::writeLine( const QString &l )
+{
+       *text << l << "\n";
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+bool
+AExtText::atEnd()
+{
+       return text->atEnd();
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+QString
+AExtText::getCodec() const
+{
+       QTextCodec *codec = text->codec();
+       if ( codec ) return codec->name();
+       return "";
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+void
+AExtText::setCodec( const QString &codecname )
+{
+       QTextCodec *codec = QTextCodec::codecForName( ( const char *) codecname );
+       if ( codec ) text->setCodec( codec );
+}
+
+
+#include <aextensionplugin.h>
+typedef AExtensionPlugin<AExtText> AExtTextPlugin;
+A_EXPORT_PLUGIN( AExtTextPlugin )
diff --git a/src/extensions/text/aexttext.h b/src/extensions/text/aexttext.h
new file mode 100644 (file)
index 0000000..e4a31d4
--- /dev/null
@@ -0,0 +1,72 @@
+/****************************************************************************
+** $Id: aexttext.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Extension object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AEXTTEXT_H
+#define AEXTTEXT_H
+
+#include "aextension.h"
+#include <qfile.h>
+
+
+/**
+ * \en
+ * Class for work with extensions
+ * \_en
+ * \ru
+ * \_ru
+ */
+class  ANANAS_EXPORT AExtText : public AExtension
+{
+    Q_OBJECT
+    Q_PROPERTY( QString codec READ getCodec WRITE setCodec )
+
+public:
+
+    AExtText();
+    ~AExtText();
+public:
+
+    QString getCodec() const ;
+    void setCodec( const QString &codecname );
+
+public slots:
+    int open( const QString &filename, const QString &mode );
+    void close();
+    bool atEnd();
+
+    QString readLine();
+    void writeLine( const QString &l );
+
+private:
+    QFile file;
+    QTextStream *text;
+};
+
+#endif //AEXTTEXT_H
diff --git a/src/extensions/text/text.pro b/src/extensions/text/text.pro
new file mode 100644 (file)
index 0000000..6b017e3
--- /dev/null
@@ -0,0 +1,17 @@
+include(../../lib/lib.pri)
+TARGET    = aexttext
+SOURCES         += aexttext.cpp
+HEADERS         += aexttext.h 
+include ( ../../ananas.pri )
+shared {
+win32:DEFINES+= ANANAS_DLL
+} else {
+win32:DEFINES   += ANANAS_NO_DLL
+}
+TEMPLATE       =lib
+CONFIG += plugin
+LIBS   += -L../../../lib -lananas4
+INCLUDEPATH    += ../../lib 
+LANGUAGE       = C++
+DESTDIR                = ..
+#win32:DLLDESTDIR      = ..
diff --git a/src/extensions/xml/aextxml.cpp b/src/extensions/xml/aextxml.cpp
new file mode 100644 (file)
index 0000000..24e785d
--- /dev/null
@@ -0,0 +1,425 @@
+/****************************************************************************
+** $Id: aextxml.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Extension object implementation file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2006 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2006 Valery Grazdankin, Orenburg.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qfile.h>
+#include <qtextstream.h>
+
+#include "aextxml.h"
+#include "acfg.h"
+/*!
+\en
+    \class AExtXML aextxml.h
+    \brief The AExtXML is Ananas extension class for work with XML files.
+\_en \ru
+    \class AExtXML aextxml.h
+    \brief Класс расширения Ананас AExtXML предназначен для работы с XML файлами.
+\_ru
+*/
+
+
+
+/*!
+ *\en
+ *     Create object.
+ *\_en \ru
+ *     Создает объект.
+ *\_ru
+ */
+AExtXML::AExtXML()
+    : AExtension("XML")
+{
+}
+
+
+
+/*!
+ *\en
+ *     Destroy object.
+ *\_en \ru
+ *     Уничтожает объект.
+ *\_ru
+ */
+AExtXML::~AExtXML()
+{
+}
+
+
+
+/*!
+ *\en
+ *     Reads XML from file.
+ *     \param fname (in) - name of XML file.
+ *     \return true if OK.
+ *\_en \ru
+ *     Читает файл XML.
+ *     \param fname (in) - имя файла XML.
+ *     \return true в случае успеха.
+ *\_ru
+ */
+bool
+AExtXML::read(const QString &fname)
+{
+    QFile file( fname );
+    QByteArray buf;
+    QString err;
+    int errLine = 0, errColumn = 0;
+    if ( !file.open( IO_ReadOnly ) ) return RC_ERROR;
+    buf = file.readAll();
+    file.close();
+    xml.setContent( QString("") );
+    if ( !xml.setContent( buf, false, &err, &errLine, &errColumn ) ) {
+       cfg_message( 2,
+                    ( const char *) QObject::tr(
+                    "Error read XML line:%d col:%s %s"),
+                    errLine, errColumn, ( const char *) err );
+       return false;
+    }
+    rootnode = xml.documentElement();
+    current = rootnode;
+    return true;
+}
+
+
+
+/*!
+ *\en
+ *     Writes XML file.
+ *     \param fname (in) - name of XML file.
+ *     \return error code.
+ *\_en \ru
+ *     Записывает файл XML.
+ *     \param fname (in) - имя файла XML.
+ *     \return Код ошибки.
+ *\_ru
+ */
+bool
+AExtXML::write(const QString &fname)
+{
+    QFile file( fname );
+    QByteArray buf( xml.toString(4).utf8() );
+    if ( file.open( IO_WriteOnly ) ) {
+       QTextStream ts( &file );
+       ts.setEncoding(QTextStream::UnicodeUTF8);
+       xml.save(ts, 4);
+       file.close();
+       return true;
+    }
+    return false;
+}
+
+
+
+/*!
+ *\en
+ *     Create new XML document.
+ *     Old document content will be destroyed.
+ *     \param rootnodename (in) - new XML docemrnt root node name.
+ *     \return void.
+ *\_en \ru
+ *     Создает новый XML документ.
+ *     Старое содержимое документа уничтожается.
+ *     \param rootnodename (in) - имя корневого узла документа XML.
+ *     \return ничего.
+ *\_ru
+ */
+void
+AExtXML::createNew( const QString &rootnodename )
+{
+       xml.setContent(QString("<?xml version = '1.0' encoding = 'UTF-8'?>\n"));
+       rootnode = xml.createElement( rootnodename );
+       xml.appendChild( rootnode );
+       current = rootnode;
+}
+
+
+
+/*!
+ *\en
+ *     Check current node is root node.
+ *     \return true if current node is root.
+ *\_en \ru
+ *     Проверяет, является ли текущий узел корневым.
+ *     \return true - если текущий узел корневой.
+ *\_ru
+ */
+bool
+AExtXML::isRoot()
+{
+       return current == rootnode;
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+bool
+AExtXML::parent()
+{
+       QDomNode pn = current.parentNode();
+       if ( pn.isNull() ) return false;
+       current = pn.toElement();
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+bool
+AExtXML::newChild( const QString &childname )
+{
+       QDomElement ne = xml.createElement( childname );
+       if ( ne.isNull() ) return false;
+       current.appendChild( ne );
+       current = ne;
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+QString
+AExtXML::nodeName()
+{
+       if (current.isNull()) return "";
+       else return current.tagName();
+}
+
+
+
+/*!
+ *\en
+ *     Sets text for current node.
+ *     \param text (in) - new text value.
+ *     \return void.
+ *\_en \ru
+ *     Устанавливает текст текущего узла.
+ *     \param text (in) - Значение нового текста.
+ *     \return ничего.
+ *\_ru
+ */
+bool
+AExtXML::setText( const QString &text )
+{
+       QDomText t;
+       if (current.isNull()) return false;
+       while (!current.firstChild().isNull()) {
+               current.removeChild( current.firstChild() );
+       }
+       t = xml.createTextNode( text );
+       if ( t.isNull() ) return false;
+       current.appendChild( t );
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *     Returns text of current node.
+ *     \return string.
+ *\_en \ru
+ *     Возвращает текст текущего узла.
+ *     \return Строка.
+ *\_ru
+ */
+QString
+AExtXML::text() const
+{
+       if (current.isNull()) return "";
+       return current.firstChild().nodeValue();
+}
+
+
+
+/*!
+ *\en
+ *     Sets current node's attribute value.
+ *     \param name (in) - attribute's name.
+ *     \param value (in) - new value.
+ *     \return void.
+ *\_en \ru
+ *     Устанавливает значение атрибута текущего узла.
+ *     \param name (in) - иям атрибута.
+ *     \param value (in) - новое значение.
+ *     \return ничего.
+ *\_ru
+ */
+bool
+AExtXML::setAttr(  const QString &name, const QString &value )
+{
+       current.setAttribute( name, value );
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *     Returns current node's attribute value.
+ *     \param name (in) - attribute name.
+ *     \return attribute value.
+ *\_en \ru
+ *     Возвращает значение атрибута текущего узла.
+ *     \param name (in) - иям атрибута.
+ *     \return значение атрибута.
+ *\_ru
+ */
+QString
+AExtXML::attr(   const QString &name ) const
+{
+       return current.attribute(name);
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+bool
+AExtXML::removeAttr(  const QString &name )
+{
+       current.removeAttribute( name );
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+bool
+AExtXML::firstChild()
+{
+       QDomNode n = current.firstChild();
+       if ( n.isNull() ) return false;
+       current = n.toElement();
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+bool
+AExtXML::lastChild()
+{
+       QDomNode n = current.lastChild();
+       if ( n.isNull() ) return false;
+       current = n.toElement();
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+bool
+AExtXML::next()
+{
+       QDomNode n = current.nextSibling();
+       if ( n.isNull() ) return false;
+       current = n.toElement();
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+bool
+AExtXML::prev()
+{
+       QDomNode n = current.previousSibling();
+       if ( n.isNull() ) return false;
+       current = n.toElement();
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *
+ *\_en \ru
+ *
+ *\_ru
+ */
+bool
+AExtXML::childExists()
+{
+       QDomNode n = current.firstChild();
+       if ( n.isNull() ) return false;
+       return true;
+}
+
+#include <aextensionplugin.h>
+typedef AExtensionPlugin<AExtXML> AExtXMLPlugin;
+A_EXPORT_PLUGIN( AExtXMLPlugin )
diff --git a/src/extensions/xml/aextxml.h b/src/extensions/xml/aextxml.h
new file mode 100644 (file)
index 0000000..715d33b
--- /dev/null
@@ -0,0 +1,83 @@
+/****************************************************************************
+** $Id: aextxml.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Extension object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AEXTXML_H
+#define AEXTXML_H
+
+#include <qdom.h>
+#include "aextension.h"
+
+/**
+ * \en
+ * Class for work with extensions
+ * \_en
+ * \ru
+ * \_ru
+ */
+class  ANANAS_EXPORT AExtXML : public AExtension
+{
+    Q_OBJECT
+
+public:
+
+    AExtXML();
+    ~AExtXML();
+public:
+
+public slots:
+       bool read(const QString &fname);
+       bool write(const QString &fname);
+       void createNew( const QString &rootnodename );
+
+       bool isRoot();
+       bool parent();
+       bool newChild( const QString &childname );
+       QString nodeName();
+       bool setText( const QString &text );
+       QString text() const;
+
+       bool setAttr(  const QString &name, const QString &value );
+       QString attr(   const QString &name ) const;
+       bool removeAttr(  const QString &name );
+
+       bool firstChild();
+       bool lastChild();
+       bool next();
+       bool prev();
+       bool childExists();
+
+private:
+       QDomDocument xml;
+       QDomElement rootnode, current;
+
+
+};
+
+#endif //AEXTTEXT_H
diff --git a/src/extensions/xml/xml.pro b/src/extensions/xml/xml.pro
new file mode 100644 (file)
index 0000000..5048820
--- /dev/null
@@ -0,0 +1,23 @@
+include(../../lib/lib.pri)
+TARGET    = aextxml
+       
+SOURCES        += aextxml.cpp 
+HEADERS        += aextxml.h 
+
+include ( ../../ananas.pri )
+
+shared {
+win32:DEFINES+= ANANAS_DLL
+} else {
+win32:DEFINES   += ANANAS_NO_DLL
+}
+
+TEMPLATE       =lib
+CONFIG += plugin
+
+INCLUDEPATH    += ../../lib 
+LIBS   += -L../../../lib -lananas4
+
+LANGUAGE       = C++
+DESTDIR     = ..
+#win32:DLLDESTDIR      = ..
diff --git a/src/lib/acfg.cpp b/src/lib/acfg.cpp
new file mode 100644 (file)
index 0000000..6346eeb
--- /dev/null
@@ -0,0 +1,1818 @@
+/****************************************************************************
+** $Id: acfg.cpp,v 1.2 2008/11/08 20:16:35 leader Exp $
+**
+** Code file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
+
+#include <qdatetime.h>
+#include <qobject.h>
+#include <qdom.h>
+#include <qfile.h>
+#include <qstringlist.h>
+//--#include <q3textstream.h>
+#include <QTextStream>
+
+#include "acfg.h"
+#include "alog.h"
+
+#ifdef _MSC_VER
+#define vsnprintf _vsnprintf
+#endif
+
+#define context_startid        100
+
+/*!
+ *     Global configuration variable.
+ */
+//aCfg * ANANAS_EXPORT globalCfg = 0;
+
+
+/*
+ */
+void (*cfg_messageproc)(int , const char *)=NULL;
+
+/*!
+ *\en
+ *     Outputs error messages.
+ *\_en \ru
+ *     Вывод сообщений об ошибках.
+ *\_ru
+ */
+void
+cfg_message(int msgtype, const char *msgfmt,...){
+       char msg[2048];
+       char *ts=(char *)"";
+       va_list args;
+
+       if (msgfmt) {
+               va_start(args, msgfmt);
+               vsnprintf(msg, sizeof(msg)-1, msgfmt, args);
+               va_end(args);
+               if (cfg_messageproc) cfg_messageproc(msgtype, msg);
+               else {
+                       if (msgtype==1) ts=(char *)"- ";
+                       if (msgtype==2) ts=(char *)"! ";
+                       if (msgtype==2) ts=(char *)"!!! ";
+                       printf("%s%s", ts, (const char *) QString::fromUtf8(msg).local8Bit());
+               }
+       }
+}
+
+/*!
+ *\en
+ *\_en \ru
+ *     Выводит отладочные сообщения, если определен макрос ANANAS_DEBUG
+ *\_ru
+ */
+void
+debug_message(const char *msgfmt,...){
+#ifdef ANANAS_DEBUG
+       char msg[2048];
+       va_list args;
+
+       if (msgfmt) {
+               va_start(args, msgfmt);
+               vsnprintf(msg, sizeof(msg)-1, msgfmt, args);
+               va_end(args);
+               printf("debug");
+               printf("> %s", (const char *) QString::fromUtf8(msg).local8Bit());
+       }
+#endif
+}
+
+
+/*!
+ *\~english
+ *     Ananas configuation object contaner constructor.
+ *\~russian
+ *     Конструктор контейнера объекта конфигурации Ананас.
+ *\~
+ *     \param newid (in) - \~english container's ID.\~russian
+ *             ID контейнера. \~
+ *     \param newitem (in) - \~english container's item.\~russian
+ *             Элемент контейнера. \~
+ */
+aCfgItemContaner::aCfgItemContaner(long newid, aCfgItem newitem)
+{
+       id = newid;
+       item = newitem;
+}
+
+
+
+/*!\~english
+ *     Ananas configuation object constructor.
+ *\~russian
+ *     Конструктор объекта конфигурации АНАНАС.
+ *\~
+ */
+aCfg::aCfg() : QObject(0, "Metadata"), xml( md_root )
+{
+       setCompressed( false );
+       setModified( false );
+       idcache.setAutoDelete( TRUE );
+       createNew();
+}
+
+
+
+/*!\en
+ *     Ananas configuation object destructor.
+ *\_en \ru
+ *     Деструктор объекта конфигурации АНАНАС.
+ *\_ru
+*/
+aCfg::~aCfg()
+{
+       xml.setContent( QString("") );
+}
+
+
+
+/*!
+ *     Reads configuration information (metadata) from file.
+ *     \param fname (in) - name of configuration file.
+ *     \return error code.
+ */
+int
+aCfg::read(const QString &fname){
+    QFile file( fname );
+    QByteArray buf;
+    QString err;
+    int errLine = 0, errColumn = 0;
+    if ( !file.open( QIODevice::ReadOnly ) ) return RC_ERROR;
+    buf = file.readAll();
+    file.close();
+    xml.setContent( QString("") );
+    if ( !xml.setContent( buf, false, &err, &errLine, &errColumn ) ) {
+       emit message( 2, QObject::tr(
+                    "Error read configuration line:%1 col:%2 %3"
+                    ).arg( errLine ).arg( errColumn ).arg( err ));
+//     cfg_message( 2, QObject::tr(
+//                  ( const char *) QObject::tr(
+//                  "Error read configuration line:%d col:%s %s"),
+//                  errLine, errColumn, ( const char *) err );
+       return RC_ERROR;
+    }
+    init();
+//CHECK_POINT
+       setModified( false );
+//CHECK_POINT
+    return RC_OK;
+}
+
+
+
+/*!\~english
+ *     helper method. Save current configuration.
+ *\~russian
+ *     Вспомогательный метод. Сохраняет текущую конфирацию.
+ *\~
+ */
+int
+aCfg::write(const QString &fname)
+{
+       return write(xml, fname);
+}
+
+/*!\~english
+ *     Writes configuration information (metadata) to file.
+ *\~russian
+ *     Записывает информацию о бизнес схеме ( метаданные ) в файл.
+ *\~
+ *     \param doc (in) - \~english xml document to save. \~russian xml для сохранения \~
+ *     \param fname (in) - \~english name of configuration file. \~russian имя файла для сохранения \~
+ *     \return \~english error code. \~russian код ошибки \~
+ */
+int
+aCfg::write(QDomDocument doc, const QString &fname)
+{
+    QFile file( fname );
+    QByteArray buf( xml.toString(4).utf8() );
+    if ( file.open( QIODevice::WriteOnly ) ) {
+       QTextStream ts( &file );
+       //--ts.setEncoding(Q3TextStream::UnicodeUTF8);
+       doc.save(ts, 4);
+       //ts <<  toString(4);
+       file.close();
+       return RC_OK;
+    }
+    return RC_ERROR;
+}
+
+/*!
+ *     Returns configuration file compression mode.
+ *     \return boolean
+ */
+bool
+aCfg::compressed()
+{
+       return fCompressed;
+}
+
+
+/*!
+ *     Sets compression mode of configuration file.
+ *     \param mode (in) - compression mode.
+ *     \return void
+ */
+void
+aCfg::setCompressed( bool mode )
+{
+       fCompressed = mode;
+}
+
+
+/*!
+ *     Returns modification status.
+ *     \return boolean
+ */
+bool
+aCfg::modified()
+{
+       return fModified;
+}
+
+
+/*!
+ *     Set modification status.
+ *     \param mode (in) - new value of modification status
+ *     \return void
+ */
+void
+aCfg::setModified( bool mode )
+{
+       fModified = mode;
+}
+
+
+/*!
+ *     Data structures initialization. Should be run after load metadata from configuration file.
+ *     \return void
+ */
+void
+aCfg::init(){
+       QDomNode cur, sub;
+       long id;
+
+//     QString s = xml.toString(4).local8Bit(); // fake call for trap troble
+       if ( !xml.isDocument() ) {
+               aLog::print(aLog::Error, tr("Bad configuration"));
+               return;
+       }
+//CHECK_POINT
+       QDomElement rootnode = xml.documentElement();
+//CHECK_POINT
+//     QDomElement root = rootnode;
+//CHECK_POINT
+       cfginfo = rootnode.namedItem( md_info ).toElement();
+       md = rootnode.namedItem( md_metadata ).toElement();
+       iface = rootnode.namedItem( md_interface ).toElement();
+       actions = rootnode.namedItem( md_actions ).toElement();
+       idcache.clear();
+       cur = rootnode.firstChild();
+       while (!cur.isNull()) {
+               if ( cur.toElement().hasAttribute( mda_id ) ) {
+                       id = 0;
+                       id = attr(cur.toElement(), mda_id).toInt();
+                       if (id) {
+                               idcache.insert(id, new aCfgItemContaner( id, cur.toElement() ) );
+                       }
+//                     printf("cache name=%s id=%ld\n",(const char *)cur.nodeName(), id);
+               }
+               sub = cur.firstChild();
+               if (!sub.isNull()) cur = sub;
+               else
+               {
+                       if (!cur.nextSibling().isNull()) cur = cur.nextSibling();
+                       else
+                       {
+                               sub = cur;
+                               cur.clear();
+                               while (cur.isNull()) {
+                                       sub = sub.parentNode();
+                                       if (sub.isNull()) break;
+                                       else cur = sub.nextSibling();
+                               }
+                       }
+               };
+       }
+//CHECK_POINT
+//     printf("init ok\n");
+}
+
+
+/*!
+ *     Reads resource file.
+ *     \param fname (in) - rc file name.
+ *     \return error code.
+ */
+int
+aCfg::readrc(const QString &fname)
+{
+       int r = RC_ERROR;
+       QString configfile;
+
+       r = rc.read( fname );
+       if ( r ) return r;
+       configfile = rc.value( "configfile" );
+       if ( !configfile.isEmpty() ) {
+               r = read( configfile );
+               if ( r ) createNew();//return r;
+//             init();
+               r = RC_OK;
+       } else r = RC_ERROR;
+       return r;
+}
+
+
+/*!
+ *     Writes resource file.
+ *     \param (in) - rc file name to write to.
+ *     \return int.
+ */
+int
+aCfg::writerc(const QString &fname)
+{
+       int r = RC_ERROR;
+       QString configfile;
+       r = rc.write( fname );
+       if ( r ) return r;
+       configfile = rc.value( "configfile" );
+       if ( !configfile.isEmpty() ) {
+               r = write( configfile );
+       }
+       if ( !r ) setModified( false );
+       return r;
+}
+
+
+
+/*!
+ *     Creates new empty configuration.
+ *     \return void.
+ */
+void
+aCfg::createNew(){
+       aCfgItem i;
+       xml.setContent(QString("<?xml version = '1.0' encoding = 'UTF-8'?>\n"));
+       setModified( true );
+
+       xml.appendChild( xml.implementation().createDocumentType("ananas_configuration",QString::null,"ananas-cfg.dtd"));
+       rootnode = xml.createElement( md_root );
+       xml.appendChild( rootnode );
+       rootnode = xml.documentElement();
+       cfginfo         = insert( rootnode, md_info, QString::null, -1 );
+       iface           = insert( rootnode, md_interface, QString::null, -1 );
+       md              = insert( rootnode, md_metadata, QString::null, -1 );
+       actions = insert( rootnode, md_actions, QString::null, -1 );
+       init();
+       setInfo( md_info_name, "New configuration" );
+       setInfo( md_info_lastid, "0" );
+       setInfo( md_info_author, "unnamed" );
+       setInfo( md_info_date, QDateTime::currentDateTime().date().toString(Qt::ISODate) );
+       //setInfo( md_info_dir, "newConfig" );
+       insert( md, md_globals, QString::null, -1 );
+       insert( md, md_catalogues, QString::null, -1 );
+       insert( md, md_documents, QString::null, -1 );
+       insert( md, md_journals, QString::null, -1 );
+       i = insert( md, md_registers, QString::null, -1 );
+       insert( i, md_iregisters, QString::null, -1 );
+       insert( i, md_aregisters, QString::null, -1 );
+}
+
+
+/*!
+ *     Returns value of info section field of configuration.
+ *     \param name (in) - name of field to fetch value from.
+ *     \return info field's value.
+ */
+QString
+aCfg::info(const QString &name)
+{
+       return text(cfginfo.namedItem( name ).toElement()); //.firstChild().nodeValue();
+}
+
+/*!
+ *     Sets new value to specified field of info section of configuration.
+ *     \param name (in) - field's name.
+ *     \param value (in) - field's value.
+ *     \return void.
+ */
+void
+aCfg::setInfo(const QString &name, const QString &value)
+{
+       aCfgItem i;
+       i = cfginfo.namedItem( name ).toElement();
+       if (i.isNull()) {
+               i = xml.createElement( name );
+               cfginfo.appendChild( i );
+       }
+       setText(i, value);
+       setModified( true );
+}
+
+
+/*!
+ *     Generates new unique ID for metadata tree object.
+ *     \return new unique ID.
+ */
+long
+aCfg::nextID()
+{
+       long id = 0;
+       id = info( md_info_lastid ).toLong();
+       if (id == 0 ) id = context_startid;
+       ++id;
+       setInfo( md_info_lastid, QString("%1").arg(id) );
+       return id;
+}
+
+
+
+/*!
+ *     Counts specified objects in metadata tree.
+ *     \param context (in) - parent of objects to count. May be a root
+ *     of metadata tree.
+ *     \param classname (in) - class of objects to count.
+ *     \return number of objects.
+ */
+int
+aCfg::count(aCfgItem context, const QString &classname){
+       return context.elementsByTagName( classname ).count();
+}
+
+
+/*!
+ *     Counts specified child objects of object in metadata tree.
+ *     Only child objects will be counted, not subchild objects.
+ *     \param context (in) - parent of objects to count. May be a root
+ *     of metadata tree.
+ *     \param classname (in) - class of objects to count.
+ *     \return number of objects.
+ */
+int
+aCfg::countChild(aCfgItem context, const QString &classname){
+       int n = 0;
+       aCfgItem i = firstChild( context );
+       while ( !i.isNull() ) {
+               if ( classname.isEmpty() ) n++;
+               else
+               if ( objClass( i ) == classname ) n++;
+               i = nextSibling( i );
+       }
+       return n;
+}
+
+
+/*!
+ * \en
+ *     Finds object by its name and number.
+ *     \param context (in) - context to seach in.
+ *     \param name (in) - name of object to search for.
+ *     \param n (in) - number of object in found context.
+ *     \return founded object.
+ * \_en
+ * \ru
+ *     Находит элемент метаданных в заданном контексте (поддереве) метаданных по имени тэга
+ *     и порядковому номеру. Порядковый номер имеет смысл, если в контексте может находиться
+ *     более одного элемента с одним и тем же тэгом. Так, например, внутри документа может быть несколько
+ *     полей. Поэтому, делая поиск элемента метаданных, описывающего поле,
+ *     внутри контекста (поддерева), описывающего документ, необходимо задавать порядковый номер поля.
+ *     \param context (in) - контекст (поддерево) метаданных,для сужения пространства поиска.
+ *     \param name (in) - имя тэга, с помощью которого описывается элемент метаданных, который мы ищем.
+ *     Возможные значения для этого параметра смотрите в файле acfg.h под заголовком Metadata tags.
+ *     \param n (in) - порядковый номер объекта, на случай, если таких объектов несколько.
+ *     \return ссылку на найденный элемент метаданных или NULL, если элемент не найден.
+ * \_ru
+ */
+aCfgItem
+aCfg::find(aCfgItem context, const QString &name, int n)
+{
+       QDomNodeList l = context.elementsByTagName( name );
+       return l.item( n ).toElement();
+}
+
+
+/*!
+ * \en
+ *     \brief Finds object by unique ID in metadata tree.
+ *     \param id (in) - id to search for.
+ *     \return founded object.
+ * \_en
+ * \ru
+ *     \brief Находит описание объекта в метаданных по его уникальному в рамках файла метаданных идентификатору.
+ *
+ *     \param id - идетнификатор объекта в метаданных
+ *     \return ссылку на элемент метаданных
+ * \_ru
+ */
+aCfgItem
+aCfg::find(long id)
+{
+       long idl = id;
+       aCfgItem i;
+       aCfgItemContaner *ic;
+
+       if ( id == 0 || id == mdc_metadata ) return md;
+       if ( id == mdc_root ) return rootnode;
+       if ( id == mdc_info ) return cfginfo;
+       if ( id == mdc_interface ) return iface;
+       if ( id == mdc_actions ) return actions;
+
+       ic = idcache.find( idl );
+       if (ic) i = ic->item;
+//     if (!i.isNull()) printf("!founded id=%li\n", id);
+//     else printf("!NOT founded id=%li\n", id);
+       return i;
+}
+
+/*!
+ *\en
+ *     Finds object by its full name.
+ *     \param name (in) - object's full name.
+ *     \return founded object.
+ *\_en \ru
+ *     \brief Находит объект в текущей (открытой) конфигурации по его полному имени.
+ *
+ *     \n Полное имя имеет вид "<OType>.<OName>[.<extName>]"
+ *     \n OType может принимать только одно из следующих значений:
+ *     - Document - для объектов типа Документ
+ *     - Catalog - для объектов типа Каталог (примером каталога является Справочник товаров)
+ *     - DocJournal - для объектов типа журнал документов
+ *     - InfoRegister - для объектов типа Информационный Регистр
+ *     - AccumulationRegister - для объектов типа Накопительный регистр.
+ *       Накопительный регистр отличается от информационного тем, что по его записям выполняется автоматический расчет остатков.
+ *     - Form - для объектов типа Экранная форма.
+ *
+ *     OName задает имя объекта, которое было присвоено объекту во время редактирования конфигурации в программе Анананс-Дизайнер.
+ *     Для поиска документа "Приходная накладная" нужно вызвать find("Document.Приходная накладная");
+ *     Для поиска формы с именем "Основная форма" в этом документе надо вызвать find("Document.Приходная накладная.Form.Основная форма");
+ *     \param name (in) - полное имя объекта.
+ *     \return ссылка на найденный объект в случае успеха или NULL в случае, если объект не найден.
+ *\_ru
+ */
+aCfgItem
+aCfg::find(const QString &name)
+{
+       QString oType, oName, omType, extName;
+       aCfgItem gobj, obj, sobj, item;
+
+       oType = name.section( ".", 0, 0 );
+       oName = name.section( ".", 1, 1 );
+       extName = name.section( ".", 2 );
+       gobj = md;
+       while ( !oType.isEmpty() && !oName.isEmpty() ) {
+               if (oType == "Document" || oType == tr("Document") ) {
+                       omType = md_document;
+                       gobj = findChild( gobj, md_documents );
+               }
+               if (oType == "Catalogue" || oType == tr("Catalogue") ) {
+                       omType = md_catalogue;
+                       gobj = findChild( gobj, md_catalogues );
+               }
+               if (oType == "DocJournal" || oType == tr("DocJournal")) {
+                       omType = md_journal;
+                       gobj = findChild( gobj, md_journals );
+               }
+               if (oType == "Report" || oType == tr("Report")) {
+                       omType = md_report;
+                       gobj = findChild( gobj, md_reports );
+               }
+               if (oType == "InfoRegister" || oType == tr("InfoRegister") ) {
+                       omType = md_iregister;
+                       gobj = findChild( find(gobj,md_registers,0),md_iregisters );
+               }
+               if (oType == "AccumulationRegister" || oType == tr("AccumulationRegister") )
+               {
+                       omType = md_aregister;
+                       gobj = findChild( find(gobj,md_registers,0),md_aregisters );
+               }
+               if (oType == "Form" || oType == tr("Form")) {
+                       omType = md_form;
+                       gobj = findChild( gobj, md_forms );
+               }
+               if ( !gobj.isNull() ) item = findName( gobj, omType, oName );
+               if ( item.isNull() ) break;
+               gobj = item;
+               oType = extName.section( ".", 0, 0 );
+               oName = extName.section( ".", 1, 1 );
+               extName = extName.section( ".", 2 );
+       }
+       return item;
+}
+
+/*
+ * ??? Parameter classname is what for ???
+ */
+aCfgItem
+aCfg::findName(aCfgItem context, const QString &classname, const QString &name )
+{
+       aCfgItem item;
+
+       if ( !context.isNull() && !classname.isEmpty() ){
+               item = firstChild( context );
+               while ( !item.isNull() ) {
+                       if ( attr( item, mda_name ) == name ){
+                               break;
+                       }
+                       item = nextSibling( item );
+               }
+       }
+       return item;
+}
+
+/*
+ *     Finds child object by its class name and number.
+ *     \param context (in) - parent object.
+ *     \param classname (in) - class name of child to search for.
+ *     \param n (in) - number of child (0..countChild( context, classname )-1).
+ *      \return child number n or Null object.
+ */
+aCfgItem
+aCfg::findChild(aCfgItem context, const QString &classname, int n)
+{
+       int in = 0;
+       aCfgItem i = firstChild( context );
+       while ( !i.isNull() ) {
+               if ( classname.isEmpty() ) {
+                       if ( in == n ) break;
+                       in++;
+               }
+               else {
+                       if ( objClass( i ) == classname ) {
+                               if ( in == n ) break;
+                               in++;
+                       }
+               }
+               i = nextSibling( i );
+       }
+       return i;
+}
+
+
+
+/*!
+ *     Swaps two items in metadata tree.
+ *     \param item1 (in) - first item to swap.
+ *     \param item2 (in) - second item to swap.
+ *     \return true or false.
+ */
+bool
+aCfg::swap(aCfgItem &item1, aCfgItem &item2)
+{
+       aCfgItem item, ic1, ic2, p1, p2;
+
+       if ( item1.isNull() || item2.isNull() || ( item1 == item2 )  )
+       {
+               if(item1.isNull()) aLog::print(aLog::Debug, tr("aCfg swap: first element is null"));
+               else
+               if(item2.isNull()) aLog::print(aLog::Debug, tr("aCfg swap: second element is null"));
+               else
+               aLog::print(aLog::Error, tr("aCfg swap element himself"));
+               return false;
+       }
+       p1 = parent( item1 );
+       p2 = parent( item2 );
+       if ( p1.isNull() || p2.isNull() || ( p1 != p2 ) )
+       {
+               if(p1.isNull()) aLog::print(aLog::Debug, tr("aCfg swap: first parent null"));
+               else
+               if(p2.isNull()) aLog::print(aLog::Debug, tr("aCfg swap: second parent null"));
+               else
+               aLog::print(aLog::Error, tr("aCfg swap elements with differernt parents"));
+               return false;
+       }
+       p1.insertBefore( item1, item2 );
+       setModified( true );
+       return true;
+}
+
+/*!
+ *     Returns onject's order number among siblings.
+ *     \param item (in) - object.
+ *     \return object's order number.
+ */
+int
+aCfg::order( aCfgItem item )
+{
+       int i = 0;
+       aCfgItem current = item;
+       while ( !current.isNull() )
+       {
+               ++i;
+               current = previousSibling( current );
+       }
+       return i;
+}
+
+
+/*!
+ *     Returns parent object.
+ *     \param context (in) - object.
+ *     \return paren object.
+*/
+aCfgItem
+aCfg::parent( aCfgItem context )
+{
+       return context.parentNode().toElement();
+}
+
+
+/*!
+ *     Returns the first child item of the context.
+ *     If there is no child, a null context is returned.
+ *     Changing the returned item will also change the item
+ *     in the metadata tree.
+ *     \param context (in) - node in metadata tree.
+ *     \return aCfgItem - node in metafata tree if found, NULL if not found.
+ */
+aCfgItem
+aCfg::firstChild( aCfgItem context )
+{
+       return context.firstChild().toElement();
+}
+
+
+/*!
+ *     Returns the last child item of the context.
+ *     If there is no child, a null context is returned.
+ *     Changing the returned item will also change the item
+ *     in the metadata tree.
+ */
+aCfgItem
+aCfg::lastChild( aCfgItem context )
+{
+       return context.lastChild().toElement();
+}
+
+
+/*!
+ *     Returns the next sibling in the netadata tree.
+ *     Changing the returned item will also change the item in the metadata tree.
+ */
+aCfgItem
+aCfg::nextSibling( aCfgItem context )
+{
+       return context.nextSibling().toElement();
+}
+
+
+/*!
+ *     Returns the previous sibling in the netadata tree.
+ *     Changing the returned item will also change the item in the metadata tree.
+ */
+aCfgItem
+aCfg::previousSibling( aCfgItem context )
+{
+       return context.previousSibling().toElement();
+}
+
+
+/*!
+ *     Returns text of object.
+ *     \param context (in) - object.
+ *     \return string.
+ */
+QString
+aCfg::text(aCfgItem context)
+{
+       if (context.isNull()) return "";
+       return context.firstChild().nodeValue();
+}
+
+
+/*!
+ *     Sets text for object.
+ *     \param context (in) - object.
+ *     \param value (in) - new value.
+ *     \return void.
+ */
+void
+aCfg::setText(aCfgItem context, const QString &value)
+{
+       QDomText t;
+       if (context.isNull()) return;
+       while (!context.firstChild().isNull()) {
+               context.removeChild( context.firstChild() );
+       }
+       t = xml.createTextNode( value );
+       context.appendChild( t );
+       setModified( true );
+}
+
+
+/*!
+ *     Returns binary value of object.
+ *     \param context (in) - object to get value of.
+ *     \return array of bytes.
+ */
+QByteArray
+aCfg::binary( aCfgItem context )
+{
+       unsigned int i, d, blen;
+       bool ok;
+       QString vs = text( context );
+       blen = attr( context, mda_length ).toInt();
+       QByteArray b( blen );
+       for ( i=0; i < blen; i++ ){
+               d = 0xff & vs.mid( i*2, 2 ).toInt( &ok, 16 );
+               if ( ok ) b.data()[ i ] = d;
+               else b.data()[ i ] = 0;
+       }
+       return b;
+}
+
+
+/*!
+ *     Sets binary value of metadata tree node.
+ *     \param context (in) - metadata tree node.
+ *     \param value (in) - new binary value.
+ *     \param format (in) - format of binary data.
+ *     \return void.
+ */
+void
+aCfg::setBinary( aCfgItem context, const QByteArray &value, const QString &format )
+{
+       QString vs ="", s;
+       unsigned int i, d;
+       for ( i=0; i<value.count(); i++) {
+               d = ( unsigned char ) value.data()[i];
+               s = QString("00")+QString::number( d, 16 ).upper();
+               vs += s.right(2);
+       }
+       setText( context, vs );
+       setAttr( context, mda_length, value.count() );
+       if ( !format.isNull() ) setAttr( context, mda_format, format );
+}
+
+/*!
+ *     Returns format of metadata tree node binary data.
+ *     \param context (in) - node of metadata tree.
+ *     \return format of binary data.
+ */
+QString
+aCfg::binaryFormat( aCfgItem context )
+{
+       return attr( context, mda_format );
+}
+
+
+/*!
+ *     Returns text value of child node of metadata tree.
+ *     \param context (in) - parent node.
+ *     \param subname (in) - name of child node.
+ *     \return text value.
+ */
+QString
+aCfg::sText(aCfgItem context, const QString & subname )
+{
+       aCfgItem i;
+       i = findChild( context, subname, 0 );
+       if ( i.isNull() ) return ""; else return text( i );
+}
+
+
+/*!
+ *     Sets text value of child node.
+ *     \param context (in) - parent node.
+ *     \param subname (in) - name of child node.
+ *     \param value (in) - new value of child node.
+ *     \return void.
+ */
+void
+aCfg::setSText(aCfgItem context, const QString & subname, const QString &value)
+{
+       aCfgItem i;
+       i = findChild( context, subname, 0 );
+       if ( i.isNull() ) {
+               i = insert( context, subname );
+       }
+       setText( i, value );
+}
+
+
+/*!
+ *     Returns class name of object.
+ *     \param id (in) - object id.
+ *     \return object's class name.
+ */
+QString
+aCfg::objClass( long id )
+{
+       return objClass( find( id ) );
+}
+
+
+/*!
+ *     Returns class name of object.
+ *     \param context (in) - object.
+ *     \return object's class name.
+ */
+QString
+aCfg::objClass( aCfgItem context )
+{
+       if (context.isNull()) return "";
+       else return context.tagName();
+}
+
+
+/*!
+ *     Returns object's attribute value.
+ *     \param context (in) - object.
+ *     \param name (in) - attribute name.
+ *     \return attribute value.
+ */
+QString
+aCfg::attr(aCfgItem context, const QString &name)
+{
+       return context.attribute(name);
+}
+
+/*!
+ *     Sets object's attribute value.
+ *     \param context (in) - object.
+ *     \param name (in) - attribute's name.
+ *     \param value (in) - new value.
+ *     \return void.
+ */
+void
+aCfg::setAttr(aCfgItem context, const QString &name, const QString &value)
+{
+       QString v = value;
+       if ( objClass( context ) == md_field && name == mda_type ) {
+               if ( v.section(" ", 1).isEmpty() ) v.append(" 0 0 *");
+               if ( v.section(" ", 2).isEmpty() ) v.append(" 0 *");
+               if ( v.section(" ", 3).isEmpty() ) v.append(" *");
+       }
+       context.setAttribute( name, v );
+       setModified( true );
+}
+
+
+/*!
+ *     Changes value of object's attribute.
+ *     \param context (in) - object.
+ *     \param name (in) - attribute's name.
+ *     \param value (in) - new attribute's vakue.
+ *     \return nothing.
+ */
+void
+aCfg::setAttr(aCfgItem context, const QString &name, int value)
+{
+       context.setAttribute(name, value);
+       setModified( true );
+}
+
+
+/*!
+ *     Inserts a new object into metadata tree.
+ *     \param context (in) - metadata object context.
+ *     \param otype (in) - metadata object type.
+ *     \param name (in) - metadata object name. If name = QString::null,
+ *     name attribute will not be setted.
+ *     \param id (in) - metadata object id. If id = 0, setting next avalable id for
+ *     the metadata tree.
+ *     \return newly created metadata object.
+ *     To check if created object is valid use "if (CreatedObject.isNull()) ..." construction.
+ */
+aCfgItem
+aCfg::insert(aCfgItem context, const QString &otype, const QString &name, long id)
+{
+       aCfgItem i;
+
+       if ( id==0 ) id = nextID();
+       i = xml.createElement( otype );
+       if ( id >= 100 ) setAttr(i, mda_id, id );
+       if ( !name.isNull()) setAttr(i, mda_name, name );
+       context.appendChild( i );
+       if ( id > 0 ) idcache.insert(id, new aCfgItemContaner( id, i ) );
+       setModified( true );
+       return i;
+}
+
+/*!
+ *\~english
+ *     Saves configuration object to file.
+ *\~russian
+ *     Сохраняет объект бизнес схемы в файл.
+ *\~
+ *     \param context - \~english object to save \~russian объект для сохранения \~
+ *     \param fileName - \~english file name \~russian имя файла \~
+ *     \return - \~english error code \~russian код ошибки \~
+ */
+int
+aCfg::saveOneObject(aCfgItem context, const QString &fileName)
+{
+       int res=RC_ERROR;
+       if(!context.isNull())
+       {
+               QDomDocument doc;
+               if(context.isDocument())
+               {
+                       doc = context.toDocument();
+               }
+               else
+               {
+                       doc.setContent(QString("<?xml version = '1.0' encoding = 'UTF-8'?>\n"));
+                       doc.appendChild(context.cloneNode(true));
+               }
+               res = write(doc,fileName);
+               if(res==RC_OK)
+               {
+                       aLog::print(aLog::Info, tr("aCfg saveOneObject: context save to file `%1'").arg(fileName));
+               }
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aCfg saveOneObject: context is null"));
+       }
+       return res;
+}
+
+/*!
+ *\~english
+ *     Load configuration object from file.
+ *\~russian
+ *     Загружает объект бизнес схемы из файла.
+ *\~
+ *     \param fileName - \~english file name \~russian имя файла \~
+ *     \return - \~english object, stored in xml file \~russian объект, хранящийся в xml файле \~
+ */
+aCfgItem
+aCfg::loadOneObject( const QString &fileName )
+{
+       aCfgItem res;
+       QDomDocument doc;
+
+       if(fileName!="")
+       {
+               QFile file( fileName );
+               QByteArray buf;
+               QString err;
+//             int errLine = 0, errColumn = 0;
+               if ( file.open( QIODevice::ReadOnly ) )
+               {
+                       buf = file.readAll();
+                       file.close();
+                       if(doc.setContent( buf, false ))
+                       {
+                               res = doc.documentElement();
+                       }
+                       else
+                       {
+                               aLog::print(aLog::Error, tr("aCfg loadOneObject: invalid cfg file `%1'").arg(fileName));
+                       }
+
+               }
+               else
+               {
+                       aLog::print(aLog::Error, tr("aCfg loadOneObject: invalid file name or not permission to file `%1'").arg(fileName));
+               }
+       }
+       return res;
+}
+
+/*!
+ *     Removes metadata object from metadata tree.
+ *     All children objects also removed.
+ *     \param context (in) - metadata object.
+ *     \return nothing.
+ */
+void
+aCfg::remove(aCfgItem context)
+{
+       long id;
+       aCfgItem child;
+
+       QDomNode own = context.parentNode();
+       if (!own.isNull()) {
+               id = attr( context, mda_id ).toLong();
+               child = firstChild(context);
+               remove(child);
+               idcache.remove( id );
+               own.removeChild(context);
+               setModified( true );
+       }
+}
+
+
+/*!
+ *\~english
+ *     Import configuration object from another configuration.
+ *\~russian
+ *     Импортирует объект конфигурации из другой конфигурации в текущую.
+ *     Устанавливает новые Id для всех потомков объекта.
+ *\~
+ *     \param context - \~english parent for imported object \~russian родитель для импортируемого объекта \~
+ *     \param objFromAnotherCfg - \~english imported object \~russian импортируемый объект \~
+ */
+aCfgItem
+aCfg::importCfgItem(aCfgItem context, aCfgItem objFromAnotherCfg )
+{
+       aCfgItem item = xml.importNode(objFromAnotherCfg,true).toElement();
+       if(!item.isNull())
+       {
+               context.appendChild( item );
+               setupNewId(item);
+       }
+       return item;
+
+}
+/*!
+ *\~english
+ *     Sets new id for all children of object \a obj
+ *\~russian
+ *     Устанавивает новый id для всех потомков объекта \a obj
+ *\~
+ */
+void
+aCfg::setupNewId( aCfgItem obj )
+{
+       if(!obj.isNull())
+       {
+               if(attr(obj, mda_id)!="")
+               {
+                       long id;
+                       aLog::print(aLog::Debug, tr("aLog setup new id for %1").arg(attr(obj, mda_name)));
+                       id = nextID();
+                       aLog::print(aLog::Debug, tr("aLog next id is %1").arg( id ) );
+                       setAttr(obj,mda_id,id);
+                       idcache.insert(id, new aCfgItemContaner( id, obj ) );
+               }
+               aCfgItem i = firstChild(obj);
+               while(!i.isNull())
+               {
+                       setupNewId(i);
+                       i = nextSibling(i);
+               }
+       }
+}
+
+/*!
+ *     Gets ID for metadata object by complete name.
+ *     Name like "Document.Invoice", "Report.Total", etc.
+ *     \param name (in) - full object's name.
+ *     \return object's ID.
+ */
+long
+aCfg::getId( QString &name )
+{
+       QString p1, p2, p3;
+       p1 = name.section( ".", 0, 0 );
+       p2 = name.section( ".", 1, 1 );
+       p3 = name.section( ".", 2, 2 );
+
+       return 0;
+}
+
+
+/*!
+ *     Returns configuration object ID.
+ *     \param context (in) - object which ID we looking for.
+ *     \return object's ID.
+ */
+long
+aCfg::id(aCfgItem context)
+{
+       long i = 0;
+       QString sid;
+
+       if ( !context.isNull() ) {
+               sid = attr( context, mda_id );
+               if ( !sid.isEmpty() ) i=sid.toLong();
+       }
+       return i;
+}
+
+/*
+ * ???
+ */
+void
+aCfg::addTypes( QStringList &list, aCfgItem context, const QString &tobject, const QString &tname)
+{
+       aCfgItem obj;
+       int i, n;
+       long oid;
+
+       if ( context.isNull() ) return;
+       n = count( context, tobject );
+       for (i=0; i<n; i++) {
+               obj = find( context, tobject, i);
+               if ( !obj.isNull() ) {
+                       oid = id( obj );
+                       if ( oid ) {
+                               list << QString("O ")+QString::number( oid )+QString("\t")+tname+QString(".")+attr( obj, mda_name );
+                       }
+               }
+       }
+}
+
+/*!
+ *     Returns list of the configuration types.
+ *     Every string in string list stored in format, consist of type's
+ *     format string and type's human name fields, separated
+ *     by tabulate char. For example:
+ *     N %d %d\tNumberic
+ *     C %d\tChar
+ *     O 221\tDocument.Invoice
+ *     \param filter (in) - used to limit returned types. If this parameter is empty
+ *     all types will be returned.
+ *     \return list of types.
+ */
+QStringList
+aCfg::types( const QString &filter, aCfgItem *obj )
+{
+       QStringList l, lg;
+       aCfgItem group, context;
+
+       if ( filter.isEmpty() ) {
+               l << QString("\t")+QObject::tr("Unknown");
+               l << QString("N %d %d\t")+QObject::tr("Numberic");
+               l << QString("C %d\t")+QObject::tr("Char");
+               l << QString("D\t")+QObject::tr("Date");
+               l << QString("B\t")+QObject::tr("Boolean");
+               addTypes( l, find( md, md_catalogues, 0), md_catalogue, QObject::tr("Catalogue") );
+               addTypes( l, find( md, md_documents, 0), md_document, QObject::tr("Document") );
+       } else {
+               QString fg, fd;
+               if ( filter == md_catalogue ){
+                       fg = md_catalogues;
+                       fd = QObject::tr("Catalogue");
+               }
+               if ( filter == md_document ){
+                       fg = md_documents;
+                       fd = QObject::tr("Document");
+               }
+               if ( filter == md_journal ){
+                       fg = md_journals;
+                       fd = QObject::tr("Journal");
+               }
+               if ( filter == md_field ){
+                       fg = md_field;
+                       fd = QObject::tr("Field");
+                       if ( obj ) context = *obj;
+                       else return l;
+               } else context = find( md, fg, 0);
+               l << QString("\t")+QObject::tr("Unknown");
+               if ( !fg.isEmpty() ) addTypes( l, context, filter, fd );
+       }
+       return l;
+}
+
+/*!
+ *     Returns object types names.
+ *     \return list of types names.
+ */
+QStringList
+aCfg::ObjectTypes()
+{
+       QStringList l, lg;
+       aCfgItem group, obj;
+
+       addTypes( l, find( md, md_catalogues, 0), md_catalogue, QObject::tr("Catalogue") );
+       addTypes( l, find( md, md_documents, 0), md_document, QObject::tr("Document") );
+       addTypes( l, find( md, md_journals, 0), md_journal, QObject::tr("Journal") );
+       addTypes( l, find( md, md_iregisters, 0), md_iregister, QObject::tr("Information Register") );
+       addTypes( l, find( md, md_aregisters, 0), md_aregister, QObject::tr("Accumuliation Register") );
+       addTypes( l, find( md, md_reports, 0), md_report, QObject::tr("Report"));
+return l;
+}
+
+
+/*!
+ *     Inserts new document in metadata tree.
+ *     \param name (in) - document's name.
+ *     \return newly created document.
+ */
+aCfgItem
+aCfg::insertDocument( const QString &name )
+{
+       aCfgItem r, i;
+       r = find( md, md_documents, 0 );
+       if ( ! r.isNull() ) {
+               i = insert( r, md_document, name );
+               insert( i, md_header, QString::null, -1 );
+               insert( i, md_tables, QString::null, -1 );
+               insert( i, md_forms, QString::null, -1 );
+               insert( i, md_webforms, QString::null, -1 );
+       }
+       return i;
+}
+
+
+/*!
+ *     Inserts document's table in metadata tree.
+ *     \param owner (in) - document to insert table.
+ *     \param name (in) - table's name.
+ *     \return newly created table.
+ */
+aCfgItem
+aCfg::insertDocumentTable(aCfgItem owner, const QString &name )
+{
+       aCfgItem sec, t;
+       sec = find( owner, md_tables, 0 );
+       if ( !sec.isNull() ) {
+               t = insert( sec, md_table, name );
+       }
+       return t;
+}
+
+
+/*!
+ *     Inserts new catalogue in metadata tree.
+ *     \param name (in) - name of catalogue.
+ *     \return newly created catalogue.
+ */
+aCfgItem
+aCfg::insertCatalogue( const QString &name )
+{
+       aCfgItem r, i;
+       r = find( md, md_catalogues, 0 );
+       if ( ! r.isNull() ) {
+               i = insert( r, md_catalogue, name );
+               insert( i, md_element, QString::null, -1 );
+               insert( i, md_group, QString::null, -1 );
+               insert( i, md_forms, QString::null, -1 );
+               insert( i, md_webforms, QString::null, -1 );
+       }
+       return i;
+}
+
+/*!
+ *     Inserts new information register in metadata tree.
+ *     \param name (in) - name of catalogue.
+ *     \return newly created catalogue.
+ */
+aCfgItem
+aCfg::insertIRegister ( const QString &name )
+{
+       aCfgItem r, i;
+       r = find(find( md, md_registers, 0 ),md_iregisters, 0);
+       if ( ! r.isNull() ) {
+               i = insert( r, md_iregister, name );
+               insert( i, md_resources, QString::null, -1 );
+               insert( i, md_dimensions, QString::null, -1 );
+               insert( i, md_information, QString::null, -1 );
+       }
+       return i;
+}
+
+/*!
+ *     Inserts new accumalation register in metadata tree.
+ *     \param name (in) - name of catalogue.
+ *     \return newly created catalogue.
+ */
+aCfgItem
+aCfg::insertARegister ( const QString &name )
+{
+       aCfgItem r, i;
+       r = find(find( md, md_registers, 0 ),md_aregisters, 0);
+       if ( ! r.isNull() ) {
+               i = insert( r, md_aregister, name );
+               insert( i, md_resources, QString::null, -1 );
+               insert( i, md_dimensions, QString::null, -1 );
+               insert( i, md_information, QString::null, -1 );
+       }
+       return i;
+}
+
+/*!
+ *     Inserts new journal in metadata tree.
+ *     \param name (in) - name of catalogue.
+ *     \return newly created catalogue.
+ */
+aCfgItem
+aCfg::insertJournal ( const QString &name )
+{
+       aCfgItem r, i;
+       r = find( md, md_journals, 0 );
+       if ( ! r.isNull() ) {
+               i = insert( r, md_journal, name );
+               insert( i, md_columns, QString::null, -1 );
+               insert( i, md_forms, QString::null, -1 );
+               insert( i, md_webforms, QString::null, -1 );
+       }
+       return i;
+}
+
+/*!
+ *     Inserts new report in metadata tree.
+ *     \param name (in) - name of catalogue.
+ *     \return newly created catalogue.
+ */
+aCfgItem
+aCfg::insertReport ( const QString &name )
+{
+       aCfgItem r, i;
+       r = find( md, md_reports, 0 );
+       if ( ! r.isNull() ) {
+               i = insert( r, md_report, name );
+               insert( i, md_forms, QString::null, -1 );
+               insert( i, md_webforms, QString::null, -1 );
+       }
+       return i;
+}
+
+
+/*!
+ *     Creates a new field's definition in owner's section.
+ *     If section is empty, field will be created in owner's context.
+ *     \param owner (in) - owner of a new field.
+ *     \param section (in) - section of owner. For example Document
+ *     may consists of one or more table sections. All of them contains set of fields.
+ *     \param name (in) - field's name.
+ *     \param ftype (in) - field's type.
+ *     \return newly created field.
+ *
+ */
+aCfgItem
+aCfg::insertField( aCfgItem owner, const QString &section, const QString &name,const QString &ftype )
+{
+       aCfgItem sec, f;
+       if ( section.isEmpty() ) sec = owner;
+       else sec = find( owner, section, 0 );
+       if ( !sec.isNull() ) {
+               f = insert( sec, md_field, name );
+               setAttr( f, mda_type, ftype );
+       }
+       return f;
+}
+
+/*!
+ *     Creates new screen form for object like Document and writes it to metadata tree.
+ *     \param owner (in) - owner of new form.
+ *     \param name (in) - name of new form.
+ *     \return node of metadata tree which represents a newly created form.
+ */
+aCfgItem
+aCfg::insertForm( aCfgItem owner, const QString &name )
+{
+       aCfgItem sec, f;
+       sec = find( owner, md_forms, 0 );
+       if ( !sec.isNull() ) {
+               f = insert( sec, md_form, name );
+       }
+       return f;
+}
+
+/*!
+ *     Creates new Web form for object like Document and writes it to metadata tree.
+ *     \param owner (in) - owner of new form.
+ *     \param name (in) - name of new form.
+ *     \return node of metadata tree which represents a newly created form.
+ */
+aCfgItem
+aCfg::insertWebForm( aCfgItem owner, const QString &name )
+{
+       aCfgItem sec, f;
+       sec = find( owner, md_webforms, 0 );
+       if ( !sec.isNull() ) {
+               f = insert( sec, md_webform, name );
+       }
+       return f;
+}
+
+/*!
+ *     Returns ID of default screen form of object like Document.
+ *     \param owner (in) - form's owner.
+ *     \param actiontype (in) - action to which form is a default form.
+ *     \param mode (in) - action to which form is a mode.
+ *     \return form's ID.
+ */
+long
+aCfg::getDefaultFormId( aCfgItem owner, int actiontype, int mode )
+{
+       aCfgItem        fobj, cobj;
+       cobj = find( owner, md_forms, 0 );
+       if ( cobj.isNull() )
+               return 0;
+       int formtype, fa;
+       switch ( actiontype )
+       {
+               case md_action_new :
+                       formtype = md_form_new;
+                       break;
+               case md_action_view :
+                       formtype = md_form_view;
+                       break;
+               case md_action_edit :
+                       formtype = md_form_edit;
+                       break;
+               default :
+                       return 0;
+       }
+       uint n = count( cobj, md_form );
+       for ( uint i = 0; i < n; i++ )
+       {
+               fobj = find( cobj, md_form, i);
+               fa = sText( fobj, md_defaultmod).toInt();
+               if (  (fa>>formtype)%2 && attr( fobj, mda_type ).toInt() == mode )
+                       return id(fobj);
+       }
+       return 0;
+}
+
+/*!
+ *     Gets journal's documents list.
+ *     \param journal (in) - journal to get list from.
+ *     \return list of documents IDs.
+ */
+QStringList
+aCfg::getJournalDocuments( aCfgItem journal )
+{
+       QStringList l;
+       l.clear();
+       if ( objClass(journal) != md_journal )
+               return l;
+       aCfgItem        dobj, pobj, jobj;
+       uint n, m;
+       int type = attr(journal,mda_type).toInt();
+       switch ( type )
+       {
+               case 0:
+                       pobj = find( find( mdc_metadata ), md_documents, 0 );
+                       n = count(pobj,md_document);
+                       for ( uint i = 0; i < n; i++ )
+                       {
+                               dobj = find ( pobj, md_document, i );
+                               if ( !dobj.isNull())
+                                       l.append( attr( dobj, mda_id ));
+                       }
+                       break;
+               case 1:
+                       n = count(journal,md_used_doc);
+                       for ( uint j = 0; j < n; j++ )
+                       {
+                               dobj = find( journal, md_used_doc, j );
+                               QString id = text(dobj);
+                               if ( !find(id.toLong()).isNull() )
+                                       l.append( text(dobj) );
+                               else
+                                       remove(dobj);
+                       }
+                       break;
+               case 2 :
+                       pobj = find( find( mdc_metadata ), md_documents, 0 );
+                       n = count(pobj,md_document);
+                       for ( uint i = 0; i < n; i++ )
+                       {
+                               jobj = find ( pobj, md_document, i );
+                               if ( !jobj.isNull())
+                                       l.append ( attr( jobj, mda_id ));
+                       }
+                       pobj = find( find( mdc_metadata ), md_journals, 0 );
+                       n = count( pobj, md_journal );
+                       for ( uint i = 0; i < n; i++ )
+                       {
+                               jobj = find ( pobj, md_journal, i );
+                               if ( !jobj.isNull())
+                               {
+                                       m = count ( jobj, md_used_doc );
+                                       for ( uint j = 0; j < m; j++ )
+                                       {
+                                               dobj = find( jobj, md_used_doc, j );
+                                               QString str = text(dobj);
+                                               l.remove ( str );
+                                       }
+                               }
+                       }
+                       break;
+       }
+       return l;
+}
+
+/*!
+ *
+ */
+aCfgItem
+aCfg::findJournal(int jtype, aCfgItem doc)
+{
+       aCfgItem res;
+       uint n,m;
+       aCfgItem js = find( find( mdc_metadata ), md_journals, 0 );
+       if(js.isNull()) return res;
+
+       n = count( js, md_journal );
+       switch(jtype)
+       {
+               case 0:
+               for ( uint i = 0; i < n; i++ )
+               {
+                       aCfgItem jobj = find ( js, md_journal, i );
+                       if ( !jobj.isNull())
+                       {
+                               if(attr(jobj, mda_type).toInt()==0) return jobj;
+                       }
+               }
+               break;
+
+               case 1:
+               for ( uint i = 0; i < n; i++ )
+               {
+                       aCfgItem jobj = find ( js, md_journal, i );
+                       if ( !jobj.isNull())
+                       {
+                               if(attr(jobj, mda_type).toInt()==1)
+                               {
+                                       m = count ( jobj, md_used_doc );
+                                       for ( uint j = 0; j < m; j++ )
+                                       {
+                                               QString dobj = text(find( jobj, md_used_doc, j ));
+                                               if(dobj==attr(doc, mda_id)) return jobj;
+
+                                       }
+                               }
+                       }
+               }
+               break;
+
+               default:
+               break;
+       }
+       return res;
+}
+
+
+/*!
+ * Return list of object database tables.
+ *     Every string in string list stored in format,
+ *     consist of table id, table's human name fields,
+ *     separated by tabulate char.
+ *     This function used by Database tables plugins.
+ *     For example:
+ *     0\tHeader
+ *     123\tTable1
+ *     id = 0 for document header, catalogue element;
+ *     id = 1 for catalogue group;
+ *     id = metadata object id for document table.
+ *     \param obj (in) - metadata object.
+ *     \return list of tables.
+ */
+QStringList
+aCfg::objTables( aCfgItem obj )
+{
+       QStringList list;
+       QString t;
+       int i, n;
+       long oid, tid;
+       aCfgItem objt;
+
+       if ( obj.isNull() ) return list;
+       t = objClass( obj );
+       oid = id( obj );
+       if ( t == md_journal ) {
+               list << QString("0\t")+QObject::tr("Documents");
+       }
+       if ( t == md_catalogue ) {
+               list << QString("0\t")+QObject::tr("Element");
+               list << QString("1\t")+QObject::tr("Group");
+       }
+       if ( t == md_document ) {
+               list << QString("0\t")+QObject::tr("Header");
+               n = count( obj, md_table );
+               for (i=0; i<n; i++) {
+                       objt = find( obj, md_table, i);
+                       if ( !objt.isNull() ) {
+                               tid = id( objt );
+                               if ( tid ) {
+                                       list << QString::number( tid )+QString("\t")+attr( objt, mda_name );
+                               }
+                       }
+               }
+       }
+       return list;
+}
+
+
+/*!
+ * Return list of object database tables.
+ *     Every string in string list stored in format,
+ *     consist of table id, table's human name fields,
+ *     separated by tabulate char.
+ *     This function used by Database tables plugins.
+ *     For example:
+ *     0\tHeader
+ *     123\tTable1
+ *     id = 0 for document header, catalogue element;
+ *     id = 1 for catalogue group;
+ *     id = metadata object id for document table.
+ *     \param objid (in) - metadata object id.
+ *     \return list of tables.
+ */
+QStringList
+aCfg::objTables( int objid )
+{
+       return objTables( find( objid ) );
+}
+
+
+/*!
+ * Return context of the object table by id.
+ *     This function used by Database tables plugins.
+ *     \param obj (in) - metadata object.
+ *     \param id (in) - metadata object table id.
+ *     id = 0 for document header, catalogue element;
+ *     id = 1 for catalogue group;
+ *     id = metadata object id for document table.
+ *     \return table context.
+ */
+aCfgItem
+aCfg::objTable( aCfgItem obj, int id )
+{
+       aCfgItem item;
+       QString t;
+
+       if ( obj.isNull() ) return obj;
+       t = objClass( obj );
+       if ( t == md_catalogue ) {
+               if ( id == 0 ) item = findChild( obj, md_element );
+               if ( id == 1 ) item = findChild( obj, md_group );
+       }
+       if ( t == md_document ) {
+               if ( id == 0 ) item = findChild( obj, md_header );
+               else item = find( id );
+       }
+       if ( t == md_journal ) {
+               if ( id == 0 ) item = findChild( obj, md_columns );
+       }
+       return item;
+}
+
+
+/*!
+ * Return context of the object table by object id and table id.
+ *     This function used by Database tables plugins.
+ *     \param objid (in) - metadata object id.
+ *     \param id (in) - metadata object table id.
+ *     id = 0 for document header, catalogue element;
+ *     id = 1 for catalogue group;
+ *     id = metadata object id for document table.
+ *     \return table context.
+ */
+aCfgItem
+aCfg::objTable( int objid, int id )
+{
+       return objTable( find( objid ), id );
+}
+
+
+/************ P U B L I C   S L O T S ******************************/
+/*!
+ *
+ */
+QString
+aCfg::Info( QString partname )
+{
+        return info( partname );
+}
+
+
+
+/*!
+ * AMetadataObject
+ *
+ */
+AMetadataObject::AMetadataObject( aCfgItem newitem )
+{
+        item = newitem;
+}
+
+
+QString
+AMetadataObject::Class()
+{
+        return "Unknown";
+}
+
diff --git a/src/lib/acfg.h b/src/lib/acfg.h
new file mode 100644 (file)
index 0000000..92e89f1
--- /dev/null
@@ -0,0 +1,495 @@
+/****************************************************************************
+** $Id: acfg.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Header file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Andrey Paskal <app at lrn dot ru>, Yoshkar-Ola
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru >, Yoshkar-Ola
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/*
+Ananas configuration objects.
+(c) 2004 Leader InfoTech
+*/
+#ifndef ACFG_H
+#define ACFG_H
+
+#include "ananasglobal.h"
+
+#include <qdom.h>
+//#include <qdict.h>
+#include <q3intdict.h>
+#include "acfgrc.h"
+
+#ifdef __BORLANDC__
+#define CHECK_POINT    printf("%s:%i %s()\n",__FILE__,__LINE__,__FUNC__);
+#else
+#define CHECK_POINT    printf("%s:%i %s()\n",__FILE__,__LINE__,__FUNCTION__);
+#endif
+
+
+extern void (*cfg_messageproc)(int , const char *);
+void ANANAS_EXPORT cfg_message(int msgtype, const char *msgfmt,...);
+void ANANAS_EXPORT debug_message(const char *msgfmt,...);
+
+class QObject;
+
+/*!
+ * \~english Metadata object methods return codes. \~russian
+ * Коды возвратов методов объекта метаданных. \~
+ */
+#define RC_OK          0       /**< All right - no errors */
+#define RC_ERROR       1       /**< Error while executing method */
+
+/*!
+Metadata system contexts id.
+*/
+#define mdc_unknown            0       /**< Unknown context */
+#define mdc_root               1       /**< Root context */
+#define mdc_info               2       /**< Info context */
+#define mdc_interface          3       /**< Interface context */
+#define mdc_metadata           4       /**< Metadata context */
+#define mdc_globals            5       /**< Metadata context */
+#define mdc_actions            6       /**< Actions context */
+
+//#define mdc_documents        6       /**< Metadata context */
+//#define mdc_catalogues       7       /**< Metadata context */
+//#define mdc_iregisters       8       /**< Metadata context */
+//#define mdc_aregisters       9       /**< Metadata context */
+//#define mdc_reports          10      /**< Metadata context */
+//#define mdc_journals         11      /**< Metadata context */
+
+/*!
+Metadata tags.
+*/
+#define md_root                "ananas_configuration"
+#define md_interface           "interface"
+
+#define md_info                "info"
+#define md_info_name           "name"
+#define md_info_author                 "author"
+#define md_info_date           "date"
+#define md_info_mdate          "mdate"
+#define md_info_remark                 "remark"
+#define md_info_lastid                 "lastid"
+//#define md_info_dir          "dir"
+
+#define md_metadata            "metadata"      /**< Metadata tag */
+#define md_globals             "globals"
+#define md_languages           "languages"
+#define md_language            "language"
+#define md_aliases             "aliases"
+#define md_alias               "alias"
+#define md_roles               "roles"
+#define md_role                "role"
+#define md_description         "description"
+#define md_sourcecode          "sourcecode"
+#define md_servermodule                "server_module"
+#define md_clientmodule                "client_module"
+#define md_formsource          "form_source"
+#define md_menutext            "menutext"
+#define md_argument            "argument"
+
+#define md_documents           "documents"
+#define md_document            "document"
+
+#define md_catalogues          "catalogues"
+#define md_catalogue           "catalogue"
+#define md_element             "element"
+#define md_group               "group"
+
+#define md_string_view         "string_view"
+#define md_svfunction          "svfunction"
+
+#define md_registers           "registers"
+#define md_iregisters          "iregisters"
+#define md_iregister           "iregister"
+#define md_aregisters          "aregisters"
+#define md_aregister           "aregister"
+
+#define md_reports             "reports"
+#define md_report              "report"
+
+#define md_journals            "journals"
+#define md_journal             "journal"
+#define md_columns             "columns"
+#define md_column              "column"
+#define md_used_doc            "used_doc"
+#define md_fieldid             "fieldid"
+
+#define md_field               "field"
+#define md_forms               "forms"
+#define md_form                        "form"
+#define md_defaultmod          "defaultmod"
+#define md_webforms            "webforms"
+#define md_webform             "webform"
+#define md_formdesign          "dialogform"
+
+#define md_tables              "tables"
+#define md_table               "table"
+#define md_header              "header"
+
+#define md_resources           "resources"
+#define md_dimensions          "dimensions"
+#define md_information         "information"
+
+/*!
+Action metadata object items.
+*/
+#define md_actions             "actions"
+#define md_actiongroup         "actiongroup"
+#define md_action              "action"
+#define md_objectid            "objectid"
+#define md_formid              "formid"
+#define md_actiontype          "actiontype"
+#define md_active_picture      "active_picture"
+#define md_passive_picture     "passive_picture"
+
+/*!
+Interface metadata object items.
+*/
+#define md_interface           "interface"
+#define md_toolbars            "toolbars"
+#define md_toolbar             "toolbar"
+#define md_popupmenus          "popupmenus"
+#define md_popupmenu           "popupmenu"
+#define md_mainmenu            "mainmenu"
+#define md_submenu             "submenu"
+#define md_command             "command"
+#define md_comaction           "comaction"
+#define md_separator           "separator"
+#define md_key                 "key"
+#define md_menutext            "menutext"
+//key modifiers
+#define md_km_ctrl             "Ctrl+"
+#define md_km_alt              "Alt+"
+#define md_km_shift            "Shift+"
+
+#define md_image_collection    "image_collection"
+#define md_image               "image"
+
+
+/*!
+Metadata attributes.
+*/
+#define mda_name               "name"
+#define mda_id                 "id"
+#define mda_type               "type"
+#define mda_readonly           "readonly"
+#define mda_lang               "lang"
+#define mda_nz                 "nz"
+#define mda_sort               "sort"
+#define mda_no_unconduct       "no_unconduct"
+#define mda_plus               "plus"
+#define mda_sum                        "sum"
+#define mda_tag                        "tag"
+#define mda_trfile             "trfile"
+#define mda_length             "length"
+#define mda_format             "format"
+#define mda_stdf               "stdf"
+#define mda_rights             "rights"
+
+/*!
+Actions types
+*/
+
+#define md_action_new          0
+#define md_action_edit         1
+#define md_action_view         2
+#define md_action_execute      3
+
+/*!
+ *     Default forms types.
+ *     If bit with some number set in 1 form can use for this action.
+ */
+
+#define md_form_nouse          0
+#define md_form_new            1
+#define md_form_view           2
+#define md_form_edit           3
+#define md_form_select         4
+
+
+/*!
+ *     Catalogue forms types.
+ */
+
+#define md_form_elem_list      0
+#define md_form_elem           1
+#define md_form_group          2
+
+
+/*!
+System object id
+*/
+
+#define        md_systemjournal        1
+#define md_aregarhive          2
+
+//class aCfg;
+//extern aCfg cfg;
+
+#define ERR_Code int
+
+#define err_unknown            -1//some ote error
+#define err_noerror            0// result successful
+#define err_notable            1// no table with such name
+#define err_objnotfound                2// no such object in metadata
+#define err_incorrecttype      3// object has othe metadata id
+#define err_uidnotfound                4// no such id in unicues
+#define err_notselected                5// select return nothing
+#define err_nodatabase         6// database is not inited
+#define        err_selecterror         7// select return some error
+#define err_condition          8// error in condition
+#define err_noobject           9// aObject didn't init md object
+#define err_nosysjournal       10// system journal not inited
+#define err_inserterror                11// insert in aSQLTable return false
+#define err_execerror          12// exec return false
+#define        err_updateerror         13// update reutrn false
+#define        err_abstractobj         14// you need to use hi level object or specimen of object
+#define err_fieldnotfound      15// no filed with such name
+#define err_copyerror          16// object don't copy
+#define err_nocatalogue                17// catalogue not found
+#define err_nogroup            18// group not found
+#define err_deleteerror                19// object don't deleted or don't mark deleted
+#define err_nodocument         20// no such document
+#define err_emptyperiod                21// you try close empty period
+#define err_noresources                22// the register object have no resources tag in metadata
+#define err_incorrectname      23// object have incorrect name
+#define err_closeperiod                24// close period error
+#define err_conducterror       25// error when document conducting
+#define err_docconducted       26// you can't change conducted document or conduct document once more
+#define err_docunconducted     27// you can unconduct document if it not conducted
+#define err_cyclereparent      28//you have cycle when try reparent
+#define err_readonly           29//object is readonly
+#define err_invaliddate                30// invalid date or datetime specified
+#define err_nodimensions       31// the register object have no dimensions tag in metadata
+#define err_nowidgetfound      32// there is no such widget in form
+
+#define md_user_roles          "userroles"
+#define md_users               "users"
+#define md_user                        "user"
+#define md_usr_role            "u_role"
+#define md_roles               "roles"
+#define md_role                        "role"
+#define md_rl_users            "r_users"
+#define md_rl_user             "r_user"
+#define md_right_roles         "rroles"
+
+#define perm_read              0
+#define perm_execute           1
+#define perm_create            2
+#define perm_delete            3
+#define perm_turn_on           4
+#define perm_turn_off          5
+#define perm_admin             6
+
+#define aPermission            int
+
+#define aCfgItem               QDomElement
+
+
+
+/*!
+ * \en
+ *     Configuration item container.
+ *     Using for id caching and fast search items by id.
+ *\_en
+ *\ru
+ *     \brief Контейнер для элемента метаданных бизнес схемы Ананаса.
+ *     Наследует QObject.
+ *
+ *     Используется для кэширования id и быстрого поиска элементов по id.
+ *\_ru
+ */
+class ANANAS_EXPORT aCfgItemContaner: public QObject
+{
+public:
+    long id;
+    aCfgItem item;
+    aCfgItemContaner(long newid, aCfgItem newitem);
+};
+
+/*
+class ANANAS_EXPORT  aCfgFieldType: public QObject
+{
+public:
+       QString name, type;
+       aCfgFieldType( const QString &newname, const QString &newtype);
+       aCfgFieldType( aCfgItem newitem );
+};
+*/
+
+
+
+/*!
+ *\en
+ *     Metadata object for metadata script access.
+ *\_en
+ *\ru
+ *     \brief Объект метаданных для обеспечения доступа из скриптов.
+ *     Наследует QObject.
+ *\_ru
+ */
+class ANANAS_EXPORT  AMetadataObject: public QObject
+{
+Q_OBJECT
+public:
+        AMetadataObject( aCfgItem newitem );
+public slots:
+        QString Class();
+private:
+        aCfgItem item;
+};
+
+
+
+/*! \en
+ *     System configuration object.
+ *
+ *     Using for story and edit accountine
+ *     system configuration.
+ *\_en \ru
+ *     \brief Класс реализует програмный интерфейс доступа к элементам метаданных системы.
+ *     Наследует QObject.
+ *
+ *     Взаимосвязанный набор метаданных, записанный в файл, называется конфигурацией
+ *     (прикладной настройкой) системы. Методы класса позволяют загружать конфигурацию из
+ *     файла, записывать её в файл.
+ *\_ru
+ */
+class ANANAS_EXPORT aCfg: public QObject //QDomDocument
+{
+    Q_OBJECT
+
+public:
+    enum fieldType { ftUnknown, ftChar, ftNumberic, ftDate, ftObject };
+    aCfgRc rc;
+
+    aCfg();
+    ~aCfg();
+
+    int read(const QString &fname);
+    int write(const QString &fname);
+    int write(QDomDocument doc, const QString &fname);
+    int readrc(const QString &fname);
+    int writerc(const QString &fname);
+    bool compressed();
+    void setCompressed( bool mode );
+    bool modified();
+    void setModified( bool mode );
+//    void print();
+    void createNew();
+
+    QString info(const QString &name);
+    void setInfo(const QString &name, const QString &value);
+
+    long getId( QString &name );
+    long id(aCfgItem context);
+
+    QString objClass( long id );
+    QString objClass( aCfgItem context );
+
+    int count(aCfgItem context, const QString &classname);
+    int countChild(aCfgItem context, const QString &classname = QString::null );
+
+    QString attr(aCfgItem context, const QString &name);
+    void setAttr(aCfgItem context, const QString &name, const QString &value);
+    void setAttr(aCfgItem context, const QString &name, int value);
+
+    QString text(aCfgItem context);
+    void setText(aCfgItem context, const QString &value );
+    QByteArray binary( aCfgItem context );
+    void setBinary( aCfgItem context, const QByteArray &value, const QString &format = QString::null );
+    QString binaryFormat( aCfgItem context );
+    QString sText(aCfgItem context, const QString & subname );
+    void setSText(aCfgItem context, const QString & subname, const QString &value);
+
+    aCfgItem find(aCfgItem context, const QString &name, int n = 0 );
+    aCfgItem find(long id);
+    aCfgItem find(const QString &name);
+    aCfgItem findChild(aCfgItem context, const QString &classname, int n = 0 );
+    aCfgItem findName(aCfgItem context, const QString &classname, const QString &name = QString::null );
+
+    bool swap( aCfgItem &item1, aCfgItem &item2);
+    int order( aCfgItem item );
+    aCfgItem parent( aCfgItem context );
+    aCfgItem firstChild( aCfgItem context );
+    aCfgItem lastChild( aCfgItem context );
+    aCfgItem nextSibling( aCfgItem context );
+    aCfgItem previousSibling( aCfgItem context );
+
+    aCfgItem insert(aCfgItem context, const QString &otype, const QString &name = QString::null, long id = 0);
+       int             saveOneObject(aCfgItem context, const QString &fileName);
+       aCfgItem        loadOneObject(const QString &fileName);
+    void remove(aCfgItem context);
+
+    aCfgItem importCfgItem( aCfgItem context,  aCfgItem obj );
+    void setupNewId( aCfgItem obj );
+
+    QStringList types( const QString &filter = QString::null, aCfgItem *obj = 0 );
+    QStringList ObjectTypes();
+
+    // Hi level functions.
+    aCfgItem insertDocument( const QString &name );
+    aCfgItem insertDocumentTable(aCfgItem owner, const QString &name );
+    aCfgItem insertCatalogue( const QString &name );
+    aCfgItem insertIRegister ( const QString &name );
+    aCfgItem insertARegister ( const QString &name );
+    aCfgItem insertJournal ( const QString &name );
+    aCfgItem insertReport ( const QString &name );
+    aCfgItem insertField( aCfgItem owner, const QString &section, const QString &name,const QString &ftype );
+    aCfgItem insertForm( aCfgItem owner, const QString &name );
+    aCfgItem insertWebForm( aCfgItem owner, const QString &name );
+
+    long getDefaultFormId( aCfgItem owner, int actiontype, int mode =0 );
+    QStringList getJournalDocuments( aCfgItem journal );
+    aCfgItem findJournal(int jtype, aCfgItem doc);
+    QStringList objTables( aCfgItem obj );
+    QStringList objTables( int objid );
+    aCfgItem objTable( aCfgItem obj, int id );
+    aCfgItem objTable( int objid, int id );
+
+public slots:
+    QString Info( QString partname );
+
+signals:
+       void message( int messageType, const QString & messageText );
+
+private:
+    QDomDocument xml;
+    bool fCompressed, fModified;
+    // QDomElement root;
+    aCfgItem rootnode, cfginfo, md,
+    iface,
+    actions;
+    Q3IntDict <aCfgItemContaner> idcache;
+    long nextID();
+    void init();
+
+    void addTypes( QStringList &list, aCfgItem context, const QString &tobject, const QString &tname);
+};
+
+#endif
diff --git a/src/lib/acfgrc.cpp b/src/lib/acfgrc.cpp
new file mode 100644 (file)
index 0000000..4108db9
--- /dev/null
@@ -0,0 +1,266 @@
+/****************************************************************************
+** $Id: acfgrc.cpp,v 1.3 2008/11/27 20:20:55 leader Exp $
+**
+** Code file of the recorse work file of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <stdlib.h>
+#include <qfile.h>
+#include <qstringlist.h>
+#include <q3textstream.h>
+//#include <QTextStream>
+#include <qpixmap.h>
+#include <q3dragobject.h>
+#include <Q3MimeSourceFactory>
+
+#include "acfg.h"
+#include "acfgrc.h"
+#include "messageswindow.h"
+
+QPixmap
+rcIcon( const char *name )
+{
+//    QString iconname = QString(":/images/%1").arg(name);
+//printf("get icon %s ",(const char *) iconname.toUtf8().data());
+    QPixmap pm(QString(":/images/%1").arg(name));
+//printf("\n");
+    return pm;
+}
+
+
+
+void
+aMessageOutput( QtMsgType type, const char *msg )
+{
+       switch ( type ) {
+       case QtDebugMsg:
+               cfg_message( 0, "%s\n", msg );
+               break;
+        case QtWarningMsg:
+                cfg_message( 1, "%s\n", msg );
+                break;
+        case QtFatalMsg:
+                cfg_message( 2, "%s\n", msg );
+                abort();                    // deliberately core dump
+        }
+}
+
+void
+setMessageHandler( bool ) // GUI )
+{
+//     qInstallMsgHandler( aMessageOutput );
+//     if ( GUI ) {
+//             cfg_messageproc = messageproc;
+//             cfg_message( 0, "<img source=\"a_system.png\">");
+//     }
+}
+
+void
+unsetMessageHandler()
+{
+       qInstallMsgHandler( 0 );
+       cfg_messageproc = 0;
+}
+
+/*!
+Ananas resource file object.
+*/
+aCfgRc::aCfgRc()
+{
+       values.setAutoDelete( TRUE );
+       filename = QString::null;
+}
+
+
+/**
+ * \ru
+ *     \brief Читает данные из файла ресурсов указанного в параметре при вызове.
+ *
+ *     И заполняет объекта класса данными из файла ресурса.
+ *     \param fname имя файла ресурса, включая полный путь.
+ *     \return 0 - в случае успешной загрузки данных из файла ресурсов.
+ *     1 - если не удалось открыть файл ресурсов для чтения.
+ * \_ru
+ */
+int
+aCfgRc::read(const QString &fname)
+{
+       QStringList l;
+       QFile file( fname );
+
+       filename = fname;
+       values.clear();
+       if ( file.open( QIODevice::ReadOnly ) )
+       {
+               Q3TextStream stream( &file );
+               QString line, k, v;
+
+               stream.setEncoding(Q3TextStream::UnicodeUTF8);
+               while ( !stream.eof() ) {
+                       line = stream.readLine(); // line of text excluding '\n'
+                       k = line.section("=",0,0);
+                       v = line.section("=",1,100); if ( v.isNull() ) v = "";
+                       values.insert( k, new QString( v ) );
+               }
+               file.close();
+               return 0;
+       }
+       return 1;
+}
+
+
+
+/**
+ * \ru
+ *     \brief Записывает данные в файл ресурсов, указанный в параметрах вызова.
+ *
+ *     В файл ресурса записываются данные, хранимые в объекте.
+ *     \param fname - имя файла ресурсов, включая полный путь.
+ *     \return 0, в случе успешной записы данных в файл ресурсов.
+ *     1, если не удалось открыть файл ресурсов на запись.
+ * \_ru
+ */
+int
+aCfgRc::write(const QString &fname)
+{
+       QFile file( fname );
+//     int i;
+
+       if ( file.open( QIODevice::WriteOnly ) )
+       {
+               Q3TextStream stream( &file );
+               Q3DictIterator<QString> it( values );
+//             int i, vc;
+
+               stream.setEncoding(Q3TextStream::UnicodeUTF8);
+               for( ; it.current(); ++it )
+               stream << it.currentKey() << "=" << *it.current() << endl;
+//                     cout << endl;
+//             vc = values.count();
+//             for ( i = 0; i< vc; i++) stream << *it << "\n";
+               file.close();
+               return 0;
+       }
+       return 1;
+}
+
+
+
+/**
+ * \ru
+ *     \brief Записывает данные объекта в файл ресурсов.
+ *
+ *     В качестве имени файла ресурсов используется значение, хранящееся
+ *     в поле filename объекта.
+ *     Использует метод aCfgRc::write(const QString &fname)
+ *     \return 0, в случе успешной записы данных в файл ресурсов.
+ *     1, если не удалось открыть файл ресурсов на запись.
+ * \_ru
+ *     \see aCfgRc::write(const QString &fname)
+ */
+int
+aCfgRc::write()
+{
+       return write( filename );
+}
+
+
+
+/**
+ * \ru
+ *     \brief Возвращает значение именованного параметра.
+ *     
+ *     Метод предоставляет доступ к параметрам файла ресурсов, хранимым в объекте.
+ *     \param name - имя параметра, значение которого требуется получить.
+ *     Состав и количество параметров вида ИМЯ=ЗНАЧЕНИЕ не контролируются методом.
+ *     \return строку со значением параметра или пустую строку "", если параметр не
+ *     найден.
+ * \_ru
+ */
+QString
+aCfgRc::value(const QString &name, const QString &defValue)
+{
+       QString *s;
+       s = values.find( name );
+       if ( s ) return *s; else return defValue;
+}
+
+
+
+/**
+ * \ru
+ *     \brief Задает значение именованного параметра.
+ *     
+ *     Метод предоставляет доступ к параметрам файла ресурсов, хранимым в объекте.
+ *     \param name - имя параметра, значение которого требуется задать.
+ *     \param value - новое значение параметра с именем name.
+ *     Состав и количество параметров вида ИМЯ=ЗНАЧЕНИЕ не контролируются методом.
+ *     Однако, для успешного создания соединения с SQL сервером должны быть заданы
+ *     как минимум приведенные в примере ниже шесть праметров.
+ *     \code
+ *     setValue( "configfile" , "resourses/inventory-demo.cfg");
+ *     setValue( "dbhost" , "localhost");
+ *     setValue( "dbname" , "tests_tmp_db");
+ *     setValue( "dbuser" , "root");
+ *     setValue( "dbpass" , "");
+ *     setValue( "dbtype" , "mysql");
+ *
+ *     \endcode 
+ * \_ru
+ */
+void
+aCfgRc::setValue(const QString &name, const QString &value)
+{
+       if (values.find( name )) values.replace( name, new QString( value ));
+       else values.insert( name, new QString( value ));
+}
+
+
+/**
+ * \ru
+ *     \brief Возвращает количество параметров, информация о которых храниться в объекте.
+ *     
+ *     \return количество параметров, информация о которых храниться в объекте.
+ * \_ru
+ */
+int
+aCfgRc::count()
+{
+       return ( int ) values.count();
+}
+
+
+
+/**
+ * \ru
+ *     \brief Возвращает имя используемого rc файла с полным путем.
+ * \_ru
+ */
+QString
+aCfgRc::getRcFileName() 
+{
+       return filename;
+}
diff --git a/src/lib/acfgrc.h b/src/lib/acfgrc.h
new file mode 100644 (file)
index 0000000..db50621
--- /dev/null
@@ -0,0 +1,72 @@
+/****************************************************************************
+** $Id: acfgrc.h,v 1.2 2008/11/09 21:09:11 leader Exp $
+**
+** Header file of the recorse work file of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ACFGRC_H
+#define ACFGRC_H
+
+#include "ananasglobal.h"
+
+#include <qobject.h>
+#include <q3dict.h>
+//Added by qt3to4:
+#include <QPixmap>
+
+QPixmap ANANAS_EXPORT rcIcon(const char *name);
+void ANANAS_EXPORT setMessageHandler(bool GUI = false);
+void ANANAS_EXPORT unsetMessageHandler();
+
+
+/**
+ * \ru
+ *     \brief Класс для работы с файлом ресурсов.
+ *
+ *     Класс aCfgRc реализует интерфейс управления файлом ресурсов бизнес-схемы Ананаса,
+ *     содержащим параметры соединения с SQL сервером, имя бизнес схемы, 
+ *     отображаемое пользователю для выбора при запуске Ананаса, и ссылку на файл метаданных
+ *     бизнес-схемы Ананаса.
+ * \_ru
+ */
+class  ANANAS_EXPORT aCfgRc: public QObject
+{
+public:
+       aCfgRc();
+       int read(const QString &fname);
+       int write(const QString &fname);
+       int write();
+       QString value(const QString &name, const QString &defValue = QString::null );
+       void setValue(const QString &name, const QString &value);
+       int count();
+       QString getRcFileName();
+
+private:
+       QString filename;
+       Q3Dict <QString> values;
+};
+
+#endif
diff --git a/src/lib/acmanifest.cpp b/src/lib/acmanifest.cpp
new file mode 100644 (file)
index 0000000..e1285e0
--- /dev/null
@@ -0,0 +1,247 @@
+/****************************************************************************
+** $Id: acmanifest.cpp,v 1.2 2008/11/08 20:16:35 leader Exp $
+**
+** Work with manifest.xml implementation file of
+** Ananas application
+**
+** Created : 20060927
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "alog.h"
+#include "acmanifest.h"
+#include <qfile.h>
+#include <QTextStream>
+
+//#define ERROR true
+
+
+aCManifest::aCManifest():QObject()
+{
+}
+
+aCManifest::~aCManifest()
+{
+}
+
+
+       // place your castom types before mf_other
+    // enum type{ mf_metadata, mf_template, mf_dir, mf_script, mf_form, mf_picture, mf_other=100 };
+
+void
+aCManifest::create()
+{
+       manifest.setContent(QString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
+       QDomElement root = manifest.createElement("manifest:manifest");
+       manifest.appendChild(root);
+       rootNode = root;
+       currentNode.clear();
+       return;
+}
+
+QString
+aCManifest::toString()
+{
+       return manifest.toString(4); //indent - 4 space
+}
+
+bool
+aCManifest::write(const QString& fname)
+{
+       QFile file(fname);
+       QByteArray buf( manifest.toString(4).utf8() );
+       if ( file.open( QIODevice::WriteOnly ) )
+       {
+               QTextStream ts( &file );
+               //--ts.setEncoding(Q3TextStream::UnicodeUTF8);
+               manifest.save(ts, 4);
+               file.close();
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aCManifest save xml %1").arg(fname));
+               txtError = QString("aCManifest save xml %1").arg(fname);
+               return false;
+       }
+       return true;
+}
+
+
+bool
+aCManifest::read(const QString& fname)
+{
+       QFile file( fname );
+       QByteArray buf;
+       QString err;
+       int errLine = 0, errColumn = 0;
+       if ( !file.open( QIODevice::ReadOnly ) )
+       {
+               aLog::print(aLog::Error, tr("aCManifest read file `%1'").arg(fname));
+               return false;
+       }
+       buf = file.readAll();
+       file.close();
+       manifest.setContent( QString("") );
+       if ( !manifest.setContent( buf, false, &err, &errLine, &errColumn ) )
+       {
+               aLog::print(aLog::Error, tr("aCManifest read line: %1 column: %2").arg(errLine).arg(errColumn));
+               txtError = err;
+               return RC_ERROR;
+       }
+       if(!manifest.documentElement().isNull())
+       {
+               rootNode =  manifest.documentElement().firstChild().toElement();
+       }
+       currentNode.clear();
+       return true;
+
+}
+
+
+void
+aCManifest::clear()
+{
+       manifest.clear();
+       currentNode.clear();
+       //manifest.setContent("");
+       rootNode.clear();
+}
+
+
+bool
+aCManifest::isExists( const QString &fname )
+{
+       //TODO implement this!
+       return isValid();
+}
+
+bool
+aCManifest::addEntry( const QString &fname, int type)
+{
+       if(isValid())
+       {
+               QDomElement entry = manifest.createElement("manifest:file-entry");
+               entry.setAttribute("manifest:full-path",fname);
+               entry.setAttribute("manifest:type",type);
+               rootNode.appendChild(entry);
+               return true;
+       }
+       else
+       {
+               return false;
+       }
+}
+
+bool
+aCManifest::removeEntry( const QString &fname, bool withChilds )
+{
+
+       bool res = false;
+       if(isValid())
+       {
+               QDomElement root = manifest.documentElement().firstChild().toElement();
+               QDomElement el = root.firstChild().toElement();
+               QString attr;
+               while(!el.isNull())
+               {
+                       printf("element is %s\n",el.nodeName().ascii());
+                       attr = el.attribute("manifest:full-path");
+                       if(withChilds)
+                       {
+                               if(attr.find(fname)!=0) // only if attr begining from fname
+                               {
+                                       printf("remove entry %s\n",attr.ascii());
+                               }
+                       }
+                       else
+                       {
+                               if(attr==fname)
+                               {
+                                       printf("remove entry %s\n",attr.ascii());
+                                       root.removeChild(el);
+                                       res = true;
+                               }
+                       }
+                       el = root.nextSibling().toElement();
+
+               }
+       }
+       return res;
+}
+
+bool
+aCManifest::isValid()
+{
+       if(rootNode.isNull())
+       {
+               aLog::print(aLog::Error, tr("aCManifest invalid manifest"));
+               txtError = "aCManifest invalid manifest";
+               return false;
+       }
+       return true;
+}
+
+
+aCManifest::record
+aCManifest::first()
+{
+       aCManifest::record rec;
+       if(isValid())
+       {
+               QDomElement node = rootNode.firstChild().toElement();
+               if(!node.isNull())
+               {
+                       currentNode = node;
+                       rec.name = node.attribute("manifest:full-path");
+                       rec.type = node.attribute("manifest:type", "0").toInt();
+               }
+       }
+       return rec;
+}
+
+
+aCManifest::record
+aCManifest::next()
+{
+       aCManifest::record rec;
+       if(isValid() && !currentNode.isNull())
+       {
+               QDomElement node = currentNode.nextSibling().toElement();
+               if(!node.isNull())
+               {
+                       currentNode = node;
+                       rec.name = node.attribute("manifest:full-path");
+                       rec.type = node.attribute("manifest:type", "0").toInt();
+               }
+       }
+       return rec;
+
+}
+
+QString
+aCManifest::lastError() const
+{
+       return txtError;
+}
+
+
diff --git a/src/lib/acmanifest.h b/src/lib/acmanifest.h
new file mode 100644 (file)
index 0000000..5058b60
--- /dev/null
@@ -0,0 +1,98 @@
+/****************************************************************************
+** $Id: acmanifest.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** manifest.xml function header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ACMANIFEST_H
+#define ACMANIFEST_H
+
+#include "qdom.h"
+#include "qstringlist.h"
+#include "ananas.h"
+#include <qobject.h>
+
+
+
+/**
+ * \en
+ *     Class for work with manifest.xml
+ * \_en
+ * \ru
+ * \brief      Класс aCManifest предназначен для работы с файлом manifest.xml
+ *     Наследует QObject.
+ *
+ * \_ru
+ */
+#define mf_invalid 0
+#define mf_metadata 1
+#define mf_template 2
+#define mf_dir 3
+#define mf_script 4
+#define mf_form 5
+#define mf_picture 6
+#define mf_other 100
+
+class ANANAS_EXPORT aCManifest: public QObject
+{
+    Q_OBJECT
+public:
+
+       aCManifest();
+       virtual ~aCManifest();
+ //    enum type{ mf_invalid, mf_metadata, mf_template, mf_dir, mf_script, mf_form, mf_picture, mf_other=100 };
+       struct record
+       {
+               QString name;
+               int type;
+       };
+       // place your castom types before mf_other
+
+       virtual void create();
+       virtual QString toString();
+       virtual bool write(const QString& fname);
+       virtual bool read(const QString& fname);
+       virtual void clear();
+       virtual bool isValid();
+
+       virtual aCManifest::record first();
+       virtual aCManifest::record next();
+
+       virtual bool isExists( const QString &fname );
+       virtual bool addEntry( const QString &fname, int type);
+       virtual bool removeEntry( const QString &fname, bool withChilds );
+       virtual QString lastError() const;
+
+private:
+       QString txtError;
+       QDomDocument manifest;
+       QDomElement rootNode, currentNode;
+
+};
+
+
+#endif //ACMANIFEST_H
diff --git a/src/lib/acontainer.cpp b/src/lib/acontainer.cpp
new file mode 100644 (file)
index 0000000..4e795fd
--- /dev/null
@@ -0,0 +1,402 @@
+/****************************************************************************
+** $Id: acontainer.cpp,v 1.2 2008/11/08 20:16:35 leader Exp $
+**
+** Data container implementation file of
+** Ananas application
+**
+** Created : 20060209
+**
+** Copyright (C) 2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "alog.h"
+#include "acontainer.h"
+#include "acmanifest.h"
+#include "aservice.h"
+#include <qapplication.h>
+#include <qfile.h>
+#include <qdir.h>
+#include <q3process.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+aContainer::aContainer():QObject()
+{
+}
+
+aContainer::aContainer(const QString& name):QObject(0, name)
+{
+       manifest = new aCManifest();
+}
+
+aContainer::~aContainer()
+{
+       delete manifest;
+       manifest = 0;
+}
+
+bool
+aContainer::open()
+{
+       return open(name());
+}
+
+bool
+aContainer::open(const QString& name)
+{
+       close();
+       generateName4TmpDir();
+       if(createTmpDir())
+       {
+               extractManifest(name, manifest);
+               if(manifest)
+               {
+                       if(extractData(name))
+                       {
+                               setName(name);
+                               aLog::print(aLog::Debug, tr("aContainer unzip"));
+                               return true;
+                       }
+               }
+               cleanupTmpFiles();
+       }
+       aLog::print(aLog::Error, tr("aContainer unzip"));
+       return false;
+}
+
+
+void
+aContainer::create()
+{
+       generateName4TmpDir();
+       createTmpDir();
+       manifest->create();
+}
+
+void
+aContainer::close()
+{
+       cleanupTmpFiles();
+}
+
+void
+aContainer::generateName4TmpDir()
+{
+       QString temp;
+#ifndef _Windows
+       temp = getenv("TMPDIR");
+       if(temp=="" || temp.isEmpty())
+               temp = P_tmpdir;
+#else
+       temp = getenv("TEMP");
+#endif
+       tmpDirName = QString(temp+"/%1").arg(QDateTime::currentDateTime().toTime_t());
+       tmpDirName = QDir::convertSeparators(tmpDirName);
+
+}
+
+bool
+aContainer::createTmpDir()
+{
+       QDir dir;
+       if(!dir.mkdir(tmpDirName))
+       {
+               setLastError(tr("Can't create temporary directory"));
+               aLog::print(aLog::Error, "aContainer create temporary directory %1");
+               return false;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aContainer create temporary directory %1").arg(tmpDirName));
+               return true;
+       }
+
+}
+
+bool
+aContainer::save(const QString& name)
+{
+       setName(name);
+       if(manifest)
+       {
+               aCManifest::record rec;
+               rec = manifest->first();
+               while(rec.type!=mf_invalid)
+               {
+                       compressFile(rec.name);
+                       rec = manifest->next();
+               }
+       }
+       else
+       {
+               setLastError(tr("No manifest found!"));
+               aLog::print(aLog::Error, "aContainer save: manifest is null");
+               return false;
+       }
+       return true;
+}
+
+bool
+aContainer::save()
+{
+       return save(name());
+
+}
+
+bool
+aContainer::addFile(const QString& filename, const QString &newname, int type)
+{
+       bool res = false;
+       if(!aService::copyFile( QDir::convertSeparators(filename), QDir::convertSeparators(tmpDirName + newname), true))
+       {
+               aLog::print(aLog::Error, tr("aContainer error copy file"));
+       }
+       else
+       {
+               if(manifest)
+               {
+                       manifest->addEntry(newname, type);
+                       res = true;
+               }
+               else
+               {
+                       aLog::print(aLog::Error, tr("aContainer manifest is null"));
+               }
+       }
+       return res;
+}
+
+QString
+aContainer::realPath(const QString &fname) const
+{
+       return "";
+}
+
+
+bool
+aContainer::extractManifest(const QString& archName, aCManifest *mf)
+{
+#ifndef Q_OS_WIN32
+       Q3Process process( QString("unzip") );
+//     process.setWorkingDirectory (dir);
+       process.addArgument("-op");
+       process.addArgument( archName );
+       process.addArgument("/META-INF/manifest.xml");
+       process.addArgument( "-d" );
+       process.addArgument( tmpDirName );
+
+#else
+       Q3Process process( QString("7z") );
+//     process.setWorkingDirectory ( templateDir);
+//     printf("working dir = `%s'\n", QString(templateDir).ascii());
+       process.addArgument( "x" );
+       process.addArgument( "-y" );
+       process.addArgument( QString("-o%1").arg(tmpDirName) );
+       process.addArgument( archName );
+
+#endif
+
+       if( !process.start() )
+       {
+               setLastError(tr("Can't start unzip"));
+               aLog::print(aLog::Error, tr("aContainer start unzip"));
+               return false;
+       }
+
+       while( process.isRunning() );
+
+       if( !process.normalExit() )
+       {
+               setLastError(tr("Unzip ended anormal"));
+               aLog::print(aLog::Error, tr("aContainer unzip dead"));
+               return false;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aContainer unzip normal"));
+       }
+       if( process.exitStatus() )
+       {
+               setLastError(tr("Unzip ended with code %1").arg(process.exitStatus()));
+               return false;
+       }
+       if(mf && mf->read(tmpDirName + QDir::convertSeparators("/META-INF/manifest.xml")))
+       {
+               return true;
+       }
+       return false;
+}
+
+bool
+aContainer::extractData(const QString& archName)
+{
+#ifndef Q_OS_WIN32
+       Q3Process process( QString("unzip") );
+//     process.setWorkingDirectory (dir);
+       process.addArgument("-op");
+       process.addArgument( archName );
+       process.addArgument( "-d" );
+       process.addArgument( tmpDirName );
+
+#else
+       Q3Process process( QString("7z") );
+//     process.setWorkingDirectory ( templateDir);
+//     printf("working dir = `%s'\n", QString(templateDir).ascii());
+       process.addArgument( "x" );
+       process.addArgument( "-y" );
+       process.addArgument( QString("-o%1").arg(tmpDirName) );
+       process.addArgument( archName );
+
+#endif
+
+       if( !process.start() )
+       {
+               setLastError(tr("Can't start unzip"));
+               aLog::print(aLog::Error, tr("aContainer start unzip"));
+               return false;
+       }
+
+       while( process.isRunning() );
+
+       if( !process.normalExit() )
+       {
+               setLastError(tr("Unzip ended anormal"));
+               aLog::print(aLog::Error, tr("aContainer unzip dead"));
+               return false;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aContainer unzip normal"));
+       }
+       if( process.exitStatus() )
+       {
+               setLastError(tr("Unzip ended with code %1").arg(process.exitStatus()));
+               return false;
+       }
+       return true;
+}
+
+bool
+aContainer::compressFile(const QString& fileName)
+{
+
+#ifndef Q_OS_WIN32
+
+       Q3Process processUpdate( QString("zip") );
+       processUpdate.setWorkingDirectory(tmpDirName);
+//     processUpdate.addArgument( "-r" ); // recurce into subdirectories
+//     processUpdate.addArgument( "-0" ); // store only
+       processUpdate.addArgument( name() ); // cfg name
+       processUpdate.addArgument(".");
+       processUpdate.addArgument("-i");
+       processUpdate.addArgument(fileName);
+#else
+       Q3Process processUpdate( QString("7z") );
+       processUpdate.setWorkingDirectory(tmpDirName);
+       processUpdate.addArgument( "a" );
+       processUpdate.addArgument( "-tzip" );
+       processUpdate.addArgument( fileName );
+       processUpdate.addArgument( "-r" );
+       processUpdate.addArgument(".");
+#endif
+
+       if( !processUpdate.start() )
+       {
+               setLastError(tr("Unable to start zip"));
+               aLog::print(aLog::Error, tr("aContainer zip start error"));
+               return false;
+       }
+
+       while( processUpdate.isRunning() );
+
+       if( !processUpdate.normalExit() )
+       {
+               setLastError(tr("Zip ended with error"));
+               aLog::print(aLog::Error, tr("aContainer zip dead"));
+               return false;
+       }
+
+       if( processUpdate.exitStatus() )
+       {
+               setLastError(tr("Zip ended with code %1").arg(processUpdate.exitStatus()));
+               return false;
+       }
+
+       return true;
+}
+
+
+
+
+void
+aContainer::setLastError(const QString& errorText)
+{
+       txtError = errorText;
+}
+
+
+QString
+aContainer::lastError() const
+{
+       return txtError;
+}
+
+void
+aContainer::cleanupTmpFiles()
+{
+       QFile file;
+       QDir dir;
+
+       if(manifest && tmpDirName!="")
+       {
+               aCManifest::record rec;
+               rec = manifest->first();
+               while(rec.type!=mf_invalid)
+               {
+                       if(rec.type!=mf_dir && rec.type!=mf_invalid)
+                       {
+                               file.setName(tmpDirName + QDir::convertSeparators(rec.name));
+                               if(file.remove())
+                                       aLog::print(aLog::Debug, tr("aContainer delete file %1").arg(rec.name));
+                       }
+                       rec = manifest->next();
+               }
+               rec = manifest->first();
+               while(rec.type!=mf_invalid)
+               {
+                       if(rec.type==mf_dir)
+                       {
+                               if(dir.rmdir(tmpDirName + QDir::convertSeparators(rec.name) ))
+                                       aLog::print(aLog::Debug, tr("aContainer delete directory %1").arg(rec.name));
+                       }
+                       rec = manifest->next();
+               }
+       }
+
+
+       file.setName(QDir::convertSeparators(tmpDirName+"/META-INF/manifest.xml"));
+       if(file.remove()) aLog::print(aLog::Debug, tr("aContainer delete file %1").arg(file.name()));
+       if(dir.rmdir(QDir::convertSeparators(tmpDirName))) aLog::print(aLog::Debug, tr("aContainer delete directory %1").arg(tmpDirName + "/META-INF"));
+       //aLog::print(aLog::Info, tr("aContainer cleanup temporary files"));
+
+}
+
diff --git a/src/lib/acontainer.h b/src/lib/acontainer.h
new file mode 100644 (file)
index 0000000..9ff4a27
--- /dev/null
@@ -0,0 +1,93 @@
+/****************************************************************************
+** $Id: acontainer.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Data container functions header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2006 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ACONTAINER_H
+#define ACONTAINER_H
+
+#include "qdom.h"
+#include "qstringlist.h"
+#include "ananas.h"
+#include "acmanifest.h"
+#include <qobject.h>
+
+
+//class aDatabase;
+
+/**
+ * \en
+ *     Class for work with data container
+ * \_en
+ * \ru
+ * \brief      Класс предназначен для работы с контейнерами данных.
+ *     Наследует QObject.
+ *
+ * \_ru
+ */
+class ANANAS_EXPORT aContainer: public QObject
+{
+    Q_OBJECT
+public:
+
+       aContainer();
+       aContainer(const QString& name);
+       virtual ~aContainer();
+
+       virtual bool open();
+       virtual bool open(const QString &name);
+       virtual void create();
+       virtual void close();
+
+       virtual bool save();
+       virtual bool save(const QString& name);
+       virtual bool addFile(const QString& filename, const QString &newname, int type);
+       virtual QString realPath(const QString &fname) const;
+
+       virtual QString lastError() const;
+       void    setLastError(const QString& errorText);
+
+//signals:
+       //void  progress(int,int);
+
+protected:
+       void generateName4TmpDir();
+       bool createTmpDir();
+       bool extractManifest(const QString& archName, aCManifest *mf);
+       bool extractData(const QString& archName);
+       bool compressFile(const QString& fileName);
+       void cleanupTmpFiles();
+
+private:
+       QString txtError;
+       aCManifest *manifest;
+       QString tmpDirName;
+
+};
+
+#endif //ACONTAINER_H
diff --git a/src/lib/adataexchange.cpp b/src/lib/adataexchange.cpp
new file mode 100644 (file)
index 0000000..71c5d17
--- /dev/null
@@ -0,0 +1,631 @@
+/****************************************************************************
+** $Id: adataexchange.cpp,v 1.2 2008/11/08 20:16:35 leader Exp $
+**
+** Import/export function implementation file of
+** Ananas application
+**
+** Created : 20060209
+**
+** Copyright (C) 2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "alog.h"
+#include "adataexchange.h"
+#include "aservice.h"
+#include <qapplication.h>
+#include <qfile.h>
+#include <qdir.h>
+#include <q3process.h>
+#include <QTextStream>
+#include <stdio.h>
+#include <stdlib.h>
+
+//#define ERROR true
+
+aBackup::aBackup():QObject()
+{
+}
+
+
+aBackup::~aBackup()
+{
+}
+
+bool
+aBackup::importData(const QString& rcfile, const QString &archfile, bool dropBase, bool replaceTemplates)
+{
+
+
+       int prg=0;
+       int totalSteps=10;
+       QString tmpDirName;
+       QString filename = archfile;
+
+       QDir dir;
+        QString temp;
+       QStringList templatesName;
+
+#ifndef _Windows
+       temp = getenv("TMPDIR");
+       if(temp=="" || temp.isEmpty())
+               temp = P_tmpdir;
+#else
+       temp = getenv("TEMP");
+#endif
+       tmpDirName = QString(temp+"/%1").arg(QDateTime::currentDateTime().toTime_t());
+       tmpDirName = QDir::convertSeparators(tmpDirName);
+       //printf("tmp dir name = %s\n",tmpDirName.ascii());
+       if(!dir.mkdir(tmpDirName))
+       {
+               setLastError(tr("Can't create temporary directory"));
+               aLog::print(aLog::Error, "aBackup create temporary directory %1");
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aBackup create temporary directory %1").arg(tmpDirName));
+       }
+       if(unzipArchive(archfile, tmpDirName)==true)
+       {
+               cleanupTmpFiles(tmpDirName, &templatesName);
+
+               //printf("unzip error!\n");
+               aLog::print(aLog::Error, tr("aBackup import data: unzip"));
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aBackup unzip"));
+       }
+
+
+       QString srcDirName = QDir::convertSeparators(tmpDirName + "/templates/");
+       dir.setPath(srcDirName);
+       templatesName = dir.entryList("templ_*.odt;templ_*.ods");
+
+
+       qApp->processEvents();
+       emit(progress(++prg,totalSteps));
+
+       filename.truncate( filename.length() - QString(".bsa").length() );
+       aLog::print(aLog::Debug, tr("aBackup filename = %1").arg(filename));
+
+       //printf("filename = %s\n",filename.ascii());
+       changeRC(rcfile, tmpDirName + "/busines-schema.cfg");
+
+       QFile f(tmpDirName+"/content.xml");
+       QDomDocument xml;
+       xml.setContent(&f);
+//     printf("%s\n",xml.toString(4).ascii());
+       aDatabase db;
+       if(db.init(rcfile))
+       {
+               emit(progress(++prg,totalSteps));
+               if(!dropBase)
+               {
+                       db.done();
+                       cleanupTmpFiles(tmpDirName, &templatesName);
+                       return false;
+               }
+               db.drop(db.cfg.rc.value("dbname"));
+               emit(progress(++prg,totalSteps));
+               db.create();
+
+               emit(progress(++prg,totalSteps));
+
+               db.exchangeDataSystables ( xml, true);
+               emit(progress(++prg,totalSteps));
+               db.exchangeDataCatalogues( xml, true );
+               emit(progress(++prg,totalSteps));
+               db.exchangeDataDocuments ( xml, true );
+               emit(progress(++prg,totalSteps));
+               db.exchangeDataJournals ( xml, true );
+               db.exchangeDataInfoRegisters ( xml, true );
+               emit(progress(++prg,totalSteps));
+               db.exchangeDataAccumulationRegisters ( xml, true );
+               emit(progress(++prg,totalSteps));
+               db.exchangeDataUniques ( xml, true );
+       }
+       else
+       {
+               setLastError(tr("Can't connect to database"));
+               cleanupTmpFiles(tmpDirName, &templatesName);
+               return true;
+       }
+       qApp->processEvents();
+
+       QString destDirName = QDir::convertSeparators(db.cfg.rc.value("workdir"));
+
+       //create template directory
+       QDir destDir;
+//     destDir.setPath(destDirName);
+       if(!destDir.exists(destDirName))
+       {
+               aLog::print(aLog::Debug, tr("aBackup template dir `%1' not exists, try create").arg(destDirName));
+               if(!destDir.mkdir(destDirName,true))
+               {
+                       aLog::print(aLog::Error, tr("aBackup create template dir `%1' fail").arg(destDirName));
+               }
+               else
+               {
+                       aLog::print(aLog::Debug, tr("aBackup create template dir `%1'").arg(destDirName));
+               }
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aBackup template dir `%1' exists").arg(destDirName));
+       }
+
+       for(uint i=0; i<templatesName.count(); i++)
+       {
+       //      aTests::print2log("f:\\ERROR.log", "aBackup", tmpDirName + "/templates/"+templatesName[i]);
+               aService::copyFile(QDir::convertSeparators(srcDirName+templatesName[i]), QDir::convertSeparators(destDirName +"/"+templatesName[i]), replaceTemplates);
+       }
+
+       db.done();
+
+//     printf("copy %s to %s\n", QDir::convertSeparators(tmpDirName+"/busines-schema.cfg").ascii(), QDir::convertSeparators(filename+".cfg").ascii());
+       if(!aService::copyFile( QDir::convertSeparators(tmpDirName+"/busines-schema.cfg"), QDir::convertSeparators(filename+".cfg"), true))
+       {
+               setLastError(tr("Can't copy .cfg file"));
+               aLog::print(aLog::Error, tr("aBackup copy unzipped business schema file"));
+               cleanupTmpFiles(tmpDirName, &templatesName);
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aBackup copy business schema file"));
+       }
+       emit(progress(++prg,totalSteps));
+//     printf("filename =%s\n",filename.ascii());
+       changeRC(rcfile, filename+".cfg");
+       cleanupTmpFiles(tmpDirName, &templatesName);
+       setLastError(tr("Database import without errors"));
+       aLog::print(aLog::Info, tr("aBackup import data ok"));
+       return false;
+}
+
+
+
+bool
+aBackup::exportData(const QString& rcfile, const QString &archfile, bool withTemplates )
+{
+       QDir dir;
+       int prg=0;
+       int totalSteps=10;
+        QString temp;
+       QString tmpDirName;
+       QString srcDirName;
+       QStringList templatesName;
+
+#ifndef _Windows
+       temp = getenv("TMPDIR");
+       if(temp=="" || temp.isEmpty())
+               temp = P_tmpdir;
+#else
+       temp = getenv("TEMP");
+#endif
+       tmpDirName = QString(temp+"/%1").arg(QDateTime::currentDateTime().toTime_t());
+       tmpDirName = QDir::convertSeparators(tmpDirName);
+       //printf("copy name = %s\n",tmpDirName.ascii());
+       if(!dir.mkdir(tmpDirName))
+       {
+               setLastError(tr("Can't create directory %s").arg(tmpDirName));
+               aLog::print(aLog::Error, tr("aBackup create temporary directory"));
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aBackup create temporary directory %1").arg(tmpDirName));
+
+       }
+       if(!dir.mkdir(tmpDirName+"/META-INF"))
+       {
+               setLastError(tr("Can't create directory %s").arg(tmpDirName+"/META-INF"));
+               aLog::print(aLog::Error, tr("aBackup create temporary directory"));
+               cleanupTmpFiles(tmpDirName, &templatesName);
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aBackup create temporary directory %1").arg(tmpDirName+"/META-INF"));
+       }
+       aCfg cfg;
+       // create copy of metadata
+       if(cfg.readrc( rcfile ))
+       {
+               setLastError(tr("Invalid resource file"));
+               aLog::print(aLog::Error, tr("aBackup invalid *.rc file"));
+               cleanupTmpFiles(tmpDirName, &templatesName);
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aBackup valid *.rc file"));
+       }
+       qApp->processEvents();
+
+       if(withTemplates)
+       {
+               srcDirName = QDir::convertSeparators(cfg.rc.value("workdir"));
+               aLog::print(aLog::Debug, tr("aBackup workdir=%1").arg(srcDirName));
+               dir.setPath(srcDirName);
+               templatesName = dir.entryList("templ_*.odt;templ_*.ods");
+               for(uint i=0; i<templatesName.count(); i++)
+               {
+                       //ayTests::print2log("f:\\ERROR.log", "aBackup", tmpDirName + "/templates/"+templatesName[i]);
+                       aLog::print(aLog::Debug, tr("aBackup template %1 %2").arg(i).arg(tmpDirName + "/templates/"+templatesName[i]));
+//                     file.remove();
+               }
+       }
+
+
+       emit(progress(++prg,totalSteps));
+       if(cfg.write( tmpDirName+"/busines-schema.cfg" ))
+       {
+               setLastError(tr("Can't write resource file"));
+               aLog::print(aLog::Error, tr("aBackup write %1 file").arg(tmpDirName+"/busines-schema.cfg"));
+               cleanupTmpFiles(tmpDirName, &templatesName);
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aBackup write %1 file").arg(tmpDirName+"/busines-schema.cfg"));
+
+       }
+       qApp->processEvents();
+       emit(progress(++prg,totalSteps));
+       // create dump
+       if(dumpBase(rcfile,tmpDirName, prg, totalSteps )==true)
+       {
+               cleanupTmpFiles(tmpDirName, &templatesName);
+               aLog::print(aLog::Error, tr("aBackup dump base error"));
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aBackup bump base"));
+       }
+
+       if(writeXml(QDir::convertSeparators(tmpDirName+"/META-INF/manifest.xml"), createManifest(templatesName))==true)
+       {
+               setLastError(tr("Can't write file META-INF/manifest.xml"));
+               aLog::print(aLog::Error, tr("aBackup write manifest.xml"));
+               cleanupTmpFiles(tmpDirName, &templatesName);
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aBackup write manifest.xml"));
+       }
+//     printf("%s\n",(createManifest(templatesName)).toString().ascii());
+       if(withTemplates)
+       {
+               QString destNamePref = tmpDirName + "/templates";
+               dir.mkdir(destNamePref);
+               bool res = false;
+               for(uint i=0; i<templatesName.count(); i++)
+               {
+//                             printf("copy %s to %s\n", QString(srcDirName+"/"+templatesName[i]).ascii(), QString(destNamePref+"/"+templatesName[i]).ascii());
+                       if(!aService::copyFile(QDir::convertSeparators(srcDirName+"/"+templatesName[i]), QDir::convertSeparators(destNamePref+"/"+templatesName[i]), true))
+                       {
+                               setLastError(tr("Can't copy template file"));
+                               res&=true;
+                       }
+
+               }
+       }
+
+       if(zipArchive(archfile + ".bsa", tmpDirName)==true)
+       {
+//             setLastError(tr("Can't zip archive"));
+               cleanupTmpFiles(tmpDirName, &templatesName);
+               aLog::print(aLog::Error, tr("aBackup zip archive"));
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aBackup zip archive"));
+       }
+       // remove files and directories
+       cleanupTmpFiles(tmpDirName, &templatesName);
+       emit (progress(++prg,totalSteps));
+       setLastError(tr("Data export done without errors"));
+       aLog::print(aLog::Debug, tr("aBackup export data ok"));
+
+       return false;
+}
+
+bool
+aBackup::unzipArchive(const QString& archName, const QString& dir)
+{
+#ifndef _Windows
+       Q3Process process( QString("unzip") );
+//     process.setWorkingDirectory (dir);
+       process.addArgument( archName );
+       process.addArgument( "-d" );
+       process.addArgument( dir );
+
+#else
+       Q3Process process( QString("7z") );
+//     process.setWorkingDirectory ( templateDir);
+//     printf("working dir = `%s'\n", QString(templateDir).ascii());
+       process.addArgument( "x" );
+       process.addArgument( "-y" );
+       process.addArgument( QString("-o%1").arg(dir) );
+       process.addArgument( archName );
+
+#endif
+
+//     printf("unzip to %s file `%s'\n",copyName.ascii(),fname.ascii());
+       if( !process.start() )
+       {
+               //qWarning("FormTemplate::unzip(): failed to start unzip");
+               setLastError(tr("Can't start zip"));
+               aLog::print(aLog::Error, tr("aBackup start unzip"));
+
+               return true;
+       }
+
+       while( process.isRunning() );
+
+       if( !process.normalExit() )
+       {
+       //      qWarning("FormTemplate::unzip(): error extracting document content");
+               setLastError(tr("Zip ended anormal"));
+               aLog::print(aLog::Error, tr("aBackup unzip dead"));
+               return true;
+       }
+       else
+       {
+               //printf("process end normal\n");
+               aLog::print(aLog::Debug, tr("aBackup unzip normal"));
+       }
+       if( process.exitStatus() )
+       {
+               //qWarning("FormTemplate::unzip(): document content extracting ended with code " + QString::number(process.exitStatus()) );
+               setLastError(tr("Zip ended with code %1").arg(process.exitStatus()));
+               return true;
+       }
+       return false;
+}
+
+bool
+aBackup::zipArchive(const QString& archName, const QString& dir)
+{
+
+
+#ifndef _Windows
+
+       Q3Process processUpdate( QString("zip") );
+       processUpdate.setWorkingDirectory(dir);
+       processUpdate.addArgument( "-r" ); // recurce into subdirectories
+       processUpdate.addArgument( "-0" ); // store only
+       processUpdate.addArgument( archName ); // backup name
+       processUpdate.addArgument(".");
+#else
+       Q3Process processUpdate( QString("7z") );
+       processUpdate.setWorkingDirectory(dir);
+       processUpdate.addArgument( "a" );
+       processUpdate.addArgument( "-tzip" );
+       processUpdate.addArgument( archName );
+       processUpdate.addArgument( "-r" );
+       processUpdate.addArgument(".");
+#endif
+
+       if( !processUpdate.start() )
+       {
+               setLastError(tr("Unable to start zip"));
+               aLog::print(aLog::Error, tr("aBackup zip start error"));
+               return true;
+       }
+
+       while( processUpdate.isRunning() );
+
+       if( !processUpdate.normalExit() )
+       {
+               setLastError(tr("Zip ended with error"));
+               aLog::print(aLog::Error, tr("aBackup zip dead"));
+               return true;
+       }
+
+       if( processUpdate.exitStatus() )
+       {
+               setLastError(tr("Zip ended with code %1").arg(processUpdate.exitStatus()));
+               return true;
+       }
+
+       return false;
+}
+
+
+bool
+aBackup::dumpBase(const QString& rcfile, const QString& tmpDirName, int& prg, int totalSteps)
+{
+       QDomDocument xml;
+       xml.setContent(QString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
+       QDomElement root = xml.createElement( "AnanasDump" );
+       xml.appendChild( root );
+       aDatabase db;
+       if(db.init(rcfile))
+       {
+               emit (progress(++prg,totalSteps));
+               db.exchangeDataSystables ( xml, false );
+               emit (progress(++prg,totalSteps));
+               db.exchangeDataCatalogues( xml, false );
+               emit (progress(++prg,totalSteps));
+               db.exchangeDataDocuments ( xml, false );
+               emit (progress(++prg,totalSteps));
+               db.exchangeDataJournals ( xml, false );
+               emit (progress(++prg,totalSteps));
+               db.exchangeDataInfoRegisters ( xml, false );
+               emit (progress(++prg,totalSteps));
+               db.exchangeDataAccumulationRegisters ( xml, false );
+
+               db.exchangeDataUniques ( xml, true );
+
+               aLog::print(aLog::Debug, tr("aBackup dump tables ok"));
+       }
+       else
+       {
+               setLastError(tr("Can't connect to database"));
+               aLog::print(aLog::Error, tr("aBackup init rc file  %1").arg(rcfile));
+               db.done();
+               return true;
+       }
+       qApp->processEvents();
+       emit (progress(++prg,totalSteps));
+       db.done();
+       if(writeXml(tmpDirName+"/content.xml",xml)==true)
+       {
+               setLastError(tr("Can't write content.xml"));
+               aLog::print(aLog::Error, tr("aBackup write content.xml"));
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Info, tr("aBackup dump base to xml compleet"));
+       }
+       return false;
+}
+
+bool
+aBackup::writeXml(const QString & name2Save, QDomDocument xml)
+{
+       QFile file(name2Save);
+       QByteArray buf( xml.toString(4).utf8() );
+       if ( file.open( QIODevice::WriteOnly ) )
+       {
+               QTextStream ts( &file );
+               //--ts.setEncoding(Q3TextStream::UnicodeUTF8);
+               xml.save(ts, 4);
+               file.close();
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aBackup save xml %1").arg(name2Save));
+               return true;
+       }
+       return false;
+}
+
+bool
+aBackup::checkStructure()
+{
+       return false;
+}
+
+QDomDocument
+aBackup::createManifest(const QStringList& templates)
+{
+       QDomDocument manifest;
+       manifest.setContent(QString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
+
+       QDomElement root = manifest.createElement("manifest:manifest");
+       manifest.appendChild(root);
+
+       QDomElement entry = manifest.createElement("manifest:file-entry");
+       entry.setAttribute("manifest:full-path","business-schema.cfg");
+       root.appendChild(entry);
+
+       entry = manifest.createElement("manifest:file-entry");
+       entry.setAttribute("manifest:full-path","content.xml");
+       root.appendChild(entry);
+       if(templates.count()>0)
+       {
+               QDomElement templatesDir = manifest.createElement("manifest:file-entry");
+               templatesDir.setAttribute("manifest:full-path","templates/");
+
+               for(uint i=0; i<templates.count();i++)
+               {
+                       entry = manifest.createElement("manifest:file-entry");
+                       entry.setAttribute("manifest:full-path",QString("%1%2").arg("templates/").arg(templates[i]));
+                       templatesDir.appendChild(entry);
+               }
+               root.appendChild(templatesDir);
+       }
+
+       aLog::print(aLog::Debug, tr("aBackup create manifest.xml"));
+       return manifest;
+}
+
+
+void
+aBackup::changeRC(const QString& nameRC, const QString& newConfigName)
+{
+       QMap<QString,QString> cfg;
+//     QString configFileName;
+
+       cfg = aTests::readConfig(QDir::convertSeparators(nameRC));
+
+//     configFileName = cfg["configfile"];
+//     configFileName.truncate( configFileName.length() - QString(".bsa").length() );
+//     cfg["configfile"] = configFileName + ".cfg";
+
+       cfg["configfile"] = newConfigName;
+
+       aTests::writeConfig(QDir::convertSeparators(nameRC), cfg);
+}
+
+
+void
+aBackup::setLastError(const QString& errorText)
+{
+       txtError = errorText;
+}
+
+
+QString
+aBackup::lastError() const
+{
+       return txtError;
+}
+
+void
+aBackup::cleanupTmpFiles(const QString& tmpDirName, QStringList *files)
+{
+       QFile file;
+       QDir dir;
+       file.setName(QDir::convertSeparators(tmpDirName+"/content.xml"));
+       aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
+       file.remove();
+       file.setName(QDir::convertSeparators(tmpDirName+"/busines-schema.cfg"));
+       aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
+       file.remove();
+       file.setName(QDir::convertSeparators(tmpDirName+"/META-INF/manifest.xml"));
+       aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
+       file.remove();
+       for(uint i=0; i<files->count(); i++)
+       {
+                       file.setName(QDir::convertSeparators(tmpDirName + "/templates/"+ (*files)[i]));
+                       aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
+                       file.remove();
+       }
+       aLog::print(aLog::Debug, tr("aBackup delete directory %1").arg(tmpDirName + "/META-INF"));
+       dir.rmdir(QDir::convertSeparators(tmpDirName + "/META-INF"));
+       aLog::print(aLog::Debug, tr("aBackup delete directory %1").arg(tmpDirName + "/templates"));
+       dir.rmdir(QDir::convertSeparators(tmpDirName + "/templates"));
+       aLog::print(aLog::Debug, tr("aBackup delete directory %1").arg(tmpDirName));
+       dir.rmdir(QDir::convertSeparators(tmpDirName));
+       aLog::print(aLog::Info, tr("aBackup cleanup temporary files"));
+
+}
+
diff --git a/src/lib/adataexchange.h b/src/lib/adataexchange.h
new file mode 100644 (file)
index 0000000..b832704
--- /dev/null
@@ -0,0 +1,84 @@
+/****************************************************************************
+** $Id: adataexchange.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Import/export data function header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2006 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ADATEXCHANGE_H
+#define ADATEXCHANGE_H
+
+#include "qdom.h"
+#include "qstringlist.h"
+#include "ananas.h"
+#include <qobject.h>
+
+
+class aDatabase;
+
+/**
+ * \en
+ *     Class for work make backup and restore databases
+ * \_en
+ * \ru
+ * \brief      Класс aBackup определяет программный интерфейс для бэкапа и востановления базы данных.
+ *     Наследует QObject.
+ *
+ * \_ru
+ */
+class ANANAS_EXPORT aBackup: public QObject
+{
+    Q_OBJECT
+public:
+
+       aBackup();
+       virtual ~aBackup();
+
+       virtual bool importData(const QString& rcfile, const QString &archfile, bool dropDB, bool replaceTemplates=0);
+       virtual bool exportData(const QString& rcfile, const QString &archfile, bool withTemplates=0 );
+       virtual QString lastError() const;
+
+signals:
+       void    progress(int,int);
+
+protected:
+       virtual void            setLastError(const QString & errorText);
+       virtual bool            unzipArchive(const QString& archName, const QString& tmpDirName);
+       virtual bool            zipArchive(const QString& archName, const QString& tmpDirName);
+       virtual bool            checkStructure();
+       virtual QDomDocument    createManifest(const QStringList& templates);
+       virtual void            changeRC(const QString& nameRC, const QString& newConfigName);
+       virtual bool            dumpBase(const QString& rcfile, const QString& tmpDirName, int &progress, int totalSteps);
+       virtual bool            writeXml(const QString & fileName, QDomDocument xml);
+       void                    cleanupTmpFiles(const QString& tmpDirName, QStringList *files);
+
+private:
+       QString txtError;
+//     QString tmpDirName;
+
+};
+
+#endif //ADATEXCHANGE_H
diff --git a/src/lib/adatafield.cpp b/src/lib/adatafield.cpp
new file mode 100644 (file)
index 0000000..de9e744
--- /dev/null
@@ -0,0 +1,213 @@
+/****************************************************************************
+** $Id: adatafield.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Code file of the Ananas database field of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+//#include <qobject.h>
+//#include "acfg.h"
+#include "adatafield.h"
+
+/*!
+Create Ananas database field contaner.
+*/
+/*
+aDataField::aDataField(aCfg *newmd, aCfgItem newcontext )
+:QObject( 0, "aField" ) // name )
+{
+       md = newmd;
+       context = newcontext;
+//     fType = type;
+       fTName = "";
+//     field = new QSqlField( fTName );
+       fSys = false;
+}
+*/
+
+/*!
+ * Create Ananas field contaner.
+ */
+aDataField::aDataField( QObject *parent, const QString &name, const QString &type )
+:QObject( parent, "aField" )
+{
+       init( name, type );
+}
+
+
+/*!
+ * Create Ananas field contaner.
+ */
+aDataField::aDataField(const QString &name, const QString &type )
+:QObject( 0, "aField" )
+{
+       init( name, type );
+}
+
+
+aDataField::aDataField( const aDataField &field )
+:QObject( 0, "aField" )
+{
+       init( field.fieldName(), field.fType );
+}
+
+/*!
+ * Destroy object.
+ */
+
+aDataField::~aDataField()
+{
+//     delete field;
+}
+
+aDataField&
+aDataField::operator=( const aDataField& other )
+{
+       Type = other.Type;
+       context = other.context;
+       id = other.id;;
+       md = other.md;
+       fSys = other.fSys;
+       Width = other.Width;
+       Dec = other.Dec;
+       Name = other.Name;
+       fType = other.fType;
+       aType = other.aType;
+       fieldData = other.fieldData;
+       return *this;
+}
+
+bool
+aDataField::operator==( const aDataField& other ) const
+{
+       return (
+       fSys == other.fSys &&
+       Name == other.Name &&
+       fType == other.fType &&
+       id == other.id &&
+       context == other.context
+       );
+}
+
+
+bool
+aDataField::operator!=( const aDataField& other ) const
+{
+       return !( other == *this );
+}
+
+void
+aDataField::init( const QString &name, const QString &type )
+{
+       QString t;
+
+       fSys = true;
+       Name = name;
+       fType = type;
+       Type = QVariant::Invalid;
+       if ( !type.isNull() ) {
+               aType = ( (const char *) type.section(" ",0,0).upper() )[0];
+               Width = type.section(" ",1,1).toInt();
+               Dec = type.section(" ",2,2).toInt();
+               switch ( aType ){
+               case 'C':
+                       Type = QVariant::String;
+                       fieldData = QString("");
+                       break;
+               case 'N':
+                       Type = QVariant::Double;
+                       fieldData = ( double ) 0.0;
+               default:
+                       Type = QVariant::Invalid;
+               }
+       }
+}
+
+/*!
+Return pointer to asociated sql field.
+*/
+//QSqlField *
+//aField::sqlField(){
+//     return field;
+//}
+
+
+/*!
+ *
+ */
+QVariant
+aDataField::internalValue()
+{
+       return fieldData;
+}
+
+
+/*!
+ *
+ */
+void
+aDataField::setInternalValue( const QVariant &value)
+{
+       fieldData = value;
+}
+
+
+
+/*!
+ * Возвращает значение поля данных.
+ */
+QVariant
+aDataField::value()
+{
+       return fieldData;
+}
+
+
+/*!
+ * Устанавливает значение поля данных.
+ */
+void
+aDataField::setValue( const QVariant &value)
+{
+       fieldData = value;
+}
+
+
+
+/*!
+ *
+ */
+int
+aDataField::ObjectType()
+{
+       return oType;
+}
+
+
+QString
+aDataField::fieldName() const
+{
+       return Name;
+}
diff --git a/src/lib/adatafield.h b/src/lib/adatafield.h
new file mode 100644 (file)
index 0000000..c6b6d23
--- /dev/null
@@ -0,0 +1,106 @@
+/****************************************************************************
+** $Id: adatafield.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Header file of the Ananas data field of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ADATAFIELD_H
+#define ADATAFIELD_H
+//#include <qsqlfield.h>
+
+#include <qobject.h>
+#include <qvariant.h>
+#include "ananasglobal.h"
+#include "acfg.h"
+
+
+//class aCfg;
+//class aCfgItem;
+//class QObject;
+//#define
+
+/*!
+ * \en
+ *     aDataField object unite all ananas types for access them from
+ *     Ananas Script.
+ *     Object translate calls from script to special type object
+ *     with check correct call functions and parameters.
+ * \_en
+ * \ru
+ *     \brief Класс определяет программный интерфейс для доступа к полям бизнес объектов Ананаса.
+ *     Наследует QObject.
+ *
+ *     Позволяет получить и задать значение поля любого типа. Предназначен для использования из Ананас-скрипта.
+ * \_ru
+ */
+
+class  ANANAS_EXPORT aDataField : public QObject
+{
+       Q_OBJECT
+//     Q_PROPERTY( Priority priority READ priority WRITE setPriority )
+//     Q_ENUMS( Priority )
+//     Q_CLASSINFO( "Author", "Oscar Peterson")
+public:
+//     enum fieldType ( Unknown, Numberic, Character, Date, Object );
+       aCfgItem context;
+       long id;
+       aCfg *md;
+       bool fSys;
+       int Width, Dec;
+       QString Name, fType;
+       char aType;
+       QVariant::Type Type;
+//     QVariant field;
+       int oType;
+
+
+//     aField( aCfg *newmd, aCfgItem newcontext );
+       aDataField( QObject *parent, const QString &fname = QString::null, const QString &ftype = QString::null );
+       aDataField( const QString &fname = QString::null, const QString &ftype = QString::null );
+       aDataField( const aDataField &field );
+       ~aDataField();
+
+       aDataField& operator=( const aDataField& other );
+       bool operator==( const aDataField& other ) const;
+       bool operator!=( const aDataField& other ) const;
+//     aDataField& operator[]( const int& i ){};
+
+//     QSqlField *sqlField();
+       virtual QVariant internalValue();
+       virtual void setInternalValue( const QVariant &value);
+public slots:
+       virtual QString fieldName() const;
+       virtual int ObjectType();
+       virtual QVariant value();
+       virtual void setValue( const QVariant &value);
+private:
+       QVariant fieldData;
+
+       void init( const QString &fname = QString::null, const QString &ftype = QString::null );
+};
+
+
+#endif
diff --git a/src/lib/aextension.cpp b/src/lib/aextension.cpp
new file mode 100644 (file)
index 0000000..2bf1234
--- /dev/null
@@ -0,0 +1,50 @@
+/****************************************************************************
+** $Id: aextension.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Extension object implementation file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2006 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2006 Valery Grazdankin, Orenburg.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "aextension.h"
+
+AExtension::AExtension( const char *name )
+    : QObject( 0, name )
+{
+    if (name==0) setName( className() );
+}
+
+
+
+AExtension::~AExtension()
+{
+}
+
+
+int AExtension::init(aDatabase* dbo){
+       db = dbo;
+       return 0;
+}
diff --git a/src/lib/aextension.h b/src/lib/aextension.h
new file mode 100644 (file)
index 0000000..70a05b6
--- /dev/null
@@ -0,0 +1,61 @@
+/****************************************************************************
+** $Id: aextension.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Extension object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AEXTENSION_H
+#define AEXTENSION_H
+
+#include "ananasglobal.h"
+#include "adatabase.h"
+#include <qobject.h>
+
+/**
+ * \en
+ * Class for work with extensions
+ * \_en
+ * \ru
+ * \_ru
+ */
+class  ANANAS_EXPORT AExtension : public QObject
+{
+    Q_OBJECT
+
+public:
+    aDatabase* db;
+
+    AExtension( const char *name = 0 );
+    ~AExtension();
+    int init(aDatabase* dbo);
+
+signals:
+    void event( const QString &data );
+
+};
+
+#endif //AEXTENSION_H
diff --git a/src/lib/aextensionfactory.cpp b/src/lib/aextensionfactory.cpp
new file mode 100644 (file)
index 0000000..e19b803
--- /dev/null
@@ -0,0 +1,136 @@
+/****************************************************************************
+** $Id: aextensionfactory.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** ...
+**
+** Created : 20060209
+**
+** Copyright (C) 2003-2006 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "aextensionfactory.h"
+#include <aextension.h>
+#include <aextensionplugin.h>
+#include <qapplication.h>
+#include <qobject.h>
+#include <QHash>
+#include <QStringList>
+#include <QDir>
+#include <QPluginLoader>
+
+class AExtensionFactoryPrivate : public QObject
+{
+public:
+    AExtensionFactoryPrivate();
+    ~AExtensionFactoryPrivate();
+
+    QHash<QString, AExtensionInterface *> hash;
+    QStringList extensionKeys;
+};
+
+static AExtensionFactoryPrivate *instance = 0;
+
+AExtensionFactoryPrivate::AExtensionFactoryPrivate()
+: QObject( qApp )
+{
+    QString extensionsDirName;
+    AExtensionInterface *iface = 0;
+    QObject *plugin = 0;
+    QPluginLoader pluginLoader;
+
+#ifdef Q_OS_WIN32
+    extensionsDirName = qApp->applicationDirPath()+"/extensions";
+#else
+    extensionsDirName = "/usr/share/ananas4/extensions";
+#endif
+
+    hash.clear();
+    extensionKeys.clear();
+    QDir extensionsDirectory( extensionsDirName );
+    QStringList extensionFiles = extensionsDirectory.entryList( QDir::Files );
+    QString fileName = extensionFiles.first();
+    for (int i=0; i<extensionFiles.count(); i++){
+      fileName = extensionFiles[i];
+      pluginLoader.setFileName( extensionsDirectory.absoluteFilePath( fileName ) );
+      plugin = pluginLoader.instance();
+      if (plugin) {
+            iface = qobject_cast<AExtensionInterface *>(plugin);
+            if( iface ) {
+                extensionKeys.append( iface->key());
+                hash[ iface->key()] = iface;
+            }
+      }
+    }
+}
+
+AExtensionFactoryPrivate::~AExtensionFactoryPrivate()
+{
+//    delete instance;
+//    instance = 0;
+}
+
+/*!
+    Creates a AExtension object that matches \a key. This is either a
+    built-in extensions, or a extension from a extension plugin.
+
+    \sa keys()
+*/
+AExtension *AExtensionFactory::create( const QString& key )
+{
+    AExtension *ret = 0;
+    AExtensionInterface *iface = 0;
+//    QString extension = key;
+
+    if ( !instance ) instance = new AExtensionFactoryPrivate();
+    if ( instance->hash.contains( key ) ){
+        iface = instance->hash.value( key );
+        if ( iface ) ret = iface->create(); 
+    }
+    if (ret) ret->setName(key);
+    return ret;
+}
+
+
+
+QMetaObject *AExtensionFactory::metaObject( const QString &key )
+{
+    QMetaObject *ret = 0;
+    AExtensionInterface *iface = 0;
+
+    if ( !instance ) instance = new AExtensionFactoryPrivate();
+    if ( instance->hash.contains( key ) ){
+        iface = instance->hash.value( key );
+        if ( iface ) ret = iface->metaObject(); 
+    }
+    return ret;
+};
+
+/*!
+    Returns the list of keys this factory can create styles for.
+
+    \sa create()
+*/
+QStringList AExtensionFactory::keys()
+{
+    if ( !instance ) instance = new AExtensionFactoryPrivate();
+    return instance->extensionKeys;
+}
+
diff --git a/src/lib/aextensionfactory.h b/src/lib/aextensionfactory.h
new file mode 100644 (file)
index 0000000..1c742bd
--- /dev/null
@@ -0,0 +1,64 @@
+/****************************************************************************
+** $Id: aextensionfactory.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** ...
+**
+** Created : 20060209
+**
+** Copyright (C) 2003-2006 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AEXTENSIONFACTORY_H
+#define AEXTENSIONFACTORY_H
+
+#include "QString"
+#include "QStringList"
+#include "aextension.h"
+
+/*!
+ * \en
+ *   \brief The AExtensionFactory class creates AExtension objects.
+ *
+ *   The style factory creates a AExtension object for a given key with
+ *   AExtensionFactory::create(key).
+ *
+ *   The styles are either built-in or dynamically loaded from a style
+ *   plugin (see \l AExtensionPlugin).
+ *
+ *   AExtensionFactory::keys() returns a list of valid keys, typically
+ *   including "XXXX".
+ * \_en
+ * \ru
+ *     \brief Опеределяет интерфейс для создания объектов класса AExtension
+ *
+ *
+ * \_ru
+ */
+
+class AExtensionFactory
+{
+public:
+    static QStringList keys();
+    static AExtension *create( const QString &key );
+    static QMetaObject *metaObject( const QString &key );
+};
+
+#endif //AEXTENSIONFACTORY_H
diff --git a/src/lib/aextensioninterface_p.h b/src/lib/aextensioninterface_p.h
new file mode 100644 (file)
index 0000000..1842fe0
--- /dev/null
@@ -0,0 +1,52 @@
+/****************************************************************************
+** $Id: aextensioninterface_p.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Definition of AExtensionInterface class
+**
+** Created : 20060209
+**
+** Copyright (C) 2003-2006 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AEXTENSIONINTERFACE_H
+#define AEXTENSIONINTERFACE_H
+
+#include <ananasglobal.h>
+#ifndef QT_H
+#include <private/qcom_p.h>
+#endif // QT_H
+
+#ifndef QT_NO_COMPONENT
+
+// {EDDD5AD8-DF3C-400c-A711-163B72FE5F61}
+#ifndef IID_AExtensionFactory
+#define IID_AExtensionFactory QUuid(0xeddd5ad8, 0xdf3c, 0x400c, 0xa7, 0x11, 0x16, 0x3b, 0x72, 0xfe, 0x5f, 0x61)
+#endif
+
+class AExtension;
+
+struct ANANAS_EXPORT AExtensionFactoryInterface : public QFeatureListInterface
+{
+    virtual AExtension* create( const QString& name ) = 0;
+};
+
+#endif //QT_NO_COMPONENT
+#endif // AEXTENSIONINTERFACE_P_H
diff --git a/src/lib/aextensionplugin.cpp b/src/lib/aextensionplugin.cpp
new file mode 100644 (file)
index 0000000..f204511
--- /dev/null
@@ -0,0 +1,126 @@
+/****************************************************************************
+** $Id: aextensionplugin.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Extension plugin class implementation file of
+**
+** Created : 20060209
+**
+** Copyright (C) 2003-2006 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "aextensionplugin.h"
+
+//#ifndef QT_NO_COMPONENT
+
+//#include "aextensioninterface_p.h"
+
+/*!
+    \fn QStringList AExtensionPlugin::keys() const
+
+    Returns the list of extensions (keys) this plugin supports.
+
+    These keys are usually the class names of the custom extension that
+    are implemented in the plugin.
+
+    \sa create()
+*/
+
+/*!
+    \fn AExtension* AExtensionPlugin::create( const QString& key )
+
+    Creates and returns a AExtension object for the driver key \a key.
+    The driver key is usually the class name of the required driver.
+
+    \sa keys()
+*/
+/*
+class AExtensionPluginPrivate : public AExtensionFactoryInterface
+{
+public:
+    AExtensionPluginPrivate( AExtensionPluginBase *p )
+       : plugin( p )
+    {
+    }
+    virtual ~AExtensionPluginPrivate();
+
+    QRESULT queryInterface( const QUuid &iid, QUnknownInterface **iface );
+    Q_REFCOUNT;
+
+    QStringList featureList() const;
+    AExtension *create( const QString &key );
+
+private:
+    AExtensionPluginBase *plugin;
+};
+
+AExtensionPluginPrivate::~AExtensionPluginPrivate()
+{
+    delete plugin;
+}
+
+QRESULT AExtensionPluginPrivate::queryInterface( const QUuid &iid, QUnknownInterface **iface )
+{
+    *iface = 0;
+
+    if ( iid == IID_QUnknown )
+       *iface = this;
+    else if ( iid == IID_QFeatureList )
+       *iface = this;
+    else if ( iid == IID_AExtensionFactory )
+       *iface = this;
+    else
+       return QE_NOINTERFACE;
+
+    (*iface)->addRef();
+    return QS_OK;
+}
+
+QStringList AExtensionPluginPrivate::featureList() const
+{
+    return plugin->keys();
+}
+
+AExtension *AExtensionPluginPrivate::create( const QString &key )
+{
+    return plugin->create( key );
+}
+*/
+/*!
+    Constructs a Ananas extension plugin. This is invoked automatically by
+    the \c Q_EXPORT_PLUGIN macro.
+*/
+
+AExtensionPluginBase::AExtensionPluginBase()
+    :QObject()// QGPlugin( d = new AExtensionPluginPrivate( this ) )
+{
+}
+
+/*!
+    Destroys the Ananas extension plugin.
+
+    You never have to call this explicitly. Qt destroys a plugin
+    automatically when it is no longer used.
+*/
+AExtensionPluginBase::~AExtensionPluginBase()
+{
+    // don't delete d, as this is deleted by d
+}
+
diff --git a/src/lib/aextensionplugin.h b/src/lib/aextensionplugin.h
new file mode 100644 (file)
index 0000000..a7dcd04
--- /dev/null
@@ -0,0 +1,139 @@
+/****************************************************************************
+** $Id: aextensionplugin.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Extension plugin object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AEXTENSIONPLUGIN_H
+#define AEXTENSIONPLUGIN_H
+
+#include <QtPlugin>
+//#ifndef QT_H
+//#include "qgplugin.h"
+//#include "qstringlist.h"
+//#endif // QT_H
+
+#include "ananasglobal.h"
+#include <QObject>
+#include <QMetaObject>
+
+class AExtension;
+//class AExtensionPluginPrivate;
+
+//#define A_EXPORT_PLUGIN(pluginobjectname) typedef AExtensionPlugin<pluginobjectname> pluginobjectname##Plugin; Q_EXPORT_PLUGIN(pluginobjectname)
+#define A_EXPORT_PLUGIN(pluginobjectname) Q_EXPORT_PLUGIN2(pluginobjectname,pluginobjectname)
+
+class  AExtensionInterface
+{
+public:
+    virtual ~AExtensionInterface(){};
+    virtual QString key() const = 0;
+    virtual AExtension *create() = 0;
+    virtual QMetaObject *metaObject() = 0;
+};
+
+Q_DECLARE_INTERFACE(AExtensionInterface,"Ananas.Extensions.AExtensionInterface/1.0")
+
+
+/*!
+ * \en
+ *     \brief Class for work with extensions
+ * \_en
+ * \ru
+ *     \brief Базовый класс в иерархии классов для работы с расширениями. Наследует QGPlugin.
+ * \_ru
+ */
+class  ANANAS_EXPORT AExtensionPluginBase : public QObject, public AExtensionInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(AExtensionInterface)
+public:
+
+    AExtensionPluginBase();
+    ~AExtensionPluginBase();
+    virtual QString key() const = 0;
+    virtual AExtension *create() = 0;
+    virtual QMetaObject *metaObject() = 0;
+
+//private:
+//    AExtensionPluginPrivate *d;
+};
+
+/*!
+ * \en
+ *   \brief The AExtensionPlugin class provides an abstract base for custom AExtension plugins.
+ *
+ *   \ingroup plugins
+ *   \mainclass
+ *
+ *   The Ananas Extension plugin is a simple plugin interface that makes it
+ *   easy to create your own Ananas extension plugins that can be loaded
+ *   dynamically by Ananas and Qt.
+ *
+ *   Writing a Ananas extension plugin is achieved by subclassing this base class,
+ *   reimplementing the pure virtual functions keys() and create(), and
+ *   exporting the class with the \c Q_EXPORT_PLUGIN macro. See the 
+ *   Ananas extensions plugins that come with Ananas for example 
+ *   implementations (in the
+ *   \c{extensions} subdirectory of the source
+ *   distribution). Read the \link plugins-howto.html plugins
+ *   documentation\endlink for more information on plugins.
+ * \_en
+ * \ru
+ *     \brief Базовый класс для создания собственных расширений. Наследует AExtensionPluginBase
+ * \_ru
+ */
+template<class type>
+class  ANANAS_EXPORT AExtensionPlugin : public AExtensionPluginBase
+{
+//    Q_OBJECT
+public:
+
+    AExtensionPlugin()
+    { 
+       type o;
+       extName = o.name();
+    };
+    ~AExtensionPlugin(){};
+    QString key() const 
+    {
+       return extName;
+    };
+    AExtension *create() 
+    {
+        return new type();
+    };
+    QMetaObject *metaObject()
+    {
+       return (QMetaObject *) &type::staticMetaObject;
+    };
+
+private:
+    QString extName;
+};
+
+#endif //AEXTENSIONPLUGIN_H
diff --git a/src/lib/afilter.cpp b/src/lib/afilter.cpp
new file mode 100644 (file)
index 0000000..5744712
--- /dev/null
@@ -0,0 +1,219 @@
+/****************************************************************************
+** $Id: afilter.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Filter implementation file of
+** Ananas application library
+**
+** Created : 20070315
+**
+** Copyright (C) 2007 Ananas Project.
+** Copyright (C) 2007 Grigory Panov <grigory.panov at gmail.com>, Moscow
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "afilter.h"
+#include <stdio.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+
+/*!
+ *     \~english
+ *     Constructor
+ *     \~russian
+ *     Конструктор.
+ *     \~
+ */
+aFilter::aFilter()
+{
+}
+
+/*!
+ *     \~english
+ *     Destructor
+ *     \~russian
+ *     Деструктор.
+ *     \~
+ */
+aFilter::~aFilter()
+{
+}
+
+/*!
+ *     \~english
+ *     Dump filter conditions to stdout
+ *     \~russian
+ *     Выводит содержимое фильтра на stdout.
+ *     \~
+ */
+void
+aFilter::Dump() const
+{
+       printf("%s\n", toString().ascii());
+}
+
+/*!
+ *     \~english
+ *     Converts filter into its sql retpesentation. \a removeFirst give you ability to remove first AND or OR operator
+ *     \~russian
+ *     Переводит фильтр в его sql представление. Параметр \a removeFirst отвечает за удаление ведущего оператора AND или OR
+ *     \~
+ */
+QString
+aFilter::toString(bool removeFirst) const
+{
+       QString str = QString::null;
+       Q3ValueList<filterCondition>::const_iterator it;
+       for ( it = conditions.begin(); it != conditions.end(); ++it )
+       {
+               filterCondition flt = (*it);
+               if(it != conditions.begin() && removeFirst)
+               {
+                       str+= flt.AndOr + " ";
+               }
+               str+= flt.fname + " ";
+               str+= flt.operation + " ";
+               str+= flt.value + " ";
+       }
+       return str;
+}
+
+
+void
+aFilter::Add(const QString& fname, const Q_INT64 value, OperationEnum op, bool AndOp, bool replace)
+{
+       AddHelper(fname, QString::number(value), op, AndOp, replace);
+}
+void
+aFilter::Add(const QString& fname, const int value, OperationEnum op, bool AndOp, bool replace)
+{
+       AddHelper(fname, QString::number(value), op, AndOp, replace);
+}
+void
+aFilter::Add(const QString& fname, const double value, OperationEnum op, bool AndOp, bool replace)
+{
+       AddHelper(fname, QString::number(value), op, AndOp, replace);
+}
+/*
+void
+aFilter::Add(const QString& fname, bool value, OperationEnum op, bool AndOp, bool replace)
+{
+       AddHelper(fname, value?"true":"false", op, AndOp, replace);
+}
+*/
+void
+aFilter::Add(const QString& fname, const QString& value, OperationEnum op, bool AndOp, bool replace)
+{
+       // need escape string
+       AddHelper(fname, Escape(value), op, AndOp, replace);
+}
+
+void
+aFilter::Add(const QString& fname, const char* value, OperationEnum op, bool AndOp, bool replace)
+{
+       // need escape string
+       AddHelper(fname, Escape(QString(value)), op, AndOp, replace);
+}
+
+void
+aFilter::Add(const QString& fname, const QDateTime& value, OperationEnum op, bool AndOp, bool replace)
+{
+       AddHelper(fname, Escape(value.toString(Qt::ISODate)), op, AndOp, replace);
+}
+
+void
+aFilter::Add(const QString& fname, const QDate& value, OperationEnum op, bool AndOp, bool replace)
+{
+       AddHelper(fname, Escape(value.toString(Qt::ISODate)), op, AndOp, replace);
+}
+
+
+QString
+aFilter::Escape(const QString& val)
+{
+       QString res = val;
+       res.replace("\"","\"\"");
+       res.replace("'","''");
+       res.insert(0,"\"");
+       res.append("\"");
+       //printf("%s\n",res.ascii());
+       return res;
+}
+
+void
+aFilter::AddHelper(const QString& fname, const QString& value, OperationEnum op, bool AndOp, bool replace)
+{
+       filterCondition flt;
+       flt.AndOr = AndOp?"AND":"OR";
+       flt.fname = fname;
+       flt.value = value;
+       switch(op)
+       {
+       case OperationEnumEquals:
+               flt.operation = "=";
+               break;
+       case OperationEnumNotEquals:
+               flt.operation = "<>";
+               break;
+       case OperationEnumGreaterThen:
+               flt.operation = ">";
+               break;
+       case OperationEnumLessThen:
+               flt.operation = "<";
+               break;
+       case OperationEnumGreaterOrEquals:
+               flt.operation = ">=";
+               break;
+       case OperationEnumLessOrEquals:
+               flt.operation = "<=";
+               break;
+       case OperationEnumLike:
+               flt.operation = "like";
+               break;
+       default:
+               printf("boo! operation not exists!");
+               break;
+
+       }
+       if(replace) // replace all entries, append to end list of conditions, if nothing found
+       {
+               Q3ValueList<filterCondition>::iterator it;
+               bool isFound = false;
+               for ( it = conditions.begin(); it != conditions.end(); ++it )
+               {
+                       if((*it).fname == fname)
+                       {
+                               (*it) = flt;
+                               isFound = true;
+                       }
+               }
+               if(!isFound) conditions.append(flt);
+       }
+       else
+       {
+               conditions.append(flt);
+       }
+
+}
+
+void
+aFilter::Clear()
+{
+       conditions.clear();
+}
diff --git a/src/lib/afilter.h b/src/lib/afilter.h
new file mode 100644 (file)
index 0000000..7d24a89
--- /dev/null
@@ -0,0 +1,81 @@
+/****************************************************************************
+** $Id: afilter.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Filter declaration file of
+** Ananas application library
+**
+** Created : 20070315
+**
+** Copyright (C) 2007 Ananas Project.
+** Copyright (C) 2007 Grigory Panov <grigory.panov at gmail.com>, Moscow
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef afilter_h
+#define afilter_h
+
+#include <qstring.h>
+#include <q3valuelist.h>
+#include <qdatetime.h>
+#include "ananasglobal.h"
+
+ANANAS_EXPORT enum OperationEnum{
+               OperationEnumEquals,
+               OperationEnumNotEquals,
+               OperationEnumGreaterThen,
+               OperationEnumLessThen,
+               OperationEnumGreaterOrEquals,
+               OperationEnumLessOrEquals,
+               OperationEnumLike
+       };
+
+class ANANAS_EXPORT aFilter
+{
+public:
+       aFilter();
+       virtual ~aFilter();
+       void Dump() const;
+
+       void Add(const QString& fname, const char* value, OperationEnum op, bool AndOp = true, bool replace = true);
+       void Add(const QString& fname, const Q_INT64 value, OperationEnum op, bool AndOp = true, bool replace = true);
+       void Add(const QString& fname, const int value, OperationEnum op, bool AndOp = true, bool replace = true);
+       void Add(const QString& fname, const double value, OperationEnum op, bool AndOp = true, bool replace = true);
+       //void Add(const QString& fname, bool value, OperationEnum op, bool AndOp = true, bool replace = true);
+       void Add(const QString& fname, const QString& value, OperationEnum op, bool AndOp = true, bool replace = true);
+       void Add(const QString& fname, const QDateTime& value, OperationEnum op, bool AndOp = true, bool replace = true);
+       void Add(const QString& fname, const QDate& value, OperationEnum op, bool AndOp = true, bool replace = true);
+       QString toString(bool removeFirst = true) const;
+       void Clear();
+protected:
+       void AddHelper(const QString& fname, const QString& value, OperationEnum op, bool And, bool replace);
+       QString Escape(const QString& val);
+private:
+       struct filterCondition
+       {
+               QString fname;
+               QString value;
+               QString operation;
+               QString AndOr;
+       }f;
+       //typedef struct filterCondition FilterCondition;
+       Q3ValueList<filterCondition> conditions;
+};
+
+#endif
diff --git a/src/lib/alog.cpp b/src/lib/alog.cpp
new file mode 100644 (file)
index 0000000..07300a2
--- /dev/null
@@ -0,0 +1,169 @@
+/****************************************************************************
+** $Id: alog.cpp,v 1.2 2008/11/08 20:16:35 leader Exp $
+**
+** Log functions source file of 
+** Ananas application library
+**
+** Created : 20060402
+**
+** Copyright (C) 2006 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas 
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include       "alog.h"
+#include       <qfile.h>
+#include       <qdir.h>
+#include       <qdatetime.h>
+#include       "aservice.h"
+
+
+QString        aLog::logName = "";
+int            aLog::logLevel = aLog::Debug;
+QFile          aLog::f;
+bool           aLog::msg_was_show = false;
+//const int    aLog::Error = 0;
+//const int    aLog::Info = 1;
+//const int    aLog::Debug = 2;
+
+
+/*!
+ *\~english
+ *     Writes text to log, if /a status less init status.
+ *     \param status - message status  ( aLog::Error, aLog::Info, aLog::Debug )
+ *     \param text - message 
+ *\~russian
+ *     Пишет текст в лог, если статус сообщения меньше установленного при инициализации. К тексту добавляется дата и статус.
+ *     \param status - статус сообщения  ( aLog::Error, aLog::Info, aLog::Debug ). 
+ *     \param text - сообщение 
+ *\~
+*/
+void
+aLog::print(   int status,
+               const QString &text)
+{
+       QString st;
+//     switch(status)
+//     {
+//             case aLog::Error: 
+               if(status == aLog::Error) st = "ERROR";
+//             break;
+//             case aLog::Info: 
+               else if(status == aLog::Info) st = "INFO";
+//             break;
+//             default: 
+               else st = "DEBUG";
+//             break;
+//     }
+       if(status<=logLevel)
+       {
+       QString endline;
+       
+#ifdef Q_OS_WIN32
+       endline = "\r\n";
+#else
+       endline = "\n";
+#endif
+               const QString toWrite = QString("%1 %2 %3%4")\
+                                 .arg(QDateTime::currentDateTime().toString(Qt::ISODate).replace('T',' '))\
+                                 .arg(st)\
+                                 .arg(text)\
+                                 .arg(endline);
+               aLog::printr(toWrite);  
+       }
+}
+
+/*!
+ *\~english
+ *     Writes raw text to log.
+ *\~russian
+ *     Пишет текст в лог без изменения.      
+ *\~
+ *     \param text - \~english text \~russian текст \~
+*/
+void
+aLog::printr(  const QString &toWrite)
+{
+       if(aLog::f.handle () !=-1)
+       {
+               aLog::f.writeBlock((const char*)toWrite.local8Bit(),strlen((const char*)toWrite.local8Bit()));
+               aLog::f.flush();
+       }
+       else
+       {
+               if(!aLog::msg_was_show)
+               {
+                       printf("Log system not initialized!\n");
+                       aLog::msg_was_show = true;
+               }
+       }
+}
+
+
+/*!
+ *\~english
+ *     Inits log system.
+ *\~russian
+ *     Инициализирует систему логирования. Выполняется один раз при запуске програмы, если параметры не указаны, осуществляется попытка прочитать из из конфигурационного файла. Если это не удается, используются параметры по умолчанию.
+ *\~
+ *     \param log_name - \~english logfile name. Default ~/.ananas.ananas.log \~russian Путь к логу. Значение по умолчанию ~/.ananas/ananas.log \~
+ *     \param status - \~english showing status  \~russian статус скрытия сообщений. Все сообщения, имеющие больший статус, не попадут в лог ( ERROR= 0, INFO= 1, DEBUG= 2 ). Значение по умолчанию DEBUG \~
+*/
+void
+aLog::init(const QString &log_name, int show_up)
+{
+       bool ok;
+       QString log;
+       if(log_name =="" || logName==QString::null)
+       {
+               log = aService::readConfigVariable("log", &ok); 
+               if(!ok) log = QDir::homeDirPath()+"/.ananas/ananas.log";
+       }
+       else
+       {
+               log = log_name;
+       }
+       
+       aLog::logLevel = show_up;
+       const QString logLev = aService::readConfigVariable("logLevel", &ok);
+       
+       if(logLev=="ERROR") aLog::logLevel = aLog::Error;
+       if(logLev=="INFO") aLog::logLevel = aLog::Info;
+       if(logLev=="DEBUG") aLog::logLevel = aLog::Debug;
+       
+       aLog::logName = log;
+
+       if (aLog::f.isOpen()) f.close();        
+       aLog::f.setName(getLogName());
+       aLog::f.open( IO_WriteOnly | IO_Append );
+
+}
+
+QString
+aLog::getLogName()
+{
+       return aLog::logName;
+}
+
+void 
+aLog::close()
+{
+       aLog::f.close();
+}
+
diff --git a/src/lib/alog.h b/src/lib/alog.h
new file mode 100644 (file)
index 0000000..4e59725
--- /dev/null
@@ -0,0 +1,98 @@
+/****************************************************************************
+** $Id: alog.h,v 1.2 2008/11/08 20:16:35 leader Exp $
+**
+** Log functions header file of 
+** Ananas application library
+**
+** Created : 20051024
+**
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas 
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ALOG_H
+#define ALOG_H
+
+//#include     "ananas.h"
+#include       "ananasglobal.h"
+#include       <qstring.h>
+#include       <qfile.h>
+
+
+// for bcc32.exe compatibility 
+// in file wingdi.h 
+// #define ERROR 0
+
+//#ifdef Q_OS_WIN32
+//#define ERROR IRROR
+//#endif
+
+/*!
+ *     \~english
+ *     Class contain static functions for log system
+ *     \~russian
+ *     \brief Класс содержит статические функции для записи сообщений в лог файл Ананаса.
+ *     \~
+*/
+class ANANAS_EXPORT aLog
+{
+       public:
+       enum MessageType { Error, Info, Debug };
+//     enum status { 
+               /*!
+                * \~english Error
+                * \~russian Сообщение об ошибке
+                * \~
+                */
+/*              
+#ifdef Q_OS_WIN32
+       static const int IRROR;//,
+#else
+       static const int ERROR;
+#endif
+*/             /*!
+                * \~english Info 
+                * \~russian Информационное сообщение
+                * \~
+                */
+//     static const int INFO;//,
+               /*!
+                * \~english Info 
+                * \~russian Отладочное сообщение
+                * \~
+                */
+//     static const int DEBUG;// };
+
+       static void     print( int status, const QString &text);
+       static void     printr( const QString &text);
+       static void     init( const QString &logname="", int loglevel=0);
+       static void     close();
+       static QString  getLogName();
+       
+       
+       private:
+       aLog();
+       static QString logName;
+       static int logLevel;
+       static QFile f;
+       static bool msg_was_show;
+       
+};
+#endif// ALOG_H
diff --git a/src/lib/amenubar.cpp b/src/lib/amenubar.cpp
new file mode 100644 (file)
index 0000000..2c77c7d
--- /dev/null
@@ -0,0 +1,183 @@
+/****************************************************************************
+** $Id: amenubar.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Code file of the Ananas Menu bar of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/******************************************************************
+ ******************************************************************/
+
+#include "amenubar.h"
+//Added by qt3to4:
+#include <Q3PopupMenu>
+#include <QPixmap>
+
+
+AMenuBar::AMenuBar( QWidget* parent , const char* name  )
+       :QMenuBar( parent, name ) {
+
+}
+
+AMenuBar::AMenuBar( aCfg *cfg, QWidget* parent , const char* name  )
+:QMenuBar( parent, name )
+{
+       md = cfg;
+       ReadMenu( md->find( md->find( mdc_interface ), md_mainmenu) );
+}
+
+void
+AMenuBar::ReadMenu( aCfgItem obj )
+{
+       aCfgItem        cobj;
+       Q3PopupMenu     *parent;
+       QString         text, aKey ;
+       long            id;
+
+       if ( !md )
+               return;
+       cobj = md->firstChild ( obj );
+       while ( !cobj.isNull() )
+       {
+               id = md->id( cobj );
+               if ( md->objClass ( cobj ) == md_submenu )
+               {
+                       parent = new Q3PopupMenu ();
+                       insertItem( md->attr( cobj, mda_name ), parent );
+                       ReadMenu( parent, cobj );
+               }
+               if ( md->objClass ( cobj ) == md_command )
+               {
+                       text = md->sText ( cobj, md_menutext );
+                       if ( text == "" ) text = md->attr( cobj, mda_name );
+                       aKey = md->sText ( cobj, md_key );
+                       QMenuBar::insertItem( text, this, SLOT(on_Item()), QKeySequence( aKey ), id );
+               }
+               if ( md->objClass ( cobj ) == md_separator )
+               {
+                       insertSeparator();
+               }
+               cobj = md->nextSibling ( cobj );
+       }
+
+}
+
+void
+AMenuBar::ReadMenu( Q3PopupMenu *parent, aCfgItem obj )
+{
+       aCfgItem        cobj, apix;
+       Q3PopupMenu     *mparent;
+       QString         text, aKey;
+       long id, pid;
+    QPixmap            pix;
+
+       if ( !md )
+               return;
+
+       cobj = md->firstChild ( obj );
+       while ( !cobj.isNull() )
+       {
+               id = md->id( cobj );
+               if ( md->objClass ( cobj ) == md_submenu )
+               {
+                       mparent = new Q3PopupMenu ();
+                       parent->insertItem( md->attr ( cobj, mda_name ), mparent );
+                       ReadMenu( mparent, cobj );
+               }
+               if ( md->objClass ( cobj ) == md_command )
+               {
+                       text = md->sText ( cobj, md_menutext );
+                       if ( text == "" )
+                               text = md->attr( cobj, mda_name );
+                       aKey = md->sText ( cobj, md_key );
+                       pid = md->text( md->findChild( cobj, md_comaction, 0 ) ).toLong();
+                       apix = md->findChild( md->find( pid ), md_active_picture, 0 );
+                       pix.loadFromData( md->binary( apix ) );
+                       parent->insertItem( pix, text, this, SLOT(on_Item()), QKeySequence( aKey ), id );
+                       pix = 0;
+               }
+               if ( md->objClass ( cobj ) == md_separator )
+               {
+                       parent->insertSeparator();
+               }
+               cobj = md->nextSibling ( cobj );
+       }
+
+}
+
+
+AMenuBar::~AMenuBar(){
+}
+
+int AMenuBar::insertItem ( const QString & text, Q3PopupMenu * popup, int id, int index ) {
+       return QMenuBar::insertItem ( text, popup, id, index);
+};
+
+/*
+int
+AMenuBar::insertItem ( const QString & text, const QObject * receiver, const char * member, const QKeySequence & accel, int id , int index ) {
+       return QMenuBar::insertItem( text, receiver, member, accel, id, index);
+}
+int
+AMenuBar::insertItem ( const QPixmap & pixmap, const QObject * receiver, const char * member, const QKeySequence & accel , int id , int index ) {
+       return QMenuBar::insertItem ( pixmap, receiver, member, accel,  id, index);
+}
+int AMenuBar::insertItem ( const QIconSet & icon, const QPixmap & pixmap, const QObject * receiver, const char * member, const QKeySequence & accel , int id , int index  ) {
+       return QMenuBar::insertItem ( icon, pixmap, receiver, member, accel,  id, index);
+};
+int AMenuBar::insertItem ( const QString & text, int id , int index  ) {
+       return QMenuBar::insertItem( text, id, index );
+};
+int AMenuBar::insertItem ( const QIconSet & icon, const QString & text, int id , int index  ) {
+       return QMenuBar::insertItem ( icon, text,  id, index);
+};
+int AMenuBar::insertItem ( const QIconSet & icon, const QString & text, QPopupMenu * popup, int id, int index ) {
+       return QMenuBar::insertItem ( icon, text, popup,  id, index);
+};
+int AMenuBar::insertItem ( const QPixmap & pixmap, int id , int index ) {
+       return QMenuBar::insertItem ( pixmap, id, index);
+};
+int AMenuBar::insertItem ( const QIconSet & icon, const QPixmap & pixmap, int id , int index ) {
+       return QMenuBar::insertItem ( icon, pixmap, id, index);
+};
+int AMenuBar::insertItem ( const QPixmap & pixmap, QPopupMenu * popup, int id, int index ) {
+       return QMenuBar::insertItem ( pixmap, popup,  id, index);
+};
+int AMenuBar::insertItem ( const QIconSet & icon, const QPixmap & pixmap, QPopupMenu * popup, int id , int index ) {
+       return QMenuBar::insertItem ( icon, pixmap, popup,  id, index);
+};
+int AMenuBar::insertItem ( QWidget * widget, int id, int index ) {
+       return QMenuBar::insertItem ( widget,  id, index);
+};
+int AMenuBar::insertItem ( const QIconSet & icon, QCustomMenuItem * custom, int id , int index ) {
+       return QMenuBar::insertItem ( icon, custom, id, index);
+};
+int AMenuBar::insertItem ( QCustomMenuItem * custom, int id , int index ) {
+       return QMenuBar::insertItem ( custom,  id, index);
+};
+int AMenuBar::insertSeparator ( int index ) {
+       return QMenuBar::insertSeparator ( index);
+};
+*/
diff --git a/src/lib/amenubar.h b/src/lib/amenubar.h
new file mode 100644 (file)
index 0000000..33e617a
--- /dev/null
@@ -0,0 +1,82 @@
+/****************************************************************************
+** $Id: amenubar.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Header file of the Ananas Menu bar of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/****************************************************************************
+****************************************************************************/
+
+#ifndef AMENUBAR_H
+#define AMENUBAR_H
+
+#include <qmenubar.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+
+#include       "acfg.h"
+
+class  ANANAS_EXPORT AMenuBar : public QMenuBar
+{
+       Q_OBJECT
+
+       private:
+       aCfg    *md;
+
+    public:
+       AMenuBar( QWidget* parent = 0, const char* name = 0 );
+       AMenuBar( aCfg *cfg, QWidget* parent = 0, const char* name = 0 );
+       ~AMenuBar();
+
+       void ReadMenu( aCfgItem obj );
+       void ReadMenu( Q3PopupMenu *parent, aCfgItem obj );
+
+    public slots:
+       void on_Item(){};
+
+       int insertItem ( const QString & text, Q3PopupMenu * popup, int id = -1, int index = -1 );
+/*
+       int insertItem ( const QString & text, const QObject * receiver, const char * member, const QKeySequence & accel = 0, int id = -1, int index = -1 );
+       int insertItem ( const QPixmap & pixmap, const QObject * receiver, const char * member, const QKeySequence & accel = 0, int id = -1, int index = -1 );
+       int insertItem ( const QIconSet & icon, const QPixmap & pixmap, const QObject * receiver, const char * member, const QKeySequence & accel = 0, int id = -1, int index = -1 );
+       int insertItem ( const QString & text, int id = -1, int index = -1 );
+       int insertItem ( const QIconSet & icon, const QString & text, int id = -1, int index = -1 );
+       int insertItem ( const QIconSet & icon, const QString & text, QPopupMenu * popup, int id = -1, int index = -1 );
+       int insertItem ( const QPixmap & pixmap, int id = -1, int index = -1 );
+       int insertItem ( const QIconSet & icon, const QPixmap & pixmap, int id = -1, int index = -1 );
+       int insertItem ( const QPixmap & pixmap, QPopupMenu * popup, int id = -1, int index = -1 );
+       int insertItem ( const QIconSet & icon, const QPixmap & pixmap, QPopupMenu * popup, int id = -1, int index = -1 );
+       int insertItem ( QWidget * widget, int id = -1, int index = -1 );
+       int insertItem ( const QIconSet & icon, QCustomMenuItem * custom, int id = -1, int index = -1 );
+       int insertItem ( QCustomMenuItem * custom, int id = -1, int index = -1 );
+       int insertSeparator ( int index = -1 );
+*/
+private:
+       Q3IntDict <aCfgItem> cfgItems;
+};
+
+
+#endif // AMENUBAR_H
diff --git a/src/lib/amoney.cpp b/src/lib/amoney.cpp
new file mode 100644 (file)
index 0000000..ddc94fa
--- /dev/null
@@ -0,0 +1,604 @@
+/****************************************************************************
+** $Id: amoney.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Service functions header file of
+** Ananas application library
+**
+** Copyright (C) 2007 Andrey Paskal.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**
+**********************************************************************/
+
+#include "amoney.h"
+#include       <math.h>
+
+
+/**
+ * \ru
+ *             \brief Конструктор
+ * \_ru
+ */
+AMoney::AMoney(){
+       this->amount = 0.0;
+       this->degree = new Degree();
+       this->currency = new Currency("RUR");
+}
+
+
+/**
+ * \ru
+ *             \brief Конструктор
+ *             \param initialValue - первоначальное количество денег
+ *             \param currency - тип валюты. По умолчанию "RUR". Допустимые значения: "RUR" - рубль, "EUR" - евро, "USD" - доллары США
+ * \_ru
+ */
+AMoney::AMoney(double initialValue, QString currency){
+       this->amount = initialValue;
+       this->degree = new Degree();
+       this->currency = new Currency( currency );
+}
+
+
+/**
+ * \ru
+ *             \brief Конвертор в строку
+ *             Периводит числовое значение к значению типа QString. Для преобразования числа в текст (пропись)
+ *             используйте метод toText()
+ * \_ru
+ */
+QString
+AMoney::toString(){
+       return QString::number( this->amount );
+}
+
+
+/**
+ * \ru
+ *             \brief Сравнивает два экземпляра объектов данного класса.
+ *
+ * \_ru
+ */
+bool
+AMoney::equal( AMoney &money){
+       return this->amount == money.getAmount();
+}
+
+
+/**
+ * \ru
+ *             \brief Возвращает количество денег.
+ *
+ * \_ru
+ */
+double
+AMoney::getAmount() {
+       return this->amount;
+}
+
+/**
+ * \ru
+ *             \brief Задает количество денег.
+ *             Валюта не меняется. Если были рубли, то и остаються рубли.
+ * \_ru
+ */
+void
+AMoney::setAmount(double val) {
+       this->amount = val;
+}
+
+/**
+ * \ru
+ *             \brief Задает количество денег в требуемой валюте.
+ *             \param cur - валюта. Допустимые значения смотри в описании конструктора.
+ * \_ru
+ */
+void
+AMoney::setAmount(double val, QString cur) {
+       this->amount = val;
+       this->currency->setId( cur );
+}
+
+/**
+ * \ru
+ *             \brief Возвращает валюту хранимой суммы.
+ *             Возможные значения смотри в описании конструктора.
+ * \_ru
+ */
+QString
+AMoney::getCurrency(){
+       return this->currency->getId();
+}
+
+/**
+ * \ru
+ *             \brief Задает валюту хранимой суммы.
+ *             Возможные значения смотри в описании конструктора.
+ * \_ru
+ */
+void
+AMoney::setCurrency(QString cur) {
+       this->currency->setId( cur );
+}
+
+/**
+ * \ru
+ *             \brief Конвертор суммы в пропись. Публичный интерфейс.
+ *             Возвращает значение хранимой суммы прописью с учетом валюты.
+ *             Например, "Сто долларов США 20 центов"
+ * \_ru
+ */
+QString
+AMoney::toText(){
+
+       uint integerKopeiki;
+       qulonglong integerRubli;
+
+       integerRubli = QVariant( this->amount).toULongLong();
+
+       double decimal = this->amount-integerRubli;
+
+#ifdef Q_OS_UNIX
+       integerKopeiki = round( decimal*100.0 );
+#else
+       integerKopeiki = decimal * 100.0;
+#endif
+
+       QString rubliText;
+       if ( integerRubli > 0 ) {
+               rubliText = valueToText( integerRubli );
+       } else {
+               rubliText = "Ноль";
+       }
+
+       QString kopeikiText;
+       if ( integerKopeiki > 0 ) {
+               kopeikiText = decimalValueToText( integerKopeiki );
+       } else {
+               kopeikiText = "ноль";
+       }
+       return this->firstUp(
+                       rubliText + " " + this->integerCurrencyName( rubliText ) + " " +
+                       QString::number( integerKopeiki ) + " " + this->decimalCurrencyName( kopeikiText )
+               );
+}
+
+
+/**
+ * \ru
+ *     \brief Собирает строку из текстовых троек, вставляя между ними слова "сотен", "тысяч", "миллионов", ...
+ *
+ *             Внутренний метод. Не предназнвчен для внешнего использования.
+ *             \param  value - числовое значение целого типа, которое необходимо перевести в пропись.
+ *             \return возвращает пропись для заданного числа без валюты
+ * \_ru
+ */
+QString
+AMoney::valueToText( qulonglong value ){
+       QString sValue = QString::number( value);
+       QString tripleText;
+       QString coupleSingleText;
+       QString degreeText;
+       QString result;
+       this->degree->setValue(0);
+
+       while ( sValue.length() >= 3 ) {
+               if ( !sValue.endsWith("000")) {
+                       tripleText = tripleToText( sValue.right(3) );
+                       result = tripleText + this->degreeText( tripleText, this->degree->getValue() ) + result ;
+               }
+               sValue = sValue.left( sValue.length() - 3);
+               this->degree->setValue( this->degree->getValue() +1);
+
+       }
+       if (sValue.length() > 0) {
+               if (sValue.length() == 2) {
+                       coupleSingleText = coupleToText( sValue );
+               } else {
+                       coupleSingleText = singleToText( sValue );
+               }
+               degreeText = this->degreeText( coupleSingleText, this->degree->getValue() );
+               if ( result != "" && (coupleSingleText + degreeText) != "") {
+                       result =  coupleSingleText + degreeText + " " + result ;
+               } else {
+                       result =  coupleSingleText + degreeText + result ;
+               }
+       }
+       return result;
+}
+
+
+/**
+ * \ru
+ *     \brief Вспомогательная функция для копеек, центов....
+ *
+ *             Используется для перевода цифры в пропись для дробной части суммы.
+ *             Эта функция необходима, так как дробная часть может имерь род отличный от целой части суммы.
+ *             Например, рубль - муж.род, копейка - жен.род.
+ *
+ * \_ru
+ */
+QString
+AMoney::decimalValueToText( qulonglong value ){
+       QString currencyId = this->currency->getId();
+       this->currency->setId( "d"+ currencyId);
+       QString result = valueToText( value );
+       this->currency->setId( currencyId );
+       return result;
+}
+
+/**
+ * \ru
+ *     \brief Преобразует однозначное число в текст.
+ *
+ *             Учитывается род Муж. или Жен. преобразуемого числа
+ *             \param string - строка, содержащая один символ [0-9]
+ *             \return  возвращает "один" или "одна" или "два" или "две" или "три" ..."девять".
+ *
+ * \_ru
+ */
+QString
+AMoney::singleToText( QString string ) {
+
+       bool male;
+
+       if ( this->degree->getValue() > 0 ) {
+               male = this->degree->isMale();
+       } else {
+               male = this->currency->isMale();
+       }
+
+       if ( male ) {
+               if (string == "1") return "один";
+               if (string == "2") return "два";
+       } else {
+               if (string == "1") return "одна";
+               if (string == "2") return "две";
+       }
+       if (string == "0") return "";
+       if (string == "3") return "три";
+       if (string == "4") return "четыре";
+       if (string == "5") return "пять";
+       if (string == "6") return "шесть";
+       if (string == "7") return "семь";
+       if (string == "8") return "восемь";
+       if (string == "9") return "девять";
+
+       return "undefinded";
+}
+
+/**
+ * \ru
+ *     \brief Преобразует двузначное число в текст.
+ *
+ *             \param string - строка, содержащая два символа [0-9][0-9]
+ *             \return  возвращает пропись двузначного числа.
+ *
+ * \_ru
+ */
+QString
+AMoney::coupleToText( QString string ) {
+
+       QString result = "";
+
+       if (string.left(1) == "0") return singleToText( string.right(1) );
+
+       if (string == "10") return "десять";
+       if (string == "11") return "одинадцать";
+       if (string == "12") return "двенадцать";
+       if (string == "13") return "тринадцать";
+       if (string == "14") return "четырнадцать";
+       if (string == "15") return "пятнадцать";
+       if (string == "16") return "шестьнадцать";
+       if (string == "17") return "семьнадцать";
+       if (string == "18") return "восемьнадцать";
+       if (string == "19") return "девятьнадцать";
+
+       if (string.left(1) == "2" ) result = "двадцать";
+       if (string.left(1) == "3" ) result = "тридцать";
+       if (string.left(1) == "4" ) result = "сорок";
+       if (string.left(1) == "5" ) result = "пятьдесят";
+       if (string.left(1) == "6" ) result = "шестьдесят";
+       if (string.left(1) == "7" ) result = "семьдесят";
+       if (string.left(1) == "8" ) result = "восемьдесят";
+       if (string.left(1) == "9" ) result = "девяносто";
+
+
+       if (string.right(1) != "0") {
+               result += " " + singleToText( string.right(1) );
+       }
+
+       return result;
+}
+
+/**
+ * \ru
+ *     \brief Преобразует трехначное число в текст.
+ *
+ *             \param string - строка, содержащая три символа [0-9][0-9][0-9]
+ *             \return  возвращает пропись трехзначного числа.
+ *
+ * \_ru
+ */
+QString
+AMoney::tripleToText( QString string ) {
+       QString result = "";
+
+       if ( string.left(1) == "0" ) return coupleToText( string.right(2) );
+
+       if ( string.left(1) == "1" ) result = "сто";
+       if ( string.left(1) == "2" ) result = "двести";
+       if ( string.left(1) == "3" ) result = "триста";
+       if ( string.left(1) == "4" ) result = "четыреста";
+       if ( string.left(1) == "5" ) result = "пятьсот";
+       if ( string.left(1) == "6" ) result = "шестьсот";
+       if ( string.left(1) == "7" ) result = "семьсот";
+       if ( string.left(1) == "8" ) result = "восемьсот";
+       if ( string.left(1) == "9" ) result = "девятьсот";
+
+       return result + coupleToText( string.right(2) );
+}
+
+/**
+ * \ru
+ *             \brief Возвращает слово "тысячи", "миллионы", "миллиарды" в  нужной численности.
+ *             \param string - пропись числа, для которого нужно вернуть название порядка
+ *             \param  degreeLevel - значение порядка. 1 - тысячи, 2 - миллионы, 3 - миллиарды, 4 - триллионы.
+ * \_ru
+ */
+QString
+AMoney::degreeText( QString string, int degreeLevel) {
+       QString result = "";
+
+       if ( degreeLevel < 1 ) return result;
+
+       if (degreeLevel == 1) {
+               if ( string.endsWith("одна") ) {
+                       result = " тысяча";
+               } else  if ( string.endsWith("две") || string.endsWith("три") || string.endsWith("четыре") ) {
+                       result = " тысячи";
+               } else {
+                       result = " тысяч";
+               }
+       } else  if (degreeLevel == 2) {
+               if ( string.endsWith("один") ) {
+                       result = " миллион";
+               } else  if ( string.endsWith("два") || string.endsWith("три") || string.endsWith("четыре") ) {
+                       result = " миллиона";
+               } else {
+                       result = " миллионов";
+               }
+       } else  if (degreeLevel == 3) {
+               if ( string.endsWith("один") ) {
+                       result = " миллиард";
+               } else  if ( string.endsWith("два") || string.endsWith("три") || string.endsWith("четыре") ) {
+                       result = " миллиарда";
+               } else {
+                       result = " миллиардов";
+               }
+       } else  if (degreeLevel == 4) {
+               if ( string.endsWith("один") ) {
+                       result = " триллион";
+               } else  if ( string.endsWith("два") || string.endsWith("три") || string.endsWith("четыре") ) {
+                       result = " триллиона";
+               } else {
+                       result = " триллионов";
+               }
+       }
+
+       return result;
+}
+
+/**
+ *     \ru
+ *             \brief Возвращает прописью название валюты для целой части числа.
+ *             \param  string - пропись числа, для которого нужно вернуть название валюты прописью.
+ *
+ *     \_ru
+ */
+QString
+AMoney::integerCurrencyName( QString string ){
+       QString result = "";
+
+       if (string == "") return "";
+
+       if ( this->currency->is("USD") ) {
+               if ( string.endsWith("один") ) {
+                       result = "доллар США";
+               } else  if ( string.endsWith("два") || string.endsWith("три") || string.endsWith("четыре") ) {
+                       result = "доллара США";
+               } else {
+                       result = "долларов США";
+               }
+       } else if ( this->currency->is("EUR") ) {
+               result = "евро";
+       } else {
+               if ( string.endsWith("один") ) {
+                       result = "рубль";
+               } else  if ( string.endsWith("два") || string.endsWith("три") || string.endsWith("четыре") ) {
+                       result = "рубля";
+               } else {
+                       result = "рублей";
+               }
+       }
+
+       return result;
+}
+
+/**
+ *     \ru
+ *             \brief Возвращает прописью название валюты для дробной части числа.
+ *             \param  string - пропись числа, для которого нужно вернуть название валюты прописью.
+ *
+ *     \_ru
+ */
+QString
+AMoney::decimalCurrencyName(QString string ){
+       QString result = "";
+
+       if (string == "") return "";
+
+       if ( this->currency->is("USD") || this->currency->is("EUR") ) {
+               if ( string.endsWith("один") ) {
+                       result = "цент";
+               } else  if ( string.endsWith("два") || string.endsWith("три") || string.endsWith("четыре") ) {
+                       result = "цента";
+               } else {
+                       result = "центов";
+               }
+       } else {
+               if ( string.endsWith("одна") ) {
+                       result = "копейка";
+               } else  if ( string.endsWith("две") || string.endsWith("три") || string.endsWith("четыре") ) {
+                       result = "копейки";
+               } else {
+                       result = "копеек";
+               }
+       }
+
+       return result;
+}
+
+/**
+ * \ru
+ *             \brief  Поднимает регистр первой буквы слова, если первой идет одна из букв: о,д,т,ч,п,ш,с,в.
+ *             \param str - строка, первый символ которой нужно перевести в верхний регистр.
+ * \_ru
+ */
+QString
+AMoney::firstUp( QString str) {
+
+       return str.left(1).upper() + str.right( str.length() - 1);
+}
+
+/**
+ * \ru
+ *             \brief Конструктор
+ *             \param - значение порядка. 0 - сотни (по умолчанию), 1 - тысячи, 2 - миллионы, 3 - миллиарды, 4 - триллионы.
+ * \_ru
+ */
+Degree::Degree( int val) {
+       this->setValue( val );
+}
+
+
+/**
+ * \ru
+ *             \brief Возвращает значение порядок.
+ *             Возможные значения смотри в описании конструктора.
+ * \_ru
+ */
+int
+Degree::getValue() {
+       return this->value;
+}
+
+/**
+ * \ru
+ *             \brief Задает значение порядка.
+ *             Допустимые значения смотри в описании конструктора.
+ * \_ru
+ */
+void
+Degree::setValue( int val ) {
+       this->value = val;
+       if (this->value == 1) {
+               this->male = false;
+       } else {
+               this->male = true;
+       }
+}
+
+/**
+ * \ru
+ *             \brief Возвращает true, если текущий порядок имеет мужской род.
+ *
+ *             Например, миллион, миллиард.
+ *             Возвращает false, если текущий порядок имеет женский род
+ *             Например, тысяча
+ * \_ru
+ */
+bool
+Degree::isMale() {
+       return this->male;
+}
+
+
+/**
+ * \ru
+ *             \brief Конструктор
+ *             \param - Обозначение валюты.
+ *             Допустимые значения параметра:
+ *             RUR - русский рубль, значение по умолчанию
+ *             dRUR - копейка
+ *             USD - доллар США
+ *             dUSD - цент
+ *             EUR - евро
+ *             dEUR = dUSD
+ * \_ru
+ */
+Currency::Currency( QString newId) {
+       setId( newId );
+}
+
+
+/**
+ * \ru
+ *     \brief Возвращает истину, если текущая валюта равна значению, указанному в рараметре.
+ *             Допустимые значения параметра смотри в описании конструктора.
+ * \_ru
+ */
+bool
+Currency::is( QString str ){
+       return this->id == str;
+}
+
+/**
+ * \ru
+ *     \brief Возвращает истину, если текущая валюта имеет мужской род.
+ *             Например, копейка.
+ * \_ru
+ */
+bool
+Currency::isMale( ){
+       return this->male;
+}
+
+
+/**
+ * \ru
+ *     \brief Возвращает символьное обозначение, идентификатор валюты.
+ *             Допустимые значения смотри в описании конструктора.
+ * \_ru
+ */
+QString
+Currency::getId() {
+       return this->id;
+}
+
+/**
+ * \ru
+ *     \brief Установка типа валюты.
+ *             Допустимые значения смотри в описании конструктора.
+ * \_ru
+ */
+void
+Currency::setId(QString newId) {
+
+       if ( newId == "dRUR") {
+               this->male = false;
+       } else {
+               this->id = newId;
+               this->male = true;
+       }
+}
diff --git a/src/lib/amoney.h b/src/lib/amoney.h
new file mode 100644 (file)
index 0000000..fd96b1f
--- /dev/null
@@ -0,0 +1,110 @@
+/****************************************************************************
+** $Id: amoney.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Service functions header file of
+** Ananas application library
+**
+** Copyright (C) 2007 Andrey Paskal.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**
+**********************************************************************/
+#ifndef AMONEY_H_
+#define AMONEY_H_
+#include       "ananas.h"
+#include       "qstring.h"
+
+class Degree;
+class Currency;
+
+/**
+ * \ru
+ *             \brief  Класс для хранения денежных значений в различной валюте и получения их прописного представления.
+ * \_ru
+ */
+class ANANAS_EXPORT AMoney{
+       public:
+               AMoney();
+               AMoney( double amount, QString currency = "RUR");
+
+               double  getAmount();
+               void    setAmount( double );
+               void    setAmount( double,  QString currency);
+               QString getCurrency();
+               void    setCurrency( QString );
+               QString toString();
+               QString toText();
+               bool    equal( AMoney &sum );
+
+       private:
+               double          amount;
+               Currency*       currency;
+               Degree*         degree;
+
+               QString degreeText( QString , int );
+               QString valueToText( qulonglong );
+               QString decimalValueToText( qulonglong );
+               QString singleToText( QString  );
+               QString coupleToText( QString  );
+               QString tripleToText( QString  );
+               QString integerCurrencyName( QString );
+               QString decimalCurrencyName( QString );
+               QString firstUp( QString );
+
+};
+
+
+
+/**
+ * \ru
+ *             \brief  содержит знания о роде (М/Ж) числовых порядков.
+ *                     После задания порядка (сотни, тысячи, миллионы....)  можно узнать род
+ *                     методом isMale()
+ * \_ru
+ */
+class Degree {
+       public:
+               Degree( int = 0 );
+               int getValue();
+               void setValue( int value);
+               bool isMale();
+
+       private:
+               int value;
+               bool male;
+};
+
+/**
+ * \ru
+ *             \brief  содержит знания о роде (М/Ж) валюты.
+ *                     После задания одного из поддерживаемых типов валюты можно узнать род
+ *                     методом isMale()
+ *             Поддерживаемые типы валют можно увидеть в описании конструктора.
+ * \_ru
+ */
+class Currency {
+       public:
+               Currency( QString currensyId = "RUR");
+
+               QString getId();
+               void    setId( QString );
+               bool    isMale();
+               bool    is( QString );
+
+       private:
+               QString id;
+               bool    male;
+};
+
+
+#endif /*AMONEY_H_*/
diff --git a/src/lib/ananas.cpp b/src/lib/ananas.cpp
new file mode 100644 (file)
index 0000000..d4db687
--- /dev/null
@@ -0,0 +1,160 @@
+/****************************************************************************
+** $Id: ananas.cpp,v 1.2 2008/11/09 21:09:11 leader Exp $
+**
+** Code file of the Ananas Library of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "ananas.h"
+#include "dselectdb.h"
+#include "dlogin.h"
+
+
+
+/*!
+ * Library version number.
+ */
+const char *
+ANANAS_EXPORT
+ananas_libversion()
+{
+       static const char libver[]=ANANAS_LIBVERSION;
+       return libver;
+}
+
+
+/*!
+ * Select database and user login.
+ */
+bool
+ANANAS_EXPORT
+ananas_login( QString &rcfile, QString &username, QString &userpassword, aDatabase *db, int appId )
+{
+    dSelectDB dselectdb;
+    dLogin dlogin;
+        
+    if ( rcfile.isEmpty() ) {
+        if (dselectdb.exec()==QDialog::Accepted) rcfile = dselectdb.rcfile;
+    }
+    if ( !rcfile.isEmpty() ) {
+       if (dlogin.exec()==QDialog::Accepted) {
+           username = dlogin.username;
+           userpassword = dlogin.password;
+            if ( !db ) db = aDatabase::database();
+           if ( !db->init( rcfile ) ) return false;
+           return ( db->login( username, userpassword, appId ) );
+       } return false;
+    }
+    return false;
+}
+
+
+/*!
+ * Select database and user login.
+ */
+void
+ANANAS_EXPORT
+ananas_logout( aDatabase *db )
+{
+    if ( !db ) db = aDatabase::database();
+    db->logout();
+}
+
+
+/*!
+ * Select database and user login.
+ */
+/*
+bool
+ANANAS_EXPORT
+ananas_login( QString &rcfile, QString &username, QString &userpassword )
+{
+    dSelectDB dselectdb;
+    //dLogin dlogin;
+
+    if ( rcfile.isEmpty() ) {
+        if (dselectdb.exec()==QDialog::Accepted) rcfile = dselectdb.rcfile;
+    }
+    if ( !rcfile.isEmpty() ) {
+//     if (dlogin.exec()==QDialog::Accepted) {
+//         username = dlogin.username;
+//         userpassword = dlogin.password;
+           return true;
+//     } return false;
+    }
+    return false;
+   // return true;
+}
+*/
+
+
+/*!
+ * \en
+ *     \brief Return object string presentation.
+ * \_en
+ * \ru
+ *     \brief Возвращает текстовое представление бизнес объекта Ананаса
+ *
+ *     \param db - база данных бизнес объекта
+ *     \param uid - уникальный идентификатор бизнес объекта
+ *     \param oid - уникальный идентификатор типа данных, соответствующих бизнес объекту, как определено в метаданных.
+ * \_ru
+ */
+QString
+ANANAS_EXPORT
+ananas_objectstr( aDatabase *db, qulonglong uid, int oid )
+{
+       QString res = "";
+
+       //TODO: make this more faster
+       aCfgItem fto;
+       QString oclass;
+
+//     printf("objstr uid = %Ld\n", uid );
+       if ( !db ) return "<>";
+       if ( !oid ) oid = db->uidType( oid );
+       fto = db->cfg.find( oid );
+       if ( !fto.isNull() ) {
+               oclass = db->cfg.objClass( fto );
+//             printf("oid = %i, oclass = %s\n", oid, ( const char *) oclass );
+               if ( oclass == md_catalogue ) {
+                       aCatalogue cat( fto, db );
+                       cat.select( uid );
+                       if ( cat.selected() ) {
+                               res = cat.displayString();
+               }
+               }else if ( oclass == md_document ) {
+                       aDocument doc(fto, db);
+                       doc.select( uid );
+                       if( doc.selected() ){
+                               res = doc.displayString();
+                       }
+               }
+       }
+
+       return res;
+}
+
+
diff --git a/src/lib/ananas.h b/src/lib/ananas.h
new file mode 100644 (file)
index 0000000..b882181
--- /dev/null
@@ -0,0 +1,131 @@
+/****************************************************************************
+** $Id: ananas.h,v 1.3 2008/12/10 21:04:03 leader Exp $
+**
+** Header file of the Ananas Library of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/*! \ru
+ *\mainpage Проект Ананас. Справочное руководство по библиотеке ananaslib
+ *
+ *
+ * В Справочном руководстве приведено описание классов, составляющих ядро системы Ананас.
+ * Документ предназначен для использования в качестве Справочника по интерфейсу прикладного программирования Ананаса.
+ * Интерфейс предоставляет доступ к управлению метаданными Ананаса, данными, хранящимися в базе данных,
+ * прикладными объектами системы. Справочное руководство предназначено для программистов. Пользовательское
+ * описание системы Ананас содержится в Руководстве пользователя.
+ *
+ * \section intro_sec Введение
+ * Ананас - вольная платформа, обеспечивающая ускоренное создание приложений автоматизации учетной деятельности,
+ * бизнес процессов организаций и компаний, работающих в различных сферах деятельности.
+ * Библиотека ananaslib, являясь частью платформы Ананас, обеспечивает удобный и понятный доступ к реализованным
+ * в системе функциям, для программ на языке программирования С++. Настоящее справочное руководство содержит описание
+ * методов доступа.
+ *
+ * \section main_classes_sec Основные классы
+ * \subsection adocument_class_sec Класс aDocument
+ * Один из важных аспектов методологии работы Ананаса с данными - управление первичными учетными документами.
+ * Для отражения хозяйственных операций Ананас предусматривает их регистрацию с помощью электронных документов.
+ * Электронные документы могут иметь произвольную структуру, состоящую из набора полей и одной или нескольких
+ * табличных частей. Информация о структуре документов хранится в системе. Управление документами осуществляется
+ * через экземпляры класса aDocument.
+
+ * \subsection acatalog_class_sec Класс aCatalogue
+ * Ананас поддерживает ведение баз данных (картотек) произвольной структуры
+ * с возможностью классификации/разнесения элементов по иерархически
+ * организованным группам. Типичным примером использования этой возможности является ведение Каталога товаров,
+ * Справочника контрагентов, Реестра сотрудников. Унифицированный интерфейс доступа к таким базам данных (картотекам)
+ * обеспечивает класс aCatalogue.
+ *
+ * \subsection adocjournal_class_sec Класс aDocJournal
+ * Все электронные документы, хранящиеся в базе данных Ананаса, регистрируются системой в момент их создания в
+ * журнале документов. Для работы с журналом документов используется класс aDocJournal.
+ *
+ *
+ * \subsection airegister_class_sec Класс aIRegister, aARegister
+ * Ананас поддерживает ведение Регистров. Регисты служат для хронологической записи информации. В системе существует
+ * два типа регистров: информационные и накопительные. Накопительный, отличается от информационного поддержкой
+ * автоматически пересчитываемых остатков по разрезам учета. Для работы с информационными регистрами используется
+ * класс aIRegister. Для работы с накопительными - aARegister.
+ *
+ * \subsection acfg_class_sec Класс aCfg
+ * Ананас разработан с учетом требований адаптируемости к различным сферам учетной деятельности. Для этих целей
+ * поддерживается работа с произвольно настраиваемыми структурами данных. Такой подход требует хранения информации,
+ * описывающей структуры данных. Такую информацию принято называть метаданными. Для управления структурами данных и для
+ * работы с метаданными используется класс aCfg.
+ *
+ * \subsection aform_class_sec Класс aForm
+ * Все бизнес объекты Ананаса, атрибуты которых может редактировать пользователь, имеют хотя бы одну экранную
+ * форму, работая с которой, пользователь осуществляет изменение значений атрибутов бизнес объектов.
+ * Класс aForm предоставляет набор методов, предназначенных для использования Ананас.Скриптом модуля экранной формы
+ * бизнес объекта Ананаса. Проектируя и программируя пользовательский интерфейс (Presentation layer)
+ * бизнес схемы Ананаса разработчик имеет дело с объектами класса aForm и расположенными в них виджетами.
+ * \_ru
+ */
+
+#ifndef ANANAS_H
+#define ANANAS_H
+
+#include "acfg.h"
+#include "acfgrc.h"
+#include "ametadata.h"
+#include "adatabase.h"
+#include "asqlfield.h"
+#include "adatafield.h"
+#include "asqltable.h"
+#include "aform.h"
+#include "engine.h"
+#include "aobject.h"
+#include "awidget.h"
+#include "messageswindow.h"
+#include "adocjournal.h"
+#include "adocument.h"
+#include "acatalogue.h"
+#include "airegister.h"
+#include "aaregister.h"
+#include "atemplate.h"
+#include "areport.h"
+#include "aextension.h"
+#include "aextensionfactory.h"
+#include "adataexchange.h"
+//#include "dlogin.h"
+//#include "deditrc.h"
+//#include "dselectdb.h"
+#include "atime.h"
+#include "auser.h"
+#include "arole.h"
+#include "aservice.h"
+#include "atests.h"
+#include "afilter.h"
+
+#define ANANAS_LIBVERSION "0.9.6"
+extern const char ANANAS_EXPORT *ananas_libversion();
+//extern bool ANANAS_EXPORT ananas_login( QString &rcfile, QString &username, QString &userpassword );
+extern bool ANANAS_EXPORT ananas_login( QString &rcfile, QString &username, QString &userpassword, aDatabase *db=0, int appId = 0 );
+extern void ANANAS_EXPORT ananas_logout( aDatabase *db=0 );
+extern QString ANANAS_EXPORT ananas_objectstr( aDatabase *db, qulonglong uid, int oid );
+
+
+#endif
diff --git a/src/lib/ananasglobal.h b/src/lib/ananasglobal.h
new file mode 100644 (file)
index 0000000..b273646
--- /dev/null
@@ -0,0 +1,87 @@
+/****************************************************************************
+** $Id: ananasglobal.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Header file of the Ananas Library of Ananas
+** Designer and Engine applications
+**
+** Created : 20040901
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Linux Center (Orenburg).  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ANANASGLOBAL_H
+#define ANANASGLOBAL_H
+
+#include <qglobal.h>
+
+#define ANANAS_DEBUG
+
+#define ANANAS_VERSION_STRING "0.4.3"
+#define ANANAS_VERSION_MAJOR 0
+#define ANANAS_VERSION_MINOR 4
+#define ANANAS_VERSION_MICRO 3
+
+// helper macros
+#define ANANAS_MAKE_VERSION(maj, min, mic) (((maj) << 16) | ((min) << 8) | (mic))
+#define ANANAS_VERSION \
+    ANANAS_MAKE_VERSION(ANANAS_VERSION_MAJOR, ANANAS_VERSION_MINOR, ANANAS_VERSION_MICRO)
+
+// evaluate to true if this version is (maj, min, mic) at minimum
+#define ANANAS_IS_VERSION(maj, min, mic) \
+    (ANANAS_VERSION >= ANANAS_MAKE_VERSION(maj, min, mic))
+
+#if defined(Q_OS_WIN32) && !defined(ANANAS_NO_DLL)
+#  if defined(ANANAS_DLL)
+#    define ANANAS_EXPORT __declspec(dllexport)
+#  else
+#    define ANANAS_EXPORT __declspec(dllimport)
+#  endif
+#else
+#  define ANANAS_EXPORT
+#endif
+
+#ifdef _MSC_VER
+#define LLU_SPEC "%I64u"
+#else
+#define LLU_SPEC "%llu"
+#endif
+
+#if defined (ANANAS_DLL)
+#  define ANANAS_TEMPLATE_EXTERN
+#elif defined (Q_TEMPLATEDLL)
+#  define ANANAS_TEMPLATE_EXTERN Q_TEMPLATE_EXTERN
+#else
+#  define ANANAS_TEMPLATE_EXTERN
+#endif
+
+
+//#if defined(Q_ULLONG)
+#      define ANANAS_UID qulonglong
+#      define ANANAS_UID_VALUE( v ) v.toULongLong()
+//#error yes
+//#else
+//#    define ANANAS_UID unsigned int
+//#    define ANANAS_UID_VALUE( v ) v.toUInt()
+//#error no
+//#endif
+
+#endif
diff --git a/src/lib/arole.cpp b/src/lib/arole.cpp
new file mode 100644 (file)
index 0000000..7a0dd07
--- /dev/null
@@ -0,0 +1,423 @@
+/****************************************************************************
+** $Id: arole.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Role object implementation file of
+** Ananas application library
+**
+** Created : 20050527
+**
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include       "arole.h"
+#include       "auser.h"
+/*!
+ *     \en
+ *     Constructor.
+ *     \_en
+ *     \ru
+ *     Конструктор. Создает экземпляр роли и настраивает его на работу с заданным id.
+ *     \param roleId - идентификатор роли.
+ *     \param adb - ссылка на базу данных.
+ *     \_ru
+ */
+aRole::aRole( qulonglong roleId, aDatabase * adb ):aObject("",adb)
+{
+
+       initObject();
+       Select(roleId);
+}
+
+
+/*!
+ *     \en
+ *     Constructor.
+ *     \_en
+ *     \ru
+ *     Конструктор. Создает экземпляр роли. Для работы необходимо выбрать нужную роль с помощью функции Select( Q_ULLONG id ).
+ *     \param adb - ссылка на базу данных.
+ *     \_ru
+ */
+aRole::aRole( aDatabase * adb ):aObject("",adb)
+{
+
+       initObject();
+}
+
+
+
+
+ERR_Code
+aRole::initObject()
+{
+       ERR_Code err = aObject::initObject();
+       err = tableInsert( db_roles,"");
+       if(err) return err;
+       err = tableInsert( db_right_roles, md_right_roles );
+       return err;
+}
+
+
+
+/*!
+ *     \en
+ *     Sets role name.
+ *     \_en
+ *     \ru
+ *     Устанавливает имя роли.
+ *     \_ru
+ *     \param rname - \en role name \_en \ru имя роли \_ru
+ *     \return \en error code \_en \ru код ошибки \_ru
+*/
+ERR_Code
+aRole::SetName( const QString &rname )
+{
+       setSysValue( "name", rname );
+       return err_noerror;
+}
+
+
+/*!
+ *     \en
+ *     Gets role name.
+ *     \_en
+ *     \ru
+ *     Функция получения имени роли.
+ *     \_ru
+ *     \return \en role name \_en \ru имя роли \_ru
+*/
+QString
+aRole::GetName( )
+{
+
+       return sysValue( "name" ).toString();
+}
+
+
+ERR_Code
+aRole::Update()
+{
+       ERR_Code err = aObject::Update();
+       if ( !err ){
+               err = TableUpdate( md_right_roles );
+       }
+       return err;
+}
+
+
+
+/*!
+ *     \en
+ *     Sets primary table selected.
+ *     \_en
+ *     \ru
+ *     Устанавливает основную таблицу выбранной.
+ *     \_ru
+ *     \return \en error code \_en \ru код ошибки \_ru
+*/
+ERR_Code
+aRole::Select(  )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       QString flt = "";
+       if ( t->select( flt ) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+               }
+               else return err_notselected;
+       else return err_selecterror;
+       return err_noerror;
+}
+
+
+/*!
+ *     \en
+ *     Select role.
+ *     \_en
+ *     \ru
+ *     Выбирает роль с заданным идентификатором.
+ *     \_ru
+ *     \param id - \en role id \_en \ru id роли \_ru
+ *     \return \en error code \_en \ru код ошибки \_ru
+*/
+ERR_Code
+aRole::Select( qulonglong id )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       QString flt;
+       flt = QString("id=%1").arg(id);
+       if ( t->select( flt ) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+               }
+               else return err_notselected;
+       else return err_selecterror;
+       return err_noerror;
+}
+
+
+/*!
+ *     \en
+ *     Adds permission to role
+ *     \_en
+ *     \ru
+ *     Добавляет к роли право \a p
+ *     \_ru
+ *     \param p - \en permission \_en \ru право \_ru
+ *     \return \en error code \_en \ru код ошибки \_ru
+*/
+ERR_Code
+aRole::addPermission( aPermission p )
+{
+       aSQLTable *tg = table( md_right_roles );
+       if ( !tg ) return err_notable;
+       setSelected(true, md_right_roles);
+       qulonglong idg;
+       QSqlRecord* rec = tg->primeInsert(); // get edit buffer for table groups
+       idg = rec->value("id").toULongLong();
+       rec->setValue("id",idg );
+       rec->setValue("permission",p);
+       tg->insert(); // insert record
+       tg->update();
+return  err_noerror;
+}
+
+
+/*!
+ *     \en
+ *     Removs permission from role
+ *     \_en
+ *     \ru
+ *     Убирает у роли право \a p
+ *     \_ru
+ *     \param p - \en permission \_en \ru право \_ru
+ *     \return \en error code \_en \ru код ошибки \_ru
+*/
+ERR_Code
+aRole::delPermission( aPermission p )
+{
+/*     aSQLTable *tg = table( md_user_roles );
+       if (!tg ) return err_notable;
+       setSelected(true, md_right_roles);
+//     tg->select(parentId);
+//     setSelected(true,md_group);
+       Q_ULLONG idg;
+       QSqlRecord* rec = tg->primeInsert(); // get edit buffer for table groups
+       idg = rec->value("id").toULongLong();
+       //printf( "idg=%lu\n", idg );
+       rec->setValue("id",idg );
+       rec->setValue("permission",p);
+       tg->insert(); // insert record
+       tg->update();*/
+return  err_noerror;
+}
+
+
+/*!
+ *     \en
+ *     Check permission \a p.
+ *     \_en
+ *     \ru
+ *     Проверяет, есть ли у роли право \a p
+ *     \_ru
+ *     \param p - \en permission \_en \ru право \_ru
+ *     \return \en true, if role has perission \_en \ru true, если у роли есть право \_ru
+*/
+bool
+aRole::hasPermission( aPermission p )
+{
+       aSQLTable *tg = table( md_right_roles );
+       if (!tg ) return err_notable;
+       tg->select(QString("idr=%1").arg(sysValue("id").toULongLong()));
+       if( tg->first() )
+       {
+               return true;
+       }
+       else
+       {
+               return false;
+       }
+
+}
+
+
+
+/*!
+ *     \en
+ *     Adds user to role
+ *     \_en
+ *     \ru
+ *     Добавляет к пользователю данную роль.
+ *     \_ru
+ *     \param userId - \en user id \_en \ru идентификатор пользовыателя \_ru
+ *     \return \en error code \_en \ru код ошибки \_ru
+*/
+
+ERR_Code
+aRole::addUser( qulonglong userId )
+{
+       aUser *user = new aUser(userId, db);
+       user->addRole(sysValue("id").toULongLong());
+       delete user;
+return  err_noerror;
+}
+
+
+/*!
+ *     \en
+ *     Delete user from role
+ *     \_en
+ *     \ru
+ *     Удаляет у пользователя данную роль
+ *     \_ru
+ *     \param userId - \en user id \_en \ru идентификатор пользовыателя \_ru
+ *     \return \en error code \_en \ru код ошибки \_ru
+*/
+ERR_Code
+aRole::delUser( qulonglong userId )
+{
+       aUser *user = new aUser(userId, db);
+       user->delRole(sysValue("id").toULongLong());
+       delete user;
+return  err_noerror;
+}
+
+
+/*!
+ *     \en
+ *     Check user have role.
+ *     \_en
+ *     \ru
+ *     Проверяет, принадлежит ли пользователь к данной роли.
+ *     \_ru
+ *     \param userId - \en user id \_en \ru id пользователя \_ru
+ *     \return \en true, if role has user \_en \ru true, если у пользователя есть эта роль\_ru
+*/
+bool
+aRole::hasUser(qulonglong userId)
+{
+       aUser *user = new aUser(userId, db);
+       bool res;
+       if(user->hasRole(sysValue("id").toULongLong()))
+       {
+               res = true;
+       }
+       else
+       {
+               res =false;
+       }
+       delete user;
+       return res;
+}
+
+
+/*!
+ *     \en
+ *     Adds new pole.
+ *     \_en
+ *     \ru
+ *     Добавляет новую роль.
+ *     \_ru
+ */
+ERR_Code
+aRole::New(const QString &rname)
+{
+       aSQLTable *te = table();
+       if (!te) return err_notable;
+       QSqlRecord *rec;
+       qulonglong ide;
+       rec = te->primeInsert(); // get edit buffer for table elements
+       ide = rec->value("id").toULongLong();
+       rec->setValue("id",ide); // set defult values for all user fields = id
+       rec->setValue( "name", rname );
+       te->insert(); // insert edit buffer as new line in table
+       te->select(QString("id=%1").arg(ide),false); // set cursor to inserted record
+       te->first();
+       setSelected(true);
+       return err_noerror;
+}
+
+
+
+
+
+/*!
+ *     \en
+ *     Delete this role.
+ *     \_en
+ *     \ru
+ *     Удаляет эту роль. Не удаляет роль у пользователей.
+ *     \_ru
+ */
+ERR_Code
+aRole::Delete()
+{
+       aSQLTable * t = table();
+       qulonglong ide=0;
+       if ( !t ) return err_notable;
+       ide = t->sysValue("id").toULongLong();
+       if ( ide )
+       {
+               printf("ide=" LLU_SPEC "\n",ide);
+               t->primeDelete();
+               t->del();
+               setSelected( false );
+       }
+       else return err_notselected;
+       return err_noerror;
+}
+
+
+
+bool
+aRole::Next()
+{
+       return  aObject::Next( );  //return !groupSelect();
+       //else return false;
+}
+
+bool
+aRole::Prev()
+{
+       return  aObject::Prev( );  //return !groupSelect();
+//     else return false;
+}
+
+bool
+aRole::First()
+{
+       return  aObject::First( );  //return !groupSelect();
+       //else return false;
+}
+
+bool
+aRole::Last()
+{
+       return aObject::Last( ); //return !groupSelect();
+       //else return false;
+}
+
+
+
diff --git a/src/lib/arole.h b/src/lib/arole.h
new file mode 100644 (file)
index 0000000..3dff46d
--- /dev/null
@@ -0,0 +1,101 @@
+/****************************************************************************
+** $Id: arole.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Role object header file of
+** Ananas application library
+**
+** Created : 20050527
+**
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AROLE_H
+#define AROLE_H
+
+#include       "aobject.h"
+#include       "adatabase.h"
+#include       "acfg.h"
+//#include     "auser.h"
+
+//class aUser;
+//class aPermission;
+//class aObject;
+
+
+
+/*!
+ *     \en
+ *     Not visual object used for working with catalogues in database.
+ *     Used as interface between database and script or wObjects*
+ *     \_en
+ * \ru
+ *     \brief Класс предоставляет методы управления ролями. Не используется в настоящее время.
+ *     Наследует aObject.
+ *
+ * \_ru
+*/
+class  ANANAS_EXPORT aRole: public aObject
+{
+       Q_OBJECT
+public:
+
+       aRole();
+       aRole(qulonglong roleId, aDatabase * adb);
+       aRole(aDatabase * adb);
+       virtual ERR_Code initObject();
+
+//public slots:
+
+       virtual ERR_Code New(const QString &name);
+
+       virtual ERR_Code Delete();
+       virtual ERR_Code Update();
+       virtual ERR_Code Select();
+       virtual ERR_Code Select(qulonglong id);
+
+       virtual ERR_Code addPermission( aPermission );
+       virtual ERR_Code delPermission( aPermission );
+       virtual bool hasPermission( aPermission );
+
+       virtual ERR_Code addUser( qulonglong userId );
+       virtual ERR_Code delUser( qulonglong userId );
+
+//     QValueList< aUser *> getUsers( bool assigned);
+
+       bool hasUser( qulonglong userId);
+
+       virtual ERR_Code SetName( const QString & );
+       virtual QString GetName();
+
+       //virtual ERR_Code setLogin( const QString & );
+       //virtual ERR_Code setFirstName( const QString & );
+       //virtual ERR_Code setLastName( const QString & );
+
+//irtual Q_ULLONG getUserId( const QString &login, const QString &password );
+//irtual ERR_Code getRoles(QValueList<aRole> *lst);
+       bool First();
+       bool Next();
+       bool Last();
+       bool Prev();
+};
+
+
+#endif// AROLE_H
diff --git a/src/lib/aservice.cpp b/src/lib/aservice.cpp
new file mode 100644 (file)
index 0000000..85433f0
--- /dev/null
@@ -0,0 +1,547 @@
+/****************************************************************************
+** $Id: aservice.cpp,v 1.2 2008/11/08 20:16:35 leader Exp $
+**
+** Service functions source file of
+** Ananas application library
+**
+** Created : 20050425
+**
+** Copyright (C) 2003-2006 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include       "qsettings.h"
+#include       "aservice.h"
+#include       "alog.h"
+#include       "amoney.h"
+#include       <qdir.h>
+#include       <math.h>
+
+
+/*!
+ *\~english
+ *     Converted double currency value to string representation (ru currency).
+ *\~russian
+ *     Конвертирует валюту, записанную в виде десятичного числа в ее текстовое представление.
+ *\~
+ *     \param rubli - \~english Value to convertions \~russian  Значение для конвертации \~
+ *     \return - \~english Converted value \~russian Сконвертированное значение \~
+ *     \see parts2money(Q_ULLONG rubli, unsigned int kopeyki, bool positive)
+ *     \see part2string(unsigned int st3, unsigned int st2, unsigned int st1, int stepen)
+ *     \see convertNumber2MoneyFormat(double number)
+*/
+QString
+aService::number2money(        double rubli,
+                       bool need_kopeyki,
+                       bool male,
+                       const QString &end1,
+                       const QString &end2,
+                       const QString &end3)
+{
+       bool neg = rubli<0;
+       //printf("chislo=%f\n",rubli);
+       if(neg)
+       {
+               rubli = -rubli;
+       }
+       qulonglong r = QVariant(rubli).toULongLong();
+       double tmp = rubli-r;
+
+       uint kop;
+#ifdef Q_OS_UNIX
+       kop = round(tmp*100.0);
+#else
+       kop = tmp * 100.0;
+#endif
+       return parts2money(r,kop, need_kopeyki, !neg, male, end1, end2, end3);
+}
+
+
+/**
+ * \ru
+ *             \brief  Конвертирует числовое представление денег в пропись с учетом указанной валюты.
+ *             \param amount - сумма денег для преобразование в пропись.
+ *             \param currency - строка с обозначением валюты. Допустимые значения: "RUR" - рубль, "USD" - доллар, "EUR" - евро.
+ *             \returns значение суммы прописью.
+ * \_ru
+ */
+QString
+aService::number2money(         QString currency, double amount ) {
+       AMoney* money = new AMoney( amount, currency );
+       return money->toText();
+}
+
+
+
+/*!
+ *\~english
+ *     Converted currency value to string representation (ru currency).
+ *\~russian
+ *     Конвертирует валюту, записанную в виде рублей и копеек в ее текстовое представление.
+ *\~
+ *     \return - \~english Converted value \~russian Сконвертированное значение \~
+ *     \see number2money(double rubli)
+ *     \see part2string(unsigned int st3, unsigned int st2, unsigned int st1, int stepen)
+*/
+QString
+aService::parts2money(qulonglong rubli,
+                        unsigned int kopeyki,
+                        bool need_kopeyki,
+                        bool positive,
+                        bool male,
+                        const QString &end1,
+                        const QString &end2,
+                        const QString &end3)
+{
+//     if(cur!=ru) return QString("%1 dollars %2 cents").arg(rubli).arg(kopeyki);
+       QString chislo = (QString("%1").arg(rubli));
+       int len = chislo.length();
+       //printf("length=%d\n",len);
+       int count=0;
+       int a,b,c;
+       int stepen=(len-1)/3;
+       int offset=(len%3);
+       if(offset) offset = 3-offset;
+       //printf("offset=%d\n",offset);
+       QString res = "";
+       bool has_sum=false;
+       if(!positive) res+="минус ";
+       while(count<len)
+       {
+               a=b=c=0;
+               if(offset<=0)
+               {
+                       a = chislo.at(count++).digitValue();
+               }
+               if(count<len)
+               {
+                       if(offset<=1)
+                       {
+                               b = chislo.at(count++).digitValue();
+                       }
+               }
+               if(count<len)
+               {
+                       if(offset<=2)
+                       {
+                               c = chislo.at(count++).digitValue();
+                       }
+               }
+//             printf("a=%d, b=%d, c=%d, stepen=%d\n",a,b,c,stepen);
+               if(a==0 && b==0 && c==0)
+               {
+                       if(stepen==0 && has_sum)
+                       {
+                               res+=part2string(a,b,c,stepen--,male,end1,end2,end3);
+                       }
+                       else
+                       {
+                               if(stepen==0)
+                               {
+                                       res+=QString("ноль %1").arg(end1);
+                               }
+                               else
+                               {
+                                       stepen--;
+                               }
+                       }
+               }
+               else
+               {
+                       has_sum=true;
+                       res+=part2string(a,b,c,stepen--,male,end1,end2,end3);
+               }
+               offset=0;
+       }
+       if(need_kopeyki)
+       {
+               res+=part2string(0,kopeyki/10,kopeyki%10,-1,false,"копеек","копейка","копейки");
+       }
+       res = res.stripWhiteSpace();
+       res = res.replace(0,1,res.at(0).upper());
+       return res;
+}
+
+
+/*!
+ *\~english
+ *     Convertions implementation.
+ *\~russian
+ *     Реализует конвертацию в рубли и копейки. На вход подаются три числа и степень,
+ *     в которую необходимо их возвести. Поддерживается суммы до 999 миллиардов.
+ *     Для использования необходимо число разбить на группы чисел по 3 числа в группе и
+ *     передать их этой функции, после чего собрать результат в одну строку.
+ *     Функция добавляет в конце строки один пробел
+ *\~
+ *     \return - \~english Converted value \~russian Сконвертированное значение для переданных чисел\~
+ *     \see number2money(double rubli)
+ *     \see parts2money(Q_ULLONG rubli, unsigned int kopeyki, bool positive)
+*/
+QString
+aService::part2string(unsigned int st3,
+                        unsigned int st2,
+                        unsigned int st1,
+                        int stepen,
+                        bool male,
+                        const QString &end1,
+                        const QString &end2,
+                        const QString &end3 )
+{
+       QString part1, part2, part3, suff;
+       QMap<int, QString> mapMaleCur;
+       QMap<int, QString> mapFeMaleCur;
+       QMap<int, QString> mapHungred;
+       QMap<int, QString> mapDec;
+
+       mapFeMaleCur[0]="";
+       mapFeMaleCur[1]="одна";
+       mapFeMaleCur[2]="две";
+       mapFeMaleCur[3]="три";
+       mapFeMaleCur[4]="четыре";
+       mapFeMaleCur[5]="пять";
+       mapFeMaleCur[6]="шесть";
+       mapFeMaleCur[7]="семь";
+       mapFeMaleCur[8]="восемь";
+       mapFeMaleCur[9]="девять";
+
+       mapFeMaleCur[10]="копеек";
+       mapFeMaleCur[11]="копейка";
+       mapFeMaleCur[12]= mapFeMaleCur[13]= mapFeMaleCur[14]="копейки";
+       mapFeMaleCur[15]= mapFeMaleCur[16]= mapFeMaleCur[17]= mapFeMaleCur[18]= mapFeMaleCur[19]="копеек";
+
+       mapFeMaleCur[20]="тысяч";
+       mapFeMaleCur[21]="тысяча";
+       mapFeMaleCur[22]= mapFeMaleCur[23]= mapFeMaleCur[24]="тысячи";
+       mapFeMaleCur[25]= mapFeMaleCur[26]= mapFeMaleCur[27]= mapFeMaleCur[28]= mapFeMaleCur[29]="тысяч";
+
+       mapMaleCur[0]="";
+       mapMaleCur[1]="один";
+       mapMaleCur[2]="два";
+       mapMaleCur[3]="три";
+       mapMaleCur[4]="четыре";
+       mapMaleCur[5]="пять";
+       mapMaleCur[6]="шесть";
+       mapMaleCur[7]="семь";
+       mapMaleCur[8]="восемь";
+       mapMaleCur[9]="девять";
+
+       if(male==true)
+       {
+               mapMaleCur[10]=end1; //"рублей";
+               mapMaleCur[11]=end2;//"рубль";
+               mapMaleCur[12]= mapMaleCur[13]= mapMaleCur[14]=end3;//"рубля";
+               mapMaleCur[15]= mapMaleCur[16]= mapMaleCur[17]= mapMaleCur[18]= mapMaleCur[19]=end1;//"рублей";
+       }
+       else
+       {
+               mapFeMaleCur[10]= end1;//"копеек";
+               mapFeMaleCur[11]= end2;//"копейка";
+               mapFeMaleCur[12]= mapFeMaleCur[13]= mapFeMaleCur[14]=end3;//"копейки";
+               mapFeMaleCur[15]= mapFeMaleCur[16]= mapFeMaleCur[17]= mapFeMaleCur[18]= mapFeMaleCur[19]=end1;//"копеек";
+       }
+       mapMaleCur[30]="миллионов";
+       mapMaleCur[31]="миллион";
+       mapMaleCur[32]= mapMaleCur[33]= mapMaleCur[34]="миллиона";
+       mapMaleCur[35]= mapMaleCur[36]=mapMaleCur[37]=mapMaleCur[38]=mapMaleCur[39]="миллионов";
+       mapMaleCur[40]="миллиардов";
+       mapMaleCur[41]="миллиард";
+       mapMaleCur[42]= mapMaleCur[43]= mapMaleCur[44]="миллиарда";
+       mapMaleCur[45]= mapMaleCur[46]=mapMaleCur[47]=mapMaleCur[48]=mapMaleCur[49]="миллиардов";
+       mapHungred[0]="";
+       mapHungred[1]="сто";
+       mapHungred[2]="двести";
+       mapHungred[3]="триста";
+       mapHungred[4]="четыреста";
+       mapHungred[5]="пятьсот";
+       mapHungred[6]="шестьсот";
+       mapHungred[7]="семьсот";
+       mapHungred[8]="восемьсот";
+       mapHungred[9]="девятьсот";
+
+       mapDec[0]="десять";
+       mapDec[1]="одиннадцать";
+       mapDec[2]="двенадцать";
+       mapDec[3]="тринадцать";
+       mapDec[4]="четырнадцать";
+       mapDec[5]="пятнадцать";
+       mapDec[6]="шестнадцать";
+       mapDec[7]="семнадцать";
+       mapDec[8]="восемнадцать";
+       mapDec[9]="девятнадцать";
+       mapDec[10]="";
+       mapDec[11]="";
+       mapDec[12]="двадцать";
+       mapDec[13]="тридцать";
+       mapDec[14]="сорок";
+       mapDec[15]="пятьдесят";
+       mapDec[16]="шестьдесят";
+       mapDec[17]="семьдесят";
+       mapDec[18]="восемьдесят";
+       mapDec[19]="девяносто";
+
+
+       if(stepen==1 || stepen==-1 || stepen==0 && male==false)
+       {
+               part1 = mapHungred[st3];
+               part2 = mapDec[10+st2];
+               int mult = 20;
+               if(stepen==-1) mult=10;
+               if(stepen==0) mult=10;
+               switch(st2)
+               {
+               case 0:
+                       part3=mapFeMaleCur[st1];
+                       suff=mapFeMaleCur[st1+mult];
+                       break;
+               case 1:
+                       part3=mapDec[st1];
+                       suff=mapFeMaleCur[9+mult];
+                       break;
+               default:
+                       part3=mapFeMaleCur[st1];
+                       suff=mapFeMaleCur[st1+mult];
+                       break;
+               }
+               if(stepen==-1 && st3==0 && st2==0 && st1==0)
+               {
+                       part3="ноль";
+               }
+       }
+       else
+       {
+               part1 = mapHungred[st3];
+               part2 = mapDec[10+st2];
+               int mult = 10*(stepen+1);
+               switch(st2)
+               {
+               case 0:
+                       part2="";
+                       part3=mapMaleCur[st1];
+                       suff=mapMaleCur[st1+mult];
+                       break;
+               case 1:
+                       part2="";
+                       part3=mapDec[st1];
+                       suff=mapMaleCur[9+mult];
+                       break;
+               default:
+                       part3=mapMaleCur[st1];
+                       suff=mapMaleCur[st1+mult];
+                       break;
+               }
+       }
+       if(stepen==-1) // если убрать этот блок, копейки будут выводиться прописью
+       {
+               part1 = part2 ="";
+               part3 = QString("%1%2").arg(st2).arg(st1);
+       }
+return part1+" "+part2 +" "+part3+" "+suff+" ";
+}
+
+
+/*!
+ *\~english
+ *     Converted date from ISO format (yyyy-mm-dd) to local format.
+ *\~russian
+ *     Конвертирует дату из ISO формата в локальный формат.
+ *\~
+ *     \param ISODate - \~english Date to convertion \~russian  Дата для конвертации \~
+ *     \return - \~english Converted value \~russian Сконвертированное значение \~
+*/
+QString
+aService::Date2Print(const QString &ISODate)
+{
+       QString res;
+       QDate dat = QDate::fromString(ISODate, Qt::ISODate);
+       res = dat.toString(Qt::LocalDate);
+       return res;
+}
+
+
+/*!
+ *\~english
+ *     Writes window size to config file.
+ *\~russian
+ *     Пишет размер окна в конфиг.
+ *\~
+ *     \param windowSize - \~english Rect of window geometry \~russian Прямоугольник, представляющий окно \~
+ *     \param mdname - \~english Unical name \~russian Имя окна (должно быть уникальным) \~
+ *     \see loadSizeFromConfig(const QString &mdname)
+*/
+void
+aService::saveSize2Config(QRect windowSize, const QString &mdname)
+{
+       QSettings settings;
+       //--settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
+       //--settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
+       settings.beginGroup(QString("/config/%1").arg(mdname));
+       settings.writeEntry("/left", windowSize.left());
+       settings.writeEntry("/top", windowSize.top());
+       settings.writeEntry("/right", windowSize.right());
+       settings.writeEntry("/bottom", windowSize.bottom());
+}
+
+
+/*!
+ *\~english
+ *     Reads window size from config file.
+ *\~russian
+ *     Читает размер окна из конфиг.
+ *\~
+ *     \param mdname - \~english       Window name.
+ *                                     If config not contains info about mdname,
+ *                                     return default value (400x300)
+ *                     \~russian       Имя окна.
+ *                                     Если конфиг не содержит информации об окне с таким именем,
+ *                                     возвращает значение по умолчанию (400x300) \~
+ *     \return - \~english Window size \~russian Размер окна \~
+ *     \see saveSize2Config(QRect windowSize, const QString &mdname)
+ *
+*/
+QRect
+aService::loadSizeFromConfig(const QString &mdname)
+{
+       QSettings settings;
+       //--settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
+       //--settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
+       settings.beginGroup(QString("/config/%1").arg(mdname));
+       int l = settings.readNumEntry("/left", 0);
+       int t = settings.readNumEntry("/top", 0);
+       int r = settings.readNumEntry("/right", 400);
+       int b = settings.readNumEntry("/bottom", 300);
+       return QRect(l,t,r,b);
+}
+
+
+/*!
+ *\~english
+ *     Reads variable from config file.
+ *\~russian
+ *     Читает переменную из конфига.
+ *\~
+ *     \param name - \~english variable name to read \~russian Имя переменной для чтения \~
+ *     \param ok (out) -       \~english true if success, false otherwise
+                               \~russian true если успешно иначе false \~
+ *     \return - \~english Variable value \~russian Значение переменной \~
+ *     \see writeConfigVariable(const QString &name, const QString &value)
+ *     \see loadSizeFromConfig(const QString &mdname)
+ *     \see saveSize2Config(QRect windowSize, const QString &mdname)
+*/
+QString
+aService::readConfigVariable(const QString &name, bool *ok)
+{
+       QSettings settings;
+       //--settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
+       //--settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
+       settings.beginGroup(QString("/config/variables"));
+       return settings.readEntry(QString("/%1").arg(name), "", ok);
+}
+
+
+/*!
+ *\~english
+ *     Writes variable to config file.
+ *\~russian
+ *     Пишет переменную в конфиг.
+ *\~
+ *     \param name - \~english Variable name \~russian Имя переменной \~
+ *     \param value - \~english Variable value \~russian Значение переменной \~
+ *     \see loadSizeFromConfig(const QString &mdname)
+ *     \see saveSize2Config(QRect windowSize, const QString &mdname)
+ *     \see readConfigVariable(const QString &name, bool *ok)
+*/
+void
+aService::writeConfigVariable(const QString &name, const QString &value)
+{
+       QSettings settings;
+       //--settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
+       //--settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
+       settings.beginGroup(QString("/config/variables"));
+       settings.writeEntry(QString("/%1").arg(name), value);
+}
+
+/*!
+ *\~english
+ *     Converted number to money format (publi.kk).
+ *\~russian
+ *     Конвертирует число с плавающей точкой в числовой денежный формат (рубли.кк)
+ *\~
+ *     \param number - \~english number to convertion \~russian число для конвертации \~
+ *     \return - \~english Converted value \~russian Сконвертированное значение \~
+*/
+QString
+aService::convertNumber2MoneyFormat(double number)
+{
+       return QString("%1").arg(number,0,'f',2);
+}
+
+bool
+aService::copyFile(const QString& srcFileName, const QString& destFileName, bool replaceIfExists)
+{
+
+       QFile srcFile(srcFileName);
+       QFile destFile(destFileName);
+
+       if(!srcFile.exists())
+       {
+               aLog::print(aLog::Error, QObject::tr("aService copy: source file %1 not exist").arg(srcFileName));
+               return false;
+       }
+       if(destFile.exists() && !replaceIfExists)
+       {
+               aLog::print(aLog::Error, QObject::tr("aService copy: replace destination file %1").arg(destFileName));
+               return false;
+       }
+
+       if(!srcFile.open( QIODevice::ReadOnly ))
+       {
+               aLog::print(aLog::Error, QObject::tr("aService copy: source file %1 open for read error").arg(srcFileName));
+               return false;
+       }
+       if(!destFile.open( QIODevice::WriteOnly))
+       {
+               aLog::print(aLog::Error, QObject::tr("aService copy: destination file %1 open for write error").arg(destFileName));
+               return false;
+       }
+
+       const int BUFFER_SIZE = 1024;
+       Q_INT8 buffer[BUFFER_SIZE];
+       QDataStream srcStream(&srcFile);
+       QDataStream destStream(&destFile);
+
+       while(!srcStream.atEnd())
+       {
+               int i = 0;
+               while(!srcStream.atEnd() && i < BUFFER_SIZE)
+               {
+                       srcStream >> buffer[i];
+                       i++;
+               }
+               for(int k = 0; k < i; k++)
+               {
+                       destStream << buffer[k];
+               }
+       }
+       srcFile.close();
+       destFile.close();
+
+       aLog::print(aLog::Info, QObject::tr("aService copy file %1 to %2 ok").arg(srcFileName).arg(destFileName));
+       return true;
+}
diff --git a/src/lib/aservice.h b/src/lib/aservice.h
new file mode 100644 (file)
index 0000000..46a74f6
--- /dev/null
@@ -0,0 +1,86 @@
+/****************************************************************************
+** $Id: aservice.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Service functions header file of
+** Ananas application library
+**
+** Created : 20050425
+**
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ASERVICE_H
+#define ASERVICE_H
+
+//#include     <qmainwindow.h>
+#include       "ananas.h"
+
+/*!
+ * \~english
+ *     Class contains static functions for various destination: convertation, work with config file etc.
+ * \~russian
+ *     \brief Класс содержит статические методы различного назначения: конвертации, работы с конфигом и т.д.
+ *     Не наследует свойства других классов.
+ *
+ *     Врапперы для некоторых функций для работы со скриптами есть в классе aForm
+ * \~
+ *     \see aForm aTests
+ */
+class ANANAS_EXPORT aService
+{
+       public:
+
+       static QString  number2money(   double rubli,
+                                       bool need_kopeyki=true,
+                                       bool male=true,
+                                       const QString &end1="рублей",
+                                       const QString &end2="рубль",
+                                       const QString &end3="рубля");
+       static QString  number2money( QString currency, double rubli );
+       static QString  parts2money(    qulonglong rubli,
+                                       unsigned int kopeyki,
+                                       bool need_kopeyki=true,
+                                       bool positive = true,
+                                       bool male=true,
+                                       const QString &end1="рублей",
+                                       const QString &end2="рубль",
+                                       const QString &end3="рубля");
+       static QString  Date2Print(const QString &ISODate);
+       static void     saveSize2Config(QRect size, const QString &mdname);
+       static QRect    loadSizeFromConfig(const QString &mdname);
+       static QString  readConfigVariable(const QString &name, bool *ok);
+       static void     writeConfigVariable(const QString &name, const QString &value);
+       static QString  convertNumber2MoneyFormat(double number);
+       static bool copyFile(const QString& srcFileName, const QString& destFileName, bool replaceIfExists=true);
+       protected:
+
+       static QString part2string(     unsigned int st3,
+                                       unsigned int st2,
+                                       unsigned int st1,
+                                       int stepen,
+                                       bool male,
+                                       const QString &end1,
+                                       const QString &end2,
+                                       const QString &end3);
+       private:
+       aService();
+};
+#endif// AREPORT_H
diff --git a/src/lib/asqlfield.cpp b/src/lib/asqlfield.cpp
new file mode 100644 (file)
index 0000000..d92a3cd
--- /dev/null
@@ -0,0 +1,155 @@
+/****************************************************************************
+** $Id: asqlfield.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Code file of the Ananas database field of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qobject.h>
+#include "acfg.h"
+#include "asqlfield.h"
+
+/*!
+Create Ananas database field contaner.
+*/
+/*
+aField::aField(aCfg *newmd, aCfgItem newcontext )
+:QObject( 0, "aField" ) // name )
+{
+       md = newmd;
+       context = newcontext;
+//     fType = type;
+       fTName = "";
+//     field = new QSqlField( fTName );
+       fSys = false;
+}
+*/
+
+/*!
+Create Ananas field contaner.
+*/
+/*
+aField::aField(const QString &name, const QString &type )
+:QObject( 0, "aField" )
+{
+       QString t;
+
+       fSys = true;
+       Name = name;
+//     Type  = type;
+       aType = ( (const char *) type.section(" ",0,0).upper() )[0];
+       Width = type.section(" ",1,1).toInt();
+       Dec = type.section(" ",2,2).toInt();
+       switch ( aType ){
+       case 'C':
+               Type = QVariant::String;
+               field = QString("");
+               break;
+       case 'N':
+               Type = QVariant::Double;
+               field = ( double ) 0.0;
+       default:
+               Type = QVariant::Invalid;
+       }
+}
+*/
+
+/*!
+Destroy object.
+*/
+
+//aField::~aField()
+//{
+//     delete field;
+//}
+
+
+/*!
+Return pointer to asociated sql field.
+*/
+//QSqlField *
+//aField::sqlField(){
+//     return field;
+//}
+
+
+//QVariant
+//aField::value()
+//{
+//     return field;
+//}
+
+
+//void
+//aField::setValue( const QVariant &value)
+//{
+//     field = value;
+//}
+
+
+aSQLField::aSQLField( aCfg *newmd, aCfgItem newcontext )
+: QObject( 0, "aSQLField" )
+{
+
+}
+
+
+aSQLField::aSQLField( const QString &name, const QString &type, const QString &tname )
+: QObject( 0, "aSQLField" )
+{
+       tName = tname;
+}
+
+
+aSQLField::~aSQLField()
+{
+
+}
+
+
+QSqlField *
+aSQLField::sqlField()
+{
+       return field;
+}
+
+
+QVariant
+aSQLField::value()
+{
+       return "";
+}
+
+
+void
+aSQLField::setValue( const QVariant &value)
+{
+
+}
+QWidget *
+aSQLField::editor()
+{
+       return NULL;
+}
diff --git a/src/lib/asqlfield.h b/src/lib/asqlfield.h
new file mode 100644 (file)
index 0000000..ac0c166
--- /dev/null
@@ -0,0 +1,85 @@
+/****************************************************************************
+** $Id: asqlfield.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Header file of the Ananas database field of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ASQLFIELD_H
+#define ASQLFIELD_H
+#include <qsqlfield.h>
+#include "acfg.h"
+
+/*
+class  ANANAS_EXPORT aField : public QObject //SqlField
+{
+       Q_OBJECT
+public:
+//     enum fieldType ( Unknown, Numberic, Character, Date, Object );
+       aCfgItem context;
+       long id;
+       aCfg *md;
+       bool fSys;
+       int Width, Dec;
+       QString Name;
+       char aType;
+       QVariant::Type Type;
+
+
+//     aField( aCfg *newmd, aCfgItem newcontext );
+       aField( const QString &fname = QString::null, const QString &ftype = QString::null );
+       ~aField();
+
+//     QSqlField *sqlField();
+public slots:
+       virtual QVariant value();
+       virtual void setValue( const QVariant &value);
+private:
+       QVariant field;
+};
+*/
+
+class  ANANAS_EXPORT aSQLField: public QObject //aField
+{
+       Q_OBJECT
+public:
+       QString tName;
+       QWidget *editorWidget;
+
+       aSQLField( aCfg *newmd, aCfgItem newcontext );
+       aSQLField( const QString &name = QString::null, const QString &type = QString::null, const QString &tname = QString::null );
+       ~aSQLField();
+
+       QSqlField *sqlField();
+       virtual QWidget *editor();
+
+public slots:
+       virtual QVariant value();
+       virtual void setValue( const QVariant &value);
+private:
+       QSqlField *field;
+};
+
+#endif
diff --git a/src/lib/asqltable.cpp b/src/lib/asqltable.cpp
new file mode 100644 (file)
index 0000000..8d5ba35
--- /dev/null
@@ -0,0 +1,1111 @@
+/****************************************************************************
+** $Id: asqltable.cpp,v 1.3 2008/11/09 21:09:11 leader Exp $
+**
+** Code file of the Ananas database table of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+//#include <stream.h>
+
+#include "asqltable.h"
+#include <qdatetime.h>
+//Added by qt3to4:
+#include <QSqlError>
+#include "adatabase.h"
+#include <q3sqlcursor.h>
+#include <Q3SqlFieldInfo>
+
+#include "acatalogue.h"
+#include "adocument.h"
+#include "aaregister.h"
+#include "alog.h"
+
+/*!
+ *     \~english
+ *     Constructor
+ *     \~russian
+ *     Создает таблицу доступа к базе данных, позволяющую работать с одной
+ *     sql таблицей или одним sql представлением (view).
+ *     \param context - объект метаданных, который описывает таблицу.
+ *     \param adb - ссылка на объект базы данных, которой
+ *     принадлежит sql таблица.
+ *     \~
+ */
+aDataTable::aDataTable( aCfgItem context, aDatabase *adb )
+:Q3SqlCursor( QString::null, false, *adb->db() )
+{
+       db = adb;
+       md = &db->cfg;
+       mdobjId = 0;
+       tableName = db->tableDbName( db->cfg, context, &mdobjId );
+       if ( !tableName.isEmpty() ) {
+               setName( tableName, true );
+               init (context, adb );
+       }
+       selected = false;
+       p_cat.setAutoDelete ( true );
+       p_reg.setAutoDelete ( true );
+       p_doc.setAutoDelete ( true );
+}
+
+
+
+/*!
+ *     \~english
+ *     Constructor
+ *     \~russian
+ *     Создает таблицу доступа к базе данных, позволяющую работать с одной
+ *     sql таблицей или одним sql представлением (view).
+ *     \param tname - имя sql таблицы в базе данных
+ *     \param adb - ссылка на объект базы данных, которой
+ *     принадлежит sql таблица.
+ *     \~
+ *
+ */
+aDataTable::aDataTable( const QString &tname, aDatabase *adb )
+:Q3SqlCursor( tname, true, *adb->db() )
+{
+       db = adb;
+       md = &db->cfg;
+       tableName = tname;
+       mdobjId = 0;
+       selected = false;
+       p_cat.setAutoDelete ( true );
+       p_reg.setAutoDelete ( true );
+       p_doc.setAutoDelete ( true );
+
+}
+
+/*!
+ *     \~english
+ *     Destructor
+ *     \~russian
+ *     Деструктор
+ *     \~
+ *
+ */
+aSQLTable::~aSQLTable()
+{
+//     delete p_reg;
+//     delete p_cat;
+       p_reg.clear();
+       p_cat.clear();
+       p_doc.clear();
+}
+
+/*!
+ *     \~english
+ *     Inits table object.
+ *     \~russian
+ *     Инициализирует объект.
+ *     \see setObject()
+ *     \param context - объект метаданных, который описывает таблицу.
+ *     \param adb - ссылка на объект базы данных, которой
+ *     принадлежит sql таблица.
+ *     \~
+ */
+void
+aDataTable::init( aCfgItem context, aDatabase *adb )
+{
+       db = adb;
+       fnames.clear();
+       fnames.setAutoDelete( true );
+       userFilter.clear();
+       userFilter.setAutoDelete( true );
+       setObject( context );
+
+}
+
+
+
+/*!
+ *     \~english
+ *     Sets md object to table.
+ *     \~russian
+ *     Задает объект метаданных для таблицы.
+ *     Заполняет внутренние объекты именами полей для последующего использования в
+ *     функциях SetValue() и Value(), добавляет информацию о них в sql курсор.
+ *     В случае, если добавляется накопительный регистр, к объетку добавляются также виртуальные поля - ресурсы регистра
+ *     После вызова этой функции с таблицей можно начинать работу.
+ *     \param context - объект метаданных, который описывает таблицу.
+ *     \~
+ */
+void
+aDataTable::setObject( aCfgItem context )
+{
+       aCfgItem cobj, parent;
+       parent = obj = context;
+
+
+       mdobjId = md->id(obj);
+       while ( !mdobjId )
+       {
+               parent = md->parent(parent);
+               mdobjId = md->id(parent);
+       }
+       if ( context.isNull() )
+       {
+               aLog::print(aLog::Error,QObject::tr("aDataTable try set mdobject to null"));
+               return;
+       }
+       mapCat.clear();
+       mapDoc.clear();
+       mapReg.clear();
+       mapDim.clear();
+       mapSum.clear();
+       //TODO:  test to memory leak
+       p_cat.clear();
+       p_reg.clear();
+       p_doc.clear();
+//     printf("before delete p_cat\n");
+//     if(p_cat)
+       //delete p_cat;
+
+//     p_cat.clear();
+//     printf("after delete p_cat\n");
+//     if(p_reg)
+       //delete p_reg;
+//     p_reg.clear();
+       if(md->objClass(context) == md_field && md->objClass(md->parent(context))== md_dimensions)
+       {
+               insertFieldInfo(context,false);
+               aCfgItem res;
+               aCfgItem ress = md->findChild(md->parent(md->parent(context)),md_resources);
+               uint n = md->count( ress, md_field );
+               for ( uint i = 0; i < n; i++ )
+               {
+                       res = md->find( ress, md_field, i );
+                       insertFieldInfo(res,false);
+               }
+       }
+       uint n = md->count( context, md_field );
+       for ( uint i = 0; i < n; i++ )
+       {
+               cobj = md->find( context, md_field, i );
+               insertFieldInfo(cobj);
+
+       }
+
+//     r = *this;
+}
+
+
+/*!
+ *     \~english
+ *     Appends info about field to object.
+ *     \~russian
+ *     Добавляет информацию о поле к объекту.
+ *     \param obj - объект метаданных, который описывает поле.
+ *     \param calculatd - указывает будет ли поле вычисляемым.
+ *     \~
+ */
+void
+aSQLTable::insertFieldInfo(aCfgItem cobj, bool calculated)
+{
+       QString fname, fdbname, objt;//, fid;
+       int fid ;
+
+       if ( !cobj.isNull() )
+       {
+               fid = md->id(cobj);
+               fname = md->attr(cobj, mda_name);
+               objt = md->attr( cobj, mda_type ).upper();
+                       fdbname = QString("uf%1").arg( fid );
+                        if ( objt[0]=='O' )
+                       {
+                               fnames.insert( fname, new QString(fdbname) );
+                               fdbname = QString("text_uf%1").arg( fid );
+                               append( Q3SqlFieldInfo( fdbname, QVariant::String ) );
+                            //   setGenerated( fdbname, false );
+                               setCalculated( fdbname, calculated );
+                               int ftid = objt.section(" ", 1, 1 ).toInt();
+                               aCfgItem fto = md->find( ftid );
+                               if ( !fto.isNull() )
+                               {
+                                       if ( md->objClass( fto ) == md_catalogue )
+                                       {
+                                               mapCat[fid] = fto;
+                                       }
+                                       if ( md->objClass( fto ) == md_document )
+                                       {
+                                               mapDoc[fid] = fto;
+                                       }
+                               }
+                        }
+                       else
+                        if ( objt[0]==' ' )
+                       {
+                               fdbname = QString("text_uf%1").arg( fid );
+                               append( Q3SqlFieldInfo( fdbname, QVariant::String ) );
+                               setCalculated( fdbname, calculated );
+                              // setGenerated( fdbname, false );
+                               fnames.insert( fname, new QString(fdbname) );
+                               int ftid = objt.section(" ", 1, 1 ).toInt();
+                               aCfgItem fto = md->find( ftid );
+                               if ( !fto.isNull() )
+                               {
+                                       if ( md->objClass( fto ) == md_aregister )
+                                       {
+                                       aCfgItem s_field = md->find(objt.section(" ",2,2).toInt());
+                                       aCfgItem dim_fields = md->find(fto,md_dimensions);
+
+                                               if(!dim_fields.isNull())
+                                               {
+                                                       int cnt = md->count( dim_fields, md_field );
+                                                       for ( int k = 0; k < cnt; k++  )
+                                                       {
+                                                               aCfgItem dim_field = md->find( dim_fields, md_field, k );
+                                                               QString type =  md->attr(dim_field, mda_type);
+                                                               if(type[0]=='O')
+                                                               {
+
+                                                                       if(type.section(" ",1,1).toInt()== mdobjId)
+                                                                       {
+                                                                               mapReg[fid]=fto;
+                                                                               mapDim[fid]= md->attr(dim_field,mda_name);
+                                                                               mapSum[fid] = md->attr(s_field,mda_name);
+                                                                               break;
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+
+                        }
+                       else
+                       {
+                               fnames.insert( fname, new QString(fdbname) );
+                       }
+       }
+}
+
+
+/*!
+ *     \~english
+ *     Gets metadata object.
+ *     \~russian
+ *     Получение объекта метаданных, которым инициализировали таблицу.
+ *     \return объект метаданных, который описывает таблицу.
+ *     \~
+ */
+qulonglong
+aDataTable::getIdd(void)
+{
+       return 0;
+}
+long
+aDataTable::getMdObjId()
+{
+       return mdobjId;
+}
+
+
+
+/*!
+ *     \~english
+ *     Stub.
+ *     \~russian
+ *     Заглушка.
+ *     \~
+ */
+void
+aDataTable::appendField( aSQLField * ) // fieldinfo )
+{
+
+}
+
+
+
+/*!
+ *     \~english
+ *     Stub.
+ *     \~russian
+ *     Заглушка.
+ *     \~
+ */
+void
+aDataTable::insertField( int /*pos*/, aSQLField * ) // fieldinfo )
+{
+
+}
+
+
+
+/*!
+ *     \~english
+ *     Stub.
+ *     \~russian
+ *     Заглушка.
+ *     \~
+ */
+void
+aDataTable::removeField( int ) // pos )
+{
+
+}
+
+
+
+/*!
+ *     \~english
+ *     Stub.
+ *     \~russian
+ *     Заглушка.
+ *     \~
+ */
+void
+aDataTable::clearFields()
+{
+
+}
+
+
+
+/*!
+ *     \~english
+ *     Stub.
+ *     \~russian
+ *     Заглушка.
+ *     \~
+ */
+bool
+aDataTable::checkStructure(  bool ) //update )
+{
+       bool rc = false;
+       if ( name().isEmpty() ) {
+
+       } else {
+
+       }
+       return rc;
+}
+
+
+
+/*!
+ *     \~english
+ *     Return field falue.
+ *     \~russian
+ *     Возвращает значение поля с номером \a i.
+ *     \param i - номер поля.
+ *     \return значение поля
+ *     \~
+ */
+QVariant
+aDataTable::value ( int i )
+{
+ //       QVariant v = QSqlCursor::value( i );
+
+       QVariant v = sysValue(Q3SqlCursor::fieldName(i));
+       return v;
+}
+
+
+
+/*!
+ *     \~english
+ *     Return field falue.
+ *     \~russian
+ *     Возвращает значение поля с именем \a name.
+ *     Для получения значения необходимо указывать имя поля в метаданных
+ *     \param name - имя поля в метаданных.
+ *     \return значение поля или QVariant::Invalid, если поля не существует.
+ *     \~
+ */
+QVariant
+aDataTable::value ( const QString & name )
+{
+       QString fname;
+        QVariant v;
+
+       if ( !fnames[name] )
+       {
+               aLog::print(aLog::Error, QObject::tr("aDataTable get value of unknown field `%1'").arg(name));
+               return QVariant::Invalid;
+       }
+       fname = * fnames[ name ];
+
+        //v = QSqlCursor::value( fname );
+
+       return sysValue(fname);
+}
+
+
+
+/*!
+ * Return true if column name exists in database table.
+ */
+ /*!
+ *     \~english
+ *     Check field existing.
+ *     \~russian
+ *     Проверяет существование поля в таблице
+ *     \param name - имя поля в таблице (не в метаданных!).
+ *     \return \~engish true if column name exists in database table \~russian true, если столбец с данным именем есть в таблице. \~
+ *     \~
+ */
+
+bool
+aDataTable::sysFieldExists( const QString & name )
+{
+       return contains( name );
+}
+
+
+
+/*!
+ * Return value of the column of the database table.
+ */
+QVariant
+aDataTable::sysValue ( const QString & name )
+{
+       if(isCalculated(name)) return calcFieldValue(name);
+       else return Q3SqlCursor::value( name );
+}
+
+
+
+/*!
+ *
+ */
+void
+aDataTable::setSysValue ( const QString & name, QVariant value )
+{
+       if ( name == QString("pnum") )
+       {
+               aLog::print(aLog::Info, QObject::tr("aDataTable get document prefix to `%1'").arg(value.toString()));
+       //      debug_message("document prefix set to '%s'\n",(const char*)value.toString());
+       }
+
+       Q3SqlCursor::setValue( name, value );
+}
+
+
+
+/*!
+ * Set value of the column of the database table.
+ */
+void
+aDataTable::setValue ( int i, QVariant value )
+{
+       Q3SqlCursor::setValue( i, value );
+}
+
+
+
+/*!
+ *
+ */
+bool
+aDataTable::setValue ( const QString & name, QVariant value )
+{
+       QString fname;
+       if ( !fnames[name] ) return false;
+       fname = * fnames[ name ];
+       if ( contains( fname ) ) {
+               Q3SqlCursor::setValue( fname, value );
+       }
+       else return false;
+       return true;
+}
+
+
+
+/*!
+ *
+ */
+QSqlRecord *
+aDataTable::primeInsert()
+{
+       QSqlRecord *rec;
+       QVariant v;
+
+       rec = Q3SqlCursor::primeInsert();
+       if ( sysFieldExists("id") ) {
+               rec->setValue("id", QVariant( db->uid( mdobjId ) ) );
+       }
+       return rec;
+}
+
+
+
+/*!
+ *
+ *//*
+QSqlRecord *
+aDataTable::primeUpdate()
+{
+       QSqlRecord *rec;
+
+       rec = QSqlCursor::primeUpdate();
+       *rec = r;
+       return rec;
+}
+*/
+
+
+/*!
+ *
+ */
+bool
+aDataTable::select( const QString & filter, bool usefltr )
+{
+       bool res;
+       QString flt = getFilter();
+       if ( usefltr )
+       {
+               if ( flt == "" ) flt = filter;
+               else if ( filter != "" ) flt = flt + " AND " + filter;
+       }
+       else flt = filter;
+       res = Q3SqlCursor::select( flt );
+//     next();
+//     r = *this;
+       return res;
+}
+
+
+
+/*!
+ *
+ */
+bool
+aDataTable::select( qulonglong id )
+{
+       bool res;
+//     printf("aSQLTable::select %llu\n",id);
+       res = Q3SqlCursor::select( QString( "id=%1" ).arg( id ) );
+       //setSelected(true);
+//     next();
+//     r = *this;
+       return res;
+}
+
+
+
+/*!
+ *
+ */
+void
+aDataTable::clearFilter()
+{
+       aLog::print(aLog::Debug, QObject::tr("aDataTable clear filter"));
+       userFilter.clear();
+}
+
+
+/*QDict<QVariant>
+aDataTable::getUserFilter() {
+       return this.userFilter;
+};
+
+void
+setUserFilter( QDict<QVariant> newFilter) {
+       this.userFilter = newFilter;
+};
+*/
+
+/**
+ *
+ */
+void
+aDataTable::setFilter ( const QString & newFilter ) {
+       Q3SqlCursor::setFilter( newFilter );
+}
+
+
+/*!
+ *
+ */
+bool
+aDataTable::setFilter( const QString& name, const QVariant& value )
+{
+
+       aLog::print(aLog::Debug, QObject::tr("aDataTable set filter %1='%2'").arg(name).arg(value.toString()));
+       if ( !fnames[name] )
+       {
+               aLog::print(aLog::Error, QObject::tr("aDataTable set filter %1='%2', %3 not exist").arg(name).arg(value.toString()).arg(name));
+               return false;
+       }
+       QVariant *v = new QVariant(value);
+       userFilter.replace(*fnames[name], v );
+       Q3SqlCursor::setFilter(getFilter());
+       return true;
+}
+
+
+
+/*!
+ *
+ */
+QString
+aDataTable::getFilter()
+{
+       QString filter = "", fid, type;
+       aCfgItem field;
+       Q3DictIterator<QVariant>it( userFilter );
+       if ( it.toFirst() )
+       {
+               fid = it.currentKey().mid(2);
+               field = md->find(fid.toLong() );
+               if ( !field.isNull() )
+               {
+                       type = md->attr( field, mda_type );
+                       if ( type[0] == 'N' || type[0] == 'O' )
+                               filter = it.currentKey() + "=" + it.current()->toString();
+                       else
+                               filter = it.currentKey() + "='" + it.current()->toString() + "'";
+               }
+       }
+       ++it;
+       for (;it.current();++it)
+       {
+               fid = it.currentKey().mid(2);
+               field = md->find(fid.toLong() );
+               if ( !field.isNull() )
+               {
+                       type = md->attr( field, mda_type );
+                       if ( type[0] == 'N' || type[0] == 'O' )
+                               filter += " and " + it.currentKey() + "=" + it.current()->toString();
+                       else
+                               filter += " and " + it.currentKey() + "='" + it.current()->toString() + "'";
+               }
+       }
+       return filter;
+}
+
+
+
+/*!
+ *
+ */
+QString
+aDataTable::getNFilter()
+{
+       QString filter = "", fid, type;
+       aCfgItem field;
+       Q3DictIterator<QVariant>it( userFilter );
+       if ( it.toFirst() )
+       {
+               fid = it.currentKey().mid(2);
+               field = md->find(fid.toLong() );
+               if ( !field.isNull() )
+               {
+                       type = md->attr( field, mda_type );
+                       if ( type[0] == 'N' || type[0] == 'O' )
+                               filter = tableName + "." + it.currentKey() + "=" + it.current()->toString();
+                       else
+                               filter = tableName + "." + it.currentKey() + "='" + it.current()->toString() + "'";
+               }
+       }
+       ++it;
+       for (;it.current();++it)
+       {
+               fid = it.currentKey().mid(2);
+               field = md->find(fid.toLong() );
+               if ( !field.isNull() )
+               {
+                       type = md->attr( field, mda_type );
+                       if ( type[0] == 'N' || type[0] == 'O' )
+                               filter += " and " + tableName + "." + it.currentKey() + "=" + it.current()->toString();
+                       else
+                               filter += " and " + tableName + "." + it.currentKey() + "='" + it.current()->toString() + "'";
+               }
+       }
+       return filter;
+}
+
+
+
+/*!
+ *
+ */
+void
+aDataTable::printRecord(){
+       unsigned int i;
+        Q3DictIterator<QString> it( fnames );
+       QString fname, sname;
+
+       for (i=0; i< count(); i++){
+               fname = "";
+               sname = field( i ).name();
+               it.toFirst();
+               for( ; it.current(); ++it ){
+                   if ( *it.current() == sname ) {
+                       fname = it.currentKey();
+                       break;
+                   }
+               }
+               printf("%s(%s)=%s\n",
+               ( const char *) fname,
+               ( const char *) sname,
+               ( const char *) value( i ).toString().local8Bit() );
+       }
+
+/*     for (i=0; i< r.count(); i++){
+               fname = "";
+               sname = r.field( i )->name();
+               it.toFirst();
+               for( ; it.current(); ++it ){
+                   if ( *it.current() == sname ) {
+                       fname = it.currentKey();
+                       break;
+                   }
+               }
+               printf("r:%s(%s)=%s\n",
+               ( const char *) fname,
+               ( const char *) sname,
+               ( const char *) r.value( i ).toString().local8Bit() );
+       }
+*/
+}
+
+
+
+/*!
+ *
+*/
+bool
+aDataTable::exec( QString query )
+{
+       return Q3SqlCursor::exec( query );
+}
+
+
+
+QVariant
+aDataTable::calc_rem(int fid, qulonglong id)
+{
+       aCfgItem o,fto;
+       QString t,oclass;
+       int ftid,oid;
+       QVariant v="";
+       fto = mapReg[fid];// = md->find( ftid );
+       if ( !fto.isNull() )
+       {
+               if(p_reg[QString("%1").arg(fid)]==0)
+               {
+                       p_reg.insert(QString("%1").arg(fid), new aARegister( fto, db ));
+               }
+               v = ((aARegister*)p_reg[QString("%1").arg(fid)])->getSaldo( QDateTime::currentDateTime(),
+                                       mapDim[fid],
+                                       id,
+                                       mapSum[fid]);//md->attr(s_field,mda_name));
+               if(!v.isValid()) v = "";
+       }
+       return v;
+}
+
+
+QVariant
+aDataTable::calc_obj(int fid, qulonglong idd)
+{
+       aCfgItem o,fto;
+       QString t,oclass;
+       int ftid;
+       QVariant v="";
+//     printf("calculate cat %d, %llu\n",fid, idd);
+       o = mapCat[fid];
+       if( !o.isNull() )
+       {
+               aCatalogue *pCat = (aCatalogue*)p_cat[QString("%1").arg(fid)];
+//             printf("obj not null\n");
+               if(pCat==0)
+               {
+                       p_cat.insert(QString("%1").arg(fid), new aCatalogue( o, db ));
+                       pCat = (aCatalogue*)p_cat[QString("%1").arg(fid)];
+               }
+               pCat->select( idd );
+
+               if ( pCat->selected() )
+               {
+//                     printf("select ok\n");
+                       v = QVariant( pCat->displayString() );
+               }
+       }
+       else
+       {
+               o = mapDoc[fid];
+               if(!o.isNull())
+               {
+                       aDocument *pDoc = (aDocument*)p_doc[QString("%1").arg(fid)];
+//                     printf("obj not null\n");
+                       if(pDoc==0)
+                       {
+                               p_doc.insert(QString("%1").arg(fid), new aDocument( o, db ));
+                               pDoc = (aDocument*)p_doc[QString("%1").arg(fid)];
+                       }
+                       pDoc->select( idd );
+                       if ( pDoc->selected() )
+                       {
+                               v = QVariant( pDoc->displayString() );
+                       }
+               }
+       }
+
+       return v;
+}
+
+/*!
+ * Calculate value object type fields.
+ */
+QVariant
+aDataTable::calculateField( const QString &name )
+{
+       QVariant v;
+       if(name=="system_icon") return v;
+       else return QVariant("");
+//     return QVariant::Invalid;
+}
+
+/*!
+ * Calculate value object type fields.
+ */
+QVariant
+aDataTable::calcFieldValue( const QString &name )
+{
+
+        QVariant v="", fv=0;
+       int fid = 0; //, ftid;
+       qulonglong id = 0;
+       aCfgItem o, fto;
+       QString t, oclass;
+        if ( name.left(5)=="text_" )
+       {
+                if(sysFieldExists(name.mid(5)))
+               {
+                       fv = sysValue( name.mid( 5 ) );
+                       id = fv.toULongLong();
+               }
+               else
+               {
+                       id = 0;
+               }
+               fid = name.mid( 7 ).toInt();
+               v = QVariant("");
+               if ( fid && id )
+               {
+                       v=calc_obj(fid,id);
+               }
+               else
+               {
+                       if(fid)
+                       {
+                               id = sysValue("id").toULongLong();
+                               v=calc_rem(fid,id);
+                       }
+               }
+        }
+//     printf("calculate field %s\n", name.ascii());
+        return v;
+}
+
+
+
+/*!
+ * Gets list of user and calculation fields.
+ */
+QStringList
+aDataTable::getUserFields()
+{
+   QStringList lst;
+   uint i;
+   const QString text_uf = "text_uf";
+       for(i=0; i<count(); i++)
+       {
+               if(fieldName(i).left(2) == "uf"
+                  || fieldName(i).left(text_uf.length()) == text_uf)
+               {
+                       if(fieldName(i).left(text_uf.length()) == text_uf)
+                       {
+                               QStringList::iterator it  = lst.find("uf"+fieldName(i).mid(text_uf.length()));
+                               if(it!=lst.end())
+                               {
+                                       lst.remove(it);
+                               }
+                       }
+                       lst << fieldName(i);
+               }
+       }
+   return lst;
+}
+
+
+
+/*!
+ *
+ */
+bool
+aDataTable::isMarkDeleted()
+{
+        if ( sysFieldExists( "df" ) ) return sysValue( "df" ).toInt() == 1;
+        return false;
+}
+
+
+
+/*!
+ *
+ */
+ERR_Code
+aDataTable::setMarkDeleted( bool Deleted )
+{
+        if ( sysFieldExists( "df" ) ) {
+                QString v = "";
+                if ( Deleted ) v = "1";
+                setSysValue( "df", QVariant( v ) );
+                return err_noerror;
+        }
+        return err_incorrecttype; // Object can not be mark deleted
+}
+
+
+bool
+aDataTable::seek ( int i, bool relative )
+{
+       bool res = Q3SqlCursor::seek( i, relative );
+//     if ( res ) r = *this;
+       return res;
+}
+
+bool
+aDataTable::next ()
+{
+       bool res = Q3SqlCursor::next();
+//     if ( res ) r = *this;
+       return res;
+}
+
+bool
+aDataTable::prev ()
+{
+       bool res = Q3SqlCursor::prev();
+//     if ( res ) r = *this;
+       return res;
+}
+
+bool
+aDataTable::first ()
+{
+       bool res = Q3SqlCursor::first();
+//     if ( res ) r = *this;
+       return res;
+}
+
+
+bool
+aDataTable::last ()
+{
+       bool res = Q3SqlCursor::last();
+//     if ( res ) r = *this;
+       return res;
+}
+
+
+
+bool
+aDataTable::New()
+{
+       QSqlRecord *rec;
+       QVariant v;
+       qulonglong Uid = 0;
+       bool res = false;
+
+       rec = Q3SqlCursor::primeInsert();
+       if ( sysFieldExists("id") )
+       {
+               Uid = db->uid( mdobjId );
+               aLog::print(aLog::Debug, QString("aDataTable new record with id=%1 for meta object with id=%2").arg(Uid).arg(mdobjId));
+
+               rec->setValue("id", QVariant( Uid ) );
+       }
+       if ( insert() )
+       {
+               if ( select(QString("id=%1").arg(Uid), false) )
+                       if ( first() )
+                       {
+                               res = true;
+                       }
+                       else
+                       {
+                               aLog::print(aLog::Error, QString("aDataTable record with id=%1 not found").arg(Uid));
+                       }
+       }
+       return res;
+}
+
+
+bool
+aDataTable::Copy()
+{
+       QSqlRecord *rec = new QSqlRecord( *editBuffer(true) );
+       if ( New() )
+       {
+               for ( unsigned int i=0; i<rec->count(); i++ )
+               {
+                       if ( rec->field( i ).name() != QString("id")  )
+                       {
+                               setValue( i, rec->value( i ) );
+//                             printf("field %s, before %s, after %s\n",rec->field( i )->name().ascii(), rec->value( i ).toString().ascii(), value( i ).toString().ascii());
+                       }
+               }
+       }
+       delete rec;
+       return Update();
+//     Q_ULLONG Uid = db->uid( t->id );
+//     r->setValue("id",Uid);
+//     if ( t->insert() ) return Uid;
+
+//     return true;
+}
+
+
+bool
+aDataTable::Delete()
+{
+       QSqlRecord *rec;
+       rec = primeDelete();
+       del();
+//     fNewNotUpdated = false;
+       return true;
+}
+
+
+bool
+aDataTable::Update()
+{
+       QSqlRecord *rec;
+
+       rec = Q3SqlCursor::primeUpdate();
+       //for ( unsigned int i=0; i<rec->count(); i++ ) rec->setValue( i, value( i ) );
+       update();
+       QSqlError err = lastError();
+       if(!err.type() == QSqlError::None)
+       {
+               aLog::print(aLog::Error, QString("%1 %2").arg(err.text()).arg(err.driverText()) );
+       }
+       return true;
+}
+
diff --git a/src/lib/asqltable.h b/src/lib/asqltable.h
new file mode 100644 (file)
index 0000000..32f206c
--- /dev/null
@@ -0,0 +1,139 @@
+/****************************************************************************
+** $Id: asqltable.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Header file of the Ananas database table of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ASQLTABLE_H
+#define ASQLTABLE_H
+#include <q3sqlcursor.h>
+#include <q3dict.h>
+#include "acfg.h"
+//#include "aaregister.h"
+//#include "adatarecord.h"
+
+// temporray define for old definitions
+#define aSQLTable aDataTable
+
+
+class aDatabase;
+class aSQLField;
+
+/*!
+ *     \~english
+ *     Provides browsing and editing Ananas's sql tables mantained by Ananas.Designer.
+ *     \~russian
+ *     \brief Определяет программный интерфейс модели данных aDataTable. Наследует QSqlCursor.
+ *
+ *     Позволяет работать с табличными представлениями данных, определенных метаданными бизнес схемы.
+ *     \~
+ */
+class  ANANAS_EXPORT aDataTable : public Q3SqlCursor
+{
+public:
+       aDatabase*      db;
+       QString         tableName;
+       bool            selected;
+
+                               aSQLTable( aCfgItem context, aDatabase *adb );
+                               aSQLTable( const QString &tname, aDatabase *adb );
+       virtual         ~aSQLTable();
+       void init( aCfgItem context, aDatabase *adb );
+       void setObject(aCfgItem context);
+       void appendField( aSQLField * fieldinfo );
+       void insertField( int pos, aSQLField * fieldinfo );
+       void removeField( int pos );
+       void clearFields();
+       bool checkStructure( bool update );
+       long getMdObjId();
+       qulonglong getIdd();
+       void            printRecord();
+       //QDict<QVariant> getUserFilter();
+       //void          setUserFilter( QDict<QVariant> );
+
+       virtual QVariant value ( int i );
+       virtual QVariant value ( const QString & name );
+       virtual void setValue ( int i, QVariant value );
+       virtual bool setValue ( const QString & name, QVariant value );
+       virtual QVariant sysValue ( const QString & name );
+       virtual void setSysValue ( const QString & name, QVariant value );
+       virtual bool sysFieldExists( const QString & name );
+
+       virtual QSqlRecord *primeInsert();
+//     virtual QSqlRecord *primeUpdate();
+
+       virtual bool select( const QString & filter="", bool usefltr = true );
+       virtual bool select( qulonglong id );
+       virtual void            clearFilter();
+       virtual bool            setFilter( const QString &name, const QVariant &value );
+       virtual void            setFilter( const QString& );
+       virtual QString         getFilter();
+       virtual QString         getNFilter();
+       virtual bool            exec( QString query );
+       virtual QStringList     getUserFields();
+       virtual ERR_Code        setMarkDeleted( bool Deleted );
+       virtual bool            isMarkDeleted();
+
+       virtual bool New();
+       virtual bool Copy();
+       virtual bool Delete();
+       virtual bool Update();
+
+       virtual bool seek ( int i, bool relative = FALSE );
+       virtual bool next ();
+       virtual bool prev ();
+       virtual bool first ();
+       virtual bool last ();
+
+
+protected:
+       QVariant calcFieldValue( const QString &name );
+       virtual QVariant calculateField( const QString &name );
+       virtual QVariant calc_obj(int fid,qulonglong idd);
+       virtual QVariant calc_rem(int fid,qulonglong id);
+       void insertFieldInfo(aCfgItem cobj, bool calculated=true);
+
+       long            mdobjId;
+
+private:
+//     bool fNewNotUpdated;
+       aCfgItem                obj;
+       aCfgItem                init_obj;
+       aCfg*                   md;
+       Q3Dict<QObject> p_cat;
+       Q3Dict<QObject> p_doc;
+       Q3Dict<QObject> p_reg;
+       QMap<int,aCfgItem> mapCat, mapReg, mapDoc;
+       QMap<int,QString> mapDim,mapSum;
+       QStringList fildsList;
+       Q3Dict<QString> fnames;
+       Q3Dict<QVariant> userFilter;
+//     QDict<aDataField> dataRecord;
+//     aDataRecord dataRecord;
+//     QSqlRecord r;
+};
+
+#endif
diff --git a/src/lib/atests.cpp b/src/lib/atests.cpp
new file mode 100644 (file)
index 0000000..31299c2
--- /dev/null
@@ -0,0 +1,239 @@
+/****************************************************************************
+** $Id: atests.cpp,v 1.2 2008/11/08 20:16:35 leader Exp $
+**
+** Tests functions source file of
+** Ananas application library
+**
+** Created : 20051024
+**
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include       "atests.h"
+#include       "alog.h"
+#include       <qfile.h>
+#include       <qdatetime.h>
+#include       <qdir.h>
+
+/*!
+ *\~english
+ *     Writes text to log.
+ *\~russian
+ *     Пишет текст в лог.
+ *\~
+ *     \param log_name - \~english Full path to logfile \~russian Полный путь к лог файлу \~
+ *     \param test_name - \~english Test name \~russian Имя теста \~
+ *     \param status - \~english OK, ERROR or SKIP \~russian OK, ОШИБКА или ПРОПУЩЕН \~
+ *     \param text - \~english Comment \~russian Комментарий \~
+*/
+void
+aTests::print2log(     const QString &log_name,
+                       const QString &test_name,
+                       const QString &status,
+                       const QString &text)
+{
+       QString toWrite = QString("%1::%2::%3::%4\r\n")\
+                         .arg(QDateTime::currentDateTime().toString(Qt::ISODate).replace('T',' '))\
+                         .arg(test_name)\
+                         .arg(status)\
+                         .arg(text);
+
+       QFile f;
+       if(log_name==QString::null)
+       {
+               f.open( QIODevice::WriteOnly, stdout );
+               f.writeBlock((const char*)toWrite,strlen((const char*)toWrite));
+       }
+       else
+       {
+               f.setName(log_name);
+               f.open( QIODevice::WriteOnly | QIODevice::Append );
+               f.writeBlock((const char*)toWrite,strlen((const char*)toWrite));
+               f.flush();
+       }
+       f.close();
+
+//     else printf("error write to log\n");
+}
+
+
+/*!
+ *\~english
+ *     Reads config into QMap object.
+ *\~russian
+ *     Считывает конфиг в объект QMap.
+ *\~
+ *     \param conf_name - \~english configfile name \~russian Путь к конфигу \~
+ *     \param log_name - \~english logfile name \~russian Путь к логу (не обязательно) \~
+ *     \return - \~english map with config values \~russian map со значениями конфига \~
+*/
+QMap<QString,QString>
+aTests::readConfig(const QString &conf_name,const QString &log_name)
+{
+       QMap<QString,QString> map;
+       QString str, buff;
+       QStringList list;
+       QFile f(conf_name);
+       if(!f.exists())
+       {
+               aLog::print(aLog::Error, QObject::tr("aTests file %1 not exists").arg(f.name()));
+       }
+       else
+       {
+               if(!f.open( QIODevice::ReadOnly ))
+               {
+                       aLog::print(aLog::Error, QObject::tr("aTests file %1 not open for read").arg(f.name()));
+               }
+               else
+               {
+                       while(!f.atEnd())
+                       {
+                               str=f.readLine(1024);
+                               if(!str.isEmpty())
+                               //--if(f.readLine(str,1024)!=-1)
+                               {
+                                       if(str==QString::null || str[0]=='#' || str[0]=='\n') continue;
+                                       QString s = str.section("=",0,0);
+                                       map[s] = (str.right(str.length() - s.length()-1)).stripWhiteSpace();
+                                       aLog::print(aLog::Debug, QString("map[%1] = %2").arg(s).arg(map[s]));
+                               }
+                               else
+                               {
+                                       break;
+                               }
+                       }
+                       f.close();
+               }
+       }
+       return map;
+}
+
+
+/*!
+ *\~english
+ *     Writes config.
+ *\~russian
+ *     Пишет конфиг из объекта QMap.
+ *\~
+ *     \param conf_name - \~english configfile name \~russian Путь к конфигу \~
+ *     \param log_name - \~english logfile name \~russian Путь к логу (не обязательно) \~
+ *     \return - \~english true, if successful \~russian true - успех \~
+*/
+bool
+aTests::writeConfig(const QString &conf_name, QMap<QString,QString> map, const QString &log_name)
+{
+       QString str;
+       QFile f(conf_name);
+       if(!f.exists())
+       {
+               aLog::print(aLog::Error, QObject::tr("aTests file %1 not exists").arg(f.name()));
+       }
+       //else
+       //{
+               if(f.open( QIODevice::WriteOnly ))
+               {
+                       QMap<QString,QString>::Iterator it;
+                       for ( it = map.begin(); it != map.end(); ++it )
+                       {
+                               str= QString("%1=%2\n").arg(it.key()).arg(it.data());
+                               f.writeBlock((const char*)str,strlen((const char*)str));
+                               f.flush();
+                       }
+                       f.close();
+                       if(log_name!=QString::null)
+                       {
+                               aTests::print2log(log_name,conf_name,"OK","write config");
+                       }
+               }
+               else
+               {
+                       aLog::print(aLog::Error, QObject::tr("aTests file %1 not open for read").arg(f.name()));
+                       return 0;
+               }
+       //}
+       return 1;
+}
+/*!
+ *\~english
+ *     Writes line in log with name \a log_name
+ *\~russian
+ *     Пишет строку в лог с именем \a log_name
+ *\~
+ *     \param log_name - \~english logfile name \~russian Путь к логу (не обязательно) \~
+*/
+void
+aTests::printline2log(const QString &log_name)
+{
+       QString toWrite;
+       toWrite.fill('=',60);
+       toWrite+="\n";
+       QFile f;
+       if(log_name==QString::null)
+       {
+               f.open( QIODevice::WriteOnly, stdout );
+               f.writeBlock((const char*)toWrite,strlen((const char*)toWrite));
+       }
+       else
+       {
+               f.setName(log_name);
+               f.open( QIODevice::WriteOnly | QIODevice::Append );
+               f.writeBlock((const char*)toWrite,strlen((const char*)toWrite));
+               f.flush();
+       }
+       f.close();
+}
+
+/*!
+ *\~english
+ *     Find parament in command line.
+ *\~russian
+ *     Ищет параметр с именем \a requestedParam в коммандной строке и если находит, то возвращает его
+ *     значение (то, что идет после знака = до первого пробела). Заменяет знак ~ на $(HOME)
+ *\~
+ *     \param argc - \~english parametr command line count \~russian число параметров коммандной строки \~
+ *     \param argv - \~english command line paraments \~russian параметры коммандной строки \~
+ *     \param requestedParam - \~english param for search \~russian параметр для поиска \~
+ *     \return - \~english parametr value \~russian значение параметра \~
+*/
+QString
+aTests::parseCommandLine(int argc, char** argv, const QString requestedParam)
+{
+
+       QString param,value;
+       for(int j=1;j<argc;j++)
+       {
+               param = argv[j];
+               if(param.section("=",0,0).lower()==requestedParam)
+               {
+                       if(param.section("=",1)!=QString::null)
+                       {
+                               value = param.section("=",1);
+                               if(value[0]=='~')
+                               {
+                                       value = value.mid(1);
+                                       value = QDir::convertSeparators(QDir::homeDirPath()+value);
+                               }
+                               return value;
+                       }
+               }
+       }
+       return QString::null;
+}
diff --git a/src/lib/atests.h b/src/lib/atests.h
new file mode 100644 (file)
index 0000000..03fb19e
--- /dev/null
@@ -0,0 +1,62 @@
+/****************************************************************************
+** $Id: atests.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Tests functions header file of
+** Ananas application library
+**
+** Created : 20051024
+**
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ATESTS_H
+#define ATESTS_H
+
+#include       "ananas.h"
+#include       <qmap.h>
+
+/*!
+ *     \~english
+ *     Class contain static functions for test utilites
+ *     \~russian
+ *             \brief Класс содержит статические функции для утилит тестирования.
+ *
+ *             Предназначен для использования при отладке и тестировании кода.
+ *     \~
+*/
+class ANANAS_EXPORT aTests
+{
+       public:
+
+       static QMap<QString, QString>   readConfig(const QString &cfg_name, const QString &log_name=QString::null);
+       static bool     writeConfig(const QString &cfg_name,QMap<QString, QString> cfg, const QString &log_name=QString::null);
+       static void     print2log(      const QString &log_name,
+                                       const QString &test_name,
+                                       const QString &status,
+                                       const QString &text="");
+
+       static void     printline2log(const QString &log_name);
+       static QString  parseCommandLine(int argc, char** argv, const QString requestedParam);
+
+       private:
+       aTests();
+};
+#endif// ATESTS_H
diff --git a/src/lib/atime.cpp b/src/lib/atime.cpp
new file mode 100644 (file)
index 0000000..9cbadf0
--- /dev/null
@@ -0,0 +1,119 @@
+/****************************************************************************
+** $Id: atime.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Engine applications
+**
+** Created : 20041109
+**
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include       "atime.h"
+//#include     "adatabase.h"
+//#include     "adocjournal.h"
+
+
+
+/*!
+ *\en
+ *     Constructor that create object aTime for work in ananas script.
+ *\_en
+ *\ru
+ *     Конструктор, который создает aTime для работы в ананас скрипте.
+ *\_ru
+ */
+aTime::aTime(): QObject()
+{
+       time = new QTime;
+
+}
+
+/*!
+ *\en
+ *     Destructor
+ *\_en
+ *\ru
+ *     Деструктор
+ *\_ru
+ */
+aTime::~aTime()
+{
+       delete time;
+}
+
+/*!
+ *\en
+ *     Starts timer.
+ *\_en
+ *\ru
+ *     Запускает таймер.
+ *\_ru
+ */
+void
+aTime::start()
+{
+       time->start();
+}
+
+
+/*!
+ *\en
+ *     Restarts timer.
+ *\_en
+ *\ru
+ *     Перезапускает таймер.
+ *\_ru
+ */
+int
+aTime::restart()
+{
+       time->restart();
+       return 0;
+}
+
+/*!
+ *\en
+ *     Gets elapsed time from last call of start() or restart()
+ *\_en
+ *\ru
+ *     Возвращает количество миллисекунд с последнего запуска таймера.
+ *\_ru
+ */
+int
+aTime::elapsed()
+{
+       return time->elapsed();
+}
+
+/*!
+ *\en
+ *     Return current date for ananas.script
+ *\_en
+ *\ru
+ *     Возвращает текущую дату в ISO формате. Используется для работы с Ананас.Скриптом
+ *\_ru
+ */
+QString
+aTime::CurrentDate()
+{
+       return QDate::currentDate().toString(Qt::ISODate);
+}
+
diff --git a/src/lib/atime.h b/src/lib/atime.h
new file mode 100644 (file)
index 0000000..702af8b
--- /dev/null
@@ -0,0 +1,64 @@
+/****************************************************************************
+** $Id: atime.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Header file of the Accumulation Register of Ananas
+** Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ATIME_H
+#define ATIME_H
+
+#include       <qobject.h>
+#include       <qdatetime.h>
+//#include     "airegister.h"
+#include "ananas.h"
+
+
+
+
+/*!
+ *\en
+ *\_en
+ *\ru
+ *     \brief Сервисный класс для работы с объектом Время
+ *\_ru
+ */
+class ANANAS_EXPORT aTime : public QObject
+{
+       Q_OBJECT
+public:
+       aTime();
+       ~aTime();
+protected:
+       QTime *time;
+public slots:
+
+       virtual void start();
+       virtual int restart();
+       virtual int elapsed();
+       virtual QString CurrentDate();
+};
+
+#endif// ATIME_H
diff --git a/src/lib/auser.cpp b/src/lib/auser.cpp
new file mode 100644 (file)
index 0000000..7caeed7
--- /dev/null
@@ -0,0 +1,402 @@
+/****************************************************************************
+** $Id: auser.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** User object implementation file of
+** Ananas application library
+**
+** Created : 20050527
+**
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include       "auser.h"
+//Added by qt3to4:
+#include <Q3ValueList>
+//#include     "ananas.h"
+
+
+/*!\en Constructor for concrete object class creating
+ * \_en
+ * \ru Конструктор для создания конкретного объекта класса
+ * \_ru
+ */
+aUser::aUser( qulonglong userId, aDatabase * adb ):aObject("",adb)
+{
+
+       initObject();
+       Select(userId);
+
+}
+/*!\en Constructor for abstract object class creating
+ * \_en
+ * \ru Конструктор для создания абстрактного объекта класса
+ * \_ru
+ */
+aUser::aUser( aDatabase * adb ):aObject("",adb)
+{
+
+//     Select(userId);
+       initObject();
+}
+
+
+
+
+/*!\en Reimplement base class function
+ * \_en
+ * \ru Переопределяет функцию базового класса
+ * \_ru
+ */
+ERR_Code
+aUser::initObject()
+{
+       ERR_Code err = aObject::initObject(); // don't handle errors
+       //if ( err ) return err;
+       //aCfgItem e;// = md->find( obj, md_group ), e = md->find( obj, md_element );
+       err = tableInsert( db_users, "");
+
+       if(err) return err;
+       err = tableInsert( db_user_roles, md_user_roles );
+       return err;
+}
+
+/*!\en Returns list of roles, (un)assigned for this user. List elements must be deleted in called procedure.
+ * \_en
+ * \ru Возвращает список ролей, (не)назначенных данному пользователю. Элементы списка должны быть удалены в вызывающей процедуре
+ * \_ru
+ * \param assibned     \en true for return assigned roles, false for retun unassigned roles\_en
+ *                     \ru true для возврата назначенных ролей, false для возврата неназначенных ролей \_ru
+ */
+Q3ValueList< aRole *>
+aUser::getRoles(bool assigned)
+{
+       Q3ValueList<aRole*> list;
+       qulonglong rid;
+       aRole *rl = new aRole(db);
+       rl->Select();
+       if(rl->First())
+       {
+               do
+               {
+                       rid = rl->sysValue("id").toULongLong();
+                       if(!(hasRole(rid) ^ assigned))// !XOR
+                       {
+                               aRole *r = new aRole(rid,db);
+                               list.insert(list.end(),r);
+                       }
+               }while(rl->Next());
+       }
+       delete rl;
+       return list;
+}
+
+/*!\en Gets user id
+ * \_en
+ * \ru Получение id пользователя
+ * \_ru
+ * \param login \en user login \_en \ru логин пользователя\_ru
+ * \param password \en user password \_en \ru пассворд пользователя\_ru
+ * \return     \en 0 if login and password has no match, user id otherwise \_en
+ *             \ru 0 если логин и пароль не совпадают, в противном случае id пользователя\_ru
+ */
+qulonglong
+aUser::getUserId(const QString &login, const QString &password)
+{
+       aSQLTable * t = table();
+       t->select(QString("login='%1' AND password='%2'").arg(login).arg(password));
+       if(t->first())
+       {
+               return t->sysValue( "id").toULongLong();
+       }
+       else
+       {
+               return 0;
+       }
+
+}
+
+
+
+/*!\en Updates table values
+ * \_en
+ * \ru Обновляет значения таблиц
+ * \_ru
+ */
+ERR_Code
+aUser::Update()
+{
+       ERR_Code err = aObject::Update();
+       if ( !err ){
+               err = TableUpdate( md_user_roles );
+       }
+       return err;
+}
+
+
+/*!\en Selected table and clear filter
+ * \_en
+ * \ru Выбирает таблицу и сбрасывает фильтр
+ * \_ru
+ */
+ERR_Code
+aUser::Select( )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+//     setSelected(true,md_group);
+//     setSelected(true);
+       QString flt = "";
+//     groupSelect();
+       if ( t->select( flt ) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+               }
+               else return err_notselected;
+       else return err_selecterror;
+       return err_noerror;
+}
+
+/*!\en Select table and set filter to user with given id
+ * \_en
+ * \ru Выбирает таблицу и устанавлиет фильтр на пользователя с переданным в параметре id
+ * \_ru
+ * \param id - \en user id \_en \ru id пользователя \_ru
+ */
+ERR_Code
+aUser::Select( qulonglong id)
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+//     setSelected(true,md_group);
+//     setSelected(true);
+       QString flt;
+       flt = QString("id=%1").arg(id);
+//     groupSelect();
+       if ( t->select( flt ) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+               }
+               else return err_notselected;
+       else return err_selecterror;
+       return err_noerror;
+}
+
+/*!\en Assign role to user
+ * \_en
+ * \ru Назначет пользователю роль
+ * \_ru
+ * \param roleId -     \en id role to asssign \_en \ru id роли для назначения\_ru
+ */
+ERR_Code
+aUser::addRole( qulonglong roleId )
+{
+       aSQLTable *tg = table( md_user_roles );
+       if (!tg ) return err_notable;
+       setSelected(true, md_user_roles);
+//     tg->select(parentId);
+//     setSelected(true,md_group);
+       qulonglong idg;
+       QSqlRecord* rec = tg->primeInsert(); // get edit buffer for table groups
+       idg = sysValue("id").toULongLong();
+       //printf( "idg=%lu\n", idg );
+       rec->setValue("id",idg );
+       rec->setValue("idr",roleId );
+       tg->insert(); // insert record
+       //tg->update();
+return  err_noerror;
+}
+
+/*!\en Drop role
+ * \_en
+ * \ru Сбрасывает назначение роли пользователю
+ * \_ru
+ * \param roleId -     \en id role to drop \_en
+ *                     \ru id роли, назначение которой будет сброшено\_ru
+ */
+ERR_Code
+aUser::delRole( qulonglong roleId )
+{
+       aSQLTable *t = table( md_user_roles );
+       qulonglong ide=0;
+       if ( !t ) return err_notable;
+       ide = sysValue("id").toULongLong();
+       t->select(QString("id=%1 and idr=%2").arg(ide).arg(roleId));
+       if ( t->first() )
+       {
+               //printf("del usr_role \n");
+               t->primeDelete();
+               t->del();
+//             setSelected( false );
+       }
+       else return err_notselected;
+       return err_noerror;
+return  err_noerror;
+}
+
+/*!\en Checks role assign
+ * \_en
+ * \ru Проверяет, назначена ли роль данному пользователю
+ * \_ru
+ * \param rid -        \en role id to check \_en
+ *                     \ru id роль для проверки \_ru
+ * \return     \en true, if role assigned, false otherwise \_en
+ *             \ru true, если роль назначена, false в противном случае \_ru
+ */
+bool
+aUser::hasRole(qulonglong rid)
+{
+       aSQLTable *tg = table( md_user_roles );
+       if (!tg ) return err_notable;
+       tg->select(QString("id=%1 AND idr=%2").arg(sysValue("id").toULongLong()).arg(rid));
+       if(tg->first())
+       return true;
+       else return false;
+//     setSelected(true, md_user_roles);
+
+
+}
+
+/*!\en
+ * Inserts new element in elements table
+ \_en \ru
+ * Вставляет новый элемент в таблицу элементов
+ *\_ru
+ * \param login -      \en login \_en \ru логин \_ru
+ * \param password -   \en password \_en \ru пароль \_ru
+ * \param firstName -  \en first name \_en \ru имя пользователя \_ru
+ * \param lastName -   \en last name \_en \ru фамилия пользователя \_ru
+ */
+ERR_Code
+aUser::New(const QString &login,
+               const QString &password,
+               const QString &firstName,
+               const QString &lastName)
+{
+       aSQLTable *te = table();
+       if (!te) return err_notable;
+       QSqlRecord *rec;
+       qulonglong ide;
+       rec = te->primeInsert(); // get edit buffer for table elements
+       ide = rec->value("id").toULongLong();
+//     printf(">>>id=%lu\n",ide);
+       rec->setValue("id",ide); // set defult values for all user fields = id
+       rec->setValue( "login", login );
+       rec->setValue( "password", password );
+       rec->setValue( "fname", firstName );
+       rec->setValue( "lname", lastName );
+       te->insert(); // insert edit buffer as new line in table
+       te->select(QString("id=%1").arg(ide),false); // set cursor to inserted record
+       te->first();
+       setSelected(true);
+       return err_noerror;
+}
+
+
+
+
+
+/*!\en
+ * Delets user.
+ \_en \ru
+ * удаляет пользователя.
+ *\_ru
+ */
+ERR_Code
+aUser::Delete()
+{
+       aSQLTable * t = table();
+       qulonglong ide=0;
+       if ( !t ) return err_notable;
+       ide = t->sysValue("id").toULongLong();
+       if ( ide )
+       {
+       //      printf("ide=" LLU_SPEC "\n",ide);
+               t->primeDelete();
+               t->del();
+//TODO: clear roles, assigned to user
+               setSelected( false );
+       }
+       else return err_notselected;
+       return err_noerror;
+}
+
+
+/*!\en Updates roles table values
+ *\_en
+ * \ru Обновляет значение таблицы ролей
+ *\_ru
+ */
+ERR_Code
+aUser::UpdateRole()
+{
+       return TableUpdate( md_user_roles );
+}
+
+
+/*!\en Next
+ *\_en
+ * \ru
+ *\_ru
+ */
+bool
+aUser::Next()
+{
+       return  aObject::Next(  );  //return !groupSelect();
+       //else return false;
+}
+
+/*!\en Rpev
+ *\_en \ru
+ *\_ru
+ */
+bool
+aUser::Prev()
+{
+       return  aObject::Prev(  );  //return !groupSelect();
+//     else return false;
+}
+
+/*!\en First
+ *\_en \ru
+ *\_ru
+ */
+bool
+aUser::First()
+{
+       return  aObject::First( );  //return !groupSelect();
+       //else return false;
+}
+
+/*!\en Last
+ *\_en \ru
+ *\_ru
+ */
+bool
+aUser::Last()
+{
+       return aObject::Last(  ); //return !groupSelect();
+       //else return false;
+}
+
+
+
diff --git a/src/lib/auser.h b/src/lib/auser.h
new file mode 100644 (file)
index 0000000..f49d9cc
--- /dev/null
@@ -0,0 +1,95 @@
+/****************************************************************************
+** $Id: auser.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** User  object header file of
+** Ananas application library
+**
+** Created : 20050527
+**
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AUSER_H
+#define AUSER_H
+
+#include       "arole.h"
+#include       "adatabase.h"
+#include       "acfg.h"
+#include       "aobject.h"
+#include       <q3valuelist.h>
+//class aDatabase;
+//class aRole;
+//class aObject;
+
+
+
+/*!
+ * \en
+ *     Not visual object used for working with users in database.
+ * \_en
+ * \ru
+ *     \brief Определяет программный интерфейс для управления пользователями. Не используется в настоящий момент.
+ *     Наследует aObject.
+ * \_ru
+*/
+class  ANANAS_EXPORT aUser: public aObject
+{
+       Q_OBJECT
+public:
+       aUser();
+       aUser(qulonglong userId, aDatabase * adb);
+       aUser(aDatabase * adb);
+       virtual ERR_Code initObject();
+
+//public slots:
+
+       virtual ERR_Code New(   const QString &login,
+                               const QString &passwd="",
+                               const QString &Name="",
+                               const QString &LastName="");
+
+       virtual ERR_Code Delete();
+       virtual ERR_Code Update();
+       virtual ERR_Code Select();
+       virtual ERR_Code Select( qulonglong userId );
+
+       virtual ERR_Code addRole( qulonglong roleId );
+       virtual ERR_Code delRole( qulonglong roleId );
+       virtual ERR_Code UpdateRole();
+
+       Q3ValueList< aRole *> getRoles( bool assigned);
+
+       bool hasRole( qulonglong roleId);
+//     virtual ERR_Code setPassword( const QString & );
+       //virtual ERR_Code setLogin( const QString & );
+       //virtual ERR_Code setFirstName( const QString & );
+       //virtual ERR_Code setLastName( const QString & );
+
+       virtual qulonglong getUserId( const QString &login, const QString &password );
+       //virtual ERR_Code getRoles(QValueList<aRole> *lst);
+       bool First();
+       bool Next();
+       bool Last();
+       bool Prev();
+};
+
+
+#endif// AUSER_H
diff --git a/src/lib/dialogs/awindowslist.cpp b/src/lib/dialogs/awindowslist.cpp
new file mode 100644 (file)
index 0000000..2427415
--- /dev/null
@@ -0,0 +1,176 @@
+/****************************************************************************
+** $Id: awindowslist.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Main window of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "awindowslist.h"
+#include "acfg.h"
+
+/*!
+ *     \~english
+ *     Constructor
+ *     \~russian
+ *     Конструктор.
+ *     \~
+ */
+aWindowsList::aWindowsList()
+    : QWidget()
+{
+}
+
+
+/*!
+ *     \~english
+ *     Destructor
+ *     \~russian
+ *     Деструктор.
+ *     \~
+ */
+aWindowsList::~aWindowsList()
+{
+}
+
+
+/*!
+ *     \~english
+ *     Insert window into list.
+ *     \~russian
+ *     Добавляет ссылку на окно в список.
+ *     \~
+ *     \param id - \~english object class id \~russian идентификатор класса объекта \~
+ *     \param window - \~english link to form \~russian ссылка на форму \~
+ *     \param ido - \~english object id (default 0) \~russian идентификатор объекта (по умолчанию 0) \~
+ */
+void
+aWindowsList::insert( int id, QWidget *window, qulonglong ido )
+{
+    list.insert( conv( id, ido ), window );
+}
+
+/*!
+ *     \~english
+ *     Remove window from list.
+ *     \~russian
+ *     Удаляет окно из списка.
+ *     \~
+ *     \param id - \~english object class id \~russian идентификатор класса объекта \~
+ *     \param ido - \~english object id (default 0) \~russian идентификатор объекта (по умолчанию 0) \~
+ */
+void
+aWindowsList::remove( int id, qulonglong ido )
+{
+    list.remove( conv( id, ido ) );
+}
+
+/*!
+ *     \~english
+ *     Remove window from list.
+ *     \~russian
+ *     Удаляет окно из списка.
+ *     \~
+ *     \param window - \~english link to form \~russian ссылка на форму \~
+ */
+void
+aWindowsList::remove( QWidget *window )
+{
+    Q3DictIterator<QWidget> it( list );
+    for ( ; it.current(); ++it )
+    {
+       if ( it.current() == window ) {
+           list.remove( it.currentKey() );
+           break;
+       }
+    }
+}
+
+/*!
+ *     \~english
+ *     Find window with \a id and \a ido.
+ *     \~russian
+ *     Ищет окно по его \a id и \a ido
+ *     \~
+ *     \param id - \~english object class id \~russian идентификатор класса объекта \~
+ *     \param ido - \~english object id (default 0) \~russian идентификатор объекта (по умолчанию 0) \~
+ *     \return \~english true, if window found \~russian true, если окно найдено. \~
+ */
+bool
+aWindowsList::find( int id, qulonglong ido )
+{
+    if ( !list.find( conv( id, ido ) ) ) return FALSE;
+    return TRUE;
+}
+
+/*!
+ *     \~english
+ *     Find object in list with link
+ *     \~russian
+ *     Ищет объект в списке по ссылке.
+ *     \~
+ *     \param window - \~english link to form \~russian ссылка на форму \~
+ *     \return \~english true, if window found \~russian true, если окно найдено. \~
+ */
+bool
+aWindowsList::find( QWidget *window )
+{
+    Q3DictIterator<QWidget> it( list );
+    for ( ; it.current(); ++it ) if ( it.current() == window ) return TRUE;
+    return FALSE;
+}
+
+
+/*!
+ *     \~english
+ *     Get window with \a id and \a ido.
+ *     \~russian
+ *     Функция получения ссылки на окно по его \a id и \a ido
+ *     \~
+ *     \param id - \~english object class id \~russian идентификатор класса объекта \~
+ *     \param ido - \~english object id (default 0) \~russian идентификатор объекта (по умолчанию 0) \~
+ *     \return \~english link to window, or 0 if window not found \~russian ссылка на окно или 0\~
+ */
+QWidget *
+aWindowsList::get( int id, qulonglong ido )
+{
+    return list.find( conv( id, ido ) );
+}
+
+
+/*!
+ *     \~english
+ *     Create key for store in list.
+ *     \~russian
+ *     Создает ключ из параметров \a id и \a ido
+ *     \~
+ *     \param id - \~english object class id \~russian идентификатор класса объекта \~
+ *     \param ido - \~english object id (default 0) \~russian идентификатор объекта (по умолчанию 0) \~
+ *     \return \~english key \~russian ключ \~
+ */
+QString
+aWindowsList::conv( int id, qulonglong ido )
+{
+    return QString("%1_%2").arg( id ).arg( ido );
+}
+
diff --git a/src/lib/dialogs/awindowslist.h b/src/lib/dialogs/awindowslist.h
new file mode 100644 (file)
index 0000000..92a1dab
--- /dev/null
@@ -0,0 +1,69 @@
+/****************************************************************************
+** $Id: awindowslist.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Main window of Ananas Designer applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application  of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AWINDOWSLIST_H
+#define AWINDOWSLIST_H
+
+#include "ananasglobal.h"
+
+
+#include <qwidget.h>
+#include <q3dict.h>
+
+/*!
+ * \~english
+ *     Contains list of opened window.
+ * \~russian
+ *     \brief Класс определяет интерфейс управления списком открытых окон.
+ *     Наследует QWidget.
+ *
+ *     Объект класса содержит ссылки на все открытые окна. При открыти окна проверяется, есть ли оно в списке,
+ *     и если есть, то ему просто передается фокус.
+ * \~
+ */
+class  ANANAS_EXPORT aWindowsList : public QWidget
+{
+    Q_OBJECT
+public:
+    aWindowsList();
+    virtual ~aWindowsList();
+
+    void insert( int id, QWidget *window, qulonglong ido = 0 );
+    void remove( int id, qulonglong ido = 0 );
+    void remove( QWidget *window );
+    bool find( int id, qulonglong ido = 0 );
+    bool find( QWidget *window );
+    QWidget *get( int id, qulonglong ido = 0 );
+
+private:
+    Q3Dict<QWidget> list;
+    QString conv( int id, qulonglong ido );
+};
+
+
+#endif //AWINDOWSLIST_H
diff --git a/src/lib/dialogs/deditrc.cpp b/src/lib/dialogs/deditrc.cpp
new file mode 100644 (file)
index 0000000..8ce6e30
--- /dev/null
@@ -0,0 +1,127 @@
+#include "deditrc.h"
+
+#include <q3filedialog.h>
+//#include <qstring.h>
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "atests.h"
+/*
+ *  Constructs a dEditRC as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+dEditRC::dEditRC(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dEditRC::~dEditRC()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dEditRC::languageChange()
+{
+    retranslateUi(this);
+}
+
+
+
+void dEditRC::setdata(QString nameRC, rcListViewItem *item)
+{
+//     QFile f;
+//     QString s, sv, sn;
+//     char buf[1025];
+       it = item;
+       QMap<QString,QString> cfg;
+
+       cfg = aTests::readConfig(QDir::convertSeparators(nameRC));
+       eRCFile->setText(QDir::convertSeparators(nameRC));
+       eDBType->setCurrentItem(0);
+
+       eDBTitle->setText(cfg["dbtitle"]);
+       eDBName->setText(cfg["dbname"]);
+       eDBUserName->setText(cfg["dbuser"]);
+       ePass->setText(cfg["dbpass"]);
+       eDBHost->setText(cfg["dbhost"]);
+       eDBPort->setText(cfg["dbport"]);
+       eCfgName->setText(QDir::convertSeparators(cfg["configfile"]));
+       if(cfg["dbtype"]=="postgres") eDBType->setCurrentItem(3);
+       if(cfg["dbtype"]=="mysql") eDBType->setCurrentItem(2);
+       if(cfg["dbtype"]=="internal") eDBType->setCurrentItem(1);
+       eWorkDir->setText(QDir::convertSeparators(cfg["workdir"]));
+}
+
+
+void dEditRC::updatecfg()
+{
+       QMap<QString,QString> cfg;
+
+       cfg["dbtitle"]  = eDBTitle->text();
+       cfg["dbname"]   = eDBName->text();
+       if(eDBType->currentItem()==1) cfg["dbtype"] ="internal";
+       if(eDBType->currentItem()==2) cfg["dbtype"] ="mysql";
+       if(eDBType->currentItem()==3) cfg["dbtype"]= "postgres";
+       cfg["dbuser"]   = eDBUserName->text();
+       cfg["dbpass"]   = ePass->text();
+       cfg["dbhost"]   = eDBHost->text();
+       cfg["dbport"]   = eDBPort->text();
+       cfg["workdir"]  = QDir::convertSeparators(eWorkDir->text());
+       cfg["configfile"]= QDir::convertSeparators(eCfgName->text());
+
+       aTests::writeConfig(QDir::convertSeparators(eRCFile->text()),cfg);
+}
+
+
+
+void dEditRC::onOK()
+{
+       updatecfg();
+       it->rcfile = QDir::convertSeparators(eRCFile->text());
+       it->setText(0,eDBTitle->text());
+       accept();
+}
+
+
+void dEditRC::onRCFile()
+{
+               Q3FileDialog fd( QString::null,
+                       tr("ananas config resource (*.rc)"),
+                       0, 0, TRUE );
+               fd. setMode ( Q3FileDialog::AnyFile );
+               fd.setSelection( QDir::convertSeparators(eRCFile->text()));
+               if ( fd.exec() == QDialog::Accepted ) {
+                       eRCFile->setText(QDir::convertSeparators(fd.selectedFile()));
+                       setdata(eRCFile->text(),it);
+               } else {
+                       return;
+               }
+}
+
+
+void dEditRC::onCFGFile()
+{
+               Q3FileDialog fd( QString::null,
+                       tr("ananas config file (*.cfg)"),
+                       0, 0, TRUE );
+               fd. setMode ( Q3FileDialog::AnyFile );
+               fd.setSelection( QDir::convertSeparators(eCfgName->text()));
+               if ( fd.exec() == QDialog::Accepted ) {
+                       eCfgName->setText(QDir::convertSeparators(fd.selectedFile()));
+               } else {
+                       return;
+               }
+}
diff --git a/src/lib/dialogs/deditrc.h b/src/lib/dialogs/deditrc.h
new file mode 100644 (file)
index 0000000..af330f9
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef DEDITRC_H
+#define DEDITRC_H
+
+#include "ui_deditrc.h"
+
+class ANANAS_EXPORT dEditRC : public QDialog, public Ui::dEditRC
+{
+    Q_OBJECT
+
+public:
+    dEditRC(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~dEditRC();
+
+public slots:
+    virtual void setdata( QString nameRC, rcListViewItem * item );
+    virtual void updatecfg();
+
+signals:
+    void onOk(QString rc);
+
+protected slots:
+    virtual void languageChange();
+
+    virtual void onCFGFile();
+
+
+private:
+    rcListViewItem *it;
+
+private slots:
+    virtual void onOK();
+    virtual void onRCFile();
+
+};
+
+#endif // DEDITRC_H
diff --git a/src/lib/dialogs/deditrc.ui b/src/lib/dialogs/deditrc.ui
new file mode 100644 (file)
index 0000000..a512e9a
--- /dev/null
@@ -0,0 +1,460 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro>ANANAS_EXPORT</exportmacro>\r
+  <class>dEditRC</class>\r
+  <widget class="QDialog" name="dEditRC" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>777</width>\r
+        <height>402</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Resource file</string>\r
+    </property>\r
+    <layout class="QVBoxLayout" >\r
+      <item>\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel4_2" >\r
+              <property name="minimumSize" >\r
+                <size>\r
+                  <width>180</width>\r
+                  <height>0</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Resource file name</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QLineEdit" name="eRCFile" />\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="bFileRC" >\r
+              <property name="maximumSize" >\r
+                <size>\r
+                  <width>30</width>\r
+                  <height>32767</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>...</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item>\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel3_2" >\r
+              <property name="minimumSize" >\r
+                <size>\r
+                  <width>180</width>\r
+                  <height>0</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Data base header</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QLineEdit" name="eDBTitle" />\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item>\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel6_2" >\r
+              <property name="minimumSize" >\r
+                <size>\r
+                  <width>180</width>\r
+                  <height>0</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Data base name</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QLineEdit" name="eDBName" />\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item>\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel3" >\r
+              <property name="minimumSize" >\r
+                <size>\r
+                  <width>180</width>\r
+                  <height>0</height>\r
+                </size>\r
+              </property>\r
+              <property name="maximumSize" >\r
+                <size>\r
+                  <width>160</width>\r
+                  <height>32767</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Data base server type</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QComboBox" name="eDBType" >\r
+              <property name="editable" >\r
+                <bool>false</bool>\r
+              </property>\r
+              <property name="duplicatesEnabled" >\r
+                <bool>false</bool>\r
+              </property>\r
+              <item>\r
+                <property name="text" >\r
+                  <string>Unknown</string>\r
+                </property>\r
+              </item>\r
+              <item>\r
+                <property name="text" >\r
+                  <string>internal</string>\r
+                </property>\r
+              </item>\r
+              <item>\r
+                <property name="text" >\r
+                  <string>mysql</string>\r
+                </property>\r
+              </item>\r
+              <item>\r
+                <property name="text" >\r
+                  <string>postgres</string>\r
+                </property>\r
+              </item>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item>\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel4" >\r
+              <property name="minimumSize" >\r
+                <size>\r
+                  <width>180</width>\r
+                  <height>0</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Data base server address</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QLineEdit" name="eDBHost" />\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item>\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel5_2" >\r
+              <property name="minimumSize" >\r
+                <size>\r
+                  <width>180</width>\r
+                  <height>0</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Data base server port</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QLineEdit" name="eDBPort" />\r
+          </item>\r
+          <item>\r
+            <spacer name="spacer7" >\r
+              <property name="sizeHint" >\r
+                <size>\r
+                  <width>146</width>\r
+                  <height>21</height>\r
+                </size>\r
+              </property>\r
+              <property name="sizeType" >\r
+                <enum>Expanding</enum>\r
+              </property>\r
+              <property name="orientation" >\r
+                <enum>Horizontal</enum>\r
+              </property>\r
+            </spacer>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item>\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel1" >\r
+              <property name="minimumSize" >\r
+                <size>\r
+                  <width>180</width>\r
+                  <height>0</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Data base server user</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QLineEdit" name="eDBUserName" />\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item>\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel2" >\r
+              <property name="minimumSize" >\r
+                <size>\r
+                  <width>180</width>\r
+                  <height>0</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Data base server password</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QLineEdit" name="ePass" >\r
+              <property name="echoMode" >\r
+                <enum>QLineEdit::Password</enum>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item>\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel7_2" >\r
+              <property name="minimumSize" >\r
+                <size>\r
+                  <width>180</width>\r
+                  <height>0</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Work directory</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QLineEdit" name="eWorkDir" />\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item>\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel8_2" >\r
+              <property name="minimumSize" >\r
+                <size>\r
+                  <width>180</width>\r
+                  <height>0</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Configuration file name</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QLineEdit" name="eCfgName" />\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="bFileCFG" >\r
+              <property name="maximumSize" >\r
+                <size>\r
+                  <width>30</width>\r
+                  <height>32767</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>...</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item>\r
+        <spacer name="spacer6" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>130</width>\r
+              <height>16</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Vertical</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+      <item>\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <spacer name="spacer7_2_2" >\r
+              <property name="sizeHint" >\r
+                <size>\r
+                  <width>470</width>\r
+                  <height>21</height>\r
+                </size>\r
+              </property>\r
+              <property name="sizeType" >\r
+                <enum>Expanding</enum>\r
+              </property>\r
+              <property name="orientation" >\r
+                <enum>Horizontal</enum>\r
+              </property>\r
+            </spacer>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="bOK" >\r
+              <property name="maximumSize" >\r
+                <size>\r
+                  <width>80</width>\r
+                  <height>32767</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>OK</string>\r
+              </property>\r
+              <property name="default" >\r
+                <bool>true</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <spacer name="spacer7_2" >\r
+              <property name="sizeHint" >\r
+                <size>\r
+                  <width>20</width>\r
+                  <height>21</height>\r
+                </size>\r
+              </property>\r
+              <property name="sizeType" >\r
+                <enum>Fixed</enum>\r
+              </property>\r
+              <property name="orientation" >\r
+                <enum>Horizontal</enum>\r
+              </property>\r
+            </spacer>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="bCancel" >\r
+              <property name="maximumSize" >\r
+                <size>\r
+                  <width>80</width>\r
+                  <height>32767</height>\r
+                </size>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Cancel</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="5" margin="5" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <tabstops>\r
+    <tabstop>eRCFile</tabstop>\r
+    <tabstop>bFileRC</tabstop>\r
+    <tabstop>eDBTitle</tabstop>\r
+    <tabstop>eDBName</tabstop>\r
+    <tabstop>eDBType</tabstop>\r
+    <tabstop>eDBHost</tabstop>\r
+    <tabstop>eDBPort</tabstop>\r
+    <tabstop>eDBUserName</tabstop>\r
+    <tabstop>ePass</tabstop>\r
+    <tabstop>eWorkDir</tabstop>\r
+    <tabstop>eCfgName</tabstop>\r
+    <tabstop>bFileCFG</tabstop>\r
+    <tabstop>bOK</tabstop>\r
+    <tabstop>bCancel</tabstop>\r
+  </tabstops>\r
+  <includes>\r
+    <include location="global" >rclistviewitem.h</include>\r
+    <include location="local" >qstringlist.h</include>\r
+    <include location="local" >ananasglobal.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>bCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>dEditRC</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bFileRC</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>dEditRC</receiver>\r
+      <slot>onRCFile()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bOK</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>dEditRC</receiver>\r
+      <slot>onOK()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bFileCFG</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>dEditRC</receiver>\r
+      <slot>onCFGFile()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/lib/dialogs/dhelpcfgform.cpp b/src/lib/dialogs/dhelpcfgform.cpp
new file mode 100644 (file)
index 0000000..fb548f9
--- /dev/null
@@ -0,0 +1,42 @@
+#include "dhelpcfgform.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a HelpCfgForm as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+HelpCfgForm::HelpCfgForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+HelpCfgForm::~HelpCfgForm()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void HelpCfgForm::languageChange()
+{
+    retranslateUi(this);
+}
+
+void HelpCfgForm::init()
+{
+ textEdit1->setText( tr("Make group, item, set item paramert and press Ok button. See http://ananas.lrn.ru/index.php?title=Manual:Disigner for details" ));
+}
diff --git a/src/lib/dialogs/dhelpcfgform.h b/src/lib/dialogs/dhelpcfgform.h
new file mode 100644 (file)
index 0000000..785f249
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef HELPCFGFORM_H
+#define HELPCFGFORM_H
+
+#include "ui_dhelpcfgform.h"
+
+
+class HelpCfgForm : public QDialog, public Ui::HelpCfgForm
+{
+    Q_OBJECT
+
+public:
+    HelpCfgForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~HelpCfgForm();
+
+    virtual void init();
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // HELPCFGFORM_H
diff --git a/src/lib/dialogs/dhelpcfgform.ui b/src/lib/dialogs/dhelpcfgform.ui
new file mode 100644 (file)
index 0000000..6f8e77b
--- /dev/null
@@ -0,0 +1,94 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>HelpCfgForm</class>\r
+  <widget class="QDialog" name="HelpCfgForm" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>608</width>\r
+        <height>508</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Create busines shema</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item rowspan="1" row="0" column="0" colspan="3" >\r
+        <widget class="Q3TextEdit" name="textEdit1" >\r
+          <property name="textFormat" >\r
+            <enum>Qt::RichText</enum>\r
+          </property>\r
+          <property name="text" >\r
+            <string/>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <enum>Q3TextEdit::WidgetWidth</enum>\r
+          </property>\r
+          <property name="undoRedoEnabled" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="1" column="2" >\r
+        <spacer name="spacer1" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>201</width>\r
+              <height>20</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Horizontal</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+      <item row="1" column="0" >\r
+        <spacer name="spacer2" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>171</width>\r
+              <height>20</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Horizontal</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+      <item row="1" column="1" >\r
+        <widget class="QPushButton" name="closeButton" >\r
+          <property name="sizePolicy" >\r
+            <sizepolicy>\r
+              <hsizetype>0</hsizetype>\r
+              <vsizetype>0</vsizetype>\r
+              <horstretch>0</horstretch>\r
+              <verstretch>0</verstretch>\r
+            </sizepolicy>\r
+          </property>\r
+          <property name="text" >\r
+            <string>Close</string>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="6" margin="11" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <connections>\r
+    <connection>\r
+      <sender>closeButton</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>HelpCfgForm</receiver>\r
+      <slot>accept()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/lib/dialogs/dialogs.pri b/src/lib/dialogs/dialogs.pri
new file mode 100644 (file)
index 0000000..003e3d4
--- /dev/null
@@ -0,0 +1,24 @@
+HEADERS += \
+    dialogs/deditrc.h \
+    dialogs/dhelpcfgform.h \
+    dialogs/dimportdb.h \
+    dialogs/dlogin.h \
+    dialogs/dselectdb.h \
+    dialogs/messageswindow.h \
+    dialogs/awindowslist.h
+
+SOURCES += \
+    dialogs/awindowslist.cpp \
+    dialogs/deditrc.cpp \
+    dialogs/dhelpcfgform.cpp \
+    dialogs/dimportdb.cpp \
+    dialogs/dlogin.cpp \
+    dialogs/dselectdb.cpp \
+    dialogs/messageswindow.cpp
+
+        
+FORMS += \
+    dialogs/deditrc.ui \
+    dialogs/dhelpcfgform.ui \
+    dialogs/dlogin.ui \
+    dialogs/dselectdb.ui
diff --git a/src/lib/dialogs/dimportdb.cpp b/src/lib/dialogs/dimportdb.cpp
new file mode 100644 (file)
index 0000000..8f3ead2
--- /dev/null
@@ -0,0 +1,64 @@
+/****************************************************************************
+** Form implementation generated from reading ui file 'deditrc.ui'
+**
+** Created: Пнд Фев 13 14:29:13 2006
+**      by: The User Interface Compiler ($Id: dimportdb.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#include "dimportdb.h"
+#include "atests.h"
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <q3filedialog.h>
+
+dImportDB::dImportDB( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
+    : dEditRC( parent, name, modal, fl )
+{
+    if ( !name )
+       setName( "dImportDB" );
+    languageChange();
+
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dImportDB::~dImportDB()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void
+dImportDB::languageChange()
+{
+       dEditRC::languageChange();
+       setCaption( tr( "Resource file" ) );
+       textLabel8_2->setText( tr( "archive file" ) );
+       bOK->setText( tr( "Import" ) );
+}
+
+void
+dImportDB::onCFGFile()
+{
+               Q3FileDialog fd( QString::null,
+                       tr("any files (*)"),
+                       0, 0, TRUE );
+               fd.setMode(Q3FileDialog::AnyFile);
+               fd.addFilter(tr("ananas business schema archiff file (*.bsa)"));
+               fd.setSelection( QDir::convertSeparators(eCfgName->text()));
+               if ( fd.exec() == QDialog::Accepted )
+               {
+                       eCfgName->setText(QDir::convertSeparators(fd.selectedFile()));
+               }
+               else
+               {
+                       return;
+               }
+}
diff --git a/src/lib/dialogs/dimportdb.h b/src/lib/dialogs/dimportdb.h
new file mode 100644 (file)
index 0000000..2c011d9
--- /dev/null
@@ -0,0 +1,30 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'deditrc.ui'
+**
+** Created: Пнд Фев 13 14:06:55 2006
+**      by: The User Interface Compiler ($Id: dimportdb.h,v 1.1 2008/11/05 21:16:28 leader Exp $)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#ifndef DIMPORTDB_H
+#define DIMPORTDB_H
+
+#include "ananasglobal.h"
+#include "deditrc.h"
+
+class ANANAS_EXPORT dImportDB : public dEditRC
+{
+    Q_OBJECT
+
+public:
+       dImportDB( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
+       ~dImportDB();
+
+
+protected slots:
+       virtual void languageChange();
+       virtual void onCFGFile();
+};
+
+#endif // DIMPORTDB_H
diff --git a/src/lib/dialogs/dlogin.cpp b/src/lib/dialogs/dlogin.cpp
new file mode 100644 (file)
index 0000000..a1c2a71
--- /dev/null
@@ -0,0 +1,52 @@
+#include "dlogin.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a dLogin as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+dLogin::dLogin(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dLogin::~dLogin()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dLogin::languageChange()
+{
+    retranslateUi(this);
+}
+
+void dLogin::init()
+{
+       username = "";
+       password = "";
+}
+
+
+void dLogin::buttonOK()
+{
+       username = eName->text();
+       password = ePassword->text();
+       accept();
+}
+
diff --git a/src/lib/dialogs/dlogin.h b/src/lib/dialogs/dlogin.h
new file mode 100644 (file)
index 0000000..aaf31bc
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DLOGIN_H
+#define DLOGIN_H
+
+#include "ui_dlogin.h"
+
+
+class ANANAS_EXPORT dLogin : public QDialog, public Ui::dLogin
+{
+    Q_OBJECT
+
+public:
+    dLogin(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~dLogin();
+
+    QString username, password;
+
+public slots:
+    virtual void init();
+    virtual void buttonOK();
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // DLOGIN_H
diff --git a/src/lib/dialogs/dlogin.ui b/src/lib/dialogs/dlogin.ui
new file mode 100644 (file)
index 0000000..cf27a3b
--- /dev/null
@@ -0,0 +1,96 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro>ANANAS_EXPORT</exportmacro>\r
+  <class>dLogin</class>\r
+  <widget class="QDialog" name="dLogin" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>303</width>\r
+        <height>89</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Ananas: Login</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <property name="resizeMode" >\r
+        <enum>Fixed</enum>\r
+      </property>\r
+      <item row="0" column="0" >\r
+        <widget class="QLabel" name="textLabel1" >\r
+          <property name="text" >\r
+            <string>Login name</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="1" column="0" >\r
+        <widget class="QLabel" name="textLabel2" >\r
+          <property name="text" >\r
+            <string>Password</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="0" column="1" >\r
+        <widget class="QLineEdit" name="eName" />\r
+      </item>\r
+      <item row="1" column="1" >\r
+        <widget class="QLineEdit" name="ePassword" >\r
+          <property name="echoMode" >\r
+            <enum>QLineEdit::Password</enum>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="1" column="2" >\r
+        <widget class="QPushButton" name="bCancel" >\r
+          <property name="text" >\r
+            <string>&amp;Cancel</string>\r
+          </property>\r
+          <property name="shortcut" >\r
+            <string>Alt+C</string>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="0" column="2" >\r
+        <widget class="QPushButton" name="bOK" >\r
+          <property name="text" >\r
+            <string>O&amp;K</string>\r
+          </property>\r
+          <property name="shortcut" >\r
+            <string>Alt+K</string>\r
+          </property>\r
+          <property name="default" >\r
+            <bool>true</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="5" margin="5" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >ananasglobal.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>bOK</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>dLogin</receiver>\r
+      <slot>buttonOK()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>dLogin</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/lib/dialogs/dselectdb.cpp b/src/lib/dialogs/dselectdb.cpp
new file mode 100644 (file)
index 0000000..b11d066
--- /dev/null
@@ -0,0 +1,520 @@
+#include "dselectdb.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "atests.h"
+#include "dhelpcfgform.h"
+/*
+ *  Constructs a dSelectDB as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+dSelectDB::dSelectDB(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+    ,settings( QSettings::IniFormat, QSettings::UserScope, "Ananas company Ltd", "Ananas4")
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+dSelectDB::~dSelectDB()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void dSelectDB::languageChange()
+{
+    retranslateUi(this);
+}
+
+
+//#include "acfgobj.h"
+#include <qdir.h>
+#include <qstring.h>
+#include <q3filedialog.h>
+#include <qlineedit.h>
+#include <qstring.h>
+#include <qdom.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+
+#include "deditrc.h"
+#include "dimportdb.h"
+#include "acfgrc.h"
+#include "atests.h"
+#include "adataexchange.h"
+#include "alog.h"
+
+void dSelectDB::init()
+{
+       aLog::init("ananas.log", aLog::Debug);
+       createMenu();
+       progressBar1->hide();
+       QString fname;
+       withgroups = 1;
+       //--settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
+       //--settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
+
+       local = settings.entryList("/groups").count();
+       changes = false;
+       /*--if(!local)
+       {
+
+               aLog::print(aLog::Debug, tr("dSelectDB local settings not found"));
+               settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas/globalsettings");
+#ifdef Q_OS_WIN32
+               QStringList subkeys = settings.subkeyList("/ananasgroup/ananas/globalsettings");
+               settings.insertSearchPath(QSettings::Windows,"/ananasgroup/ananas/globalsettings");
+               QStringList entryGroup;
+               for(uint i=0; i<subkeys.count();i++)
+               {
+                       QString str =subkeys[i];
+                       //str = str.left(str.length()-2); // length("rc")=2
+                       entryGroup =settings.entryList("/"+str);
+                       settings.beginGroup("/"+str);
+                       readSettings(entryGroup);
+                       settings.endGroup();
+               }
+
+#else
+               QString suff = "*_grouprc";
+               QDir dir("/etc/ananas",suff,QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::Readable);
+               QStringList subkeys = dir.entryList(suff);
+               settings.insertSearchPath(QSettings::Unix,"/etc/ananas/");
+               QStringList entryGroup;
+               for(uint i=0; i<subkeys.count();i++)
+               {
+                       QString str =subkeys[i];
+                       str = str.left(str.length()-2); // length("rc")=2
+                       entryGroup =settings.entryList("/"+str);
+                       settings.beginGroup("/"+str);
+                       readSettings(entryGroup);
+                       settings.endGroup();
+               }
+#endif
+       }
+       else*/
+       {
+               QStringList lst = settings.entryList("/groups");
+               settings.beginGroup("/groups");
+               readSettings(lst);
+               settings.endGroup();
+       }
+       setIcon( rcIcon("a-system.png"));
+       listDBRC->hideColumn( 1 );
+       listDBRC->setSorting( -1 );
+       listDBRC->header()->hide();
+       listDBRC->setRootIsDecorated(1);
+       buttonOk->setEnabled( FALSE );
+       return;
+}
+
+void dSelectDB::readSettings(QStringList entryGroup)
+{
+       rcfile="";
+       ro_mode=0;
+       QFile f, fc;
+       QString s, sp, sn, rc;
+       rcListViewItem *item, *gitem=NULL; //, *subitem;
+       for(uint j=0; j<entryGroup.count();j++)
+       {
+               QStringList eitems;
+               eitems = settings.entryList(entryGroup[j]);
+               QString groupName = "unknown group";
+               groupName = settings.readEntry(entryGroup[j]);
+               aLog::print(aLog::Debug, tr("dSelectDB read settings for group with name %1").arg(groupName));
+               rcListViewItem * lastIt = (rcListViewItem *) listDBRC->lastItem();
+               if(lastIt!=NULL)
+               {
+                       while(lastIt->depth()>0)
+                       {
+                               lastIt =(rcListViewItem *) lastIt->parent();
+                       }
+                       gitem= new rcListViewItem(listDBRC, lastIt, groupName, "", true );
+                       gitem->setOpen(true);
+               }
+               else
+               {
+                       gitem= new rcListViewItem(listDBRC, groupName, "", true );
+                       gitem->setOpen(true);
+               }
+//             withgroups=1;
+               QMap<QString,QString> cfg;
+               for(int k = eitems.count()-1; k>=0; k--)
+               {
+                       if(k<0) break;
+                       rc = settings.readEntry(entryGroup[j]+"/"+eitems[k]);
+                       cfg = aTests::readConfig(QDir::convertSeparators(rc));
+                       sn=cfg["dbtitle"];
+                       if (gitem) item= new rcListViewItem( gitem, sn, rc );
+                       else item= new rcListViewItem( listDBRC, sn, rc );
+               }
+       }
+}
+
+
+void dSelectDB::itemSelect( Q3ListViewItem *item )
+{
+       if (! item ) return;
+       rcListViewItem *i = ( rcListViewItem *) item ;
+       buttonOk->setEnabled( !i->group );
+}
+
+
+void dSelectDB::newGroup()
+{
+       Q3ListViewItem *gitem;
+       gitem = new rcListViewItem(listDBRC, tr("New group"), "", true );
+       listDBRC->setRootIsDecorated(1);
+       gitem->setOpen(true);
+       listDBRC->setSelected(gitem, true);
+       editItem();
+       withgroups=1;
+       changes = true;
+       //saveRC();
+}
+
+
+void dSelectDB::newItem()
+{
+       rcListViewItem *item, *gitem;
+       QString rc;
+       item= ( rcListViewItem *) listDBRC->selectedItem();
+       if (!item) return;
+       if (withgroups) {
+               if (item->parent()) gitem = ( rcListViewItem *) item->parent();
+               else gitem=item;
+               item = new rcListViewItem(gitem, tr("New shema"), "myrc");
+               gitem->setOpen(true);
+
+       } else {
+               item = new rcListViewItem(listDBRC, tr("New shema"), "myrc");
+       }
+       listDBRC->setSelected(item, true);
+       editItem();
+       changes = true;
+}
+
+
+void dSelectDB::editItem()
+{
+       rcListViewItem *item;
+       dEditRC *d = new dEditRC(this);
+
+       item = ( rcListViewItem *) listDBRC->selectedItem();
+       if (!item) return;
+       if ( item->group )
+       {
+       // Group
+               item->setRenameEnabled(0, true);
+               item->startRename(0);
+               changes = true;
+       }
+       else
+       {
+       // Resource
+               d->setdata( QDir::convertSeparators(item->rcfile), item );
+               if ( d->exec() == QDialog::Accepted )
+               {
+                       changes = true;
+               }
+       }
+}
+
+
+
+void dSelectDB::deleteItem()
+{
+       Q3ListViewItem *item;
+       item=listDBRC->selectedItem();
+       if (item)
+       {
+               QString msg = tr("Delete item?");
+               if(QMessageBox::question(this,tr("confirm delete"),msg,QMessageBox::Ok,QMessageBox::Cancel)!=QMessageBox::Ok)
+               {
+                       return;
+               }
+
+               delete item;
+               if (listDBRC->childCount()==0) withgroups=0;
+               changes = true;
+       }
+}
+
+
+void dSelectDB::saveRC()
+{
+       rcListViewItem *item, *gitem;
+       QFile f( rcfile );
+       aLog::print(aLog::Info, tr("dSelectDB save settings"));
+       if (!local)
+       {
+               if(!changes) return;
+               QString home = QDir::homeDirPath();
+#ifndef Q_OS_WIN32
+               QString msg = QString("Все внесенные изменения будут сохранены локально в вашем домашнем каталоге.\nПри очередном запуске программы будут использованы локальные настройки из каталога\n%1/.ananas.\nЕсли Вы хотите использовать глобальные настройки, вам следует удалить каталог\n%2/.ananas").arg(home).arg(home);
+#else
+               QString msg = tr("save settings local?");
+#endif
+               if(QMessageBox::question(this,tr("save"),QString::fromUtf8(msg),QMessageBox::Ok,QMessageBox::Cancel)!=QMessageBox::Ok)
+               {
+                       return;
+               }
+       }
+               //--settings.removeSearchPath( QSettings::Unix, "/etc/ananas" );
+               //--settings.removeSearchPath( QSettings::Windows, "/ananasgroup/ananas/globalsettings");
+
+
+               gitem= ( rcListViewItem *) listDBRC->firstChild();
+               uint gcount=0;
+               uint ecount=0;
+               clearSettings();
+
+               settings.beginGroup("/groups");
+
+               while (gitem)
+               {
+                       if (withgroups)
+                       {
+                                settings.writeEntry(QString::number(gcount),gitem->text(0));
+                               if(gitem->childCount())
+                               {
+                                       item = ( rcListViewItem *) gitem->firstChild();
+                                       while (item)
+                                       {
+                                               settings.writeEntry(QString::number(gcount)+"/"+QString::number(ecount),item->rcfile);
+                                               item =  ( rcListViewItem *) item->nextSibling();
+                                               ++ecount;
+                                       }
+                               }
+                       }
+                       ++gcount;
+                       gitem =  ( rcListViewItem *) gitem->nextSibling();
+               }
+               settings.endGroup();
+}
+
+
+void dSelectDB::onOK()
+{
+       rcListViewItem *item;
+
+       saveRC();
+       item =  ( rcListViewItem *) listDBRC->selectedItem();
+       if (item) {
+                    if ( !item->rcfile.isEmpty() ) {
+                        rcfile = item->rcfile;
+                        accept();
+               }
+       }
+}
+
+
+void dSelectDB::onCancel()
+{
+       //saveRC();
+       reject();
+}
+
+
+void dSelectDB::ItemRenamed(Q3ListViewItem *item, int col)
+{
+       if (!item) return;
+       if (col>1) return;
+}
+
+
+void dSelectDB::clearSettings()
+{
+        QStringList eitems;
+       QStringList entryGroup =settings.entryList("/groups");
+       settings.beginGroup("/groups");
+       for(uint j=0; j<entryGroup.count();j++)
+       {
+               eitems = settings.entryList(entryGroup[j]);
+               settings.removeEntry(entryGroup[j]);
+               for(int k = eitems.count()-1; k>=0; k--)
+               {
+                       if(k<0) break;
+                       settings.removeEntry(entryGroup[j]+"/"+eitems[k]);
+               }
+       }
+       settings.endGroup();
+}
+
+
+void dSelectDB::onHelp()
+{
+       HelpCfgForm f;
+       f.exec();
+}
+
+void dSelectDB::createMenu()
+{
+
+       menuBar = new QMenuBar(this);
+       Q3PopupMenu *menuFile = new Q3PopupMenu(this);
+       menuFile->insertItem(tr("E&xit"), this, SLOT(onCancel()));
+
+       Q3PopupMenu *menuEdit = new Q3PopupMenu(this);
+       menuEdit->insertItem(tr("New &group"), this, SLOT(newGroup()));
+       menuEdit->insertItem(tr("&New shema"), this, SLOT(newItem()));
+       menuEdit->insertSeparator();
+       menuEdit->insertItem(tr("Edi&t"),  this, SLOT(editItem()));
+       menuEdit->insertSeparator();
+       menuEdit->insertItem(tr("&Delete"),  this, SLOT(deleteItem()));
+
+       Q3PopupMenu *menuAction = new Q3PopupMenu(this);
+       menuAction->insertItem(tr("&Import"),  this, SLOT(importItem()));
+       menuAction->insertItem(tr("&Export"),  this, SLOT(exportItem()));
+
+       menuBar->insertItem(tr("Program"), menuFile);
+       menuBar->insertItem(tr("Actions"), menuEdit);
+       menuBar->insertItem(tr("Service"), menuAction);
+       layout()->setMenuBar(menuBar);
+       menuBar->show();
+}
+
+
+void dSelectDB::importItem()
+{
+       rcListViewItem *item,*gitem;
+       dImportDB *d = new dImportDB(this);
+       item = (rcListViewItem *)listDBRC->selectedItem();
+       if (!item) return;
+       if (withgroups)
+       {
+               if (item->parent()) gitem = ( rcListViewItem *) item->parent();
+               else gitem=item;
+               item = new rcListViewItem(gitem, tr("New shema"), "myrc");
+               gitem->setOpen(true);
+
+       }
+       else
+       {
+               item = new rcListViewItem(listDBRC, tr("New shema"), "myrc");
+       }
+       listDBRC->setSelected(item, true);
+       d->setdata("", item );
+       if ( d->exec() == QDialog::Accepted )
+       {
+               bool res;
+               QString rcfile = item->rcfile;
+               QString filename = d->eCfgName->text();
+               progressBar1->show();
+               progressBar1->reset();
+               aBackup newBase;
+               connect (&newBase, SIGNAL(progress(int,int)), progressBar1, SLOT( setProgress(int,int)));
+               if(newBase.importData(rcfile, filename, true)==false)
+               {
+                       QMessageBox::information(this,tr("Backup"),newBase.lastError(),Qt::NoButton);
+                       progressBar1->hide();
+                       aLog::print(aLog::Info, tr("dSelectDB business schema import"));
+               }
+               else
+               {
+                       aLog::print(aLog::Error, tr("dSelectDB restore: %1").arg(newBase.lastError()));
+                       QMessageBox::critical(this,tr("Backup"),newBase.lastError(),0, Qt::NoButton);
+                       progressBar1->hide();
+                       delete item;
+                       item =0;
+                       return;
+               }
+
+
+
+               changes = true;
+       }
+       else
+       {
+               delete item;
+               item = 0;
+               return;
+       }
+}
+
+
+void dSelectDB::exportItem()
+{
+//     progressBar1->setTotalSteps(10);
+       QString dir,rcfile,filename;
+#ifndef Q_OS_WIN32
+       dir = "/home";
+#endif
+
+       rcListViewItem *item =  ( rcListViewItem *) listDBRC->selectedItem();
+       if (item)
+       {
+               if ( !item->rcfile.isEmpty() && !item->group )
+               {
+                       rcfile = item->rcfile;
+               }
+               else
+               {
+                       QMessageBox::information(this,tr("Select item"),tr("Please, select item for export"),Qt::NoButton);
+                       return;
+               }
+
+               Q3FileDialog *fdlg = new Q3FileDialog(this, "fileDialog",true); // create modal dialog
+               fdlg->setMode ( Q3FileDialog::AnyFile );
+               if(fdlg->exec()==QDialog::Accepted)
+               {
+                       filename = fdlg->selectedFile();
+               }
+               else
+               {
+                       return;
+               }
+               delete fdlg;
+               fdlg = 0;
+
+               aBackup backupBase;
+               progressBar1->show();
+               progressBar1->reset();
+               connect (&backupBase, SIGNAL(progress(int,int)), progressBar1, SLOT( setProgress(int,int)));
+               if(backupBase.exportData(rcfile, filename, true )==0)
+               {
+                       aLog::print(aLog::Info, tr("dSelectDB backup ok"));
+                       QMessageBox::information(this,tr("Backup"),backupBase.lastError(),Qt::NoButton);
+                       progressBar1->hide();
+
+               }
+               else
+               {
+                       aLog::print(aLog::Debug, tr("dSelectDB backup: %1").arg(backupBase.lastError()));
+                       QMessageBox::critical(this,tr("Backup"),backupBase.lastError(),0, Qt::NoButton);
+                       progressBar1->hide();
+                       return;
+               }
+       }
+       else
+       {
+               QMessageBox::information(this,tr("Select item"),tr("Please, select item for export"),Qt::NoButton);
+               return;
+       }
+
+}
+
+
+void dSelectDB::onDblClick( Q3ListViewItem *item)
+{
+
+       if (! (( rcListViewItem *)item)->group )
+       {
+               onOK();
+
+       }
+}
+
diff --git a/src/lib/dialogs/dselectdb.h b/src/lib/dialogs/dselectdb.h
new file mode 100644 (file)
index 0000000..817019a
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef DSELECTDB_H
+#define DSELECTDB_H
+
+#include "ui_dselectdb.h"
+
+
+class ANANAS_EXPORT dSelectDB : public QDialog, public Ui::dSelectDB
+{
+    Q_OBJECT
+
+public:
+    dSelectDB(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~dSelectDB();
+
+    QString rcfile;
+
+public slots:
+    void newItem();
+    void editItem();
+    void deleteItem();
+    void onCancel();
+    void ItemRenamed( Q3ListViewItem * item, int col );
+    void onHelp();
+    void createMenu();
+    virtual void onDblClick(Q3ListViewItem *);
+
+protected:
+    QSettings settings;
+
+    virtual void clearSettings();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    int withgroups;
+    QMenuBar *menuBar;
+    bool changes;
+    int ro_mode;
+    bool local;
+
+private slots:
+    void init();
+    void readSettings( QStringList entryGroup );
+    void itemSelect( Q3ListViewItem * item );
+    void newGroup();
+    void saveRC();
+    void onOK();
+    void importItem();
+    void exportItem();
+
+};
+
+#endif // DSELECTDB_H
diff --git a/src/lib/dialogs/dselectdb.ui b/src/lib/dialogs/dselectdb.ui
new file mode 100644 (file)
index 0000000..ac202a1
--- /dev/null
@@ -0,0 +1,181 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro>ANANAS_EXPORT</exportmacro>\r
+  <class>dSelectDB</class>\r
+  <widget class="QDialog" name="dSelectDB" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>443</width>\r
+        <height>415</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Information base</string>\r
+    </property>\r
+    <property name="sizeGripEnabled" >\r
+      <bool>true</bool>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item row="0" column="1" >\r
+        <layout class="QVBoxLayout" >\r
+          <item>\r
+            <widget class="QPushButton" name="buttonOk" >\r
+              <property name="text" >\r
+                <string>&amp;OK</string>\r
+              </property>\r
+              <property name="shortcut" >\r
+                <string/>\r
+              </property>\r
+              <property name="autoDefault" >\r
+                <bool>true</bool>\r
+              </property>\r
+              <property name="default" >\r
+                <bool>true</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="buttonCancel" >\r
+              <property name="text" >\r
+                <string>&amp;Cancel</string>\r
+              </property>\r
+              <property name="shortcut" >\r
+                <string>Alt+C</string>\r
+              </property>\r
+              <property name="autoDefault" >\r
+                <bool>true</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="buttonHelp" >\r
+              <property name="text" >\r
+                <string>&amp;Help</string>\r
+              </property>\r
+              <property name="shortcut" >\r
+                <string>Alt+H</string>\r
+              </property>\r
+              <property name="autoDefault" >\r
+                <bool>true</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <spacer name="Spacer1" >\r
+              <property name="sizeHint" >\r
+                <size>\r
+                  <width>20</width>\r
+                  <height>80</height>\r
+                </size>\r
+              </property>\r
+              <property name="sizeType" >\r
+                <enum>Expanding</enum>\r
+              </property>\r
+              <property name="orientation" >\r
+                <enum>Vertical</enum>\r
+              </property>\r
+            </spacer>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item row="0" column="0" >\r
+        <layout class="QVBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel1" >\r
+              <property name="text" >\r
+                <string>Select data base</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="Q3ListView" name="listDBRC" >\r
+              <property name="hScrollBarMode" >\r
+                <enum>Q3ScrollView::AlwaysOff</enum>\r
+              </property>\r
+              <property name="allColumnsShowFocus" >\r
+                <bool>true</bool>\r
+              </property>\r
+              <column>\r
+                <property name="text" >\r
+                  <string>Name</string>\r
+                </property>\r
+                <property name="clickable" >\r
+                  <bool>true</bool>\r
+                </property>\r
+                <property name="resizable" >\r
+                  <bool>true</bool>\r
+                </property>\r
+              </column>\r
+              <column>\r
+                <property name="text" >\r
+                  <string>Resource file</string>\r
+                </property>\r
+                <property name="clickable" >\r
+                  <bool>true</bool>\r
+                </property>\r
+                <property name="resizable" >\r
+                  <bool>true</bool>\r
+                </property>\r
+              </column>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="Q3ProgressBar" name="progressBar1" >\r
+              <property name="percentageVisible" >\r
+                <bool>true</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="5" margin="5" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >ananasglobal.h</include>\r
+    <include location="local" >qmenubar.h</include>\r
+    <include location="local" >q3popupmenu.h</include>\r
+    <include location="local" >qsettings.h</include>\r
+    <include location="local" >rclistviewitem.h</include>\r
+    <include location="local" >qmessagebox.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>buttonOk</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>dSelectDB</receiver>\r
+      <slot>onOK()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>buttonCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>dSelectDB</receiver>\r
+      <slot>onCancel()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>listDBRC</sender>\r
+      <signal>selectionChanged(Q3ListViewItem*)</signal>\r
+      <receiver>dSelectDB</receiver>\r
+      <slot>itemSelect(Q3ListViewItem*)</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>buttonHelp</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>dSelectDB</receiver>\r
+      <slot>onHelp()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>listDBRC</sender>\r
+      <signal>doubleClicked(Q3ListViewItem*)</signal>\r
+      <receiver>dSelectDB</receiver>\r
+      <slot>onDblClick(Q3ListViewItem*)</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/lib/dialogs/messageswindow.cpp b/src/lib/dialogs/messageswindow.cpp
new file mode 100644 (file)
index 0000000..3c12310
--- /dev/null
@@ -0,0 +1,140 @@
+/****************************************************************************
+** $Id: messageswindow.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Header file of the Mesages window of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/*
+*/
+#include <q3textbrowser.h>
+#include <qlayout.h>
+#include <qworkspace.h>
+#include <qimage.h>
+#include <qpixmap.h>
+//Added by qt3to4:
+#include <QHideEvent>
+#include "messageswindow.h"
+#include "acfg.h"
+
+/*
+ *  Constructs a MessagesWindow as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+MessagesWindow *msgwindow = 0;
+
+
+void
+messageproc(int n, const char *msg){
+       if (msgwindow) msgwindow->message( n, QObject::trUtf8( msg ) );
+}
+
+
+MessagesWindow::MessagesWindow( QWidget* parent, Qt::WFlags fl )
+    : Q3DockWindow( parent, "MessagesWindow", fl )
+{
+       msgBrowser = new Q3TextBrowser( this, "msgBrowser" );
+       boxLayout()->addWidget( msgBrowser );
+       languageChange();
+       setMinimumSize( QSize( 1, 1 ) );
+       msgBrowser->setMinimumSize( QSize( 1, 1 ) );
+       //--clearWState( WState_Polished );
+       //--setWindowState( WState_Polished );
+       setResizeEnabled( TRUE );
+       setExpanded(false);
+       setCloseMode( Q3DockWindow::Always );
+       msgBrowser->show();
+       msgwindow = this;
+       connect(msgBrowser, SIGNAL(doubleClicked(int,int)), this, SLOT(on_click()));
+       cfg_messageproc=messageproc;
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+MessagesWindow::~MessagesWindow()
+{
+       msgwindow=NULL;
+       cfg_messageproc = 0;
+}
+
+void
+MessagesWindow::message( int msgtype, const QString &msg)
+{
+       char st[4][50]={
+                       "<img src=\"msg_info.png\" width=12 height=12>",
+                       "<img src=\"msg_warning.png\" width=12 height=12>",
+                       "<img src=\"msg_error.png\" width=12 height=12>",
+                       "<img src=\"msg_fatal.png\" width=12 height=12>"};
+       if (msgtype<0) msgtype=0;
+       if (msgtype>3) msgtype=3;
+       msgBrowser->append( tr( st[ msgtype ] )+msg );
+       show();
+}
+
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void MessagesWindow::languageChange()
+{
+    setCaption( tr( "Messages window" ) );
+    msgBrowser->setText( QString::null );
+}
+
+void
+MessagesWindow::hideEvent ( QHideEvent *e )
+{
+       msgBrowser->clear();
+       Q3DockWindow::hideEvent( e );
+}
+
+
+void
+MessagesWindow::on_click()
+{
+       setExpanded(!expanded);
+}
+
+
+void
+MessagesWindow::setExpanded(bool exp)
+{
+       if(exp) setFixedExtentHeight ( 150 );
+       else setFixedExtentHeight ( 30 );
+       expanded = exp;
+       updateGeometry();
+}
+
+
+bool
+MessagesWindow::isExpanded()
+{
+       return expanded;
+}
+
+
diff --git a/src/lib/dialogs/messageswindow.h b/src/lib/dialogs/messageswindow.h
new file mode 100644 (file)
index 0000000..d647fee
--- /dev/null
@@ -0,0 +1,67 @@
+/****************************************************************************
+** $Id: messageswindow.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Header file of the Mesages window of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/*
+*/
+#ifndef MESSAGESWINDOW_H
+#define MESSAGESWINDOW_H
+
+#include "ananasglobal.h"
+
+#include <q3dockwindow.h>
+//Added by qt3to4:
+#include <QHideEvent>
+
+class Q3TextBrowser;
+
+void messageproc(int n, const char *msg);
+
+class  ANANAS_EXPORT MessagesWindow : public Q3DockWindow
+{
+    Q_OBJECT
+
+public:
+//     bool empty;
+    MessagesWindow( QWidget* parent = 0, Qt::WFlags fl = Qt::WType_TopLevel );
+    ~MessagesWindow();
+
+    Q3TextBrowser* msgBrowser;
+private:
+    bool expanded;
+public slots:
+       void message( int msgtype, const QString &msg);
+protected slots:
+       virtual void languageChange();
+       virtual void hideEvent ( QHideEvent *e );
+       void on_click();
+       void setExpanded(bool exp);
+       bool isExpanded();
+};
+
+#endif // MESSAGESWINDOW_H
diff --git a/src/lib/images/lib_database.png b/src/lib/images/lib_database.png
new file mode 100644 (file)
index 0000000..5f6aad3
Binary files /dev/null and b/src/lib/images/lib_database.png differ
diff --git a/src/lib/images/lib_dbgroup.png b/src/lib/images/lib_dbgroup.png
new file mode 100644 (file)
index 0000000..3005290
Binary files /dev/null and b/src/lib/images/lib_dbgroup.png differ
diff --git a/src/lib/images/print.png b/src/lib/images/print.png
new file mode 100644 (file)
index 0000000..b03cafd
Binary files /dev/null and b/src/lib/images/print.png differ
diff --git a/src/lib/lib.pri b/src/lib/lib.pri
new file mode 100644 (file)
index 0000000..99447cc
--- /dev/null
@@ -0,0 +1,17 @@
+# include paths for Ananas library
+
+INCLUDEPATH += \ 
+       ../lib/metadata \
+       ../lib/dialogs \
+       ../lib/objects \
+       ../lib/widgets \
+       ../lib/report \ 
+       ../lib/sys
+
+INCLUDEPATH += \ 
+       ../../lib/metadata \
+       ../../lib/dialogs \
+       ../../lib/objects \
+       ../../lib/widgets \
+       ../../lib/report \ 
+       ../../lib/sys
diff --git a/src/lib/lib.pro b/src/lib/lib.pro
new file mode 100644 (file)
index 0000000..209ff48
--- /dev/null
@@ -0,0 +1,132 @@
+include(../plugins/plugins.pri)
+include(lib.pri)
+
+TARGET = ananas4
+TEMPLATE = lib 
+shared:CONFIG += dll
+unix:VERSION = 1.0.1
+
+DESTDIR = ../../lib
+DLLDESTDIR = ../../bin
+
+INCLUDEPATH += ../lib ../plugins
+LIBS += -L../../lib
+LIBS +=-lqt4-qdataschema
+
+shared {
+    win32:DEFINES += ANANAS_DLL
+} else {
+    win32:DEFINES += ANANAS_NO_DLL
+}
+
+win32 {
+  CONFIG -= console
+#  CONFIG += dll
+}
+
+#LIBS += -L$(QTDIR)/plugins/designer -lqsa  # Why? -L../designer -lformdesigner
+unix{
+    LIBS        +=  -L/usr/X11R6/lib/
+}
+win32 {
+    #LIBS        += -L..\..\plugins -lananasplugin
+}
+
+#MOC_DIR = ../../tmp/moc/$$TARGET
+#OBJECTS_DIR = ../../tmp/obj/$$TARGET
+#UI_DIR = ../../tmp/ui/$$TARGET
+
+include ( ../ananas.pri )
+
+HEADERS = \
+    acfg.h \
+    acfgrc.h \
+    acmanifest.h \
+    acontainer.h \
+    adataexchange.h \
+    adatafield.h \
+    aextension.h \
+    aextensionplugin.h \
+    aextensionfactory.h \
+    afilter.h \
+    alog.h \
+    amenubar.h \
+    amoney.h \
+    ananas.h \
+    ananasglobal.h \
+    arole.h \
+    aservice.h \
+    asqlfield.h \
+    asqltable.h \
+    atests.h \
+    atime.h \
+    auser.h \
+    rclistviewitem.h
+
+SOURCES = \
+    acfg.cpp \
+    acfgrc.cpp \
+    acmanifest.cpp \
+    acontainer.cpp \
+    adataexchange.cpp \
+    adatafield.cpp \
+    aextension.cpp \
+    aextensionplugin.cpp \
+    aextensionfactory.cpp \
+    afilter.cpp \
+    alog.cpp \
+    amenubar.cpp \
+    amoney.cpp \
+    ananas.cpp \
+    arole.cpp \
+    aservice.cpp \
+    asqlfield.cpp \
+    asqltable.cpp \
+    atests.cpp \
+    atime.cpp \
+    auser.cpp \
+    rclistviewitem.cpp
+
+#FORMS = \
+#    deditrc.ui \
+#    dhelpcfgform.ui \
+#    dlogin.ui \
+#    dselectdb.ui
+    
+RESOURCES += \
+    lib.qrc
+
+TRANSLATIONS = \
+    ../../translations/ananas-lib-en.ts \
+    ../../translations/ananas-lib-ru.ts 
+    
+unix{
+    alib.path = $(LIBDIR) 
+    alib.files = libananas4.so.$$VERSION
+    alib.extra = cp -df libananas4.so* $(INSTALL_ROOT)$(LIBDIR)
+
+    alibheader.path = $(INCLUDEDIR)
+    alibheader.files = $$HEADERS
+    alibheader.files += .ui/*h
+    }
+
+win32 {
+    alib.path = $(QTDIR)\lib
+    alib.files += ananas4.dll
+    alib.files += ananas4.lib
+#    alibheader.path = $(INCLUDEDIR)
+#    alibheader.files = $$HEADERS
+#    alibheader.files += tmp\ui\*h
+      }
+
+#INSTALLS += alib
+unix{
+#    INSTALLS += alibheader
+}
+
+include(metadata/metadata.pri)
+include(dialogs/dialogs.pri)
+include(objects/objects.pri)
+include(widgets/widgets.pri)
+include(report/report.pri)
+include(sys/sys.pri)
diff --git a/src/lib/lib.qrc b/src/lib/lib.qrc
new file mode 100644 (file)
index 0000000..5a3ede7
--- /dev/null
@@ -0,0 +1,7 @@
+<RCC>\r
+    <qresource prefix="/">\r
+        <file>images/lib_database.png</file>\r
+        <file>images/lib_dbgroup.png</file>\r
+        <file>images/print.png</file>\r
+    </qresource>\r
+</RCC>\r
diff --git a/src/lib/metadata/ametadata.cpp b/src/lib/metadata/ametadata.cpp
new file mode 100644 (file)
index 0000000..8bf566e
--- /dev/null
@@ -0,0 +1,117 @@
+/****************************************************************************
+** $Id: ametadata.cpp,v 1.3 2008/12/14 10:53:02 leader Exp $
+**
+** Code file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "ametadata.h"
+
+#define context_startid        100
+
+AMetaData AMetaData_default;
+
+/*!
+ * \class AMetaData
+ *
+ */
+AMetaData::AMetaData()
+:AMetaObjectGroup( "MetaData", (AMetaObjectGroup *) 0 )
+{
+/*
+    int i = qRegisterMetaType<AMetaDataInfo>("AMetaDataInfo");
+printf("metatype=%i\n", i);
+
+int id = QMetaType::type("AMetaDataInfo");
+ if (id != -1) {
+     void *myClassPtr = QMetaType::construct(id);
+     if (myClassPtr) printf("OK\n");
+
+     QMetaType::destroy(id, myClassPtr);
+     myClassPtr = 0;
+ }
+*/
+}
+
+
+AMetaData* 
+AMetaData::metadata()
+{
+    return &AMetaData_default;
+}
+
+
+void
+AMetaData::clear()
+{
+
+}
+
+
+
+ACataloguesGroup *
+AMetaData::catalogues()
+{
+    return &v_catalogues;
+}
+
+
+
+ADocumentsGroup *
+AMetaData::documents()
+{
+    return &v_documents;
+}
+
+
+AReportsGroup *
+AMetaData::reports()
+{
+    return &v_reports;
+}
+
+
+AJournalsGroup *
+AMetaData::journals()
+{
+    return &v_journals;
+}
+
+
+AInfoRegistersGroup *
+AMetaData::inforegisters()
+{
+    return &v_inforegisters;
+}
+
+
+
+AAccRegistersGroup *
+AMetaData::accregisters()
+{
+    return &v_accregisters;
+}
+
diff --git a/src/lib/metadata/ametadata.h b/src/lib/metadata/ametadata.h
new file mode 100644 (file)
index 0000000..4a2fcf9
--- /dev/null
@@ -0,0 +1,105 @@
+/****************************************************************************
+** $Id: ametadata.h,v 1.3 2008/12/14 10:53:02 leader Exp $
+**
+** Header file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Andrey Paskal <app at lrn dot ru>, Yoshkar-Ola
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru >, Yoshkar-Ola
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef AMETADATA_H
+#define AMETADATA_H
+
+#include <QObject>
+#include <QDate>
+
+#include "ametaobject.h"
+#include "ametaobjectgroup.h"
+
+
+#ifdef __BORLANDC__
+#define CHECK_POINT    printf("%s:%i %s()\n",__FILE__,__LINE__,__FUNC__);
+#else
+#define CHECK_POINT    printf("%s:%i %s()\n",__FILE__,__LINE__,__FUNCTION__);
+#endif
+
+/*!
+ * \~english Metadata object methods return codes. \~russian
+ * Коды возвратов методов объекта метаданных. \~
+ */
+#define RC_OK          0       /**< All right - no errors */
+#define RC_ERROR       1       /**< Error while executing method */
+
+
+//#define aPermission          int
+
+#include <QHash>
+#include <QVariant>
+
+/*!
+ *\en
+ *     Metadata object for metadata script access.
+ *\_en
+ *\ru
+ *     \brief Объект метаданных для обеспечения доступа из скриптов.
+ *     Наследует QObject.
+ *\_ru
+ */
+class AMetaData: public AMetaObjectGroup
+{
+Q_OBJECT
+//Q_PROPERTY( AMetaDataInfo info READ info SCRIPTABLE true )
+//Q_PROPERTY( AMetaDataGlobal* global READ global SCRIPTABLE true )
+public:
+    AMetaData();
+    void clear();
+
+    static AMetaData* metadata();
+
+public slots:
+    AMetaDataInfo *info(){ return &v_info;};
+    AMetaDataGlobal *global(){ return &v_global;};
+
+    ADocumentsGroup*      documents();
+    ACataloguesGroup*     catalogues();
+    AReportsGroup*        reports();
+    AJournalsGroup*       journals();
+    AInfoRegistersGroup*  inforegisters();
+    AAccRegistersGroup*   accregisters();
+
+    QString test(){ return QString("AMETADATA TEST STRING");};
+
+private:
+    AMetaDataInfo v_info;
+    AMetaDataGlobal v_global;
+//groups
+    ACataloguesGroup v_catalogues;
+    ADocumentsGroup v_documents;
+    AReportsGroup v_reports;
+    AJournalsGroup v_journals;
+    AInfoRegistersGroup v_inforegisters;
+    AAccRegistersGroup v_accregisters;
+};
+
+#endif
diff --git a/src/lib/metadata/ametadataio.cpp b/src/lib/metadata/ametadataio.cpp
new file mode 100644 (file)
index 0000000..f94fe8f
--- /dev/null
@@ -0,0 +1,77 @@
+/****************************************************************************
+** $Id: ametadataio.cpp,v 1.2 2008/12/13 22:19:15 leader Exp $
+**
+** Code file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qdatetime.h>
+#include <qobject.h>
+#include <qfile.h>
+#include <qstringlist.h>
+#include <QTextStream>
+#include <QDomDocument>
+
+#include "ametadataio.h"
+
+/*!
+ * \class AMetaDataIO
+ *
+ */
+AMetaDataIO::AMetaDataIO()
+:QObject()
+{
+}
+
+
+AMetaDataIO::~AMetaDataIO()
+{
+}
+
+
+int
+AMetaDataIO::read(  const QString &name, AMetaData *md )
+{
+    if ( !md ) md = AMetaData::metadata();
+}
+
+
+int
+AMetaDataIO::write(  const QString &name, AMetaData *md )
+{
+    if ( !md ) md = AMetaData::metadata();
+}
+
+
+QObject *
+AMetaDataIO::createObject( const QString &name )
+{
+   QObject *o = 0;
+   if ( name == "AMetaObject" ) return new AMetaObject();
+//   if ( name == "AMetaObjectGroup" ) return new AMetaObjectGroup();
+
+   return o;
+} 
diff --git a/src/lib/metadata/ametadataio.h b/src/lib/metadata/ametadataio.h
new file mode 100644 (file)
index 0000000..f515e92
--- /dev/null
@@ -0,0 +1,51 @@
+/****************************************************************************
+** $Id: ametadataio.h,v 1.3 2008/12/15 22:22:48 leader Exp $
+**
+** Header file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2008 Valeriy Grazhdankin.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef AMETADATAIO_H
+#define AMETADATAIO_H
+
+#include <QObject>
+#include "ametadata.h"
+
+class AMetaDataIO: public QObject
+{
+Q_OBJECT
+public:
+    AMetaDataIO();
+    ~AMetaDataIO();
+    virtual int read( const QString &name, AMetaData *md = 0);
+    virtual int write( const QString &name, AMetaData *md = 0);
+    virtual QObject *createObject( const QString &name ); 
+    //virtual void storeGroup( AMetaObjectGroup *g );
+    virtual void storeGroupBegin( AMetaObjectGroup *g );
+
+signals:
+    void message( int msg_class, const QString & msg );
+};
+
+#endif
diff --git a/src/lib/metadata/ametadataioxml.cpp b/src/lib/metadata/ametadataioxml.cpp
new file mode 100644 (file)
index 0000000..29d0e72
--- /dev/null
@@ -0,0 +1,373 @@
+/****************************************************************************
+** $Id: ametadataioxml.cpp,v 1.2 2008/12/13 22:19:15 leader Exp $
+**
+** Code file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qdatetime.h>
+#include <qobject.h>
+#include <qfile.h>
+#include <qstringlist.h>
+#include <QTextStream>
+#include <QDomDocument>
+
+#include "ametadataioxml.h"
+
+
+/*!
+Metadata tags.
+*/
+#define md_root                "ananas_configuration"
+#define md_interface           "interface"
+
+#define md_info                "info"
+#define md_info_name           "name"
+#define md_info_author                 "author"
+#define md_info_date           "date"
+#define md_info_mdate          "mdate"
+#define md_info_remark                 "remark"
+#define md_info_lastid                 "lastid"
+//#define md_info_dir          "dir"
+
+#define md_metadata            "metadata"      /**< Metadata tag */
+#define md_globals             "globals"
+#define md_languages           "languages"
+#define md_language            "language"
+#define md_aliases             "aliases"
+#define md_alias               "alias"
+#define md_roles               "roles"
+#define md_role                "role"
+#define md_description         "description"
+#define md_sourcecode          "sourcecode"
+#define md_servermodule                "server_module"
+#define md_clientmodule                "client_module"
+#define md_formsource          "form_source"
+#define md_menutext            "menutext"
+#define md_argument            "argument"
+
+#define md_documents           "documents"
+#define md_document            "document"
+
+#define md_catalogues          "catalogues"
+#define md_catalogue           "catalogue"
+#define md_element             "element"
+#define md_group               "group"
+
+#define md_string_view         "string_view"
+#define md_svfunction          "svfunction"
+
+#define md_registers           "registers"
+#define md_iregisters          "iregisters"
+#define md_iregister           "iregister"
+#define md_aregisters          "aregisters"
+#define md_aregister           "aregister"
+
+#define md_reports             "reports"
+#define md_report              "report"
+
+#define md_journals            "journals"
+#define md_journal             "journal"
+#define md_columns             "columns"
+#define md_column              "column"
+#define md_used_doc            "used_doc"
+#define md_fieldid             "fieldid"
+
+#define md_field               "field"
+#define md_forms               "forms"
+#define md_form                        "form"
+#define md_defaultmod          "defaultmod"
+#define md_webforms            "webforms"
+#define md_webform             "webform"
+#define md_formdesign          "dialogform"
+
+#define md_tables              "tables"
+#define md_table               "table"
+#define md_header              "header"
+
+#define md_resources           "resources"
+#define md_dimensions          "dimensions"
+#define md_information         "information"
+
+/*!
+Action metadata object items.
+*/
+#define md_actions             "actions"
+#define md_actiongroup         "actiongroup"
+#define md_action              "action"
+#define md_objectid            "objectid"
+#define md_formid              "formid"
+#define md_actiontype          "actiontype"
+#define md_active_picture      "active_picture"
+#define md_passive_picture     "passive_picture"
+
+/*!
+Interface metadata object items.
+*/
+#define md_interface           "interface"
+#define md_toolbars            "toolbars"
+#define md_toolbar             "toolbar"
+#define md_popupmenus          "popupmenus"
+#define md_popupmenu           "popupmenu"
+#define md_mainmenu            "mainmenu"
+#define md_submenu             "submenu"
+#define md_command             "command"
+#define md_comaction           "comaction"
+#define md_separator           "separator"
+#define md_key                 "key"
+#define md_menutext            "menutext"
+//key modifiers
+#define md_km_ctrl             "Ctrl+"
+#define md_km_alt              "Alt+"
+#define md_km_shift            "Shift+"
+
+#define md_image_collection    "image_collection"
+#define md_image               "image"
+
+
+/*!
+Metadata attributes.
+*/
+#define mda_name               "name"
+#define mda_id                 "id"
+#define mda_type               "type"
+#define mda_readonly           "readonly"
+#define mda_lang               "lang"
+#define mda_nz                 "nz"
+#define mda_sort               "sort"
+#define mda_no_unconduct       "no_unconduct"
+#define mda_plus               "plus"
+#define mda_sum                        "sum"
+#define mda_tag                        "tag"
+#define mda_trfile             "trfile"
+#define mda_length             "length"
+#define mda_format             "format"
+#define mda_stdf               "stdf"
+#define mda_rights             "rights"
+
+/*!
+Actions types
+*/
+
+#define md_action_new          0
+#define md_action_edit         1
+#define md_action_view         2
+#define md_action_execute      3
+
+/*!
+ *     Default forms types.
+ *     If bit with some number set in 1 form can use for this action.
+ */
+
+#define md_form_nouse          0
+#define md_form_new            1
+#define md_form_view           2
+#define md_form_edit           3
+#define md_form_select         4
+
+
+/*!
+ *     Catalogue forms types.
+ */
+
+#define md_form_elem_list      0
+#define md_form_elem           1
+#define md_form_group          2
+
+/*!
+System object id
+*/
+
+#define        md_systemjournal        1
+#define md_aregarhive          2
+
+//class aCfg;
+//extern aCfg cfg;
+
+#define ERR_Code int
+
+#define md_user_roles          "userroles"
+#define md_users               "users"
+#define md_user                        "user"
+#define md_usr_role            "u_role"
+#define md_roles               "roles"
+#define md_role                        "role"
+#define md_rl_users            "r_users"
+#define md_rl_user             "r_user"
+#define md_right_roles         "rroles"
+
+#define perm_read              0
+#define perm_execute           1
+#define perm_create            2
+#define perm_delete            3
+#define perm_turn_on           4
+#define perm_turn_off          5
+#define perm_admin             6
+
+/*!
+ * \class AMetaDataIOXML
+ *
+ */
+AMetaDataIOXML::AMetaDataIOXML()
+:AMetaDataIO()
+{
+}
+
+
+int
+AMetaDataIOXML::read(  const QString &name, AMetaData *md )
+{
+    QFile file( name );
+    QByteArray buf;
+    QString err;
+    int errLine = 0, errColumn = 0;
+//    QDomDocument xml;
+    QDomNode cur, sub;
+    QDomElement node, rootnode, cfginfo, mdelement, iface, actions;
+    long id;
+
+    if ( !md ) md = AMetaData::metadata();
+    if ( !file.open( QIODevice::ReadOnly ) ) return 1;
+    buf = file.readAll();
+    file.close();
+    xml.setContent( QString("") );
+    if ( !xml.setContent( buf, false, &err, &errLine, &errColumn ) ) {
+       emit message( 2, QObject::tr(
+                    "Error read configuration line:%1 col:%2 %3"
+                    ).arg( errLine ).arg( errColumn ).arg( err ));
+       return 1;
+    }
+    if ( !xml.isDocument() ) {
+//            aLog::print(aLog::Error, tr("Bad configuration"));
+        return 1;
+    }
+    md->clear();
+    rootnode = xml.documentElement();
+
+    node = rootnode.namedItem( md->info()->className() ).toElement();
+    XMLToAMetaObject( node, md->info() );
+    node = rootnode.namedItem( md->global()->className() ).toElement();
+    XMLToAMetaObject( node, md->global() );
+
+    mdelement = rootnode.namedItem( md_metadata ).toElement();
+    iface = rootnode.namedItem( md_interface ).toElement();
+    actions = rootnode.namedItem( md_actions ).toElement();
+    return 0;
+}
+
+
+int
+AMetaDataIOXML::write(  const QString &name, AMetaData *md )
+{
+    QFile file( name );
+
+    if ( !md ) md = AMetaData::metadata();
+//    QDomDocument xml("ananas4_configuration");
+    QDomNode cur, sub;
+    QDomElement node, rootnode, cfginfo, mdelement, iface, actions;
+
+    xml.setContent(QString("<?xml version = '1.0' encoding = 'UTF-8'?>\n"));
+    xml.appendChild( xml.implementation().createDocumentType("ananas_configuration",
+                     QString::null,"ananas-cfg.dtd"));
+    rootnode = xml.createElement( md_root );
+    xml.appendChild( rootnode );
+    rootnode = xml.documentElement();
+
+    rootnode.appendChild( AMetaObjectToXML( md->info() ) );
+    rootnode.appendChild( AMetaObjectToXML( md->global() ) );
+
+
+    node     = xml.createElement( md_info );
+    rootnode.appendChild( node );
+
+
+    node     = xml.createElement( md_interface );
+    rootnode.appendChild( node );
+
+    node     = xml.createElement( md_metadata );
+    rootnode.appendChild( node );
+
+    node     = xml.createElement( md_actions );
+    rootnode.appendChild( node );
+
+
+    if ( !file.open( QIODevice::WriteOnly ) ) return 1;
+    QTextStream ts( &file );
+    xml.save( ts, 4 );
+    file.close();
+    return 0;
+}
+
+#include <QtDebug>
+
+void 
+AMetaDataIOXML::XMLToAMetaObject( QDomElement e, AMetaObject *o )
+{
+    int i;
+    QDomElement se;
+    QDomNode cur;
+    QString s, t;
+    int id;
+
+       cur = e.firstChild();
+       while (!cur.isNull()) {
+            se = cur.toElement();
+            if ( se.hasAttribute( mda_id ) ) {
+                id = 0;
+                id = se.attribute( mda_id ).toInt();
+                o->setId( id );
+            }
+            s = se.text();
+// qDebug() << se.tagName() << ":" << s;
+            if ( !s.isNull() ) o->setText( se.tagName(), s );
+            cur = cur.nextSibling();
+       }
+
+}
+
+
+
+QDomElement 
+AMetaDataIOXML::AMetaObjectToXML( AMetaObject *o )
+{
+    int i;
+    QDomElement e, se;
+
+    e = xml.createElement( o->className() );
+    for ( i=0; i< o->textCount(); i++ ){
+       se = xml.createElement( o->textName( i ) );
+       se.appendChild( xml.createTextNode( o->text( i ) ) );
+       e.appendChild( se );
+    }
+    return e;
+}
+
+
+QString 
+AMetaDataIOXML::text()
+{
+    return xml.toString( 4 );
+}
diff --git a/src/lib/metadata/ametadataioxml.h b/src/lib/metadata/ametadataioxml.h
new file mode 100644 (file)
index 0000000..bae4f59
--- /dev/null
@@ -0,0 +1,50 @@
+/****************************************************************************
+** $Id: ametadataioxml.h,v 1.2 2008/12/13 22:19:15 leader Exp $
+**
+** Header file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2008 Grazhdankin Valeriy.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AMETADATAOIXML_H
+#define AMETADATAIOXML_H
+#include "ametadataio.h"
+#include <QDomDocument>
+#include <QDomElement>
+
+class AMetaDataIOXML: public AMetaDataIO
+{
+Q_OBJECT
+public:
+    AMetaDataIOXML();
+    int read(const QString &name, AMetaData *md = 0);
+    int write( const QString &name, AMetaData *md = 0);
+    QString text();
+private:
+    void XMLToAMetaObject( QDomElement e, AMetaObject *o );
+    QDomElement AMetaObjectToXML( AMetaObject *o );
+    QDomDocument xml;
+};
+
+#endif
diff --git a/src/lib/metadata/ametadocument.cpp b/src/lib/metadata/ametadocument.cpp
new file mode 100644 (file)
index 0000000..0de6592
--- /dev/null
@@ -0,0 +1,61 @@
+/****************************************************************************
+** $Id: ametadocument.cpp,v 1.1 2008/12/15 22:22:48 leader Exp $
+**
+** Code file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include "ametadocument.h"
+
+/*!
+ * \class AMetaDocument
+ *
+ */
+AMetaDocument::AMetaDocument()
+:AMetaObject("Document")
+{
+}
+
+
+AMetaFields *
+AMetaDocument::fields()
+{
+    return &v_fields;
+}
+
+
+
+AMetaTables *
+AMetaDocument::tables()
+{
+    return &v_tables;
+}
+
+
+AMetaForms *
+AMetaDocument::forms()
+{
+    return &v_forms;
+}
diff --git a/src/lib/metadata/ametadocument.h b/src/lib/metadata/ametadocument.h
new file mode 100644 (file)
index 0000000..91ff5e8
--- /dev/null
@@ -0,0 +1,56 @@
+/****************************************************************************
+** $Id: ametadocument.h,v 1.1 2008/12/15 22:22:48 leader Exp $
+**
+** Header file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Andrey Paskal <app at lrn dot ru>, Yoshkar-Ola
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru >, Yoshkar-Ola
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef AMETADOCUMENT_H
+#define AMETADOCUMENT_H
+
+#include "ametaobject.h"
+#include "ametaobjectgroup.h"
+#include "ametafield.h"
+
+
+class AMetaDocument: public AMetaObject
+{
+Q_OBJECT
+public:
+    AMetaDocument();
+
+public slots:
+    AMetaFields      *fields();
+    AMetaTables      *tables();
+    AMetaForms       *forms();
+
+private:
+    AMetaFields      v_fields;
+    AMetaTables      v_tables;
+    AMetaForms       v_forms;
+};
+
+#endif
diff --git a/src/lib/metadata/ametafield.cpp b/src/lib/metadata/ametafield.cpp
new file mode 100644 (file)
index 0000000..e979278
--- /dev/null
@@ -0,0 +1,176 @@
+/****************************************************************************
+** $Id: ametafield.cpp,v 1.1 2008/12/15 22:22:48 leader Exp $
+**
+** Code file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include "ametafield.h"
+
+
+/*!
+ * \class AMetaField
+ *
+ */
+AMetaField::AMetaField()
+:AMetaObject("MetaField")
+{
+    setFieldType( Unknown );
+    setFieldSubType( 0 );
+    setWidth( 0 );
+    setDecimals( 0 );
+    setNotNull( false );
+    setNotNegative( false );
+    setCalcSumm( false );
+}
+
+
+AMetaField::AMetaField( FieldTypes t, int st, int w, int d, bool notnul, bool notneg, bool calcsum )
+:AMetaObject("MetaField")
+{
+    setFieldType( t );
+    setFieldSubType( st );
+    setWidth( w );
+    setDecimals( d );
+    setNotNull( notnul );
+    setNotNegative( notneg );
+    setCalcSumm( calcsum );
+}
+
+
+int 
+AMetaField::fieldType()
+{
+    return attr("type").toInt();
+}
+
+
+
+void 
+AMetaField::setFieldType( FieldTypes t )
+{
+    setAttr( "type", t );
+}
+
+
+
+int 
+AMetaField::fieldSubType()
+{
+    return attr("subtype").toInt();
+}
+
+
+void 
+AMetaField::setFieldSubType( int st )
+{
+    setAttr( "subtype", st );
+}
+
+
+int 
+AMetaField::width()
+{
+    return attr("width").toInt();
+}
+
+
+void 
+AMetaField::setWidth( int w )
+{
+    setAttr( "width", w );
+}
+
+
+
+int 
+AMetaField::decimals()
+{
+    return attr("decimals").toInt();
+}
+
+
+void 
+AMetaField::setDecimals( int d )
+{
+    setAttr( "decimals", d );
+}
+
+
+
+bool 
+AMetaField::notNull()
+{
+    return attr("notnull").toBool();
+}
+
+
+void 
+AMetaField::setNotNull( bool f )
+{
+    setAttr( "notnull", f );
+}
+
+
+bool 
+AMetaField::notNegative()
+{
+    return attr("notnegative").toBool();
+}
+
+
+void 
+AMetaField::setNotNegative( bool f )
+{
+    setAttr( "notnegative", f );
+}
+
+
+
+bool 
+AMetaField::calcSumm()
+{
+    return attr("calcsumm").toBool();
+}
+
+
+void 
+AMetaField::setCalcSumm( bool f )
+{
+    setAttr( "calcsumm", f );
+}
+
+
+
+/*!
+ * \class AMetaFields
+ *
+ */
+AMetaFields::AMetaFields()
+:AMetaObjectGroup("MetaFields")
+{
+
+}
+
diff --git a/src/lib/metadata/ametafield.h b/src/lib/metadata/ametafield.h
new file mode 100644 (file)
index 0000000..9e3c5e6
--- /dev/null
@@ -0,0 +1,95 @@
+/****************************************************************************
+** $Id: ametafield.h,v 1.1 2008/12/15 22:22:48 leader Exp $
+**
+** Header file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Andrey Paskal <app at lrn dot ru>, Yoshkar-Ola
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru >, Yoshkar-Ola
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef AMETAFIELD_H
+#define AMETAFIELD_H
+
+#include "ametaobject.h"
+#include "ametaobjectgroup.h"
+
+
+class AMetaField: public AMetaObject
+{
+Q_OBJECT
+Q_ENUMS( FieldTypes )
+Q_PROPERTY( int  fieldtype    READ fieldType    SCRIPTABLE true )
+Q_PROPERTY( int  fieldsubtype READ fieldSubType SCRIPTABLE true )
+Q_PROPERTY( int  width        READ width        SCRIPTABLE true )
+Q_PROPERTY( int  decimals     READ decimals     SCRIPTABLE true )
+Q_PROPERTY( bool notnull      READ notNull      SCRIPTABLE true )
+Q_PROPERTY( bool notnegative  READ notNegative  SCRIPTABLE true )
+Q_PROPERTY( bool calcsumm     READ calcSumm     SCRIPTABLE true )
+
+public:
+    enum FieldTypes { Unknown, Char, String, Number, Date, Object, Document, Catalogue };
+    AMetaField();
+
+    AMetaField( FieldTypes t, int st = 0, int w = 0, 
+                int d = 0, bool notnul = false, bool notneg = false, 
+                bool calcsum = false );
+
+    int fieldType();
+    void setFieldType( FieldTypes t );
+
+    int fieldSubType();
+    void setFieldSubType( int st );
+
+    int width();
+    void setWidth( int w );
+
+    int decimals();
+    void setDecimals( int d );
+
+    bool notNull();
+    void setNotNull( bool f );
+
+    bool notNegative();
+    void setNotNegative( bool f );
+
+    bool calcSumm();
+    void setCalcSumm( bool f );
+
+private:
+
+};
+
+
+class AMetaFields: public AMetaObjectGroup
+{
+Q_OBJECT
+public:
+    AMetaFields();
+
+public slots:
+
+
+};
+
+#endif
diff --git a/src/lib/metadata/ametaform.cpp b/src/lib/metadata/ametaform.cpp
new file mode 100644 (file)
index 0000000..4f98592
--- /dev/null
@@ -0,0 +1,40 @@
+/****************************************************************************
+** $Id: ametaform.cpp,v 1.1 2008/12/15 22:22:48 leader Exp $
+**
+** Code file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include "ametaform.h"
+
+
+/*!
+ * \class AMetaField
+ *
+ */
+AMetaForm::AMetaForm()
+:AMetaObject("MetaForm")
+{
+}
diff --git a/src/lib/metadata/ametaform.h b/src/lib/metadata/ametaform.h
new file mode 100644 (file)
index 0000000..0436d21
--- /dev/null
@@ -0,0 +1,45 @@
+/****************************************************************************
+** $Id: ametaform.h,v 1.1 2008/12/15 22:22:48 leader Exp $
+**
+** Header file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Andrey Paskal <app at lrn dot ru>, Yoshkar-Ola
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru >, Yoshkar-Ola
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef AMETAFORM_H
+#define AMETAFORM_H
+
+#include "ametaobject.h"
+
+class AMetaForm: public AMetaObject
+{
+Q_OBJECT
+public:
+    AMetaForm();
+private:
+    
+};
+
+#endif
diff --git a/src/lib/metadata/ametaobject.cpp b/src/lib/metadata/ametaobject.cpp
new file mode 100644 (file)
index 0000000..7f19273
--- /dev/null
@@ -0,0 +1,386 @@
+/****************************************************************************
+** $Id: ametaobject.cpp,v 1.2 2008/12/15 22:22:48 leader Exp $
+**
+** Code file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qdatetime.h>
+//#include <qobject.h>
+#include <qfile.h>
+#include <qstringlist.h>
+#include <QTextStream>
+#include <QDomDocument>
+
+#include "ametaobject.h"
+#include "ametaobjectgroup.h"
+
+/*!
+ * \class AMetaObject
+ *
+ */
+/*!
+ *\en
+ *     Metadata object for metadata script access.
+ *\_en
+ *\ru
+ *     \brief Объект метаданных для обеспечения доступа из скриптов.
+ *     Наследует QObject.
+ *\_ru
+ */
+
+AMetaObject::AMetaObject(const QString &objectclass, 
+                     const QString &objectname, 
+                     AMetaObjectGroup *parent)
+:QObject( parent )
+{
+    setObjectName( objectname );
+    setClassName( objectclass );
+    setDescription("");
+}
+
+
+Q_ULONG 
+AMetaObject::id()
+{
+    return v_id;
+}
+
+
+void 
+AMetaObject::setId( Q_ULONG new_id )
+{
+    v_id = new_id;
+}
+
+
+void 
+AMetaObject::setClassName( const QString &name )
+{
+    v_className = name;
+}
+
+
+QString
+AMetaObject::className()
+{
+    return v_className;
+}
+
+
+QString
+AMetaObject::name()
+{
+    return objectName();
+}
+
+
+QString 
+AMetaObject::description()
+{
+    return text("description");
+}
+
+void 
+AMetaObject::setDescription( const QString &descr )
+{
+    setText( "description", descr );
+}
+
+
+void 
+AMetaObject::setAttr( const QString &name, const QVariant &value )
+{
+    if ( value.isNull() && attrExists( name ) ) v_attr.remove( name );
+    else v_attr[ name ] = value;
+}
+
+
+
+void 
+AMetaObject::setText( const QString &name, const QString &text )
+{
+    if ( text.isNull() && textExists( name ) ) v_text.remove( name );
+    else v_text[ name ] = text;
+}
+
+
+void 
+AMetaObject::setRawdata( const QString &name, const QByteArray &data )
+{
+    if ( data.isNull() && rawdataExists( name ) ) v_rawdata.remove( name );
+    else v_rawdata[ name ] = data;
+}
+
+
+
+QVariant
+AMetaObject::attr( const QString &name ) const
+{
+    return v_attr.value( name, QVariant() );
+}
+
+
+
+QString 
+AMetaObject::text( const QString &name ) const
+{
+    return v_text.value( name, QString::null );
+}
+
+
+
+QByteArray 
+AMetaObject::rawdata( const QString &name ) const
+{
+    return v_rawdata.value( name, QByteArray() );
+}
+
+
+
+QVariant 
+AMetaObject::attr( int idx ) const
+{
+    return attr( attrName( idx ) );
+}
+
+
+
+QString 
+AMetaObject::text( int idx ) const
+{
+    return text( textName( idx ) );
+}
+
+
+
+QByteArray 
+AMetaObject::rawdata( int idx ) const
+{
+    return rawdata( rawdataName( idx ) );
+}
+
+
+
+QString 
+AMetaObject::attrName( int idx ) const
+{
+    if ( idx < 0 || idx >= attrCount() ) return QString::null;
+    return v_attr.keys().at( idx );
+}
+
+
+
+QString 
+AMetaObject::textName( int idx ) const
+{
+    if ( idx < 0 || idx >= textCount() ) return QString::null;
+    return v_text.keys().at( idx );
+}
+
+
+
+QString 
+AMetaObject::rawdataName( int idx ) const
+{
+    if ( idx < 0 || idx >= rawdataCount() ) return QString::null;
+    return v_rawdata.keys().at( idx );
+}
+
+
+
+bool 
+AMetaObject::attrExists( const QString &name )
+{
+    return v_attr.contains( name );
+}
+
+
+
+bool 
+AMetaObject::textExists( const QString &name )
+{
+    return v_text.contains( name );
+}
+
+
+
+bool 
+AMetaObject::rawdataExists( const QString &name )
+{
+    return v_rawdata.contains( name );
+}
+
+
+
+int 
+AMetaObject::attrCount() const
+{
+    return v_attr.size();
+}
+
+
+
+int 
+AMetaObject::textCount() const
+{
+    return v_text.size();
+}
+
+
+int 
+AMetaObject::rawdataCount() const
+{
+    return v_rawdata.size();
+}
+
+
+
+/*!
+ * \class AMetaCatalogue
+ *
+ */
+AMetaCatalogue::AMetaCatalogue()
+:AMetaObject("Catalogue")
+{
+}
+
+
+
+/*!
+ * \class AMetaDataInfo
+ *
+ */
+AMetaDataInfo::AMetaDataInfo()
+:AMetaObject("Info")
+{
+    setAppName("new");
+    setAuthor("unknown");
+    setDate( QDate::currentDate() );
+    setLastId( 100 );
+
+}
+
+
+AMetaDataInfo::AMetaDataInfo( const AMetaDataInfo &info )
+:AMetaObject("Info")
+{
+}
+
+
+AMetaDataInfo::~AMetaDataInfo()
+{
+}
+
+
+AMetaDataInfo& 
+AMetaDataInfo::operator=(const AMetaDataInfo&)
+{
+    return *this;
+}
+
+
+QString 
+AMetaDataInfo::appName()
+{
+    return text("name");
+}
+
+
+void 
+AMetaDataInfo::setAppName( const QString &name )
+{
+    setText( "name", name );
+}
+
+
+long 
+AMetaDataInfo::lastId()
+{
+    return text( "lastid" ).toLong();
+}
+
+
+void 
+AMetaDataInfo::setLastId( long id )
+{
+    setText( "lastid", QString::number( id ) );
+}
+
+
+QString 
+AMetaDataInfo::author()
+{
+    return text("author");
+}
+
+
+void 
+AMetaDataInfo::setAuthor( const QString &name )
+{
+    setText( "author", name );
+}
+
+
+QDate 
+AMetaDataInfo::date()
+{
+    return QDate::fromString( text("date"), Qt::ISODate );
+}
+
+
+void 
+AMetaDataInfo::setDate( QDate d )
+{
+    setText( "date", d.toString( Qt::ISODate ) );
+}
+
+
+
+/*!
+ * \class AMetaDataGlobal
+ *
+ */
+AMetaDataGlobal::AMetaDataGlobal()
+:AMetaObject("Global")
+{
+    setSourceCode("function on_systemstart()\n{\n}\n");
+}
+
+
+QString 
+AMetaDataGlobal::sourceCode()
+{
+    return text("sourcecode");
+}
+
+
+void 
+AMetaDataGlobal::setSourceCode( const QString &src )
+{
+    setText( "sourcecode", src );
+}
+
diff --git a/src/lib/metadata/ametaobject.h b/src/lib/metadata/ametaobject.h
new file mode 100644 (file)
index 0000000..18bb096
--- /dev/null
@@ -0,0 +1,162 @@
+/****************************************************************************
+** $Id: ametaobject.h,v 1.2 2008/12/15 22:22:48 leader Exp $
+**
+** Header file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Andrey Paskal <app at lrn dot ru>, Yoshkar-Ola
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru >, Yoshkar-Ola
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef AMETAOBJECT_H
+#define AMETAOBJECT_H
+
+#include <QObject>
+#include <QDate>
+
+#ifdef __BORLANDC__
+#define CHECK_POINT    printf("%s:%i %s()\n",__FILE__,__LINE__,__FUNC__);
+#else
+#define CHECK_POINT    printf("%s:%i %s()\n",__FILE__,__LINE__,__FUNCTION__);
+#endif
+
+/*!
+ * \~english Metadata object methods return codes. \~russian
+ * Коды возвратов методов объекта метаданных. \~
+ */
+#define RC_OK          0       /**< All right - no errors */
+#define RC_ERROR       1       /**< Error while executing method */
+
+#include <QHash>
+#include <QVariant>
+class AMetaObjectGroup;
+
+class AMetaObject: public QObject
+{
+Q_OBJECT
+// system properties
+Q_PROPERTY( Q_ULONG id READ id SCRIPTABLE true )
+Q_PROPERTY( QString name READ name SCRIPTABLE true )
+Q_PROPERTY( QString className READ className SCRIPTABLE true )
+Q_PROPERTY( QString description READ description SCRIPTABLE true )
+
+public:
+    AMetaObject( const QString &objectclass  = QString::null, 
+                 const QString &objectname = QString::null, 
+                 AMetaObjectGroup *parent = 0 );
+
+    void setClassName( const QString &name );
+
+    Q_ULONG id();
+    void setId( Q_ULONG );
+    QString className();
+    QString name();
+
+    QString description();
+    void setDescription( const QString &descr );
+
+    void setAttr( const QString &name, const QVariant &value );
+    void setText( const QString &name, const QString &text );
+    void setRawdata( const QString &name, const QByteArray &data );
+
+    QVariant attr( const QString &name ) const;
+    QString text( const QString &name ) const;
+    QByteArray rawdata( const QString &name ) const;
+
+    QVariant attr( int idx ) const;
+    QString text( int idx ) const;
+    QByteArray rawdata( int idx ) const;
+
+    QString attrName( int idx ) const;
+    QString textName( int idx ) const;
+    QString rawdataName( int idx ) const;
+
+    bool attrExists( const QString &name );
+    bool textExists( const QString &name );
+    bool rawdataExists( const QString &name );
+
+    int attrCount() const;
+    int textCount() const;
+    int rawdataCount() const;
+
+public slots:
+
+private:
+    Q_ULONG v_id;
+    QString v_className;
+    QHash <QString, QVariant> v_attr;
+    QHash <QString, QString> v_text;
+    QHash <QString, QByteArray> v_rawdata;
+};
+
+
+
+class AMetaCatalogue: public AMetaObject
+{
+Q_OBJECT
+public:
+    AMetaCatalogue();
+};
+
+
+
+class AMetaDataInfo: public AMetaObject
+{
+Q_OBJECT
+Q_PROPERTY( QString appname READ appName SCRIPTABLE true )
+Q_PROPERTY( QString author  READ author  SCRIPTABLE true )
+Q_PROPERTY( QDate   date    READ date    SCRIPTABLE true )
+public:
+    AMetaDataInfo();
+    AMetaDataInfo( const AMetaDataInfo &info );
+    ~AMetaDataInfo();
+    AMetaDataInfo& operator=(const AMetaDataInfo&);
+
+    QString appName();
+    void setAppName( const QString &name );
+    long lastId();
+    void setLastId( long id );
+    QString author();
+    void setAuthor( const QString &name );
+    QDate date();
+    void setDate( QDate d );
+};
+
+
+class AMetaDataGlobal: public AMetaObject
+{
+Q_OBJECT
+public:
+    AMetaDataGlobal();
+
+    QString sourceCode();
+    void setSourceCode( const QString &src );
+
+};
+
+Q_DECLARE_METATYPE ( AMetaDataInfo )
+
+//qRegisterMetaType<AMetaDataInfo>("MetaDataInfo");
+//Q_DECLARE_METATYPE ( AMetaDataGlobal )
+
+#endif
diff --git a/src/lib/metadata/ametaobjectgroup.cpp b/src/lib/metadata/ametaobjectgroup.cpp
new file mode 100644 (file)
index 0000000..bd2e97a
--- /dev/null
@@ -0,0 +1,220 @@
+/****************************************************************************
+** $Id: ametaobjectgroup.cpp,v 1.2 2008/12/15 22:22:48 leader Exp $
+**
+** Code file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qdatetime.h>
+#include <qobject.h>
+#include <qfile.h>
+#include <qstringlist.h>
+//--#include <q3textstream.h>
+#include <QTextStream>
+#include <QDomDocument>
+
+#include "ametaobject.h"
+#include "ametaobjectgroup.h"
+
+#define context_startid        100
+
+
+/*!
+ * \class AMetaObjectGroup
+ *
+ */
+AMetaObjectGroup::AMetaObjectGroup( const QString &groupname )
+:QObject()
+{
+    setObjectName( groupname );
+}
+
+
+
+
+AMetaObjectGroup::AMetaObjectGroup( const QString &groupname, AMetaObject *parent )
+:QObject( parent )
+{
+    setObjectName( groupname );
+}
+
+
+AMetaObjectGroup::AMetaObjectGroup( const QString &groupname, AMetaObjectGroup *parent )
+:QObject( parent )
+{
+    setObjectName( groupname );
+}
+
+
+QString
+AMetaObjectGroup::name()
+{
+    return objectName();
+}
+
+
+
+AMetaObject *
+AMetaObjectGroup::metaObject( const QString &name )
+{
+    return findChild<AMetaObject *>( name );
+}
+
+
+
+AMetaObject *
+AMetaObjectGroup::metaObject( int idx )
+{
+    return v_metaObjects.at( idx );
+}
+
+
+void 
+AMetaObjectGroup::append( AMetaObject *obj )
+{
+    obj->setParent( this );
+    v_metaObjects.append( obj );
+    connect( obj, SIGNAL(destroyed(QObject*)), this, SLOT(destroyed(QObject *)));
+}
+
+
+int 
+AMetaObjectGroup::count() const
+{
+    return v_metaObjects.count();
+}
+
+
+void 
+AMetaObjectGroup::clear()
+{
+    v_metaObjects.clear();
+}
+
+
+void 
+AMetaObjectGroup::destroyed( QObject *obj )
+{
+  if ( obj->inherits("AMetaObject") ){
+      v_metaObjects.removeAll( ( AMetaObject *) obj );
+  }
+}
+
+
+
+/*!
+ * \class ADocumentsGroup
+ *
+ */
+ADocumentsGroup::ADocumentsGroup()
+:AMetaObjectGroup("Documents")
+{
+
+}
+
+
+
+/*!
+ * \class ACataloguesGroup
+ *
+ */
+ACataloguesGroup::ACataloguesGroup()
+:AMetaObjectGroup("Catalogues")
+{
+
+}
+
+
+
+/*!
+ * \class AReportsGroup
+ *
+ */
+AReportsGroup::AReportsGroup()
+:AMetaObjectGroup("Reports")
+{
+
+}
+
+
+
+/*!
+ * \class AReportsGroup
+ *
+ */
+AJournalsGroup::AJournalsGroup()
+:AMetaObjectGroup("Journals")
+{
+
+}
+
+
+
+/*!
+ * \class AInformationRegistersGroup
+ *
+ */
+AInfoRegistersGroup::AInfoRegistersGroup()
+:AMetaObjectGroup("InfoRegisters")
+{
+
+}
+
+
+
+/*!
+ * \class AInformationRegistersGroup
+ *
+ */
+AAccRegistersGroup::AAccRegistersGroup()
+:AMetaObjectGroup("AccRegisters")
+{
+
+}
+
+
+
+/*!
+ * \class AMetaTables
+ *
+ */
+AMetaTables::AMetaTables()
+:AMetaObjectGroup("MetaTables")
+{
+
+}
+
+
+
+/*!
+ * \class AMetaForms
+ *
+ */
+AMetaForms::AMetaForms()
+:AMetaObjectGroup("MetaForms")
+{
+
+}
diff --git a/src/lib/metadata/ametaobjectgroup.h b/src/lib/metadata/ametaobjectgroup.h
new file mode 100644 (file)
index 0000000..52210a6
--- /dev/null
@@ -0,0 +1,185 @@
+/****************************************************************************
+** $Id: ametaobjectgroup.h,v 1.2 2008/12/15 22:22:48 leader Exp $
+**
+** Header file of the Ananas configuration objects of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Andrey Paskal <app at lrn dot ru>, Yoshkar-Ola
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru >, Yoshkar-Ola
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef AMETAOBJECTGROUP_H
+#define AMETAOBJECTGROUP_H
+
+#include <QObject>
+#include <QDate>
+#include <QPointer>
+
+#include "ametaobject.h"
+
+#include <QHash>
+#include <QVariant>
+
+
+/*!
+ *\en
+ *     Metadata object for metadata script access.
+ *\_en
+ *\ru
+ *     \brief Объект метаданных для обеспечения доступа из скриптов.
+ *     Наследует QObject.
+ *\_ru
+ */
+class AMetaObjectGroup: public QObject
+{
+Q_OBJECT
+Q_PROPERTY( QString name READ name SCRIPTABLE true )
+public:
+    AMetaObjectGroup( const QString &groupname );
+    AMetaObjectGroup( const QString &groupname, AMetaObject *parent );
+    AMetaObjectGroup( const QString &groupname, AMetaObjectGroup *parent );
+
+    QString name();
+//        QMetaObject *metaObject(const QString &objClass, const QString &objName);
+//    QMetaObject *metaObject(const QString &objClass, const QString &objName);
+    AMetaObject *metaObject( const QString &name );
+    AMetaObject *metaObject( int idx );
+    void append( AMetaObject *object );
+    int count() const;
+    void clear();
+
+public slots:
+    QString test(){ return QString("TEST STRING");};
+
+private slots:
+    void destroyed( QObject *obj );
+
+private:
+    QList <AMetaObject *> v_metaObjects;
+};
+
+
+class ACataloguesGroup: public AMetaObjectGroup
+{
+Q_OBJECT
+public:
+    ACataloguesGroup();
+
+public slots:
+
+
+};
+
+
+
+class ADocumentsGroup: public AMetaObjectGroup
+{
+Q_OBJECT
+public:
+    ADocumentsGroup();
+
+public slots:
+    QString test(){ return QString("DOCUMENTS TEST STRING");};
+
+
+};
+
+
+
+class AReportsGroup: public AMetaObjectGroup
+{
+Q_OBJECT
+public:
+    AReportsGroup();
+
+public slots:
+
+
+};
+
+
+
+class AJournalsGroup: public AMetaObjectGroup
+{
+Q_OBJECT
+public:
+    AJournalsGroup();
+
+public slots:
+
+
+};
+
+
+
+class AInfoRegistersGroup: public AMetaObjectGroup
+{
+Q_OBJECT
+public:
+    AInfoRegistersGroup();
+
+public slots:
+
+
+};
+
+
+
+class AAccRegistersGroup: public AMetaObjectGroup
+{
+Q_OBJECT
+public:
+    AAccRegistersGroup();
+
+public slots:
+
+
+};
+
+
+
+class AMetaTables: public AMetaObjectGroup
+{
+Q_OBJECT
+public:
+    AMetaTables();
+
+public slots:
+
+
+};
+
+
+
+class AMetaForms: public AMetaObjectGroup
+{
+Q_OBJECT
+public:
+    AMetaForms();
+
+public slots:
+
+
+};
+
+#endif
diff --git a/src/lib/metadata/metadata.pri b/src/lib/metadata/metadata.pri
new file mode 100644 (file)
index 0000000..d914a90
--- /dev/null
@@ -0,0 +1,19 @@
+HEADERS += \
+    metadata/ametadata.h \ 
+    metadata/ametaobject.h \ 
+    metadata/ametaobjectgroup.h \ 
+    metadata/ametafield.h \
+    metadata/ametadocument.h \
+    metadata/ametaform.h \
+    metadata/ametadataio.h \ 
+    metadata/ametadataioxml.h
+
+SOURCES += \
+    metadata/ametadata.cpp \
+    metadata/ametaobject.cpp \
+    metadata/ametaobjectgroup.cpp \
+    metadata/ametafield.cpp \
+    metadata/ametadocument.cpp \
+    metadata/ametaform.cpp \
+    metadata/ametadataio.cpp \
+    metadata/ametadataioxml.cpp
diff --git a/src/lib/objects/aaregister.cpp b/src/lib/objects/aaregister.cpp
new file mode 100644 (file)
index 0000000..5b7a027
--- /dev/null
@@ -0,0 +1,585 @@
+/****************************************************************************
+** $Id: aaregister.cpp,v 1.3 2008/11/09 21:09:11 leader Exp $
+**
+** Code file of the Accumulation Register of Ananas
+** Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Andrey Paskal <app at lrn dot ru>, Yoshkar-Ola
+** Copyright (C) 2005 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include       "aaregister.h"
+#include       "adatabase.h"
+#include       "adocjournal.h"
+#include       "alog.h"
+#include       <stdlib.h>
+//Added by qt3to4:
+#include <QSqlQuery>
+
+
+/*!
+ *\en
+ *     Constructor that create object of aAregister by metadata object.
+ *\_en
+ *\ru
+ * Конструктор, который создает объект по элементу метаданных.
+ *\_ru
+ *\param context -\en configuration item, \_en \ru
+                                       элемент конфигурации,\_ru
+ *\param adb -\en link on ananas database.\_en \ru
+                                       ссылка на базу данных.\_ru
+ */
+aARegister::aARegister( aCfgItem context, aDatabase * adb )
+:aIRegister( context, adb )
+{
+       concrete = !context.isNull();
+       initObject();
+}
+
+
+
+/*!
+ *\en
+ *     Сonstructor that create object of aAregister by metadata name
+ *\_en
+ *\ru
+ * Конструктор, который создает объект по имени рагистра остатков из конфигурации.
+ *\_ru
+ *\param context -\en md name of register,\_en \ru
+       имя регистра, заданное в конфигурации через Ананас-Дизайнер,\_ru
+ *\param adb -
+       \en link on ananas database.\_en
+       \ru ссылка на базу данных. Необязательный параметр. Если не задан или задано нулевое
+       значение, создавамый объект для работы с регистром не будет связан с базой данный.
+       То есть объект не будет заполнен данными из регистра, хранящимися в базе данных,
+       и все изменения, вносимые в него, не будут сохранены в базе данных.
+       \_ru
+ */
+aARegister::aARegister( QString name, aDatabase *adb  )
+:aIRegister( name, adb, "AccumulationRegister.")
+{
+       if ( name.isEmpty() ) concrete = false;
+       else concrete = true;
+       initObject();
+}
+
+/*!
+ *\en
+ *     Destructor
+ *\_en
+ *\ru
+ *     Деструктор.
+ *\_ru
+ */
+aARegister::~aARegister()
+{
+}
+
+
+/*!
+ *\en
+ *     Initing this object by metadata object.
+ *     Сreating used tables and filters
+ *\_en
+ *\ru
+ *     Инициализирует объект элементом конфигурации.
+ *     В процесе инициализации выполняется настройка на таблицы базы данных.
+ *     Этот метод вызывается конструктором.
+ *\_ru
+ *\return  -\en  error code.\_en \ru код ошибки.\_ru
+ */
+ERR_Code
+aARegister::initObject()
+{
+       int len_uf;
+       //resnames.clear();
+       ERR_Code err = aIRegister::initObject();
+       if ( err )
+       {
+               aLog::print(aLog::Error, tr("Accumulation Register init"));
+               return err;
+       }
+       err = tableInsert( db->tableDbName(*md,obj), obj );
+       if ( err )
+       {
+               aLog::print(aLog::Error, tr("Accumulation Register create main table"));
+               return err;
+       }
+       aCfgItem field, dims = md->find(obj, md_dimensions,0);
+       aCfgItem ress = md->find(obj, md_resources,0);
+       //if ( res.isNull() ) return err_noresources;
+       tablename = table()->tableName;
+       uint n = md->count( dims, md_field );
+       for ( uint i = 0; i < n; i++  )
+       {
+               field = md->find( dims, md_field, i );
+               err = tableInsert( db->tableDbName(*md,field), field, md->attr(field,mda_name) );
+               if ( err )
+               {
+                       aLog::print(aLog::Error, tr("Accumulation Register create saldo table"));
+                       return err;
+               }
+               long mdid = md->id(field);
+               QString f_name = md->attr(field,mda_name);
+               dimnames[mdid]=f_name;
+       }
+       ress = md->find(obj, md_resources,0);
+       n = md->count( ress, md_field );
+       for ( uint i = 0; i < n; i++  )
+       {
+               field = md->find( ress, md_field, i );
+               long mdid = md->id(field);
+               QString f_name = md->attr(field,mda_name);
+               resnames[mdid]=f_name;
+               resSysNames[f_name]=QString("uf%1").arg(md->attr(field,mda_id));
+       }
+       return err_noerror;
+}
+
+
+/*!
+ *\en
+ *     \brief Adds new line to register table.
+ *
+ *     \return Error code
+ *     \see SetDocument( aDocument * doc )
+ *     \see SetTable( const QString & tblname )
+ *\_en
+ *\ru
+ *     \brief Добавляет новую строку к таблице регистра.
+ *
+ *     \return Код ошибки
+ *     \see SetDocument( aDocument * doc )
+ *     \see SetTable( const QString & tblname )
+ *\_ru
+ */
+int
+aARegister::New()
+{
+       if ( !docseted ) return err_nodocument;
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       qulonglong idd = nowDoc->getUid();
+       if ( !idd ) return err_notselected;
+       int err = aObject::New();
+       if ( err ) return err;
+       t->setSysValue( "idd", idd );
+       t->setSysValue( "date", nowDoc->Value("DocDate") );
+       if ( tableseted )
+       {
+               aSQLTable * tt = nowDoc->getTable ( tname );
+               t->setSysValue("iddt",tt->sysValue("id"));
+               t->setSysValue("ln",tt->sysValue("ln"));
+       }
+       err = Update();
+       if ( err ) return err;
+       else return select(getUid());
+}
+
+/*!
+ *\en
+ *     Updates information in database.
+ *     Reimplements aObject function for recalc rests.
+ *\_en
+ *\ru
+ *     Обновляет информацию в регитре.
+ *     Все новые значения, заданные с помощью SetValue, сохраняются в базе данных.
+ *     Выполняет пересчет остатков.
+ *\_ru
+ *\return  -\en  error code.\_en \ru код ошибки.\_ru
+ */
+int
+aARegister::Update()
+{
+       aIRegister::Update();
+       qulonglong uid = getUid();
+       resum( table(), nowDoc->Value("DocDate").toDateTime(), true );
+       aLog::print(aLog::Debug, tr("Accumulation Register update"));
+       return err_noerror;//aIRegister::Update();
+}
+
+
+/*!
+ *\en
+ *     Deletes records from accumulation registers.
+ *     Deletes all records from accumulation register tables that contents reference to doc.
+ *\_en
+ *\ru
+ *     Удаляет все записи в регистре, ссылающиеся на досумент.
+ *\_ru
+ *\param doc - \en document to delete\_en \ru
+       документ для удаления\_ru
+ *\return  - \en false if can't find tag <aregisters/> in meta data or have no document.\_en \ru
+       false если в конфигурации отсутствует раздел регистров остатков или нет документа.\_ru
+ */
+bool
+aARegister::deleteDocument( aDocument * doc )
+{
+       qulonglong idd = doc->getUid();
+       if ( !idd ) return false;
+       aSQLTable *t = table();
+       if ( t->select(QString("idd=%1").arg(idd) ))
+       {
+               if(t->first())
+               {
+                       do
+                       {
+                               resum( t, doc->Value("DocDate").toDateTime(), false );
+                       }while(t->next());
+               }
+               db->db()->exec(QString("delete from %1 where idd=%2").arg(t->tableName).arg(idd));
+               aLog::print(aLog::Info, QString("Accumulation register delete document with idd=%1").arg(idd));
+       }
+       return true;
+}
+
+
+
+
+/*!
+ *\en
+ *     Gets saldo.
+ *     Helper metod.
+ *\_en
+ * \see getSaldo(const QDateTime &date, const QString & dimfieldname, QVariant dimvalue, const QString &resname)
+ *\ru
+ *     Функция получения остатка. Вспомогательный метод. Служит для совместимости со скриптами.
+ *\_ru
+ *\param strdate - \en date\_en \ru дата, за которую надо получить остаток. Дата задается в виде строки в ISO формате.\_ru
+ *\param dimfieldname - \en name of dimensions field\_en \ru измерение, по которому нужно получить остаток\_ru
+ *\param dimvalue - \en value of dimensions field\_en \ru значение измерения, по которому надо получить остаток\_ru
+ *\param resname - \en name of resounces field\_en \ru ресурс, значение которого надо получить\_ru
+ *\return  - \en Saldo value or QVariant::Invalid on error.\_en \ru
+       Значение остатка или QVariant::Invalid при ошибке или неправильных параметрах.\_ru
+ */
+QVariant
+aARegister::getSaldo(const QString & strdate, const QString & dimfieldname, QVariant  dimvalue, const QString &resname)
+{
+       QDateTime data = QDateTime::fromString(strdate,Qt::ISODate);
+
+       if (!data.isValid()){
+               QDate dt = QDate::fromString(strdate,Qt::ISODate);
+               if(dt.isValid())
+               {
+                       QTime tm;
+                       data.setDate(dt);
+                       data.setTime(tm);
+                       return getSaldo(data,dimfieldname, dimvalue,resname);
+               }
+               else
+               {
+                       aLog::print(aLog::Error, QString(tr("Accumulation register convert datetime from string %1")).arg(strdate));
+                       return QVariant::Invalid;
+               }
+       }
+       else
+       {
+               return getSaldo(data,dimfieldname, dimvalue,resname);
+       }
+}
+
+
+
+/*!
+ * \ru
+ *  Выбирает остаток на заданную дату-время.
+ *  Выбирает остаток на заданную дату-время для одного (любого из заданных в регистре)
+ *  аналитического разреза (измерения) с указанным значением.
+ *  Проще говоря, метод позволяет получить, например, остаток по дебету или кредиту требуемого счета
+ *  на требуемую дату, если регистр используется для хранения бухгалтерских проводок, в каждой из которых
+ *  указывается один дебетуемый и один кредитуемый счет.
+ *  \param date - дата, на которую требуется получить остаток.
+ *  \param dimfieldname - название аналитического разреза регистра.
+ *  \param dimvalue - значение (точка) аналитического разреза, для которого требуется определить остаток.
+ *  Например для Аналитического разреза "Счет по дебету" значение может быть "41.1" или любой другой
+ *  номер счета бухгалтерского плана счетов.
+ *  \return возвращает значение остатка.
+ * \_ru
+ */
+
+QVariant
+aARegister::getSaldo(const QDateTime &date, const QString & dimfieldname, QVariant dimvalue, const QString &resname)
+{
+       aSQLTable *t_dim = table(dimfieldname);
+       if(!t_dim)
+       {
+               aLog::print(aLog::Error,QString(tr("Accumulation register not found table %1")).arg(dimfieldname));
+               return QVariant::Invalid;
+       }
+       t_dim->clearFilter();
+       if(!t_dim->setFilter(dimfieldname,dimvalue))
+       {
+               aLog::print(aLog::Error,tr("Accumulation register set filter"));
+               return QVariant::Invalid;
+       }
+       QString flt = QString("date<='%1' and %2").arg(date.toString(Qt::ISODate)).arg(t_dim->getFilter());
+
+       QString query = QString("select * from %1 where %2").arg(t_dim->tableName).arg(flt);
+       t_dim->clearFilter();
+       t_dim->select();
+
+       QSqlQuery q = db->db()->exec(query);
+       q.last();
+       if(q.isValid())
+       {
+               return q.value(t_dim->position(resSysNames[resname]));
+       }
+       else
+       {
+               aLog::print(aLog::Debug,"Accumulation register record empty");
+       }
+       return QVariant::Invalid;// t_dim->value(resname);//QVariant::Invalid;
+}
+
+
+/*!
+ * \ru
+ *  Вычисляет сумму за определенный период.
+ *  Выбирает сумму для одного (минимум) аналитического разреза (измерения) с указанным значением.
+ *  Если необходимо сальдо по нескольким измерениям, установите по ним фильтры \see aIRegister::SetFilter()
+ *  \param from - дата начала периода.
+ *  \param to - дата окончания периода.
+ *  \param dimfieldname - название аналитического разреза регистра.
+ *  \param dimvalue - значение (точка) аналитического разреза, для которого требуется определить остаток.
+ *  Например для Аналитического разреза "Счет по дебету" значение может быть "41.1" или любой другой
+ *  номер счета бухгалтерского плана счетов.
+ *  \return возвращает значение остатка.
+ * \_ru
+ */
+QVariant
+aARegister::getSaldoByManyDimensions(const QString &from, const QString &to, const QString & dimfieldname, QVariant dimvalue, const QString &resname)
+{
+       aSQLTable *t = table();
+       QString currentFilter;
+               
+       if(!t)
+       {
+               aLog::print(aLog::Error,QString(tr("Accumulation register not found main table")));
+               return QVariant::Invalid;
+       }
+       currentFilter = t->filter(); // QSqlCursor method call
+       
+       if(!t->setFilter(dimfieldname,dimvalue))
+       {
+               aLog::print(aLog::Error,tr("Accumulation register set filter"));
+               t->setFilter(  currentFilter ); // QSqlCursor method call
+               t->select();
+               return QVariant::Invalid;
+       }
+       QString flt = QString("date>='%1' and date<='%2' and %3 ").arg(from).arg(to).arg(t->getFilter());
+
+       QString query = QString("select sum(%1) from %2 where %3").arg(resSysNames[resname]).arg(t->tableName).arg(flt);
+       
+       aLog::print(aLog::Info,QString("Accumulation register query %1").arg(query));
+       QSqlQuery q = db->db()->exec(query);
+       q.last();
+       if(q.isValid())
+       {
+               t->setFilter( currentFilter );
+               t->select();
+               return q.value(0);//t->position(resSysNames[resname]));
+       }
+       else
+       {
+               aLog::print(aLog::Debug,"Accumulation register record empty");
+       }
+       t->setFilter( currentFilter );
+       t->select();
+       return 0;
+       
+}
+/*!
+ *\en
+ *     Recalculates rest tables.
+ *\_en
+ *\ru
+ *     Пересчитывает таблицы остатков.
+ *     Таблицы остатков пересчитывается для всех занчений с равной или более поздней датой.
+ *     В передаваемой таблице должны быть выбрана запись, обусловившая пересчет.
+ *\_ru
+ *\param t - \en table with selected record \_en \ru
+ *     таблица с выбранной записью\_ru
+ *\param dd - \en date for start recalculation.\_en \ru
+ *     дата, с которой пересчитаются остатки.\_ru
+ *\param plus - \en true for new record, false for delete\_en \ru
+ *     true для новой записи, false для удаления записи.\_ru
+ */
+void
+aARegister::resum( aSQLTable * t, const QDateTime & dd, bool plus )
+{
+       aCfgItem dims;
+       dims = md->find( obj, md_dimensions );
+       int dims_count = md->count(dims,md_field);
+       for(uint i=0; i<dims_count; i++)
+       {
+               aCfgItem dim = md->findChild(dims,md_field,i);
+               long dimId = atoi(md->attr(dim,mda_id).ascii());
+               aSQLTable *t_dim = table(md->attr(dim,mda_name));
+               QVariant v = t->value(md->attr(dim,mda_name));
+               if(v.isValid() && !v.isNull() && v!=QString())
+               {
+                       recalculate_saldo(t_dim, t, dd, plus, dimId, v );
+               }
+       }
+}
+
+
+
+/*!
+ *\ru
+ *     Выбирает запись в таблице остатков с заданной датой, если ее нет, то создает новую.
+ *     После этого вызывает функцию для обновления значений остатков.
+ *\_ru
+ *\param t_dim - \en saldo table \_en \ru таблица остатков для обновления\_ru
+ *\param t - \en table \_en \ru таблица оборотов с выбранной записью, из которой берутся значения\_ru
+ *\param dd - \en date for start recalculation.\_en \ru дата, с которой пересчитаются остатки.\_ru
+ *\param plus - \en true for new record, false for delete\_en \ru true для новой записи, false для удаления записи.\_ru
+ *\param dimId - \en dimension id\_en \ru id поля измерения в метаданных\_ru
+ *\param dimValue - \en dimension value\_en \ru значение поля измерения в метаданных\_ru
+ */
+void //protected
+aARegister::recalculate_saldo(aSQLTable *t_dim, aSQLTable *t, const QDateTime & dd, bool plus, long dimId, QVariant dimValue)
+{
+       QString query = QString("select * from %1 where date='%2' and uf%3='%4'").arg(t_dim->tableName).arg(dd.toString(Qt::ISODate)).arg(dimId).arg(dimValue.toString());
+
+       QSqlQuery q =db->db()->exec(query);
+       q.first();
+       if(!q.isValid())
+       {
+               t_dim->select();
+               QString where = QString("date<'%2' and uf%3='%4'").arg(dd.toString(Qt::ISODate)).arg(dimId).arg(dimValue.toString());
+               query = QString("select * from %1 where %2").arg(t_dim->tableName).arg(where);
+               QString values;
+               q = db->db()->exec(query);
+               q.last();
+               if(q.isValid())
+               {
+                       //t_dim->select(query,false);
+                       //t_dim->last();
+                       insert_values(&q,t_dim,dd,plus,dimId,dimValue);
+               }
+               else
+               {
+                       insert_values(0,t_dim,dd,plus,dimId,dimValue);
+               }
+       }
+       update_values(t_dim,dd,plus,dimId,dimValue,t);
+}
+
+/*!
+ *\ru
+ *     Добавляет запись в таблицу остатков.
+ *\_ru
+ *\param q - \en query with selected record \_en \ru запрос с данными для добавления. Если q!=0, то данные из q  попадут в добавляемую строку\_ru
+ *\param t_dim - \en saldo table \_en \ru таблица остатков\_ru
+ *\param dd - \en date for start recalculation.\_en \ru дата, с которой пересчитаются остатки.\_ru
+ *\param plus - \en true for new record, false for delete\_en \ru true для новой записи, false для удаления записи.\_ru
+ *\param dimId - \en dimension id\_en \ru id поля измерения в метаданных\_ru
+ *\param dimValue - \en dimension value\_en \ru значение поля измерения в метаданных\_ru
+ */
+
+int //protected
+aARegister::insert_values(QSqlQuery *q, aSQLTable *t_dim, const QDateTime & dd, bool plus, long dimId, QVariant dimValue)
+{
+       int res=0;
+       QString ins_col = QString("date,uf%1,").arg(dimId);
+       QString ins_val = QString("'%1','%2',").arg(dd.toString(Qt::ISODate)).arg(dimValue.toString());
+       QMap<QString,QString>::Iterator it;
+       QVariant res_value;
+       for ( it = resSysNames.begin(); it != resSysNames.end(); ++it )
+       {
+               if(q)
+               {
+                       res_value = q->value(t_dim->position(it.data()));
+               }
+               else
+               {
+                       res_value = 0;
+               }
+               ins_col+=QString("%1,").arg(it.data());
+               ins_val+=QString("%2,").arg(res_value.toString());
+       }
+       ins_col.truncate(ins_col.length()-1);
+       ins_val.truncate(ins_val.length()-1);
+       QString query = QString("insert into %1 (%2) values(%3)").arg(t_dim->tableName).arg(ins_col).arg(ins_val);
+       db->db()->exec(query);
+       t_dim->select();
+       return res;
+}
+
+
+
+/*!
+ *\ru
+ *     Обновляет записи в таблице остатков с датой, большей или равной заданной.
+ *\_ru
+ *\param t_dim - \en saldo table \_en \ru таблица остатков для обновления\_ru
+ *\param t - \en table \_en \ru таблица оборотов с выбранной записью, из которой берутся значения\_ru
+ *\param dd - \en date for start recalculation.\_en \ru дата, с которой пересчитаются остатки.\_ru
+ *\param plus - \en true for new record, false for delete\_en \ru true для новой записи, false для удаления записи.\_ru
+ *\param dimId - \en dimension id\_en \ru id поля измерения в метаданных\_ru
+ *\param dimValue - \en dimension value\_en \ru значение поля измерения в метаданных\_ru
+ */
+int //protected
+aARegister::update_values(aSQLTable *t_dim, const QDateTime & dd, bool plus, long dimId, QVariant dimValue, aSQLTable *t)
+{
+       QMap<long,QString>::Iterator it;
+       QString upd;
+       QString where = QString("date>='%1' and uf%2='%3'").arg(dd.toString(Qt::ISODate)).arg(dimId).arg(dimValue.toString());
+       QVariant res_value;
+       QString sign;//="-";
+       //if(plus) sign="+";
+       for ( it = resnames.begin(); it != resnames.end(); ++it )
+       {
+               if(t)
+               {
+                       res_value = t->value(it.data());
+               }
+               else
+               {
+                       res_value = 0;
+               }
+               if(plus) sign="+";
+               else sign ="-";
+               upd+=QString("uf%1=uf%2%3%4,").arg(it.key()).arg(it.key()).arg(sign).arg(res_value.toString());
+       }
+       upd.truncate(upd.length()-1);
+       QString query = QString("update %1 set %2 where %3").arg(t_dim->tableName).arg(upd).arg(where);
+       db->db()->exec(query);
+       return 0;
+}
+
+
+
+
+
+QString
+aARegister::trSysName( const QString & sname)
+{
+       if(sname == tr("RecordDate") || sname == "RecordDate" )
+       {
+               return "date";
+       }
+       else return "";
+}
diff --git a/src/lib/objects/aaregister.h b/src/lib/objects/aaregister.h
new file mode 100644 (file)
index 0000000..ac1e906
--- /dev/null
@@ -0,0 +1,104 @@
+/****************************************************************************
+** $Id: aaregister.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of the Accumulation Register of Ananas
+** Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Andrey Paskal <app at lrn dot ru>.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AAREGISTER_H
+#define AAREGISTER_H
+
+#include       "acfg.h"
+#include       "airegister.h"
+//Added by qt3to4:
+#include <QSqlQuery>
+
+
+
+/*!
+ *\en
+ *     Object for working with accumulation register in database.
+ *     Using for provide between database tables and wobjects or ananas scripts
+ *\_en
+ *\ru
+ *\brief Класс aARegister определяет программный интерфейс Накопительных регистров. Наследует aIRegister.
+ *
+ *     Накопительный регистр расширяет функциональность информационного регистра aIRegister,
+ *     автоматически расчитывая остатки по каждому измерению.
+ *     В базе данных хранятся остатки по каждому измерению и на каждое время изменения значения ресурсов.
+ *     Реквизиты накопительного регистра деляться на три вида: измерения, ресурсы, примечания.
+ *     \see aIRegister
+ *\_ru
+ */
+class  ANANAS_EXPORT aARegister : public aIRegister
+{
+       Q_OBJECT
+public:
+       aARegister(aCfgItem context, aDatabase * adb = 0);
+       aARegister(QString name, aDatabase * adb = 0);
+       virtual ~aARegister();
+
+       virtual ERR_Code initObject();
+
+       virtual bool deleteDocument( aDocument * doc );
+       //virtual bool deleteTable( Q_ULLONG iddt );
+       virtual QString trSysName( const QString & sname );
+public slots:
+       virtual ERR_Code New();
+       virtual int Update();
+       //int SelectCountByDoc();
+       //int ClosePeriod( const QDateTime & date = QDateTime::currentDateTime() );
+       //int SelectRemainders(const QDateTime & date = QDateTime::currentDateTime() );
+       //int SelectRemainders(const QString & strdate);
+       //int SelectRemainder(const QString & strdate, const QString & dimfieldname, QVariant dimvalue);
+       QVariant getSaldo(const QDateTime &date, const QString & dimfieldname, QVariant dimvalue, const QString &resname);
+       QVariant getSaldo(const QString &dateISO, const QString & dimfieldname, QVariant dimvalue, const QString &resname);
+
+       QVariant getSaldoByManyDimensions(const QString &from, const QString &to, const QString & dimfieldname, QVariant dimvalue, const QString &resname);
+       /*
+       QVariant SumValue( const QString & name );
+       bool SumNext();
+       bool SumPrev();
+       bool SumFirst();
+       bool SumLast();
+       */
+protected:
+       void recalculate_saldo(aSQLTable *t, aSQLTable *t_dim, const QDateTime & dd, bool plus, long dimId, QVariant dimValue);
+       int insert_values(QSqlQuery *q, aSQLTable *t_dim, const QDateTime & dd, bool plus, long dimId, QVariant dimValue);
+       int update_values(aSQLTable *t_dim, const QDateTime & dd, bool plus, long dimId, QVariant dimValue, aSQLTable *t=0);
+private:
+
+       void resum( aSQLTable * t, const QDateTime & dd, bool plus );
+       QString tablename;
+       QSqlQuery sumQuery;
+       QMap<long,QString> resnames;
+       QMap<QString,QString> resSysNames;
+       QMap<long,QString> dimnames;
+       //QDateTime actualDate;
+       //ERR_Code makeTmpTable( const QDateTime & date );
+};
+
+#endif// AAREGISTER_H
diff --git a/src/lib/objects/acatalogue.cpp b/src/lib/objects/acatalogue.cpp
new file mode 100644 (file)
index 0000000..63b6a54
--- /dev/null
@@ -0,0 +1,1146 @@
+/****************************************************************************
+** $Id: acatalogue.cpp,v 1.3 2008/11/09 21:09:11 leader Exp $
+**
+** Catalogue metadata object implementation file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include       "acfg.h"
+#include       "aobject.h"
+#include       "adatabase.h"
+#include       "acatalogue.h"
+#include       "alog.h"
+//Added by qt3to4:
+#include <Q3ValueList>
+
+
+/*!\en
+ *\_en \ru
+ *\_ru
+ */
+aCatalogue::aCatalogue( aCfgItem context, aDatabase * adb )
+:aObject( context, adb, 0, "aCatalogue")
+{
+       concrete = !context.isNull();
+       initObject();
+}
+
+
+
+/*!\en
+ *\_en \ru
+ *\_ru
+ */
+aCatalogue::aCatalogue(QString name, aDatabase * adb)
+:aObject( "Catalogue."+name, adb, 0, "aCatalogue")
+{
+       if ( name.isEmpty() ) concrete = false;
+       else concrete = true;
+       initObject();
+}
+
+
+
+ERR_Code
+aCatalogue::initObject()
+{
+       ERR_Code err = aObject::initObject();
+       if ( err ) return err;
+       aCfgItem g = md->find( obj, md_group ), e = md->find( obj, md_element );
+       err = tableInsert( aDatabase::tableDbName( *md, e ), e );
+       if ( err ) return err;
+       return tableInsert( aDatabase::tableDbName( *md, g ), g, md_group );
+}
+
+/*
+Q_ULLONG
+aCatalogue::getCatGroup()
+{
+       aSQLTable * t = table();
+       if ( !t ) return 0;
+       if ( !selected() ) return 0;
+       return t->sysValue("idg").toULongLong();
+}*/
+
+qulonglong
+aCatalogue::getGroup()
+{
+       aSQLTable * t = table(md_group);
+       if ( !t ) return 0;
+       if ( !selected(md_group) ) return 0;
+       return t->sysValue("id").toULongLong();
+}
+
+ERR_Code
+aCatalogue::setGroup( qulonglong idg )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       if ( !selected() ) return err_notselected;
+       t->setSysValue( "idg", idg );
+       t->primeUpdate();
+       t->update();
+       return err_noerror;
+}
+
+ERR_Code
+aCatalogue::SetGroup( aCatalogue * cat )
+{
+       if ( !cat ) return setGroup( 0 );
+       else return setGroup(cat->getGroup());
+}
+
+qulonglong
+aCatalogue::getOwner()
+{
+       aSQLTable * t = table();
+       if ( !t ) return 0;
+       if ( !selected() ) return 0;
+       return t->sysValue("ido").toULongLong();
+}
+
+ERR_Code
+aCatalogue::setOwner( qulonglong ido )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       if ( !selected() ) return err_notselected;;
+       t->setSysValue( "ido", ido );
+       t->primeUpdate();
+       t->update();
+       return err_noerror;
+}
+
+ERR_Code
+aCatalogue::SetOwner( aCatalogue * cat )
+{
+       if ( !cat ) return setOwner( 0 );
+       else return setOwner(cat->getUid());
+}
+
+ERR_Code
+aCatalogue::New( bool child )
+{
+       qulonglong group = getGroup(), parent = getUid();
+       ERR_Code err = aObject::New();
+       if ( err ) return err;
+       aSQLTable * t = table();
+       t->setSysValue( "idg", group );
+       if ( child ) t->setSysValue( "ido", parent );
+       t->primeUpdate();
+       t->update();
+       if ( group ) groupSelect();
+       setSelected(true);
+       return err_noerror;
+}
+
+
+ERR_Code
+aCatalogue::New( )
+{
+       return New(false);
+}
+
+
+ERR_Code
+aCatalogue::Delete()
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       if ( !selected() ) return err_notselected;
+       qulonglong ido = t->sysValue("id").toULongLong();
+       if ( ido )
+       {
+               aLog::print(aLog::Debug, tr("aCatalogue delete ido=%1").arg(ido));
+               aCatalogue cat( obj, db );
+               while ( !cat.selectByOwner(ido) )
+               {
+                       cat.Delete();
+               }
+       }
+       return aObject::Delete();
+}
+
+ERR_Code
+aCatalogue::Update()
+{
+       ERR_Code err = aObject::Update();
+       if ( !err )
+       {
+
+               aLog::print(aLog::Debug, tr("aCatalogue update"));
+               err = TableUpdate( md_group );
+               if(err)
+               {
+                       aLog::print(aLog::Error, tr("aCatalogue update groups error %1").arg(err));
+               }
+               else
+               {
+                       aLog::print(aLog::Debug, tr("aCatalogue update groups"));
+               }
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aCatalogue update elements error %1").arg(err));
+       }
+       return err;
+}
+
+ERR_Code
+aCatalogue::Copy()
+{
+       return aObject::Copy();
+}
+
+ERR_Code
+aCatalogue::Select( bool grouponly )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+//     setSelected(true,md_group);
+//     setSelected(true);
+       qulonglong idg = getGroup();
+       QString flt = "";
+//     groupSelect();
+       if ( grouponly ) flt = QString("idg=%1").arg( idg );
+       if ( t->select( flt ) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+                       qulonglong newidg = t->sysValue("idg").toULongLong();
+
+                       aLog::print(aLog::Debug, tr("aCatalogue select group id=%1").arg(idg));
+                       if ( newidg != idg ) groupSelect( newidg );
+                       return err_noerror;
+               }
+               else return err_notselected;
+       else return err_selecterror;
+}
+
+/*!
+ *\~english
+ *     Select group.
+ *     Get group id from current element and select group table
+ *     with this id.
+ *\~russian
+ *\~
+ * \return \~english Error code \~russian \~
+ */
+int
+aCatalogue::GroupSelect()
+{
+       aSQLTable * t = table();
+       if(!t) return err_notable;
+       if ( !selected() ) return err_notselected;;
+       qulonglong idg = t->sysValue("idg").toULongLong();
+       return groupSelect(idg);
+}
+void
+aCatalogue::UnSelect( bool grouponly )
+{
+       if (!grouponly )
+       {
+               setSelected(false);
+       }
+       setSelected(false, md_group);
+}
+ERR_Code
+aCatalogue::groupSelect ( qulonglong idg )
+{
+       if ( !idg ) return err_noerror;
+       aSQLTable * t = table( md_group );
+       if ( !t ) return err_notable;
+       setSelected( false, md_group );
+       if ( t->select( idg ) )
+               if ( t->first() )
+               {
+                       setSelected( true, md_group );
+                       return err_noerror;
+               }
+               else return err_notselected;
+       else return err_selecterror;
+}
+
+
+ERR_Code
+aCatalogue::groupSelect ()
+{
+       aSQLTable * t = table(md_group);
+       if ( !t ) return err_notable;
+       qulonglong idg = t->sysValue("id").toULongLong();
+       return groupSelect( idg );
+}
+
+ERR_Code
+aCatalogue::selectByOwner ( qulonglong ido )
+{
+       aSQLTable * t = table();
+
+       if ( !t ) return err_notable;
+       if ( t->select(QString("ido=%1").arg(ido),false) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+                       return err_noerror;
+               }
+               else return err_notselected;
+       else return err_selecterror;
+}
+
+ERR_Code
+aCatalogue::selectByGroup ( qulonglong idg )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       setSelected(false);
+       if ( t->select(QString("idg=%1").arg(idg),false ) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+                       return err_noerror;
+               }
+               else return err_notselected;
+       else return err_selecterror;
+}
+
+ERR_Code
+aCatalogue::groupByParent(qulonglong idp )
+{
+       aSQLTable * t = table( md_group );
+       if ( !t ) return err_notable;
+//f ( !selected(md_group) ) return err_notselected;
+       setSelected( false, md_group );
+       if ( t->select(QString("idp=%1").arg(idp),false) )
+               if ( t->first() )
+               {
+                       setSelected(true,md_group);
+                       return err_noerror;
+               }
+               else
+               {
+                       return err_notselected;
+               }
+       else return err_selecterror;
+}
+
+
+
+/*!\en
+ *     Select groups depth level.
+ *     \param level (in) - level
+\_en \ru
+ *
+  *\_ru
+*/
+int
+aCatalogue::selectByLevel(int level )
+{
+       aSQLTable * t = table(md_group);
+       if ( !t ) return err_notable;
+//     if ( !selected(md_group) ) return err_notselected;
+       setSelected( false, md_group );
+       if ( t->select(QString("level=%1").arg(level),false) )
+               if ( t->first() )
+               {
+
+                       setSelected(true, md_group);
+                       return err_noerror;
+               }
+               else
+               {
+                       return err_notselected;
+               }
+       else
+       {
+               return err_selecterror;
+       }
+
+}
+
+
+
+/*!\en
+ * Gets id of group on the id of element
+ * \param ide (in) - id of element.
+ * \return id of group.
+ \_en \ru
+ * Получает идентификационный номер группы по номеру элемента
+ * \param ide (in) - идентификационный номер элемента.
+ * \return идентификационный номер группы.
+ *\_ru
+ */
+qulonglong
+aCatalogue::idGroupByElement(qulonglong ide )
+{
+       aSQLTable * t = table();
+       if ( !t ) return 0;
+       t->select(QString("id=%1").arg(ide), false);
+       if ( t->first() )
+       {
+               setSelected(true);
+               return sysValue("idg").toLongLong();
+       }
+       else return 0;
+}
+
+ERR_Code
+aCatalogue::GroupNew( bool reparent )
+{
+       aSQLTable * te = table(), *tg = table( md_group );
+       if ( !te || !tg ) return err_notable;
+//     groupSelect();
+//     setSelected(true, md_group);
+       qulonglong idp = getGroup(), level = tg->sysValue("level").toULongLong(),
+                       idg = tg->primeInsert()->value("id").toULongLong();
+       if ( tg->insert() )
+       {
+               if ( idp ) level++;
+               tg->select( idg );
+               if ( !tg->first() ) return err_selecterror;
+               tg->selected = true;
+               aLog::print(aLog::Info,tr("aCatalogue  new group with id=%1").arg(idg) );
+               tg->setSysValue("idp",idp);
+               tg->setSysValue("level",level);
+               if ( reparent ) te->setSysValue("idg",idg);
+       }
+       return Update();
+}
+
+
+
+/*!\en
+ * Inserts new group in groups table
+ * \param parentId (in) - id parent group, or 0 if no parent.
+ \_en \ru
+ * Вставляет новую группу в таблицу групп
+ * \param parentId (in) - идентификационный номер группы предка или 0 если нет предка.
+   *\_ru
+*/
+ERR_Code
+aCatalogue::newGroup(qulonglong parentId )
+{
+       aSQLTable *tg = table( md_group );
+       if (!tg ) return err_notable;
+       setSelected(true, md_group);
+       tg->select(parentId);
+       setSelected(true,md_group);
+       qulonglong level, idg;
+       if(tg->first())
+       {
+               level = tg->sysValue("level").toULongLong()+1;
+       }
+       else level=0;
+       QSqlRecord* rec = tg->primeInsert(); // get edit buffer for table groups
+       idg = rec->value("id").toULongLong();
+       aLog::print(aLog::Info,tr("aCatalogue  new group with id=%1").arg(idg) );
+       rec->setValue("id",idg );
+       rec->setValue("idp",parentId);
+       rec->setValue("level",level);
+       rec->setValue("df","0");
+       tg->insert(); // insert record
+       tg->select(QString("id=%1").arg(idg),false); // set cursor to inserted record
+       tg->first();
+       setSelected(true,md_group);
+       //tg->update();
+return groupSelect(idg);
+}
+
+
+
+/*!\en
+ * Inserts new element in elements table
+ * \param parentId (in) - id parent group.
+ \_en \ru
+ * Вставляет новый элемент в таблицу элементов
+ * \param parentId (in) - идентификационный номер группы предка.
+ *\_ru
+ */
+ERR_Code
+aCatalogue::newElement(qulonglong parentId )
+{
+       aSQLTable *te = table();
+       if (!te) return err_notable;
+       QSqlRecord *rec;
+       qulonglong ide;
+       rec = te->primeInsert(); // get edit buffer for table elements
+       ide = rec->value("id").toULongLong();
+       rec->setValue("id",ide); // set defult values for all user fields = id
+       //for(uint i=0; i< rec->count(); i++)
+       //{
+       //      rec->setValue(i,ide);
+//             printf("%s\n",rec->fieldName(i).ascii());
+       //}
+       rec->setValue("idg",parentId);
+       rec->setValue("df","0");
+       rec->setNull("ido");
+       te->insert(); // insert edit buffer as new line in table
+       te->select(QString("id=%1").arg(ide),false); // set cursor to inserted record
+       te->first();
+       setSelected(true);
+       return err_noerror;
+}
+
+
+
+/*!\en
+ * Mark deleted element only. Don't supports link one to many.
+ * \return id of deleted element.
+ \_en \ru
+ * Только выделяет удаляемый элемент. Не поддерживает связь один ко многим.
+ * \return идентификационный номер удаляемого элемента.
+ *\_ru
+ */
+qulonglong
+aCatalogue::setMarkDeletedElement(qulonglong id_el,bool del)
+{
+       select(id_el);
+       SetMarkDeleted(del);
+       Update();
+return table()->sysValue("id").toULongLong();
+}
+qulonglong
+aCatalogue::setMarkDeletedGroup(qulonglong id_gr, bool del)
+{
+       groupSelect(id_gr);
+       SetMarkDeleted(del, md_group);
+       GroupUpdate();
+return table()->sysValue("id").toULongLong();
+}
+
+
+
+/*!\en
+ * Delets element only. Don't supports link one to many.
+ * \return id of deleted element.
+ \_en \ru
+ * Только удаляет элемент. Не поддерживает связь один ко многим.
+ * \return идентификационный номер удаляемого элемента.
+ *\_ru
+ */
+qulonglong
+aCatalogue::delElement()
+{
+       aSQLTable * t = table();
+       qulonglong ide=0;
+       if ( !t ) return ide;
+       ide = t->sysValue("id").toULongLong();
+       if ( ide )
+       {
+               aLog::print(aLog::Info,tr("aCatalogue delete element with id=%1").arg(ide));
+               t->primeDelete();
+               t->del();
+               setSelected( false );
+       }
+       return ide;
+}
+
+
+
+/*!\en
+ * Mark deleted group with child elements and groups.
+ * \param idg (in) - id mark deleted group.
+ * \param listDelId (in,out) - list of id mark deleted elements and groups.
+ \_en \ru
+ * Выделяет удаляемую группу с дочерними элементами и группами.
+ * При первом вызове параметр listDelId должен быть пустой, он не обнуляется
+ * автоматически при вызове этой функции.
+ * Функция рекурсивно вызывает сама себя для всех дочерних подгрупп и
+ * добавляет их id в список. Также туда добавляются и id элементов,
+ * содержащихся в этих группах. Для изменения атрибута удаления используте функции
+ * setElementMarkDeleted(id)(для элементов) и setGroupMarkDeleted(id) (для групп)
+ * \param idg (in) - идентификационный номер выделенной для удаления группы.
+ * \param listDelId (in,out) - список идентификационных номеров выделенных для удаления элементов и групп.
+  *\_ru
+ */
+void
+aCatalogue::getMarkDeletedList(qulonglong idg,
+                               Q3ValueList<qulonglong> &listDelId)
+{
+       Q3ValueList<qulonglong> lst;
+       aSQLTable * tg = table ( md_group );
+       if ( !tg ) return;
+       qulonglong tmp;
+       if ( idg )
+       {
+
+       //      delete elements in group;
+                       if(selectByGroup(idg)==err_noerror)
+                       {
+                               do
+                               {
+                                       listDelId << sysValue("id").toULongLong();
+                               }
+                               while(Next());
+                       }
+                       if (groupByParent(idg)==err_noerror)
+                       {
+                               do
+                               {
+                               lst << GroupSysValue("id").toULongLong();
+                               }while(NextInGroupTable());
+
+                               Q3ValueList<qulonglong>::iterator it = lst.begin();
+                               while(it!= lst.end())
+                               {
+                                       getMarkDeletedList((*it),listDelId);
+                                       ++it;
+                               }
+                       }
+
+       }
+       tg->select(QString("id=%1").arg(idg),false);
+       if(tg->first())
+       {
+               listDelId << idg;
+       }
+       return;
+}
+bool
+aCatalogue::isGroupMarkDeleted()
+{
+       return IsMarkDeleted(md_group);
+}
+bool
+aCatalogue::isElementMarkDeleted()
+{
+       return IsMarkDeleted();
+}
+
+
+
+/*!\en
+ * Delets group with child elements and groups.
+ * \param idg (in) - id deleted group.
+ * \param listDelId (in,out) - list of id deleted elements and groups.
+ \_en \ru
+ * Физически удаляет группу со всеми ее дочерними элементами и группами.
+ * \param idg (in) - идентификационный номер выделенной для удаления группы.
+ * \param listDelId (in,out) - список идентификационных номеров выделенных для удаления элементов и групп.
+ *\_ru
+ */
+qulonglong
+aCatalogue::delGroup(qulonglong idg, Q3ValueList<qulonglong> &listDelId)
+{
+       aSQLTable * tg = table ( md_group );
+       if ( !tg ) return 0;
+       //if ( !selected( md_group ) ) return err_notselected;
+       qulonglong tmp;// idg = tg->sysValue("id").toULongLong();
+       groupSelect(idg);
+       if ( idg )
+       {
+
+               aLog::print(aLog::Info,tr("aCatalogue delete group with id=%1").arg(idg));
+       //              printf("idg=" LLU_SPEC "\n",idg);
+       //      delete elements in group;
+                       while(selectByGroup(idg)==err_noerror)
+                       {
+                               listDelId << delElement();
+                       }
+                       while (groupByParent(idg)==err_noerror)
+                       {
+                               delGroup(GroupSysValue("id").toULongLong(), listDelId);
+                               //printf(">>>idg=%lu\n",tmp);
+                       }
+       }
+       tg->select(QString("id=%1").arg(idg),false);
+       if(tg->first())
+       {
+               tg->primeDelete();
+               tg->del();
+               listDelId << idg;
+               setSelected( false, md_group );
+       }
+       return idg;
+}
+ERR_Code
+aCatalogue::GroupDelete()
+{
+       aSQLTable * tg = table ( md_group );
+       if ( !tg ) return err_notable;
+       getGroup();
+       if ( !selected( md_group ) )
+       {
+
+               aLog::print(aLog::Info,tr("aCatalogue delete without selection"));
+               //debug_message(">>not seletc in delete\n");
+               return err_notselected;
+       }
+
+       qulonglong idg = tg->sysValue("id").toULongLong();
+       if ( idg )
+       {
+               //printf("idg=" LLU_SPEC "\n",idg);
+               aCatalogue cat( obj,db );
+               while ( !cat.selectByGroup(idg) ) cat.Delete();
+               while ( !cat.groupByParent(idg) )
+               {
+                       //printf("delete group\n");
+                       cat.GroupDelete();
+               }
+       }
+       tg->primeDelete();
+       tg->del();
+       aLog::print(aLog::Info,tr("aCatalogue delete group with id=%1").arg(idg));
+       if(tg->first())
+       {
+               setSelected( true, md_group );
+       }
+       else
+       {
+               setSelected( false, md_group );
+       }
+       return err_noerror;
+}
+
+ERR_Code
+aCatalogue::GroupMarkDeleted()
+{
+       aSQLTable * t = table ( md_group );
+       if ( !t ) return err_notable;
+       if ( !selected( md_group ) ) return err_notselected;
+       if ( SetMarkDeleted( true, md_group ) ) return err_noerror;
+       else return err_deleteerror;
+}
+
+ERR_Code
+aCatalogue::GroupUpdate()
+{
+       aLog::print(aLog::Debug, tr("aCatalogue update group"));
+       return TableUpdate( md_group );
+}
+
+ERR_Code
+aCatalogue::GroupSetGroup( aCatalogue * cat )
+{
+       aSQLTable * t = table( md_group );
+       if ( !t ) return err_notable;
+       qulonglong newidp, oldidp = t->sysValue("idp").toULongLong();
+       if ( !cat ) newidp = 0;
+       else newidp = cat->getGroup();
+       if ( newidp == oldidp ) return err_noerror;
+       t->setSysValue( "idp", newidp );
+       t->primeUpdate();
+       t->update();
+       return err_noerror;
+}
+
+QVariant
+aCatalogue::GroupValue( const QString & name )
+{
+       aSQLTable * t = table( md_group );
+       if ( !t ) return QVariant::Invalid;
+       return t->value( name );
+}
+
+
+
+/*!\en
+ * Gets system field value in table of group.
+ * \param name (in) - field name.
+ * \return field value or QVariant::Invalid if no field.
+ \_en \ru
+ *\_ru
+ */
+QVariant
+aCatalogue::GroupSysValue( const QString & name )
+{
+       aSQLTable * t = table( md_group );
+       if ( !t ) return QVariant::Invalid;
+       //if(name=="id") return t->sysValue(name).toString();
+       return t->sysValue( name );//.toString();
+}
+
+ERR_Code
+aCatalogue::GroupSetValue( const QString & name, const QVariant & value )
+{
+       aSQLTable * t = table( md_group );
+       if ( !t ) return err_notable;
+       if ( !selected( md_group ) ) return err_notselected;
+       if ( t->setValue( name, value ) ) return err_noerror;
+       else return err_fieldnotfound;
+
+}
+
+
+ERR_Code
+aCatalogue::GroupSetSysValue( const QString & name, const QVariant & value )
+{
+       aSQLTable * t = table( md_group );
+       if ( !t ) return err_notable;
+       if ( !selected( md_group ) ) return err_notselected;
+        t->setSysValue( name, value);
+       return err_noerror;
+       //else return err_fieldnotfound;
+
+}
+
+QVariant
+aCatalogue::GetElementValue(QVariant ide, const QString &fname)
+{
+       aSQLTable * t = table();
+       if ( !t ) return "";
+       t->select(ide.toULongLong());
+       if ( !t->first() ) return "";
+       else return t->value( fname );
+
+
+}
+bool
+aCatalogue::Next()
+{
+       return  aObject::Next();  //return !groupSelect();
+       //else return false;
+}
+
+bool
+aCatalogue::Prev()
+{
+       return  aObject::Prev();  //return !groupSelect();
+//     else return false;
+}
+
+bool
+aCatalogue::First()
+{
+       return  aObject::First();  //return !groupSelect();
+       //else return false;
+}
+
+bool
+aCatalogue::Last()
+{
+       return aObject::Last(); //return !groupSelect();
+       //else return false;
+}
+
+bool
+aCatalogue::NextInGroupTable()
+{
+       return aObject::Next(md_group);
+}
+
+bool
+aCatalogue::PrevInGroupTable()
+{
+       return aObject::Prev(md_group);
+}
+
+bool
+aCatalogue::FirstInGroupTable()
+{
+       return aObject::First(md_group);
+}
+
+bool
+aCatalogue::LastInGroupTable()
+{
+       return  aObject::Last(md_group);
+}
+
+
+
+/*!\en
+ * Gets list user and calculation fields in table of elements.
+ \_en \ru
+  *\_ru
+ */
+QStringList
+aCatalogue::getUserFields()
+{
+       QStringList l;
+       aSQLTable *t = table();
+       if(t) l = t->getUserFields();
+       return l;
+}
+
+
+
+/*!\en
+ * Gets list user and calculation fields in table of Groups.
+ \_en \ru
+  *\_ru
+ */
+QStringList
+aCatalogue::getGroupUserFields()
+{
+       QStringList l;
+       aSQLTable *t = table( md_group );
+       if(t) l = t->getUserFields();
+       return l;
+}
+
+
+aCfgItem
+aCatalogue::displayStringContext()
+{
+       return md->find( md->find( obj, md_element ), md_string_view );
+}
+
+
+
+aCatElement::aCatElement(aCfgItem context, aDatabase * adb)
+:aObject( context, adb, 0, "aElement")
+{
+}
+
+
+
+
+aCatGroup::aCatGroup(aCfgItem context, aDatabase * adb)
+:aObject( context, adb, 0, "aGroup")
+{
+       int err = initObject();
+}
+
+
+
+
+/*!
+ *\ru
+ *     Возвращает id родительской группы
+ *\_ru
+ */
+qulonglong
+aCatGroup::parentUid()
+{
+       if ( !selected() ) return 0;
+       else return table()->sysValue("idp").toULongLong();
+}
+
+
+
+void
+aCatGroup::setLevel( qulonglong newLevel )
+{
+       if ( !selected() ) return;
+       aSQLTable * t = table();
+       qulonglong level = t->sysValue("level").toULongLong();
+       if ( level == newLevel ) return;
+       aCatGroup tgr( obj, db );
+       QString query;
+       query = QString("UPDATE %1 SET level=%2 WHERE id=%3")\
+                                       .arg(t->tableName).arg(newLevel).arg(getUid());
+//     printf("%s\n",(const char*) query);
+       db->db()->exec(query);
+       if ( !tgr.SelectChild( this ));
+               do
+               {
+                       tgr.setLevel( newLevel + 1 );
+               }
+               while ( tgr.Next() );
+}
+
+
+
+QString
+aCatGroup::trSysName( const QString & sname )
+{
+       if (( sname == "Level" )||( sname == QString::fromUtf8("Уровень") )) return "Level";
+       return "";
+}
+
+
+
+QVariant
+aCatGroup::sysValue( const QString & sname )
+{
+       if ( sname == "Level" )
+               return table()->sysValue("level");
+       return QVariant::Invalid;
+}
+
+
+
+/*!
+ *\~english
+ *     Init object.
+ *     We can work with object only after inited.
+ *     Auto call from constructor.
+ *\~russian
+ *\brief Инициализирует объект элементом конфигурации.
+ *
+ *     Мы можем работать с объектом после его инициализации.
+ *     Функция вызывается из конструктора.
+ *\~
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aCatGroup::initObject()
+{
+       ERR_Code err = aObject::initObject();
+       if ( err ) return err;
+       aCfgItem g = md->find( obj, md_group );
+       return tableInsert( aDatabase::tableDbName( *md, g ), g );
+}
+
+
+/*!
+ *\ru
+ *\brief Ничего не делает. Возвращает 0.
+ *
+ *\return Код ошибки.
+ *\_ru
+ */
+
+ERR_Code
+aCatGroup::New(aCatGroup *group)
+{
+       int rc = 0;
+       return rc;
+}
+/*!
+ *\en
+ *     Create new group in table.
+ *     New group added in root group and have level 0.
+ *     \return Error code.
+ *\_en
+ *\ru
+ *     \brief Добавляет группу в справочник.
+ *
+ *     Группа добавляется как корневая и имеет уровень 0.
+ *     \return  Код ошибки.
+ *\_ru
+ */
+ERR_Code
+aCatGroup::New()
+{
+       int rc = 0;
+       qulonglong level = 0, idg=0, idp = 0;
+       aSQLTable * t;
+       aLog::print(aLog::Info, tr("aCatGroup new group"));
+       int err = aObject::New();
+       if(!err)
+       {
+               aLog::print(aLog::Info, tr( "aCatGroup new group ok"));
+               setSelected(true);
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aCatGroup new group error %1").arg(err));
+       }
+       return err;
+}
+
+
+
+/*!
+ *\~english
+ *     Select all groups.
+ *     Select all groups use filter (if it's seted).
+ *\~russian
+ *     \brief Выбирает все группы.
+ *
+ *     Выбирает все группы используя фильтр (если он установлен).
+ *\~
+ *\return \~english Error code. \~russian Код ошибки.\~
+ */
+ERR_Code
+aCatGroup::Select()
+{
+       return aObject::select("");
+}
+
+
+
+/*!
+ *\~english
+ *     Select all childs.
+ *     Select childs ( not include ) for parent.
+ *     If parent = 0 or not parent, selected all root groups.
+ *\~russian
+ *     Выбирает всех потомков.
+ *     Выбирает всех потомков (первого уровня) для группы parent.
+ *     Если параметр отсутствует или нулевой, находятся все группы 0 - уровня.
+ *     Навигация по выбранным записям стандартная(Next(), Prev(), First(), Last())
+ *\~
+ *\param parent - \~english parent group. \~russian родительская группа.\~
+ *\return \~english Error code. \~russian Код ошибки.\~
+ */
+ERR_Code
+aCatGroup::SelectChild( aCatGroup * parent )
+{
+       qulonglong idp = 0;
+       if ( parent ) idp = parent->getUid();
+       QString query;
+       query = QString("idp=%1").arg(idp);
+//     printf("%s\n",(const char*)query);
+       return select(query);
+}
+
+
+
+/*!
+ *\~english
+ *     Set parent for group.
+ *     Set for current group new parent.
+ *     Check for cycle parent and recalc levels.
+ *\~russian
+ *     Устанавливает родителя для группы.
+ *     устанавливает текущей группе родителя переданного в качестве параметра.
+ *     Выполняется проверка на циклическое присваивание и пересчет уровней вложенности.
+ *\~
+ *\param parent - \~english new parent group. \~russian новая родительская группа.\~
+ *\return \~english Error code. \~russian Код ошибки.\~
+ */
+
+ERR_Code
+aCatGroup::SetParent( aCatGroup * parent )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       qulonglong idp = 0, uid = getUid();
+       if ( parent ) idp = parent->getUid();
+       if ( idp == uid ) return err_cyclereparent;
+       qulonglong level, tmpid = idp;
+       aCatGroup tg( obj, db );
+       while ( tmpid )
+       {
+               tg.select(tmpid);
+               tmpid = tg.parentUid();
+               if ( tmpid == uid ) return err_cyclereparent;
+       }
+       QString query;
+       query = QString("UPDATE %1 SET idp=%2 WHERE id=%3").arg(t->tableName).arg(idp).arg(uid);
+       level = parent->Value("Level").toULongLong();
+//     printf("%s\n",(const char*)query);
+       QSqlDatabase tdb = *db->db();
+       tdb.exec(query);
+       if ( !tdb.lastError().type() )
+       {
+               if (idp) setLevel(level+1);
+               else setLevel(0);
+               return err_noerror;
+       }
+       else return err_execerror;
+}
+
+
+aCfgItem
+aCatGroup::displayStringContext()
+{
+       return md->find( md->find( obj, md_group ), md_string_view );
+}
diff --git a/src/lib/objects/acatalogue.h b/src/lib/objects/acatalogue.h
new file mode 100644 (file)
index 0000000..24a3e1e
--- /dev/null
@@ -0,0 +1,175 @@
+/****************************************************************************
+** $Id: acatalogue.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Catalogue metadata object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ACATALOGUE_H
+#define ACATALOGUE_H
+
+#include       "acfg.h"
+#include       "aobject.h"
+//Added by qt3to4:
+#include <Q3ValueList>
+
+class aDatabase;
+class aCatGroup;
+//class aObject;
+
+
+
+/*!\en
+ *     Not visual object used for working with catalogues in database.
+ *     Used as interface between database and script or wObjects*
+ *\_en
+ *\ru
+ *\brief Класс aCatalogue определяет программный интерфейс иерархических справочников.
+ *     Наследует aObject.
+ *
+ *     Не визуальный объект используемый для работы с иерархическими каталогами (справочниками).
+ *     Используется как интерфейс между базой данных и скриптами или wObjects*
+ *\_ru
+ */
+class  ANANAS_EXPORT aCatalogue :public aObject
+{
+       Q_OBJECT
+public:
+
+       aCatalogue(aCfgItem context, aDatabase * adb = 0);
+       aCatalogue(QString name, aDatabase * adb = 0);
+//     virtual ERR_Code initObject(aDatabase * adb);
+       virtual ERR_Code initObject();
+
+protected:
+       virtual aCfgItem displayStringContext();
+
+private:
+//     Q_ULLONG getCatGroup();
+       qulonglong getGroup();
+       qulonglong getOwner();
+       ERR_Code setOwner( qulonglong ido );
+       ERR_Code setGroup( qulonglong idg );
+       ERR_Code selectByOwner ( qulonglong ido );
+       ERR_Code groupSelect ();
+       ERR_Code groupByParent(qulonglong idp );
+public slots:
+       //virtual aCatGroup * group();
+       virtual int New( bool child);
+       virtual int New();
+       virtual int Delete();
+
+       virtual int newGroup( qulonglong parentId );
+       virtual int newElement( qulonglong parentId );
+
+       virtual int Update();
+       virtual int Copy();
+       virtual int SetOwner( aCatalogue * cat );
+       virtual int SetGroup( aCatalogue * cat );
+       virtual int Select( bool grouponly = false );
+       void UnSelect( bool grouponly = false );
+       virtual int selectByLevel ( int level );
+       virtual int selectByGroup ( qulonglong idg );
+       virtual qulonglong idGroupByElement(qulonglong ide );
+       virtual int groupSelect ( qulonglong idg );
+
+       virtual QVariant GetElementValue(QVariant ide, const QString &fname);
+
+       virtual qulonglong delElement();
+       virtual qulonglong delGroup(qulonglong idg, Q3ValueList<qulonglong> &listDelId);
+
+       qulonglong setMarkDeletedElement(qulonglong el_id, bool del);
+       qulonglong setMarkDeletedGroup(qulonglong gr_id, bool del);
+       void getMarkDeletedList(qulonglong idg, Q3ValueList<qulonglong> &listDelId);
+
+       virtual bool isGroupMarkDeleted();
+       virtual bool isElementMarkDeleted();
+
+       virtual bool Next();
+       virtual bool Prev();
+       virtual bool First();
+       virtual bool Last();
+
+       virtual bool NextInGroupTable();
+       virtual bool PrevInGroupTable();
+       virtual bool FirstInGroupTable();
+       virtual bool LastInGroupTable();
+
+       virtual int GroupNew( bool reparent = false );
+       virtual int GroupDelete();
+       virtual int GroupMarkDeleted();
+       virtual int GroupUpdate();
+       virtual int GroupSelect();
+       virtual int GroupSetGroup( aCatalogue * cat );
+       virtual QVariant GroupValue( const QString & name );
+       virtual int GroupSetValue( const QString & name, const QVariant & value);
+       virtual QVariant GroupSysValue( const QString & name );
+       virtual int GroupSetSysValue( const QString & name, const QVariant & value);
+//     virtual ERR_Code GroupSelectChild( aCatalogue * parent = 0 );
+       virtual QStringList getUserFields();
+       virtual QStringList getGroupUserFields();
+};
+
+class  ANANAS_EXPORT aCatElement :public aObject
+{
+       Q_OBJECT
+public:
+       aCatElement(aCfgItem context, aDatabase * adb = 0);
+
+};
+
+
+
+/*!
+ *\~english
+ *     Object for work with catalogue group.
+ *\~russian
+ *\brief Класс aCatGroup определяет программный интерфейс для управления группами иерархических
+ *     справочников (каталогов). Наследует aObject.
+ *
+ *     Иерархический справочник может состоять из элементов и групп. Группы, в отличие от элементов
+ *     предназначены не для хранения данных, а для группировки элементов.
+ */
+class  ANANAS_EXPORT aCatGroup :public aObject
+{
+       Q_OBJECT
+       qulonglong parentUid();
+       void setLevel( qulonglong newlevel );
+       virtual QString trSysName( const QString & sname );
+       QVariant sysValue( const QString & sname );
+public:
+       aCatGroup(aCfgItem context, aDatabase * adb = 0);
+       virtual ERR_Code initObject();
+public slots:
+       ERR_Code New();
+       ERR_Code New(aCatGroup *gr);
+       ERR_Code Select();
+       ERR_Code SelectChild( aCatGroup * parent = 0 );
+       ERR_Code SetParent( aCatGroup * parent );
+protected:
+       virtual aCfgItem displayStringContext();
+};
+
+#endif// ACATALOGUE_H
diff --git a/src/lib/objects/adocjournal.cpp b/src/lib/objects/adocjournal.cpp
new file mode 100644 (file)
index 0000000..6169f4b
--- /dev/null
@@ -0,0 +1,726 @@
+/****************************************************************************
+** $Id: adocjournal.cpp,v 1.3 2008/11/09 21:09:11 leader Exp $
+**
+** Documents journal metadata object implementation file of
+** Ananas application library
+**
+** Created : 20040701
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include       <qdatetime.h>
+//Added by qt3to4:
+#include <QSqlQuery>
+
+#include       "acfg.h"
+#include       "aobject.h"
+#include       "adatabase.h"
+#include       "adocjournal.h"
+#include       "alog.h"
+
+/*!
+ *     \en
+ *     Constructor. Init object with \a context.
+ *     \_en
+ *     \ru
+ *     Конструктор. Инициализирует объект объектом метаданных.
+ *     \_ru
+ *     \param context - \en md object\_en \ru объект метаданных \_ru
+ *     \param adb - \en link to database\_en \ru ссылка на базу данных \_ru
+*/
+aDocJournal::aDocJournal( aCfgItem context, aDatabase * adb )
+:aObject( context, adb, 0, "aDocJournal")
+{
+       initObject();
+}
+
+
+/*!
+ *     \en
+ *     Constructor. Init object with md object, founded by \a name.
+ *     \_en
+ *     \ru
+ *     Конструктор. Инициализирует объект объектом метаданных с именем \a name.
+ *     \_ru
+ *     \param name - \en md object name\_en \ru имя объекта метаданных \_ru
+ *     \param adb - \en link to database\_en \ru ссылка на базу данных \_ru
+*/
+aDocJournal::aDocJournal( const QString & name, aDatabase * adb)
+:aObject( name, adb, 0, "aDocJournal")
+{
+       db = adb;
+       initObject();
+}
+
+
+/*!
+ *     \en
+ *     Constructor. Creates system journal.
+ *     \_en
+ *     \ru
+ *     Конструктор. Создает экземпляр системного журнала, в котором хранятся ссылки на все созданные документы.
+ *     \_ru
+ *     \param adb - \en link to database\_en \ru ссылка на базу данных \_ru
+*/
+aDocJournal::aDocJournal( aDatabase * adb )
+{
+       db = adb;
+       initObject();
+}
+
+
+
+ERR_Code
+aDocJournal::initObject()
+{
+       ERR_Code err = err_noerror;
+       aCfgItem mditem, docitem, header;
+
+
+       journalType=0;
+
+       setInited( true );
+       md = 0;
+       if ( db ) md = &db->cfg;
+       if(!md)
+       {
+                aLog::print(aLog::Error, tr("aDocJournal md object not exists"));
+                return err_objnotfound;
+       }
+//     aObject::initObject();
+       journalType= md->attr(obj,mda_type).toInt();
+       if (journalType)
+       {
+               mditem= md->find(obj,md_fieldid);
+               if (mditem.isNull())
+               {
+                       aLog::print(aLog::Error, tr("aDocJournal columns not defined"));
+                       return err;
+               }
+               else
+               {
+                       aLog::print(aLog::Debug, tr("aDocJournal column defined"));
+               }
+               docitem= md->parent( md->parent( md->find(md->text(mditem).toLong())));
+
+               header = md->find( docitem, md_header );
+               if(header.isNull()) aLog::print(aLog::Error, tr("aDocJournal invalid column define"));
+       //table for special journal
+               err =  tableInsert( aDatabase::tableDbName( *md, header ), header );
+//             printf("table name is %s\n", aDatabase::tableDbName( *md, header ).ascii());
+       }
+       else
+       {
+       //table for common journal
+               err = tableInsert( "a_journ" );
+       }
+
+       return err;
+}
+
+
+
+/*!
+ *\~english
+ *     Get current document id.
+ *     Get database id for current document.
+ *\~russian
+ *     Возвращает id текущего документа.
+ *     Возвращает id документа в базе данных.
+ *\~
+ *\return \~english database document id. \~russian id документа в базе данных.\~
+ */
+qulonglong
+aDocJournal::docId()
+{
+       if (!journalType) {
+               return table()->sysValue("idd").toULongLong();
+       } else {
+               return table()->sysValue("id").toULongLong();
+       }
+}
+
+
+
+/*!
+ *\~english
+ *     Gets current document type.
+ *\~russian
+ *     Получение типа текущего документа.
+ *\~
+ *\return \~english database document type. \~russian тип документа в базе данных.\~
+ */
+int
+aDocJournal::docType()
+{
+       return db->uidType( docId() );
+}
+
+
+
+/*!
+ *\~english
+ *     Delets current document.
+ *\~russian
+ *     Удаляет текущий документ.
+ *\~
+ *\see deleteDocument( Q_ULLONG idd )
+ *\return \~english error code \~russian код ошибки.\~
+ */
+ERR_Code
+aDocJournal::Delete()
+{
+       ERR_Code err;
+       aDocument * doc = CurrentDocument();
+       if ( !doc ) return err_notselected;
+       else err = doc->Delete();
+       delete doc;
+       doc = 0;
+       return err;
+}
+
+
+
+/*!
+ *\~english
+ *     Delets document with id =\a idd.
+ *\~russian
+ *     Удаляет документ с заданным идентификатором.
+ *\~
+ *\see Delete()
+ *\param idd - \~english document id \~russian идентификатор документа \~
+ *\return \~english error code \~russian код ошибки.\~
+ */
+ERR_Code
+aDocJournal::deleteDocument( qulonglong idd )
+{
+       aSQLTable * t = table();
+       qulonglong Uid = findDocument(idd);
+       db->markDeleted( Uid );
+       if (t->exec("DELETE FROM a_journ WHERE idd =" + QString("%1").arg(idd)))
+       {
+               aLog::print(aLog::Info, tr("aDocJournal delete document with idd=%1").arg(idd));
+               return err_noerror;
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aDocJournal delete document with idd=%1").arg(idd));
+               return err_execerror;
+       }
+}
+
+
+
+/*!
+ *\~english
+ *     Create new record in system journal.
+ *     Record create afte crate new document and use information about doc's
+ *     database id, prefix and metadata id(type).
+ *     Document number generate automatically by nextNumber().
+ *\~russian
+ *     Добавляет запись в системный журнал.
+ *     Запись добавляется после создания документа и использует информацию о его
+ *     id в базе данных, префиксе номера и id в конфигурации.
+ *     Номер досумента генерируется функцией nextNumber()
+ *\~
+ *\param idd - \~english database document id.\~russian id базы данных.\~
+ *\param docPrefix - \~english document number prefix.
+                                       \~russian перфикс номера документа.\~
+ *\param type - \~english document metadata id.
+                               \~russian id документа в конфигурации.\~
+ *\return \~english error code.\~russian код ошибки.\~
+ */
+ERR_Code
+aDocJournal::New( qulonglong idd, const QString & docPrefix, int type )
+{
+       //qulonglong Uid =0;// db->uid( md_systemjournal );
+       aDataTable * t = table();
+       if ( !t ) return err_notable;
+       //t->exec("LOCK TABLE a_journ WRITE");
+       //printf("insert into ajourn id=%llu idd=%llu, docPrefix=%s, type=%d\n",Uid,idd, (const char*)docPrefix.local8Bit(), type);
+//     t->exec("LOCK TABLE a_journ WRITE");
+       QSqlRecord *rec;
+       rec = t->primeInsert(); // get edit buffer for table elements
+//     t->primeInsert();
+       //ide = rec->value("id").toULongLong();
+       //rec->setValue("id",Uid);
+       rec->setValue("idd",idd);
+       rec->setValue("typed",type);
+       rec->setValue("num",nextNumber(docPrefix,type));
+       rec->setValue("pnum",docPrefix);
+       rec->setValue("ddate",QDateTime::currentDateTime());
+
+       t->insert(); // insert edit buffer as new line in table
+//TODO: error handle
+       aLog::print(aLog::Info, tr("aDocJournal new document with idd=%1").arg(idd));
+       /*
+       t->primeInsert();
+       t->insert();
+       t->setSysValue( "id", Uid );
+       t->setSysValue( "idd", idd );
+       t->setSysValue( "typed", type );
+       t->setSysValue( "num", nextNumber(docPrefix,type) );
+       t->setSysValue( "pnum", docPrefix );
+       t->setSysValue( "ddate", QDateTime::currentDateTime() );
+       Update();
+       t->exec("UNLOCK TABLE");
+       */
+
+       int err = selectDocument( idd );
+       setSelected(!err);
+       return err;
+}
+
+
+
+/*!
+ *\~english
+ *     Select document with id =\a idd.
+ *\~russian
+ *     Выбирает документ с заданным идентификатором.
+ *\~
+ *\param idd - \~english document id \~russian идентификатор документа \~
+ *\see findDocument( Q_ULLONG idd )
+ *\return \~english error code \~russian код ошибки.\~
+ */
+ERR_Code
+aDocJournal::selectDocument( qulonglong idd )
+{
+       aDataTable * t = table();
+       if ( !t ) return err_notable;
+       QString flt;
+       flt = QString("idd=%1").arg(idd);
+       if ( t->select(flt) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+                       return err_noerror;
+               }
+               else return err_notselected;
+       return err_selecterror;
+}
+
+
+
+
+/*!
+ *\~english
+ *     Generate next document number.
+ *\~russian
+ *     Генерирует следующий номер для документа.
+ *     Номер представляет собой строку, состоящую из префикса номера и числа.
+ *     Номер документа генерируется используя префикс номера документа
+ *     и его тип (id в конфигурации), как следующий за максимальным для даного сочетания.
+ *     Номер является уникальным в для доументов одного типа.
+ *\~
+ *\param prefix - \~english \~russian префикс номера.\~
+ *\param mdId - \~english \~russian id документа в конфигурации.\~
+ *\return \~english document number \~russian номер документа (только число).\~
+ */
+QString
+aDocJournal::nextNumber( const QString &prefix, int mdId )
+{
+       QString num="0", query;
+       query = QString("SELECT MAX(num)+1 FROM a_journ where pnum='%1' AND typed=%2").arg( prefix ).arg(mdId);
+       QSqlQuery q = db->db()->exec( query );
+       if ( q.first() ) num = q.value( 0 ).toString();
+        if ( num == "0" ) num = "1";
+       aLog::print(aLog::Info, tr("aDocJournal generated next number for %1 is %2").arg(prefix).arg(num));
+       //debug_message("<<<Next document number query>>>\n%s\nreturn: %s\n",
+               //      (const char*)query,(const char*)num);
+       return num;
+}
+
+
+
+/*!
+ *\~english
+ *     Gets current document date.
+ *\~russian
+ *     Возвращает дату текущего документа.
+ *\~
+ *\see setDate( QVariant date )
+ *\return \~english document date \~russian дата документа \~
+ */
+QVariant
+aDocJournal::getDate()
+{
+       aSQLTable * t = table();
+       if ( !t || !selected() ) return QVariant::Invalid;
+       else return t->sysValue("ddate");
+}
+
+
+/*!
+ *\~english
+ *     Gets current document prefix + number.
+ *\~russian
+ *     Возвращает строку префикс + номер текущего документа.
+ *\~
+ *\see setNumber( QVariant number )
+ *\return \~english document number \~russian номер документа \~
+ */
+QString
+aDocJournal::getNumber()
+{
+       aSQLTable * t = table();
+       if ( !t || !selected() ) return "";
+       else return t->sysValue("pnum").toString() + t->sysValue("num").toString();
+}
+
+/*!
+ *\~english
+ *     Gets current document number.
+ *\~russian
+ *     Возвращает номер текущего документа.
+ *\~
+ *\see getNumber( QVariant number )
+ *\return \~english document number \~russian номер документа \~
+ */
+int
+aDocJournal::getSerialNumber()
+{
+       aSQLTable * t = table();
+       if ( !t || !selected() ) return 0;
+       else return t->sysValue("num").toInt();
+}
+
+/*!
+ *\~english
+ *     Sets current document date.
+ *\~russian
+ *     Устанавливает дату текущего документа.
+ *\~
+ *\see getDate()
+ *\param date - \~english document date \~russian дата документа \~
+ *\return \~english error code \~russian код ошибки.\~
+ */
+ERR_Code
+aDocJournal::setDate( QVariant date )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       if ( !selected() ) return err_notselected;
+       t->setSysValue( "ddate", date );
+       return err_noerror;
+}
+
+
+
+/*!
+ *\~english
+ *     Sets current document number.
+ *\~russian
+ *     Устанавливает номер текущего документа.
+ *\~
+ *\see getNumber()
+ *\param number - \~english document number \~russian номер документа \~
+ *\return \~english error code \~russian код ошибки.\~
+ */
+ERR_Code
+aDocJournal::setNumber( QVariant number  )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       if ( !selected() ) return err_notselected;
+       QString pr;
+       int num;
+       decodeDocNum( number.toString(), pr, num  );
+       t->setSysValue( "pnum", pr );
+       t->setSysValue( "num", num );
+       return err_noerror;
+//     return Update();
+       /*QString query;
+       Q_ULLONG idd = docId();
+       QSqlQuery q = db->db()->exec ( QString("SELECT pnum, num FROM a_journ WHERE idd=%1").arg( idd ) );
+       if ( q.first() ) return q.value(0).toString()+q.value(1).toString();
+       else return "";*/
+}
+
+
+
+/*!
+ *\~english
+ *     Find document by id.
+ *\~russian
+ *     Ищет документ в системном журнале по его идентификатору.
+ *\~
+ *\see findDoc( const QString & number, int type ) selectDocument( Q_ULLONG idd )
+ *\param idd - \~english document number \~russian номер документа \~
+ *\return      \~english document id or 0 if document not found
+ *             \~russian id документа или 0, если документ не найден.\~
+ */
+qulonglong
+aDocJournal::findDocument( qulonglong idd )
+{
+       aSQLTable * t = table();
+       if ( !t ) return 0;
+       if (t->exec(QString("SELECT * FROM a_journ WHERE idd=%1").arg(idd)) )
+               if ( t->first() )
+               {
+                       setSelected( true );
+                       return getUid();
+               }
+               else
+               {
+                       aLog::print(aLog::Debug, tr("aDocJournal document not found with idd=%1").arg(idd));
+               }
+       return 0;
+}
+
+
+
+/*!
+ *\~english
+ *     Find document by number and type.
+ *\~russian
+ *     Ищет документ по его номеру и типу.
+ *\~
+ *\see findDocument( Q_ULLONG idd )
+ *\param number - \~english document number \~russian номер документа, состоящий из префикса и номера \~
+ *\param type - \~english document type \~russian тип документа \~
+ *\return      \~english document id or 0 if document not found
+ *             \~russian id документа или 0, если документ не найден.\~
+ */
+qulonglong
+aDocJournal::findDoc( const QString & number, int type )
+{
+       QString pref;
+       int num;
+       decodeDocNum( number, pref, num );
+       if ( table()->select(QString("pnum='%1' AND num=%2 AND typed=%3").arg(pref).arg(num).arg(type)) )
+               if ( table()->first() )
+               {
+                       setSelected(true);
+                       return table()->sysValue("idd").toULongLong();
+               }
+               else
+               {
+                       aLog::print(aLog::Debug, tr("aDocJournal document not found with number=%1 and type=%2 ").arg(number).arg(type));
+               }
+       return 0;
+}
+
+
+
+/*!
+ *\~english
+ *     Gets current document.
+ *\~russian
+ *     Возвращает текущий документ. Полученный документ необходимо удалить после использования.
+ *     \code
+ *     aDocument *doc = sysJournal->CurrentDocument();
+ *     //какие-то действия с документом
+ *     delete doc;
+ *     doc=0;
+ *     \endcode
+ *\~
+ *\return      \~english current document
+ *             \~russian текущий документ \~
+ */
+aDocument*
+aDocJournal::CurrentDocument()
+{
+       aCfgItem i = md->find( docType() );
+       if(!i.isNull())
+       {
+               aDocument *d = new aDocument( i, db );
+               if(!d->select( docId() ))
+               {
+                       return d;
+               }
+               else
+               {
+                       delete d;
+                       return 0;
+               }
+       }
+       else
+       {
+               return 0;
+       }
+}
+
+
+
+/*!
+ *\~english
+ *     Select documents at some period.
+ *\~russian
+ *     Выбирает документы определенного типа за некоторый период.
+ *\~
+ *\param from - \~english begin date \~russian дата начала периода \~
+ *\param to - \~english end date \~russian дата окончания периода \~
+ *\param nmName - \~english document type \~russian тип документа \~
+ *\return      \~english error code
+ *             \~russian код ошибки \~
+ */
+ERR_Code
+aDocJournal::Select( QDateTime from, QDateTime to, const QString & mdName )
+{
+       aSQLTable  * t = table();
+       if ( !t )
+               return err_notable;
+       QString fltr, docType = "";
+       if ( mdName != "" )
+       {
+               aCfgItem item = md->find( "Document." + mdName );
+               if ( item.isNull() )
+                       return err_objnotfound;
+               int type = md->id( item );
+               docType = QString(" AND typed=%1").arg(type);
+       }
+       if ( from.isNull() )
+               if ( !to.isNull() )
+                       fltr = "ddate<='" + to.toString("yyyy-MM-dd hh:mm:ss") + "'";
+               else
+                       return err_condition;
+       else
+               if ( !to.isNull() )
+                       fltr = "ddate>='" + from.toString("yyyy-MM-dd hh:mm:ss") + "' AND ddate<='" +\
+                                        to.toString("yyyy-MM-dd hh:mm:ss") + "'";
+               else
+                       fltr = "ddate>='" + from.toString("yyyy-MM-dd hh:mm:ss") + "'";
+       if ( t->select( fltr + docType ) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+                       return err_noerror;
+               }
+               else return err_notselected;
+       return err_selecterror;
+}
+
+
+
+/*!
+ *\~english
+ *     Select document by number and type.
+ *\~russian
+ *     Выбирает документ определенного типа и номера.
+ *\~
+ *\param number - \~english document number \~russian составной номер документа \~
+ *\param nmName - \~english document type \~russian тип документа \~
+ *\return      \~english error code
+ *             \~russian код ошибки \~
+ */
+ERR_Code
+aDocJournal::Select( const QString & number, const QString & mdName )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       QString dFilter = "", pref;
+       if ( mdName != "" )
+       {
+               aCfgItem tObj = md->find( "Document."+mdName );
+               if ( tObj.isNull() ) return err_objnotfound;
+               else dFilter = QString(" AND typed=%1").arg(md->attr(tObj,mda_id));;
+       }
+       int num;
+       //printf(">>>>>>>>>>>>decode doc num %s\n",number.ascii());
+       decodeDocNum( number, pref, num );
+       if ( t->select(QString("pnum='%1' AND num=%2").arg(pref).arg(num) + dFilter) )
+               if ( t->first() )
+               {
+//                     printf(">document selected!\n");
+
+                       aLog::print(aLog::Debug, tr("aDocJournal select document with number=%1 and md name=%2").arg(number).arg(mdName));
+                       setSelected(true);
+                       return err_noerror;
+               }
+               else return err_notselected;
+       return err_selecterror;
+
+}
+
+
+
+/*!
+ *\~english
+ *     Gets current document prefix
+ *\~russian
+ *     Выбирает префикс текущего документа.
+ *\~
+ *\return      \~english prexix
+ *             \~russian префикс \~
+ */
+QString
+aDocJournal::getPrefix()
+{
+       QString pref = "";
+       qulonglong dUid = docId();
+       if ( dUid )
+       {
+               QSqlQuery q = db->db()->exec(QString("SELECT pnum FROM a_journ WHERE idd=%1").arg(dUid));
+               if ( q.first() ) pref = q.value(0).toString();
+       }
+       return pref;
+}
+
+
+
+QString
+aDocJournal::selectionFilter( QDateTime from, QDateTime to, const QString & mdName, bool full )
+{
+       QString fltr="", docType = "", journ="";
+       if ( full ) journ="a_journ.";
+       if ( mdName != "" )
+       {
+               aCfgItem item = md->find( "Document." + mdName );
+               if ( item.isNull() )
+                       return "";
+               int type = md->id( item );
+               docType = " AND " + journ + QString("typed=%1").arg(type);
+       }
+       if ( from.isNull() )
+               if ( !to.isNull() )
+                       fltr = journ + "ddate<='" + to.toString("yyyy-MM-dd hh:mm:ss") + "'";
+               else
+                       return "";
+       else
+               if ( !to.isNull() )
+                       fltr = journ + "ddate>='" + from.toString("yyyy-MM-dd hh:mm:ss") + "' AND " + journ + "ddate<='" + to.toString("yyyy-MM-dd hh:mm:ss") + "'";
+               else
+                       fltr = journ + "ddate>='" + from.toString("yyyy-MM-dd hh:mm:ss") + "'";
+       return fltr + docType;
+}
+
+QString
+aDocJournal::selectionFilter( const QString & num, const QString & mdName, bool full )
+{
+       QString pref, fltr="", journ="";
+       int nm;
+       decodeDocNum( num, pref, nm );
+       if ( full )
+       {
+               fltr=QString("a_journ.num=%1 AND a_journ.pnum='%2'").arg(nm).arg(pref);
+               journ = "a_journ.";
+       }
+       else fltr=QString(" num=%1 AND pnum='%2'").arg(nm).arg(pref);
+       if ( mdName != "" )
+       {
+               aCfgItem tObj = md->find( "Document."+mdName );
+               if ( tObj.isNull() ) return "";
+               else fltr += QString(" AND %1typed=%2").arg(journ).arg(md->id(tObj));
+       }
+       return fltr;
+}
diff --git a/src/lib/objects/adocjournal.h b/src/lib/objects/adocjournal.h
new file mode 100644 (file)
index 0000000..8804c70
--- /dev/null
@@ -0,0 +1,110 @@
+/****************************************************************************
+** $Id: adocjournal.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Documents journal metadata object header file of
+** Ananas application library
+**
+** Created : 20040701
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) Andrey Paskal <app at lrn dot ru>, Yoshkar-Ola
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ADOCJOURNAL_H
+#define ADOCJOURNAL_H
+
+#include       <qdatetime.h>
+#include       "acfg.h"
+#include       "aobject.h"
+#include       "adocument.h"
+
+class aDatabase;
+
+
+
+/*!
+ *\~english
+ *     Not visual object used for working with system journal.
+ *     Used as interface between database and script or wObjects
+ *     Included in aDocument for linked document and system journal
+ *\~russian
+ *     \brief Определяет программный интерфейс управления общим (системным) журналом документов.
+ *     Наследует aObject.
+ *
+ *     Невизуальный объект для работы с системным журналом документов базы данных.
+ *     Все хранящиеся в базе данных Ананаса документы система регистрирует в журнале.
+ *     Используется для доступа к системному журналу  скриптами и визуальными объектами.
+ *     Включается в объект aDocument, для обеспечения работы документа с ситемным журналом.
+ *\~
+ */
+class  ANANAS_EXPORT aDocJournal :public aObject
+{
+       Q_OBJECT
+private:
+       /*!\ru  Тип журнала. \n
+        *      0 - общий, содержит список документов всех типовб. \n
+        *      1 - специализированный журнал, содрежит список документов одного типа,
+        *      например  "Расходные накладные".
+        * \_ru
+        */
+       int journalType;
+public:
+       aDocJournal(aCfgItem context, aDatabase * adb = 0);
+       aDocJournal( const QString & name, aDatabase * adb = 0);
+       aDocJournal( aDatabase * adb = 0);
+       virtual ERR_Code initObject();
+       ERR_Code selectDocument( qulonglong idd );
+       virtual qulonglong docId();
+       int docType();
+
+       /*!\ru  \return тип журнала. \n
+        *      0 - общий, содержит список документов всех типовб. \n
+        *      1 - специализированный журнал, содержит список документов одного типа,
+        *      например  "Расходные накладные". \n
+        * \_ru
+        */
+       int type() { return journalType; }
+       QString nextNumber( const QString &prefix, int mdId );
+       QVariant getDate();
+       QString getNumber();
+       // may be need return ULongLong ?
+       int getSerialNumber();
+       ERR_Code setDate( QVariant date );
+       ERR_Code setNumber( QVariant number );
+
+       virtual ERR_Code New ( qulonglong idd, const QString & docPrefix, int type );
+       virtual ERR_Code deleteDocument ( qulonglong idd );
+       qulonglong findDocument( qulonglong idd );
+//     Q_ULLONG docId( Q_ULLONG id );
+       qulonglong findDoc( const QString & num, int type );
+       QString getPrefix();
+       QString selectionFilter( QDateTime from, QDateTime to, const QString & mdName = "",
+                                                       bool full=false );
+       QString selectionFilter( const QString & num, const QString & mdName = "", bool full=false );
+
+public slots:
+       aDocument* CurrentDocument();
+       virtual ERR_Code Delete();
+       virtual ERR_Code Select( QDateTime from, QDateTime to, const QString & mdName = "" );
+       virtual ERR_Code Select( const QString & num, const QString & mdName = "" );
+};
+
+#endif// ADOCJOURNAL_H
diff --git a/src/lib/objects/adocument.cpp b/src/lib/objects/adocument.cpp
new file mode 100644 (file)
index 0000000..cca5253
--- /dev/null
@@ -0,0 +1,1522 @@
+/****************************************************************************
+** $Id: adocument.cpp,v 1.3 2008/11/09 21:09:11 leader Exp $
+**
+** Document metadata object implementation file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+
+#include       "acfg.h"
+#include       "alog.h"
+#include       "aobject.h"
+#include       "adatabase.h"
+#include       "adocument.h"
+#include       "adocjournal.h"
+#include       "airegister.h"
+#include       "aaregister.h"
+//Added by qt3to4:
+#include <QSqlQuery>
+
+
+
+/*!
+ *\en
+ *     Create object aDocument by ananas configuration object.
+ *     New object initing by md ojbect
+ *     Use for creating object if you have md object, for example in default document form
+ *\_en
+ *\ru
+ *     \brief Создает объект и инициализирует его по метаданным бизнес схемы.
+ *\_ru
+ *     \param context - \en md object used for initing aDocument. \_en \ru
+ *                                             элемент метаданных бизнес схемы, инициализирующий объект.\_ru
+ *     \param adb - \en ananas database for working. \_en \ru
+ *                                     ссылка на базу данных.\_ru
+*/
+aDocument::aDocument( aCfgItem context, aDatabase * adb )
+:aObject( context, adb, 0, "aDocument")
+{
+       if ( context.isNull() ) concrete = false;
+       else concrete = true;
+       initObject();
+       sysJournal = new aDocJournal(adb);
+}
+
+
+
+/*!
+ *\en
+ *     Create object aDocument by document metadata name.
+ *     new object initing by md ojbect with some name
+ *     Use for creating object if you know it's name
+ *\_en
+ *\ru
+ *     Создает объект и инициализирует его по метаданным бизнес схемы.
+ *     Документ инициализируется элементом метаданных, найденым по его имени,
+ *     причем поиск осуществляется только среди документов.
+ *\_ru
+ *     \param name - \en md name of document.\_en \ru
+                                       имя документа в метаданных бизнес схемы.\_ru
+ *     \param adb - \en ananas database for working. \_en \ru
+ *                                     ссылка на базу данных\_ru
+ */
+aDocument::aDocument(const QString & name, aDatabase * adb)
+:aObject( "Document."+name, adb, 0, "aDocument")
+{
+       if ( name.isEmpty() ) concrete = false;
+       else concrete = true;
+       initObject();
+       sysJournal = new aDocJournal(adb);
+}
+
+
+
+/*!
+ *\en
+ *     Destroy object aDocument.
+ *     Use for delete system journal and free memory.
+ *\_en
+ *\ru
+ *     Уничтожает объект.
+ *     Используется для удаления системного журнала и освобождения занятой под него памяти.
+ *\_ru
+ */
+aDocument::~aDocument()
+{
+       delete sysJournal;
+       sysJournal=0;
+}
+
+
+
+/*!
+ *     \en
+ *     Translate name of system field.
+ *     Used for translate same system names from different languages ot english,
+ *     result used from working with system fields
+ *     \_en
+ *     \ru
+ *     Используется для перевода предопределенных имен для системных полей.
+ *     Позволяет использовать для обращения к системным полям из скриптов назавания,
+ *     близкие по смыслу к их назначению с учетом языка пользователя.
+ *     Например к полю номер документа можно обратиться используя имя "НомерДок" или "DocNumber".
+ *     \_ru
+ *     \param sname - \en field name on same language. \_en \ru
+ *                                     одно из предопределенных имен поля.\_ru
+ *     \return \en field name on english \_en \ru имя поля\_ru
+ */
+QString
+aDocument::trSysName( const QString & sname )
+{
+       if (( sname == "DocDate" )||( sname == QString::fromUtf8("ДатаДок") )) return "DocDate";
+       if (( sname == "DocNumber" )||( sname == QString::fromUtf8("НомерДок") )) return "DocNumber";
+       if (( sname == "SerialNumber" )||( sname == "ПНомДок" )) return "SerialNumber";
+       if (( sname == "TableLine" )||( sname == QString::fromUtf8("ЛинияТабл") )) return "TableLine";
+       return "";
+}
+
+
+
+/*!
+ *     \en
+ *     Init object aDocument.
+ *     Used for insert table for document header and tables for all table part of document.
+ *     After that we can work wthith document' tables by it name, name of heared table = ""
+ *     \_en
+ *     \ru
+ *     Инициализирует объект элементом метаданных бизнес схемы.
+ *     В процесе инициализации выполняется настройка на шапку документа
+ *     и все его табличные части. После инициализации появляется возможность
+ *     работать с полями и таблицами, используя их имена, определенные в бизнес схеме.
+ *     \_ru
+ *     \return \en error code. \_en \ru код ошибки.\_ru
+ */
+ERR_Code
+aDocument::initObject()
+{
+       aCfgItem o, og;
+       int i, nt;
+       QString tdbname, tname;
+
+       pref="";
+       ERR_Code error = aObject::initObject();
+       if ( error )
+               return error;
+       og = md->find( obj, md_header );
+       error =  tableInsert( aDatabase::tableDbName( *md, og ), og );
+       if ( error )
+               return error;
+        og = md->find( obj, md_tables );
+        nt = md->count( og, md_table );
+        for ( i=0; i< nt; i++ ) {
+                o = md->find( og, md_table, i );
+                tdbname = aDatabase::tableDbName( *md, o );
+                tname = md->attr( o, mda_name );
+                error = tableInsert( tdbname, o, tname );
+                               if ( error )
+                                       return error;
+        }
+       return err_noerror;
+}
+
+
+
+/*!
+ *\en
+ *     Get value for some system field of document.
+ *     Used for read some system field of document: DocDate - Date and time of document,
+ *     DocNumber - Number of document.
+ *\_en
+ *\ru
+ *     Читает значение системного поля.
+ *     Используется для получения значения системного поля по его имени
+ *\_ru
+ *     \param sname - \en name of system field. \_en \ru
+ *                                     имя ситемного поля. \_ru
+ *     \return \en field value or QVariant::Invalid if used unknown field name.\_en \ru
+ *                             значение поля или ошибочное значение, если имя поля неизвестно.\_ru
+ */
+QVariant
+aDocument::sysValue( const QString & sname, const QString & )
+{
+       if ( sname == "DocDate" )
+               return sysJournal->getDate();
+       if ( sname == "DocNumber" )
+               return sysJournal->getNumber();
+       if ( sname == "SerialNumber" )
+               return sysJournal->getSerialNumber();
+       return QVariant::Invalid;
+}
+
+
+
+/*!
+ *     \en
+ *     Set value for some system field of document.
+ *     Used for write some system field of document: DocDate - Date and time of document,
+ *     DocNumber - Number of document.
+ *     \_en
+ *     \ru
+ *     Устанавливает значение системного поля.
+ *     Используется для установки значения системного поля по его имени
+ *     \_ru
+ *     \param sname - \en name of system field\_en \ru
+                                       имя ситемного поля.\_ru
+ *     \param value - \en new value of field\_en \ru
+                                       устанавливаемое значение\_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::setSysValue( const QString & sname, QVariant value, const QString &)
+{
+       if ( sname == "DocDate" )
+               return sysJournal->setDate( value );
+       if ( sname == "DocNumber" )
+               return sysJournal->setNumber( value );
+       return err_fieldnotfound;
+}
+
+
+
+/*!
+ *     \en
+ *     Get some field value of current table line.
+ *     Get value for field by metadata name or sustem value ln if use name "TableLine".
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Читает значение поля табличной части документа.
+ *
+ *     Используется для получения значения поля таблицы по именам таблицы и поля.
+ *     При вызове функции используются имена, указанные в бизнес схеме.
+ *     Кроме этого может использоваться продопределенное имя "TableLine" для
+ *     получения номера текущей записи
+ *     \_ru
+ *     \param tablename - \en metadata name of table\_en \ru
+                                               имя таблицы в бизнес схеме\_ru
+ *     \param name - \en name of field\_en \ru
+                                       имя поля в бизнес схеме\_ru
+ *     \return \en field value\_en \ru
+                               значение поля\_ru
+ */
+QVariant
+aDocument::TableValue( const QString & tablename, const QString & name )
+{
+       if ( trSysName(name) == "TableLine" ) return table(tablename)->sysValue("ln");
+       else return tValue( tablename, name );
+}
+
+
+
+/*!
+ *     \en
+ *     Set some field value of current table line.
+ *     Set value for field by metadata name
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Записывает значение в поле текущей строки табличной части документа.
+ *     \_ru
+ *     \param tablename - \en metadata name of table,\_en \ru
+                               имя таблицы в бизнес схеме,\_ru
+ *     \param name - \en metadata name of field,\_en \ru
+                               имя поля в бизнес схеме,\_ru
+ *     \param value - \en new field value.\_en \ru
+                               новое значение поля.\_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::TableSetValue( const QString & tablename, const QString & name, const QVariant &value )
+{
+        return setTValue( tablename, name, value );
+}
+
+
+
+/*!
+ * \en
+ *     Create new document.
+ *     Create new document header record by selected type in database,
+ *     if object not seted, return error.
+ *     New document also registred in system journal and make current
+ * \_en
+ * \ru
+ *     \brief ScriptAPI. Создает и регистрирует в системном журнале объект aDocument.
+ *
+ *     Создает новую запись в  БД с данными из шапки документа. При этом резервируется уникальный Id записи таблицы.
+ *     При этом документ регистрируется в системном журнале и получает следующий по порядку номер.
+ * \_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::New()
+{
+       if ( !sysJournal )
+       {
+               aLog::print(aLog::Error, tr("aDocument have no sysjournal"));
+               return err_nosysjournal;
+       }
+       ERR_Code err = aObject::New();
+       if ( err )
+       {
+               aLog::print(aLog::Error, tr("aDocument aObject::New() ended with error code = %1").arg(err));
+               return err;
+       }
+       if ( obj.isNull() )
+       {
+               aLog::print(aLog::Error, tr("aDocument metaobject is null=%1"));
+               return err_noobject;
+       }
+       qulonglong Uid = getUid();
+       SetPrefix(md->attr(obj,mda_name));
+       aLog::print(aLog::Debug, tr("aDocument new type = %1").arg(md->id(obj)));
+       err = sysJournal->New( Uid, Prefix(), md->id(obj) );
+       if ( err )
+       {
+               aLog::print(aLog::Error, tr("aDocument New() error while added record in sysJournal =%1").arg(err));
+               table()->exec(QString("DELETE FROM %1 WHERE id=%2").arg(table()->tableName).arg(Uid));
+               db->markDeleted( Uid );
+               return err;
+       }
+
+       aLog::print(aLog::Debug, tr("aDocument new document"));
+       return err_noerror;
+}
+
+
+
+/*!
+ *     \en
+ *     Create new table line.
+ *     Create new table line for table of now document
+ *     if document not selected, or no table with some name return error.
+ *     New line begin current in table
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Добавляет новую строку табличной части документа.
+ *
+ *     Строка добавляется в таблицу текущего документа, если документ не выбран
+ *     или не имеет таблицы с таким именем - возникает ошибка.
+ *     При создании строки ей автоматически присваивается очередной номер.
+ *     \_ru
+ *     \param tablename - \en metadata name of table.\_en \ru
+                               имя таблицы в бизнес схеме.\_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::TableNewLine( const QString & tablename )
+{
+       if ( IsConducted() ) return err_docconducted;
+       aSQLTable *t = table( tablename );
+       if ( !t ) return err_notable;
+       qulonglong tUid = t->primeInsert()->value("id").toULongLong(), dUid = getUid();
+       if ( !dUid ) return err_abstractobj;
+       if ( t->insert() )
+       {
+               t->select( QString("id=%1").arg(tUid), false );
+               if (!t->first())
+                       return err_selecterror;
+               t->setSysValue("idd",dUid);
+               QString  query;
+               QVariant ln;
+               query = QString("SELECT MAX(ln)+1 FROM %1 WHERE idd=%2").arg( t->tableName ).arg(dUid);
+               QSqlQuery q = db->db()->exec( query );
+               if ( q.first() )
+               {
+                       ln = q.value( 0 );
+                       if ( !ln.toInt() ) ln = 1;
+               }
+               else
+               {
+                       aLog::print(aLog::Error, tr("aDocument select new table line number"));
+                       return err_execerror;
+               }
+               t->setSysValue("ln",ln);
+               t->selected = true;
+               aLog::print(aLog::Info, tr("aDocument new table line number=%1").arg(ln.toString()));
+               return TableUpdate( tablename );
+       }
+       aLog::print(aLog::Error, tr("aDocument insert new table line"));
+       return err_inserterror;
+}
+
+
+
+/*!
+ *     \en
+ *     Delete current document.
+ *     Delete document header, all tables and system journal record,
+ *     If document conducted (turn on) it unconduct (make turn off).
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Удаляет текущий документ.
+ *
+ *     Документ удаляется полностью вместе с табличными частями, также документ удаляется из системного журнала.
+ *     Идентификатор документа не освободжается и повторно не используется.
+ *     \_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::Delete()
+{
+       if ( !selected() ) return err_notselected;
+       if(IsConducted()) UnConduct();
+       qulonglong uid = getUid();
+       sysJournal->deleteDocument(uid);
+
+       aLog::print(aLog::Debug, tr("aDocument delete from sysjournal"));
+       db->markDeleted( uid );
+       aLog::print(aLog::Debug, tr("aDocument delete from unicues"));
+       aCfgItem tobj;
+       uint n = md->count( obj, md_table );
+       for ( uint i = 0; i < n; i++ )
+       {
+               tobj = md->find(obj,md_table,i);
+               if ( tobj.isNull() ) continue;
+               tableDeleteLines( md->attr(tobj,mda_name) );
+               aLog::print(aLog::Debug, tr("aDocument delete table %1").arg(md->attr(tobj,mda_name)));
+       }
+       return aObject::Delete();
+}
+
+
+
+/*!
+ *     \en
+ *     Delete current table line.
+ *     When deleted table line also deleted all records in all reegisters which contain link on this line
+ *     Don't work if document conducted.
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Удаляет текущую строку табличной части документа.
+ *
+ *     Также удаляются все записи, связанные с этой строкой во всех регистрах.
+ *     Не работает для проведенных документов.
+ *     \_ru
+ *     \param tablename - \en metadata name of table\_en \ru
+                               имя таблицы в бизнес схеме\_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::TableDelete( const QString & tablename )
+{
+       if ( IsConducted() )
+       {
+               aLog::print(aLog::Error, tr("aDocument delete table of conducted document"));
+               return err_docconducted;
+       }
+       aSQLTable * t = table(tablename);
+       if ( !t )
+       {
+               aLog::print(aLog::Error, tr("aDocument deleted table not exist"));
+               return err_notable;
+       }
+       if ( !t->selected )
+       {
+               //а эта проверка нужна???
+               aLog::print(aLog::Error, tr("aDocument deleted table not selected"));
+               return err_notselected;
+       }
+       qulonglong tUid = t->sysValue("id").toULongLong();
+       aIRegister * reg = new aIRegister("",db);
+       reg->deleteTable(tUid);
+       delete reg;
+       aLog::print(aLog::Debug, tr("aDocument delete table from info register"));
+       //reg = new aARegister("",db);
+       //reg->deleteTable(tUid);
+       //delete reg;
+       db->markDeleted( tUid );
+       t->primeDelete();
+       t->del();
+       t->selected = false;
+       aLog::print(aLog::Info, tr("aDocument delete table"));
+       return err_noerror;
+}
+
+
+
+
+/*!
+ *     \en
+ *     Delete all table lines.
+ *     Delete all table lines for current document.
+ *     Delete all table lines, don't take document conductions and make any chanded in registers.
+ *     \_en
+ *     \ru
+ *     Удаляет все строки таблицы.
+ *     Удаляет все строки таблицы для текущего документа.
+ *     Функция является внутренней для документа, не проверяет проведен ли документ
+ *     и не вызывает никах изменения в регистрах.
+ *     \_ru
+ *     \param tablename - \en metadata name of table\_en \ru
+                               имя таблицы в бизнес схеме\_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::tableDeleteLines( const QString & tablename )
+{
+       qulonglong dUid = getUid();
+       if ( !dUid )
+       {
+               aLog::print(aLog::Error, tr("aDocument not selected"));
+               return err_notselected;
+       }
+       QString tdbname = table( tablename )->tableName;
+       if ( tdbname == "" )
+       {
+               aLog::print(aLog::Error, tr("aDocument table name is empty"));
+               return err_notable;
+       }
+       db->db()->exec(QString("DELETE FROM %1 WHERE idd=%2").arg(tdbname).arg(dUid));
+       return err_noerror;
+}
+
+
+
+/*!
+ *     \en
+ *     Updete current record in database.
+ *     Also update record for document system journal and all table parts.
+ *     Don't work for conducted (Turn on) documents
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Обновляет информацию в базе данных.
+ *
+ *     Заносит запись из буфера ОЗУ в базу данных. Обновляется информация в шапке документа,
+ *     табличных частях, журнале документов.
+ *     Не работает для проведенных документов.
+ *     \_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::Update()
+{
+       if ( IsConducted() ) return err_docconducted;
+       ERR_Code e = aObject::Update();
+       if ( e )
+       {
+               aLog::print(aLog::Error, tr("aDocument update error=%1").arg(e));
+               return e;
+       }
+       e = sysJournal->Update();
+       //TODO: may be it fix bug with saving values in first line;
+       //e += TableUpdate();
+       return e;
+}
+
+
+
+/*!
+ *\en
+ *     Update table.
+ *     Use for insert information from bufer into database.
+ *     Information is inserting in table with md name=teblename,
+ *     if used TableUpdate() - updating all tables of document.
+ *     If document already conducted return error.
+ *\_en
+ *\ru
+ *     \brief SrciptAPI. Обновляет текущую запись табличной части документа.
+ *
+ *     Копирует информацию из буфера в текущую строку таблицы.
+ *     Если имя не указано или задана пустая строка, обновляются все таблицы документа.
+ *     Не работает для проведенного досумента.
+ *\_ru
+ *     \param tablename - \en metadata name of table\_en \ru
+                               имя таблицы в бизнес схеме\_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::TableUpdate( const QString & tablename )
+{
+       if ( IsConducted() )
+       {
+               aLog::print(aLog::Debug, tr("aDocument conducted table update"));
+               return err_docconducted;
+       }
+       if ( tablename != "" ) return aObject::TableUpdate(tablename);
+       aCfgItem tobj;
+       uint n = md->count( obj, md_table );
+       ERR_Code err = 0;
+       for ( uint i = 0; i < n; i++ )
+       {
+               tobj = md->find(obj,md_table,i);
+               if ( tobj.isNull() ) continue;
+               err += aObject::TableUpdate( md->attr(tobj,mda_name) );
+       }
+       return err;
+}
+
+
+
+/*!
+ *     \en
+ *     Check document on mark deleted
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Проверяет помечен ли документ как удаленный.
+ *     \_ru
+ *     \return \en true if document is mark deleted and fasle in othe event\_en \ru
+                               значение флага удаления.\_ru
+ */
+bool
+aDocument::IsMarkDeleted()
+{
+       return sysJournal->IsMarkDeleted();
+}
+
+
+
+/*!
+ *     \en
+ *     Check document on marked
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Проверяет помечен ли документ.
+ *     \_ru
+ *     \return \en true if document is marked and fasle in othe event\_en \ru
+                               значение флага.\_ru
+ */
+bool
+aDocument::IsMarked()
+{
+        return sysJournal->IsMarked();
+}
+
+
+
+/*!
+ *     \en
+ *     Set document deleted flag
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Устанавливает флаг удаления.
+ *     \_ru
+ *     \param Deleted - \en deleted flag\_en \ru
+                               флаг удаления\_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::SetMarkDeleted( bool Deleted )
+{
+       return sysJournal->SetMarkDeleted( Deleted );
+}
+
+
+
+/*!
+ *     \en
+ *     Set document marked flag
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI Помечает документ.
+ *
+ *     В последствии помеченные документы можно рассматривать как группу документов,
+ *     подобранных для обработки.
+ *     \_ru
+ *     \param Marked - \en marked flag\_en \ru
+                               флаг отметки\_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::SetMarked( bool Marked )
+{
+       return sysJournal->SetMarked( Marked );
+}
+
+
+
+/*!
+ *     \en
+ *     Set document prefix.
+ *     Document prefix used for generate document number.
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Задает префикс документа.
+ *
+ *     Префикс документа используется для генерации номера документа.
+ *     \_ru
+ *     \see Prefix() Select( const QString & num )
+ *     \param pr - \en new document prefix.\_en \ru
+                               Новый префикс документа.\_ru
+ */
+void
+aDocument::SetPrefix( const QString & pr )
+{
+       pref = pr;
+}
+
+
+
+/*!
+ *     \en
+ *     Get document prefix.
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Возвращает префикс документа.
+ *     \_ru
+ *     \see SetPrefix( const QString & pr ) Select( const QString & num )
+ *     \return \en document prefix.\_en \ru
+                                текущий префикс документа.\_ru
+ */
+QString
+aDocument::Prefix()
+{
+       return pref;
+}
+
+
+
+/*!
+ *     \en
+ *     Select document by dates.
+ *     If set only one date (othe isNull) select records before or after date.
+ *     If adocument inited by some document type from metadata selected only this documents from jpurnal,
+ *     otherwise - select all documents from system journal with such date
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Выбирает документы по интервалу времени.
+ *
+ *     Выбирает из системного журнала документы, значение поля "дата" которых
+ *     лежит в указанном диапазоне. Если объект настроен на конкретный тип документа из бизнес схемы,
+ *     выбираются только документы этого типа, в противном случае - все документы журнала,
+ *     соответствующие условию.
+ *     \_ru
+ *     \param from - \en begin date of selection if isNull - selected from first date of system journal,\_en \ru
+                               начальная дата диапазона, если дата isNull, первая дата журнала,\_ru
+ *     \param to - \en end date of selection if isNull - selected to last date of system journal.\_en \ru
+                               конечная дата диапазона, если isNull - до наиболее позднего документа.\_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::Select( QDateTime from, QDateTime to )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       QString query, dname = "", jFltr;
+       if ( concrete ) dname = md->attr(obj, mda_name);
+       jFltr = sysJournal->selectionFilter( from, to, dname, true );
+       if ( jFltr == "" ) return err_selecterror;
+       query = QString("SELECT %1.* FROM %2, a_journ WHERE a_journ.idd=%3.id AND %4").arg(t->tableName).arg(t->tableName).arg(t->tableName).arg( jFltr );
+       if ( IsFiltred() ) query = query + QString(" AND %1").arg(t->getNFilter());
+       if ( t->exec(query) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+                       sysJournal->findDocument(getUid());
+                       return err_noerror;
+               }
+               else return err_notselected;
+       else
+               return err_selecterror;
+}
+
+
+
+/*!
+ *     \en
+ *     Select document by number.
+ *     Document number string which conteyn document prefix and some number
+ *     If adocument inited by some document type from metadata selected only this documents from jpurnal,
+ *     otherwise - select all documents from system journal with such date
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Выбирает документы по номеру.
+ *
+ *     Номер задается как строка, которая содержит префикс и число.
+ *     Если объект настроен на конкретный тип документа из бизнес схемы,
+ *     выбираются только документы этого типа, в противном случае - все документы
+ *     с таким номером.
+ *     \_ru
+ *     \see Prefix() SetPrefix()
+ *     \param num - \en document number\_en \ru
+                               \_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::Select( const QString & num )
+{
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       QString query, dname = "", jFltr;
+       if ( concrete ) dname = md->attr(obj, mda_name);
+       jFltr = sysJournal->selectionFilter( num, dname, true );
+       if ( jFltr == "" ) return err_selecterror;
+       query = QString("SELECT %1.* FROM %2, a_journ WHERE a_journ.idd=%3.id AND %4").arg(t->tableName).arg(t->tableName).arg(t->tableName).arg( jFltr );
+       if ( IsFiltred() ) query = query + QString(" AND %1").arg(t->getNFilter());
+       if ( t->exec(query) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+                       sysJournal->findDocument(getUid());
+                       return err_noerror;
+               }
+               else return err_notselected;
+       else
+               return err_selecterror;
+}
+
+bool
+aDocument::Select()
+{
+       aSQLTable *t = table();
+       if(!t) return false;
+       t->select();
+       if(t->first())
+       {
+               setSelected(true);
+               return true;
+       }
+       else
+       {
+               return false;
+       }
+}
+
+
+/*!
+ *     \en
+ *     Select table lines by name and document uid.
+ *     If document uid = 0 selected table in current document.
+ *     \_en
+ *     \ru
+ *     Выбирает строку таблицы по имени и uid документа.
+ *     Если uid документа не указан или равен 0, выбирается строка текущего.
+ *     \_ru
+ *     \param name - \en table metadata name\_en \ru имя таблицы в бизнес схеме\_ru
+ *     \param idd - \en document database id (uid)\_en \ru идентификатор экземпляра документа в базе\_ru
+ *     \return \en error code. \_en \ru код ошибки.\_ru
+ */
+ERR_Code
+aDocument::tableSelect( const QString & name, qulonglong idd )
+{
+       qulonglong dUid = idd;
+       if ( !dUid ) dUid = getUid();
+       if ( !dUid ) return err_abstractobj;
+       aSQLTable * t = table( name );
+       if ( !t ) return err_notable;
+       if ( t->select(QString("idd=%1").arg(dUid)))
+               if ( t->first() )
+               {
+                       setSelected( true, name );
+                       return err_noerror;
+               }
+               else return err_notselected;
+       else return err_selecterror;
+}
+
+
+
+/*!
+ *     \en
+ *     Get table by it's metadataname name.
+ *     This function added for get access to document table by it name for othe objects.
+ *     \_en
+ *     \ru
+ *     Возвращает таблицу дакумента по имени.
+ *     Функция позволяет получить ссылку на таблизу документа по ее имени.
+ *     \_ru
+ *     \see aObject::table()
+ *     \param tname - \en metadata table name.\_en \ru
+                               имя таблицы в бизнес схеме.\_ru
+ *     \return \en link on aSQLTable or 0 if table not found.\_en \ru
+                               ссылка на таблицу.\_ru
+ */
+aSQLTable *
+aDocument::getTable( const QString & tname )
+{
+       return table(tname);
+}
+
+
+
+/*!
+ *     \en
+ *     Select table by name.
+ *     Make table with such name current
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Выбирает табличную часть документа по ее имени.
+ *
+ *     Используется, если документ имеет более одной табличной части.
+ *     \_ru
+ *     \param name - \en table metadata name\_en \ru имя таблицы \_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::TableSelect( const QString & name )
+{
+       return tableSelect( name );
+}
+
+
+
+/*!
+ *     \en
+ *     Copy current document.
+ *     Create document with header and table pats like current document.
+ *     New document have current date and next unical number.
+ *     \_en
+ * \ru
+ *     \brief ScriptAPI. Копирует текущий документ
+ * \_ru
+ *     \return \en error code. \_en \ru
+                               код ошибки.\_ru
+ */
+ERR_Code
+aDocument::Copy()
+{
+       if ( !sysJournal ) return err_nosysjournal;
+       QString nowPrefix = sysJournal->getPrefix();
+       qulonglong oldUid = getUid();
+       ERR_Code err = aObject::Copy();
+       if ( err ) return err;
+       qulonglong Uid = getUid();
+       err = sysJournal->New( Uid, nowPrefix, md->id(obj) );
+       if ( err )
+       {
+               table()->exec(QString("DELETE FROM %1 WHERE id=%2").arg(table()->tableName).arg(Uid));
+               db->markDeleted( Uid );
+               return err;
+       }
+       aDocument doc( obj, db );
+       err = doc.select(oldUid);
+       if ( err ) return err;
+       aCfgItem tObj, fObj;
+       QString tname, query, tdbname, fname ;
+       uint n = md->count(obj,md_table), m;
+       for ( uint i = 0; i < n; i++ )
+       {
+               tObj = md->find( doc.obj, md_table, i );
+               if ( tObj.isNull() ) continue;
+               tname = md->attr( tObj, mda_name );
+               if ( !doc.TableSelect(tname) )
+               {
+                       TableNewLine(tname);
+                       m = md->count( tObj, md_field );
+                       for ( uint j = 0; j < m; j++ )
+                       {
+                               fObj = md->find( tObj, md_field, j );
+                               if ( fObj.isNull() ) continue;
+                               fname = md->attr( fObj, mda_name );
+                               TableSetValue( tname, fname, doc.TableValue( tname, fname ) );
+                       }
+                       TableUpdate( tname );
+                       while ( doc.TableNext( tname ) )
+                       {
+                               TableNewLine(tname);
+                               m = md->count( tObj, md_field );
+                               for ( uint j = 0; j < m; j++ )
+                               {
+                                       fObj = md->find( tObj, md_field, j );
+                                       if ( fObj.isNull() ) continue;
+                                       fname = md->attr( fObj, mda_name );
+                                       TableSetValue( tname, fname, doc.TableValue( tname, fname ) );
+                               }
+                               TableUpdate( tname );
+                       }
+               }
+       }
+       return err_noerror;
+}
+
+
+
+/*!
+ *     \en
+ *     Make current next selected header.
+ *     Use for navigation by selected documents.
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Переход к следующему документу.
+ *     \_ru
+ *     \return \en operation result.\_en \ru
+                       результат операции (успешно или нет)\_ru
+ */
+bool
+aDocument::Next()
+{
+       if ( aObject::Next() ) if ( sysJournal->findDocument( getUid() ) ) return true;
+       return false;
+}
+
+
+
+/*!
+ *     \en
+ *     Make current prev selected header.
+ *     Use for navigation by selected documents.
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Переход к предыдущему документу
+ *     \_ru
+ *     \return \en operation result.\_en \ru
+                       результат операции (успешно или нет)\_ru
+ */
+bool
+aDocument::Prev()
+{
+       if ( aObject::Prev() ) if ( sysJournal->findDocument( getUid() ) ) return true;
+       return false;
+}
+
+
+
+/*!
+ *     \en
+ *     Make current first selected header.
+ *     Use for navigation by selected documents.
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Переходит к первому документу
+ *     \_ru
+ *     \return \en operation result.\_en \ru
+                       результат операции (успешно или нет)\_ru
+ */
+bool
+aDocument::First()
+{
+
+       printf("aDoc::first uid = %llu\n", getUid());
+       if ( aObject::First() ) if ( sysJournal->findDocument( getUid() ) ) return true;
+       return false;
+}
+
+
+
+/*!
+ *     \en
+ *     Make current last selected header.
+ *     Use for navigation by selected documents.
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Переходит к последнему документу
+ *     \_ru
+ *     \return \en operation result.\_en \ru
+                       результат операции (успешно или нет)\_ru
+ */
+bool
+aDocument::Last()
+{
+       if ( aObject::Last() ) if ( sysJournal->findDocument( getUid() ) ) return true;
+       return false;
+}
+
+
+
+/*!
+ *     \en
+ *     Make current next selected line in table.
+ *     Use for navigation in table.
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Переход к следуещей записи в табличной части документа
+ *     \_ru
+ *     \param name - \en metadata table name.\_en \ru
+                                       имя таблицы из бизнес схемы.\_ru
+ *     \return \en operation result.\_en \ru
+                       результат операции (успешно или нет)\_ru
+ */
+bool
+aDocument::TableNext( const QString & name )
+{
+       aSQLTable * t = table(name);
+       if ( !t ) return false;
+       if ( t->next() ) return true;
+       else return false;
+}
+
+
+
+/*!
+ *     \en
+ *     Make current prev selected line in table.
+ *     Use for navigation in table
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Переход к предыдущей записи в табличной части документа
+ *     \_ru
+ *     \param name - \en metadata table name.\_en \ru
+                                       имя таблицы из бизнес схемы.\_ru
+ *     \return \en operation result.\_en \ru
+                       результат операции (успешно или нет)\_ru
+ */
+bool
+aDocument::TablePrev( const QString & name)
+{
+       aSQLTable * t = table(name);
+       if ( !t ) return false;
+       if ( t->prev() ) return true;
+       else return false;
+}
+
+
+
+/*!
+ *     \en
+ *     Make current first selected line in table.
+ *     Use for navigation in table
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Переход к первой записи в табличной части документа
+ *     \_ru
+ *     \param name - \en metadata table name.\_en \ru
+                                       имя таблицы из бизнес схемы.\_ru
+ *     \return \en operation result.\_en \ru
+                       результат операции (успешно или нет)\_ru
+ */
+bool
+aDocument::TableFirst( const QString & name)
+{
+       aSQLTable * t = table(name);
+       if ( !t ) return false;
+       if ( t->first() ) return true;
+       else return false;
+}
+
+
+
+/*!
+ *     \en
+ *     Make current last selected line in table.
+ *     Use for navigation in table
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Переход к последней записи в табличной части документа
+ *     \_ru
+ *     \param name - \en metadata table name.\_en \ru
+                                       имя таблицы из бизнес схемы.\_ru
+ *     \return \en operation result.\_en \ru
+                       результат операции (успешно или нет)\_ru
+ */
+bool
+aDocument::TableLast( const QString & name )
+{
+       aSQLTable * t = table(name);
+       if ( !t ) return false;
+       if ( t->last() ) return true;
+       else return false;
+}
+
+
+
+
+/*!
+ *     \en
+ *     Set filter for some field.
+ *     If filter seted, on select selected only records where that field equal value.
+ *     If seted filters for diferent fields it's group by and.
+ *     If filter reseted it override previous value
+ *     \_en
+ *     \ru
+ *     \brief ScripAPI. Устанавливает фильтр на доступные документы.
+ *
+ *     Доступными становяться только документы, удовлетворяющие условию.
+ *     Например, для получения всех накладных с номером 0003 нужно сделать примерно следующее:
+ *     \code
+ *     aDocument * doc = new aDocument("Накладная", db);
+ *     doc->SetFilter("Номер","0003");
+ *     doc->First();
+ *     do{
+ *             //какие-то действия
+ *        }while(doc->Next());
+ *     delete doc;
+ *     \endcode
+ *     \_ru
+ *     \see ClearFilter()
+ *     \param valname - \en metadata name of field.\_en \ru имя поля в метаданных \_ru
+ *     \param value - \en filter value.\_en \ru Значение фильтра \_ru
+ *     \return \en error code. \_en \ru код ошибки.\_ru
+ */
+ERR_Code
+aDocument::SetFilter( const QString & valname, const QVariant & value )
+{
+       return aObject::SetFilter( valname, value );
+}
+
+
+
+/*!
+ *     \en
+ *     Clear all filters values.
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Сбрасывает фильтр.
+ *     \_ru
+ *     \see SetFilter( const QString & valname, const QVariant & value )
+ *     \return \en error code. \_en \ru код ошибки.\_ru
+ */
+ERR_Code
+aDocument::ClearFilter()
+{
+       return aObject::ClearFilter();
+}
+
+/*
+ERR_Code
+aDicument::TableSetFilter( const QString & tname, const QString & valname, const QVariant & value )
+{
+}
+
+ERR_Code
+aDicument::TableClearFilter( const QString & tname )
+{
+}
+*/
+
+
+
+/*!
+ *     \en
+ *     Set conduct flag for current document.
+ *     \_en
+ *     \ru
+ *     Устанавливает флаг проведения для текущего документа. Не используйте эту функцию напрямую. Используйте Conduct() и UnConduct()
+ *     \_ru
+ *     \param cond - \en conducted flag, flag set on 1 if cond true adn 0 if cond false\_en \ru значение флага \_ru
+ *     \see Conduct() Unconduct() IsConducted()
+ *     \return \en error code. \_en \ru код ошибки.\_ru
+ */
+ERR_Code
+aDocument::setConduct( bool cond )
+{
+       qulonglong idd = getUid();
+
+       if (!idd) return err_nodocument;
+       QSqlDatabase *tdb = db->db();
+       QString query;
+       query = QString("UPDATE a_journ SET cf='%1' WHERE idd=%2").arg( ( int ) cond).arg( idd );
+       tdb->exec(query);
+       if ( !tdb->lastError().type() )
+       {
+               aLog::print(aLog::Debug, tr("aDocument conduct"));
+               return err_noerror;
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aDocument conduct"));
+               return err_conducterror;
+       }
+}
+
+/**
+ * \brief Deprecated
+ */
+ERR_Code
+aDocument::Conduct(){
+       aLog::print(aLog::Debug, tr("Deprecated method call. aDocument::Conduct(...)"));
+       return this->SignIn();
+}
+
+/*!
+ *     \en
+ *     Make document conducted.
+ *     Work only for unconducted documents otherwise return error err_docconducted
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Вызывает проведение документа.
+ *     \_ru
+ *     \see SignOut() IsSignedIn()
+ *     \return \en error code. \_en \ru код ошибки.\_ru
+ */
+ERR_Code
+aDocument::SignIn()
+{
+       if ( IsConducted() ) return err_docconducted;
+       else return setConduct(true);
+
+}
+
+
+/**
+ * \brief Deprecated
+ */
+ERR_Code
+aDocument::UnConduct(){
+       aLog::print(aLog::Debug, tr("Deprecated method call. aDocument::UnConduct()"));
+       return this->SignOut();
+}
+
+/*!
+ *     \en
+ *     Make document unconducted.
+ *     Work only for conducted documents otherwise return error err_docunconducted
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Отменяет проведение документа.
+ *     \_ru
+ *     \see SignIn() IsSignedIn()
+ *     \return \en error code. \_en \ru код ошибки.\_ru
+ */
+ERR_Code
+aDocument::SignOut()
+{
+       if ( !IsConducted() ) return err_docunconducted;
+       ERR_Code err = setConduct(false);
+       if ( err ) return err;
+       //Q_ULLONG uid = getUid();
+       aIRegister * reg = new aIRegister("",db);
+       reg->deleteDocument(this);
+       delete reg;
+       aCfgItem aReg, aRegs;
+       aRegs= md->find(md->find(md->find(mdc_metadata),md_registers,0),md_aregisters,0);
+       if ( aRegs.isNull() ) return 1; //TODO: set error code
+       uint n = md->count( aRegs, md_aregister );
+       aARegister *areg;
+       for ( uint i = 0; i < n; i++  )
+       {
+               aReg = md->find( aRegs, md_aregister, i );
+               if ( aReg.isNull() ) continue;
+               areg = new aARegister(aReg,db);
+               areg->deleteDocument(this);
+               aLog::print(aLog::Debug, tr("aDocument delete from accumulation register"));
+               delete areg;
+               areg = 0;
+       }
+       return err_noerror;
+}
+
+
+/**
+ * \brief Deprecated
+ */
+bool
+aDocument::IsConducted(){
+       aLog::print(aLog::Debug, tr("Deprecated method call. aDocument::IsConducted()"));
+       return this->IsSignedIn();
+}
+
+/*!
+ *     \en
+ *     Check document conducting.
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Проверяет, проведен ли документ.
+ *     \_ru
+ *     \see SignIn() SignOut()
+ *     \return \en true, if document is conducted. \_en \ru true, если документ проведен \_ru
+ */
+bool
+aDocument::IsSignedIn()
+{
+       qulonglong idd = getUid();
+       if (!idd) return false;
+       QSqlQuery q = db->db()->exec(QString("SELECT cf FROM a_journ WHERE idd=%1").arg(idd));
+       if ( q.first() ) return q.value(0).toBool();
+       else return false;
+}
+
+
+
+/*!
+ *     \en
+ *     Select document with id = \a uid.
+ *     \_en
+ *     \ru
+ *     Выбирает документ с заданным идентификатором.
+ *     \_ru
+ */
+ERR_Code
+aDocument::select( qulonglong uid)
+{
+       ERR_Code res= err_noerror;
+       qulonglong idd = 0;
+       if ( !sysJournal ) return err_nosysjournal;
+       res = aObject::select(uid);
+       if(res != err_noerror) return res;
+       idd = sysJournal->findDocument(uid);
+       if (idd == 0) return err_nodocument;
+       aCfgItem tobj;
+       uint n = md->count( obj, md_table );
+       for ( uint i = 0; i < n; i++ )
+       {
+               tobj = md->find(obj,md_table,i);
+               if ( tobj.isNull() ) continue;
+               tableSelect(md->attr(tobj,mda_name), uid);
+//             aObject::select( QString("idd=%1").arg(uid), md->attr(tobj,mda_name) );
+       }
+       return res;
+}
+
+/**
+ * \ru
+ *     \brief ScriptAPI. Выбирает документ с заданным идентификатором.
+ * \_ru
+ */
+int
+aDocument::SelectDocument( QVariant uid )
+{
+       return select(uid.toULongLong());
+}
+
+/*!
+ *     \en
+ *     Sets position in document table tname at \a pos.
+ *     \_en
+ *     \ru
+ *     \brief ScriptAPI. Устанавливает позицию в табличной части документа на строку с заданным номером.
+ *     \_ru
+ *     \param pos - \en line number \_en \ru номер строки \_ru
+ *     \param tname - \en table name \_en \ru имя таблицы \_ru
+ */
+void
+aDocument::Seek(int pos, const QString &tname)
+{
+       aSQLTable * t = table(tname);
+       if(t && t->first())
+       {
+               setSelected( true, tname );
+               for(int i=0; i<pos; i++)
+               {
+                       if(t->next()) continue;
+                       else break;
+               }
+       }
+}
+
+/**
+ * \en
+ *     Get value of document field.
+ * \_en
+ * \ru
+ *     \brief ScriptAPI. Получение значения атрибута документа c указанным идентификатором.
+ *
+ *     С помощью этого метода можно получить значение атрибута документа, не являющегося текущим.
+ *     Вызов метода приводит к смене текущего документа.
+ *     Для получения значения атрибута текущего документа используйте метод Value(...),
+ *     унаследованный от aObject.
+ * \_ru
+ *
+ * \param docId - \en document id \_en \ru id документа \_ru
+ * \param fname - \en md field name \_en \ru имя поля в метаданных \_ru
+ *
+ * \return  \en value of field \_en \ru значение поля или строку "Unknown", в случае ошибки \_ru
+ *
+ */
+QVariant
+aDocument::GetDocumentValue(QVariant docId, const QString &fname)
+{
+       //aSQLTable * t = table();
+       //if ( !t ) return "";
+       //t->select(docId.toULongLong());
+       //if ( !t->first() ) return "";
+       //else
+       //{
+       if(!select(docId.toULongLong()))
+       {
+               QVariant val = Value( fname );
+               if(val.type()==QVariant::ULongLong ||
+                               val.type()==QVariant::LongLong)
+               {
+                       return val.toString();
+               }
+               else
+               {
+                       return val;
+               }
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aDocument::GetDocumentValue(...): Can't find aDocument"));
+               return "Unknown";
+       }
+       //}
+
+}
+/*!
+ *     \en
+ *     Return field value with name = \a name of the primary object database table.
+ *     \_en
+ *     \ru
+ *     Возвращает значения поля с именем = \a name основг\ной таблицы объекта.
+ *     \_ru
+ *     \param name - \en field name \_en \ru имя поля \_ru
+ *     \return \en field value \_en \ru значение поля. Поля типа Q_ULLONG и DateTime переводятся в строки. \_ru
+ */
+QVariant
+aDocument::Value( const QString & name, const QString &tableName )
+{
+       QVariant res = aObject::Value(name, tableName);
+       if(res.type() == QVariant::ULongLong || res.type() == QVariant::LongLong)
+       {
+               return QVariant(res.toString());
+       }
+       //if(res.type() == QVariant::DateTime)
+       //{
+       //      return QVariant(res.toDate().toString(Qt::ISODate));
+       //}
+       return res;
+}
diff --git a/src/lib/objects/adocument.h b/src/lib/objects/adocument.h
new file mode 100644 (file)
index 0000000..50bf259
--- /dev/null
@@ -0,0 +1,140 @@
+/****************************************************************************
+** $Id: adocument.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Document metadata object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ADOCUMENT_H
+#define ADOCUMENT_H
+
+#include       <qdatetime.h>
+#include       "acfg.h"
+#include       "aobject.h"
+//#include     "adocjournal.h"
+
+class aDocJournal;
+
+class aDatabase;
+
+
+
+/*!
+ *     \en
+ *     Not visual object used for working with documents in database.
+ *     Used as interface between database and script or wObjects
+ *     \_en
+ *     \ru
+ *     \brief Определяет программный интерфейс для работы с бизнес объектами типа Документ и их атрибутами.
+ *     Наследует aObject.
+ *
+ *     Объект класса предоставляет навигационный доступ ко всем документам, имеющим тип, указанный при инициализации
+ *     объекта. С помощью методов класса можно управлять как документом целиком, так и отдельными его реквизитами.
+ *     В том числе табличными частями, если они определены в метаданных у документа.
+ *     Обеспечивает единообразный доступ к полям и таблицам документов,
+ *     хранимых в базе данных. Информация о составе и структуре полей и табличных частей документа
+ *     храниться в метаданных.
+ *     Позволяет создавать, удалять, изменять, копировать, проводить и распроводить документы.
+ *     \_ru
+ */
+class  ANANAS_EXPORT aDocument :public aObject
+{
+       Q_OBJECT
+       ERR_Code tableDeleteLines( const QString & tablename );
+       ERR_Code tableSelect( const QString & tablename, qulonglong = 0 );
+public:
+
+       aDocument( aCfgItem context, aDatabase * adb = 0 );
+       aDocument( const QString & name, aDatabase * adb = 0 );
+       virtual ~aDocument();
+
+       virtual ERR_Code select ( qulonglong uid );
+       virtual ERR_Code initObject();
+       virtual QString trSysName( const QString & sname );
+       virtual QVariant sysValue( const QString & sname, const QString & = ""); // second parameter is here to make method declaration identical to aObject::sysValue
+       virtual ERR_Code setSysValue( const QString & sname, QVariant value, const QString & = ""); // third parameter makes method declaration identical to aObject::setSysValue
+
+       aSQLTable * getTable( const QString & tablename );
+public slots:
+
+       virtual ERR_Code New();
+       virtual ERR_Code Delete();
+       virtual ERR_Code Update();
+       virtual ERR_Code Select( QDateTime from, QDateTime to );
+       virtual bool     Select();
+       virtual ERR_Code Select( const QString & num );
+       virtual int SelectDocument( QVariant uid );
+       virtual ERR_Code Copy();
+
+       virtual bool Next();
+       virtual bool Prev();
+       virtual bool First();
+       virtual bool Last();
+
+       virtual ERR_Code TableNewLine( const QString & tablename );
+       virtual ERR_Code TableDelete(const QString & tablename);
+       virtual ERR_Code TableSelect( const QString & name );
+
+       virtual QVariant TableValue( const QString & tablename, const QString & name );
+       virtual ERR_Code TableSetValue( const QString & tablename, const QString & name,
+                                                                       const QVariant &value );
+       virtual ERR_Code TableUpdate( const QString & tablename = "" );
+
+       virtual bool TableNext( const QString & name);
+       virtual bool TablePrev( const QString & name);
+       virtual bool TableFirst( const QString & name);
+       virtual bool TableLast( const QString & name);
+
+       virtual bool IsMarkDeleted();
+       virtual bool IsMarked();
+       virtual ERR_Code SetMarkDeleted( bool Deleted );
+       virtual ERR_Code SetMarked( bool Marked );
+
+       void SetPrefix( const QString & pr );
+       QString Prefix();
+
+       virtual QVariant Value( const QString & name, const QString &tableName = "" );
+
+       virtual ERR_Code SetFilter( const QString & valname, const QVariant & value );
+       virtual ERR_Code ClearFilter();
+
+       ERR_Code Conduct(); //depricated
+       ERR_Code UnConduct(); //depricated
+       bool IsConducted(); // depricated
+       ERR_Code SignIn();
+       ERR_Code SignOut();
+       bool IsSignedIn();
+//     virtual ERR_Code TableSetFilter( const QString & tname, const QString & valname, const QVariant & value );
+//     virtual ERR_Code TableClearFilter( const QString & tname );
+       void Seek(int pos, const QString &tname);
+       QVariant GetDocumentValue(QVariant ide, const QString &fname);
+
+private:
+       QString pref;
+       aDocJournal* sysJournal;
+       ERR_Code setConduct( bool cond );
+};
+
+#endif// ADOCUMENT_H
diff --git a/src/lib/objects/airegister.cpp b/src/lib/objects/airegister.cpp
new file mode 100644 (file)
index 0000000..ead4d50
--- /dev/null
@@ -0,0 +1,554 @@
+/****************************************************************************
+** $Id: airegister.cpp,v 1.3 2008/11/09 21:09:11 leader Exp $
+**
+** Code file of the Information Register of Ananas
+** Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include       "airegister.h"
+#include       "adatabase.h"
+#include       "adocjournal.h"
+#include       "adocument.h"
+#include       "alog.h"
+
+
+/*!
+ *\en
+ *     \brief Create object aIRegister by ananas configuration object.
+ *
+ *     New object initing by md ojbect
+ *     \param context - md object used for initing aDocument
+ *     \param adb - ananas database for working
+ *\_en
+ *\ru
+ *     \brief Создает новый экземпляр объекта информационного регистра по описанию в бизнес схеме.
+ *
+ *     \param context - Ссылка на объект бизнес схемы, описывающий регистр.
+ *     \param adb - Можно не передавать. Значение по умолчанию = 0. Текущая база данных Ананаса.
+ *
+ *\_ru
+ */
+aIRegister::aIRegister( aCfgItem context, aDatabase * adb )
+: aObject( context, adb )
+{
+       concrete = !context.isNull();
+       initObject();
+}
+
+
+
+/*!
+ *\en
+ *     \brief Create object aIRegister by information register metadata name.
+ *
+ *     New object initing by md ojbect with some name.
+ *     Use for creating object if you know it's name.
+ *     \param name - md name of document
+ *     \param adb - ananas database for working
+ *     \param type - ananas database for working
+ *\_en
+ *\ru
+ *     \brief Создает новый экземпляр объекта информационного регистра по имени.
+ *
+ *     Новый объект создается по описанию объекта с таким именем, хранимом в бизнес схеме.
+ *     \param name - Имя Регистра в бизнес схеме
+ *     \param adb - Можно не передавать. Значение по умолчанию = 0. Ссылка на текущую базу данных Ананаса
+ *     \param type - Можно не передавать. Значение по умолчанию = "InfoRegister". Тип (класс) реристра в бизнес схеме
+ *
+ *\_ru
+ */
+aIRegister::aIRegister( const QString & name, aDatabase * adb,  const QString & type )
+:aObject( type+name, adb )
+{
+       if ( name.isEmpty() ) concrete = false;
+       else concrete = true;
+       initObject();
+}
+
+/*!
+ *     \ru
+ *     Деструктор.
+ *     \_ru
+ */
+
+aIRegister::~aIRegister()
+{
+}
+
+
+/*!
+ *\en
+ *     \brief Initing this object by information registr from metadata object
+ *
+ *     \return Error code
+ *\_en
+ *\ru
+ *     \brief Инициализирует объект информационного регистра.
+ *
+ *     \return Код ошибки
+ *\_ru
+ */
+ERR_Code
+aIRegister::initObject()
+{
+       docseted = false;
+       tableseted = false;
+       ERR_Code err = aObject::initObject();
+       if ( err )
+               return err;
+       return tableInsert( db->tableDbName(*md,obj), obj );
+}
+
+
+/*!
+ *\ru
+ *     \brief Устанавливает фильтр на записи регистра.
+ *
+ *     После установки фильтра навигация происходит по записям значение данного поля которых равно указанному значению.
+ *     \param name - Имя столбца в метаданных, на который устанавливается фильтр
+ *     \param value - Значение для фильтрации
+ *     \return Код ошибки
+ *\_ru
+ *\en
+ *     \brief Sets filter.
+ *
+ *     \param name - Field name.
+ *     \param value - Field value.
+ *     \return Error code
+ *\_en
+ */
+int
+aIRegister::SetFilter( const QString & name, const QVariant & value )
+{
+       if ( (md->findName( md->find(obj,md_dimensions,0), md_field, name  )).isNull() )
+               return err_incorrecttype;
+       return aObject::SetFilter( name, value );
+}
+
+
+
+/*!
+ *\ru
+ *     \brief Отфильтровывает записи регистра, принадлежащие документу. Подготовливает регистр для добавления записи
+ *     функцией New.
+ *
+ *
+ *     Задав документ для регистра, получаем возможность работать только с записями регистра, указывающими на этот документом.
+ *
+ *     \param - Ссылка на существующий документ
+ *     \return Код ошибки
+ *     \see New()
+ *
+ *\_ru
+ *\en
+ *     \brief Sets document.
+ *
+ *     \param doc -  Reference to documetn.
+ *     \return Error code
+ *     \see New()
+ *\_en
+ */
+int
+aIRegister::SetDocument( aDocument * doc )
+{
+       nowDoc = doc;
+       if ( !doc ) return err_nodocument;
+       docseted = true;
+       SetFilter( "idd", doc->getUid() );
+       return err_noerror;
+}
+
+/*!
+ *\ru
+ *     \brief Возвращает документ, на основании которого была сделана текущая запись регистра.
+ *
+ *     Возвращяет хранящийся в текущей записи регистра указатель на документ (не идентификатор, а объект),
+ *     позволяющий обратиться к реквизитам документа.
+ *     \return Указатель на документ, если текущая запись регистра имеет ссылку на документ и этот докуменрт существует.
+ *     Возврат ошибки будет свидетельствовать, что с данными не все в порядке, т.е. нарушена ссылочная целостность.
+ *\_ru
+ *\en
+ *     \brief Gets document.
+ *
+ *     \return Document pointer
+ *\_en
+ */
+aDocument*
+aIRegister::GetDocument()
+{
+       //TODO: проверить, не происходит ли утечек памяти
+       qulonglong doc_id = table()->sysValue("idd").toULongLong();
+       aCfgItem o = md->find(db->uidType(doc_id));
+       if(!o.isNull())
+       {
+               aDocument * d = new aDocument(o, db);
+               if(d)
+               {
+                       d->select(doc_id);
+               }
+               return d;
+       }
+       return 0;
+}
+
+
+/*!
+ *\en
+ *     \brief Sets table.
+ *
+ *     \param tblname - Table name.
+ *     \return Error code
+ *\_en
+ *\ru
+ *     \brief Задает табличную часть документа для использования при добавдении новых записей регистра методом New.
+ *
+ *     Вновь добавляемые записи регистра будут содержать ссылку на текущую запись указанной табличной части документа.
+ *     Используется только когда нужно добавить строки из таблицы документа.
+ *     До вызова этой функции должна быть вызвана функция установки документа SetDocument( aDocument * doc ).
+ *     \param tblname - Имя таблицы документа.
+ *     \return Код ошибки
+ *     \see SetDocument( aDocument * doc )
+ *\_ru
+ */
+int
+aIRegister::SetTable( const QString & tblname )
+{
+       if ( tblname == "" )
+       {
+               tname = "";
+               tableseted = false;
+               return err_notable;
+       }
+       if ( !docseted ) return err_nodocument;
+       tableseted = true;
+       tname = tblname;
+       return err_noerror;
+}
+
+
+
+/*!
+ *\en
+ *     \brief Adds new line to infomation register table.
+ *
+ *     \return Error code
+ *     \see SetDocument( aDocument * doc )
+ *     \see SetTable( const QString & tblname )
+ *\_en
+ *\ru
+ *     \brief Добавляет новую строку к таблице информационного регистра.
+ *
+ *     Для каждой строки информационного регистра обязательным является указание того, какая строка
+ *     табличной части какого документа с ней связана. То есть каждая запись в регистре обязательно связана
+ *     ровно с одной строкой табличной части какого-либо документа. И если при редактировании документа
+ *     пользователем удаляется строка      в его табличной части, то происходит автоматическое удаление соответствующих
+ *     строк регистра.
+ *     Перед вызовом необходимо указать ссылку на документ и на одну из его (возможно нескольких) табличных частей.
+ *     Важно чтобы в табличной части документа была задана требуемая текущая запись (строка). Именно с ней будет связана
+ *     создаваемая запись регистра.
+ *     Для указания документа и табличной части перед выховом этой функции нужно вызвать функции SetDocument() и SetTable()
+ *     Иначе запись не будет создана и вернется ошибка.
+ *     \return Код ошибки
+ *     \see SetDocument( aDocument * doc )
+ *     \see SetTable( const QString & tblname )
+ *\_ru
+ */
+int
+aIRegister::New()
+{
+       if ( !docseted ) return err_nodocument;
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       qulonglong idd = nowDoc->getUid();
+       if ( !idd ) return err_notselected;
+       int err = aObject::New();
+       if ( err ) return err;
+       t->setSysValue( "idd", idd );
+       //t->setSysValue( "date", nowDoc->Value("DocDate") );
+       if ( tableseted )
+       {
+               aSQLTable * tt = nowDoc->getTable ( tname );
+               t->setSysValue("iddt",tt->sysValue("id"));
+               t->setSysValue("ln",tt->sysValue("ln"));
+       }
+       err = Update();
+       if ( err ) return err;
+       else return select(getUid());
+}
+
+
+/*!
+ *\en
+ *     \brief Delete all record with document id from all information registers.
+ *
+ *     \param doc - document to delete.
+ *     \return true - ok, false - error
+ *\_en
+ *\ru
+ *     \brief Удаляет все записи с идентификатором данного документа из всех информационных регистров.
+ *
+ *     \param doc - Документ, записи о котором будут удалены.
+ *     \return true - успех, false - ошибка
+ *\_ru
+ */
+bool
+aIRegister::deleteDocument( aDocument * doc )
+{
+       QString tdbname;
+       aCfgItem iReg, iRegs = md->find(md->find(md->find(mdc_metadata),md_registers,0),md_iregisters,0);
+       if ( iRegs.isNull() )
+       {
+               aLog::print(aLog::Error, tr("aIRegister metaobject is null"));
+               return false;
+       }
+       qulonglong idd = doc->getUid();
+       if ( !idd )
+       {
+               aLog::print(aLog::Error, tr("aIRegister deleted document have invalid idd"));
+               return false;
+       }
+       uint n = md->count( iRegs, md_iregister );
+       for ( uint i = 0; i < n; i++  )
+       {
+               iReg = md->find( iRegs, md_iregister, i );
+               if ( iReg.isNull() ) continue;
+               if ( md->attr( iReg, mda_no_unconduct)=="1") continue;
+               tdbname = db->tableDbName( db->cfg, iReg );
+               db->db()->exec(QString("DELETE FROM %1 WHERE idd=%2").arg(tdbname).arg(idd));
+       }
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *     \brief Removes records with given table id
+ *
+ *     \param iddt - table id.
+ *     \return true - ok, false - error
+ *\_en
+ *\ru
+ *     \brief Удаляет все записи из всех информационных регистрах о таблице с данным идентификатором
+ *
+ *     \param iddt - id таблицы.
+ *     \return true - успех, false - ошибка
+ *\_ru
+ */
+bool
+aIRegister::deleteTable( qulonglong iddt)
+{
+       QString tdbname;
+       aCfgItem iReg, iRegs = md->find(md->find(md->find(mdc_metadata),md_registers,0),md_iregisters,0);
+       if ( iRegs.isNull() )
+       {
+               aLog::print(aLog::Error, tr("aIRegister metaobject is null"));
+               return false;
+       }
+       uint n = md->count( iRegs, md_iregister );
+       for ( uint i = 0; i < n; i++  )
+       {
+               iReg = md->find( iRegs, md_iregister, i );
+               if ( iReg.isNull() ) continue;
+               if ( md->attr( iReg, mda_no_unconduct)=="1") continue;
+               tdbname = db->tableDbName( db->cfg, iReg );
+               db->db()->exec(QString("DELETE FROM %1 WHERE iddt=%2").arg(tdbname).arg(iddt));
+       }
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *     \brief Selects records for date interval.
+ *
+ *     \return Error code
+ *     \see Select( QDateTime from, QDateTime to )
+ *\_en
+ *\ru
+ *     \brief Выбирает записи в информационном регистре за заданный период.
+ *
+ *     Вспомогательный метод для скриптов.
+ *     \param from - дата начала периода в строке в фрмате ISO 8601 (ГГГГ-ММ-ДД)
+ *     \param to - дата окончания периода в строке в формате ISO 8601 (ГГГГ-ММ-ДД)
+ *     \return Код ошибки
+ *     \see Select( QDateTime from, QDateTime to )
+ *\_ru
+ */
+int
+aIRegister::Select( const QString &from, const QString &to)
+{
+       //printf("from %s, to %s\n",from.ascii(),to.ascii() );
+       aLog::print(aLog::Debug, tr("aIRegister select period from %1 to %2").arg(from).arg(to));
+       return Select(QDateTime::fromString(from+"T00:00:00",Qt::ISODate), QDateTime::fromString(to+"t00:00:00",Qt::ISODate));
+}
+
+
+/*!
+ *\en
+ *     \brief Selects records for period
+ *
+ *     \param from - Period begin date
+ *     \param to - Period end date
+ *     \return Error code
+ *\_en
+ *\ru
+ *     \brief Выбирает записи в информационном регистре за заданный период.
+ *
+ *     \param from - Дата начала периода
+ *     \param to - Дата окончания периода
+ *     \return Код ошибки
+ *\_ru
+ */
+int
+aIRegister::Select( QDateTime from, QDateTime to )
+{
+       aDocJournal journ(db);
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       QString query, flt;
+       flt = journ.selectionFilter( from, to, "", true );
+       if ( flt == "" ) return err_selecterror;
+       query = QString("SELECT %1.* FROM a_journ, %2 WHERE %3.idd=a_journ.idd AND %4").arg(t->tableName).arg(t->tableName).arg(t->tableName).arg(flt);
+       if ( IsFiltred() )
+       {
+               QString tf = t->getNFilter();
+               if ( tf != "" )
+                       query = query + QString(" AND %1").arg(tf);
+       }
+       if ( t->exec(query) )
+               if ( t->first() )
+               {
+                       setSelected(true);
+                       return err_noerror;
+               }
+               else return err_notselected;
+       else
+               return err_selecterror;
+}
+
+
+/*!
+ *\en
+ *
+ *     \return Error code
+ *\_en
+ *\ru
+ *     \brief Выбирает первую запись регистра по документу, установленному перед этим функцией SetDocument( aDocument * doc ).
+ *
+ *     \return Код ошибки
+ *     \see SetDocument( aDocument * doc )
+ *\_ru
+ */
+int
+aIRegister::SelectByDoc()
+{
+       if ( !docseted ) return err_nodocument;
+       qulonglong uidd = nowDoc->getUid();
+       if ( !uidd ) return err_nodocument;
+       aSQLTable * t = table();
+       if ( !t ) return err_notable;
+       if ( t->select(QString("idd=%1").arg(uidd)) )
+               if (t->first()) return err_noerror;
+               else return err_notselected;
+       else return err_selecterror;
+}
+
+/*!
+ *\en
+ *     \brief Return field value with name = name of the primary object database table.
+ *
+ *     \param name - field name
+ *     \return  field value
+ *\_en
+ *\ru
+ *     \brief Возвращает значения поля с именем =  name основной таблицы объекта.
+ *
+ *     \param name - имя поля
+ *     \return  значение поля. Поля типа Q_ULLONG и DateTime переводятся в строки.
+ *\_ru
+ */
+QVariant
+aIRegister::Value( const QString & name, const QString &tableName )
+{
+       QVariant res = aObject::Value(name, tableName);
+       if(res.type() == QVariant::ULongLong || res.type() == QVariant::LongLong)
+       {
+               return QVariant(res.toString());
+       }
+       //if(res.type() == QVariant::DateTime)
+       //{
+       //      return QVariant(res.toDate().toString(Qt::ISODate));
+       //}
+       return res;
+}
+
+/**
+ * \ru
+ *     \brief Переход к следующей записи регистра.
+ * \_ru
+ */
+bool
+aIRegister::Next()
+{
+       return aObject::Next();
+}
+
+
+/**
+ * \ru
+ *     \brief Переход к предыдущей записи регистра.
+ * \_ru
+ */
+bool
+aIRegister::Prev()
+{
+       return aObject::Prev();
+}
+
+
+/**
+ * \ru
+ *     \brief Переход к первой записи регистра.
+ * \_ru
+ */
+bool
+aIRegister::First()
+{
+       return aObject::First();
+}
+
+
+/**
+ * \ru
+ *     \brief Переход к последней записи регистра.
+ * \_ru
+ */
+bool
+aIRegister::Last()
+{
+       return aObject::Last();
+}
diff --git a/src/lib/objects/airegister.h b/src/lib/objects/airegister.h
new file mode 100644 (file)
index 0000000..d7ab9b6
--- /dev/null
@@ -0,0 +1,93 @@
+/****************************************************************************
+** $Id: airegister.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of the Information Register of Ananas
+** Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AIREGISTER_H
+#define AIREGISTER_H
+#include       <q3valuelist.h>
+#include       <qstringlist.h>
+#include       <qvariant.h>
+#include       <qdatetime.h>
+#include       "acfg.h"
+#include       "aobject.h"
+
+class aDatabase;
+
+class aDocJournal;
+
+class aDocument;
+
+
+
+/*!
+ * \en
+ *     Object for working with information register in database.
+ *     Using for provide between database tables and wobjects or ananas scripts
+ * \_en
+ * \ru
+ * \class aIRegister aIRegister.h
+ * \brief Класс aIRegister определяет программный интерфейс Информационных регистров.
+ *
+ *     Информационный регистр служит для хронологической записи данных.
+ *     Для хранения остатков следует использовать Накопительные регистры aARegister
+ *     \see aARegister
+ * \_ru
+ */
+class  ANANAS_EXPORT aIRegister :public aObject
+{
+       Q_OBJECT
+public:
+       aIRegister(aCfgItem registerItem, aDatabase * adb = 0);
+       aIRegister( const QString & name, aDatabase * adb = 0, const QString & type = "InfoRegister.");
+       virtual ~aIRegister();
+//     ERR_Code initObject(aDatabase * adb);
+       virtual ERR_Code initObject();
+       virtual bool deleteDocument( aDocument * doc );
+       virtual bool deleteTable( qulonglong iddt );
+public slots:
+       virtual int SetDocument( aDocument * doc );
+       virtual aDocument * GetDocument();
+       virtual int SetTable( const QString & tblname );
+       virtual int New();
+       virtual int Select( const QString &from, const QString & to);
+       virtual int Select( QDateTime from, QDateTime to );
+       virtual int SelectByDoc();
+       virtual QVariant Value( const QString & name, const QString &tableName = "" );
+
+       virtual int SetFilter( const QString & fieldName, const QVariant & value );
+       virtual bool Next();
+       virtual bool Prev();
+       virtual bool First();
+       virtual bool Last();
+protected:
+       bool docseted, tableseted;
+       QString tname;
+       aDocument * nowDoc;
+};
+
+#endif// AIREGISTER_H
diff --git a/src/lib/objects/aobject.cpp b/src/lib/objects/aobject.cpp
new file mode 100644 (file)
index 0000000..cad317a
--- /dev/null
@@ -0,0 +1,1136 @@
+/****************************************************************************
+** $Id: aobject.cpp,v 1.3 2008/11/09 21:09:11 leader Exp $
+**
+** Code file of the Ananas Object of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2005-2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qobject.h>
+#include <q3sqlcursor.h>
+#include <q3sqlpropertymap.h>
+#include <qdialog.h>
+#include "adatabase.h"
+#include "aobject.h"
+#include "aform.h"
+#include "alog.h"
+
+
+/*!
+ *     \en
+ *     Craeate abstract aObject.
+ *     \param parent - parent object
+ *     \param name - name of object
+ *     \_en
+ *     \ru
+ *     Создает абстрактный не связанный с базой данных объект управления данными.
+ *     Созданный таким образом объект не использует информацию из метаданных о составе и
+ *     типах полей. То есть он не является какой-либо моделью данных. И на самом деле малопригоден
+ *     для использования. В дазе данных ни как не отражается создание этого объекта. Для того,
+ *     что бы зарегистрировать вновь созданный абстрактный объект в базе данных, необходимо
+ *     сначала проинициализировать его с использованием метаданных, а затем вызвать метод New().
+ *     \_ru
+ */
+aObject::aObject( QObject *parent, const char *name )
+:QObject( parent, name )
+{
+       db = 0;
+       vInited = false;
+       filtred = false;
+       selectFlag = false;
+}
+
+
+
+/*!
+ *     \en
+ *     Create aObject, inited by md object.
+ *     md object finding by name
+ *     \param oname - md name of object, name contens prefix
+ *                             Document. for documents,
+ *                             InfoRegister. for information registers,
+ *                             Catalogue. for catalogues,
+ *                             AccumulationRegister. for Accumulation registers,
+ *                             DocJournal. for journals
+ *     \param adb - link on object aDataBase used for work
+ *     \param parent - parent object
+ *     \param name - name of object
+ *     \_en
+ *     \ru
+ *     Создает объект как модель данных, описанную в метаданных. На описание в метаданных
+ *     указывает один из передаваемых при вызове параметров - имя элемента метаданных.
+ *     После успешного создания объекта с ним можно работать как с объектом данных со структурой,
+ *     описанной в метаданных, и индентифицируемой именем, переданным в параметрах вызова.
+ *
+ *     \_ru
+ */
+aObject::aObject( const QString &oname, aDatabase *adb, QObject *parent, const char *name )
+:QObject( parent, name )
+{
+       vInited = false;
+       filtred = false;
+       selectFlag = false;
+       db = adb;
+       if ( adb )
+       {
+               obj = adb->cfg.find( oname );
+               setObject( obj );
+       }
+}
+
+
+
+/*!
+ *     Create aObject, inited by md object.
+ *     \param context - hi leve md object
+ *     \param adb - link on object aDataBase used for work
+ *     \param parent - parent object
+ *     \param name - name of object
+ */
+aObject::aObject( aCfgItem context, aDatabase *adb, QObject *parent, const char *name )
+:QObject( parent, name )
+{
+       filtred = false;
+       vInited = false;
+       db = adb;
+       if ( adb )
+       {
+               setObject( context );
+       }
+}
+
+
+
+/*!
+ *     virtual destructor.
+ */
+aObject::~aObject()
+{
+}
+
+
+
+/*!
+ *     Tune on metadata object and it's database tables.
+ *     \param adb - link on database object
+ *     \return error code
+ */
+ERR_Code
+aObject::init()
+{
+       if ( isInited() ) return err_noerror;
+       return initObject();
+}
+
+
+
+/*!
+ *     Set new object type after create
+ *     /param newobject - new md object
+ *     \return error code
+ */
+ERR_Code
+aObject::setObject( aCfgItem newobject )
+{
+       setInited( false );
+       obj = newobject;
+       return init();
+}
+
+
+
+/*!
+ *     Init object after create.
+ *     Need setObject( id ), where id - if of the metadata object of the adb->cfg loaded Configuration.
+ *     \return error code
+ */
+ERR_Code
+aObject::initObject()
+{
+       aCfgItem fg, f;
+       QString tname;
+
+       setInited( true );
+//     db = adb;
+       md = 0;
+       if ( db ) md = &db->cfg;
+       else
+       {
+               aLog::print(aLog::Error, tr("aObject have no database!"));
+               return err_nodatabase;
+       }
+       if ( obj.isNull() )
+       {
+               aLog::print(aLog::Error, tr("aObject md object not found"));
+               return err_objnotfound;
+       }
+       return err_noerror;
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObject::checkStructure()
+{
+       return false;
+}
+
+
+
+/*!
+ *     Return the table of object by it's name.
+ *     /param name - name of table for main table use name="" or empty parametr
+ *     /return link on aDataTable or 0 if table not found
+ */
+aDataTable *
+aObject::table( const QString &name )
+{
+       if ( !dbtables[ name ] )
+       {
+               if (name!="" && !name.isEmpty())
+               {
+                       aLog::print(aLog::Error, tr("aObject table with name %1 not found").arg(name));
+                       cfg_message(1, tr("Table `%s' not found.\n").utf8(),(const char*) name);
+               }
+       //      else
+       //      {
+       //              cfg_message(1, tr("Table name is empty.\n").utf8());
+       //      }
+               return 0;
+       }
+       return dbtables[ name ];
+}
+
+
+
+/*!
+ *     Insert table name and it link into internal buffer.
+ *     used for finding table by it's md name or some default name
+ *     /param dbname - database name of table
+ *     /param obj - md object, used for aDataTable initing
+ *     /param name - name of table, used for finding table in buffer
+ *     /return error code
+ */
+ERR_Code
+aObject::tableInsert( const QString &dbname,  aCfgItem obj, const QString &name )
+{
+       if ( db )
+       {
+               aDataTable *t = db->table( dbname );
+               if ( !t )
+                       return err_notable;
+               t->setObject( obj );
+               dbtables.insert( name, t );
+               return err_noerror;
+       }
+       aLog::print(aLog::Error, tr("aObject have no database!"));
+       return err_nodatabase;
+}
+
+
+
+/*!
+ *     Insert table name and it link into internal buffer.
+ *     used for finding table by it's md name or some default name
+ *     table not inited by md object
+ *     /param dbname - database name of table
+ *     /param name - name of table, used for finding table in buffer
+ *     /return error code
+ */
+ERR_Code
+aObject::tableInsert( const QString &dbname, const QString &name )
+{
+       if ( db ) {
+               aDataTable *t = db->table( dbname );
+               if ( !t ) return err_notable;
+               dbtables.insert( name, t );
+               return err_noerror;
+       }
+       aLog::print(aLog::Error, tr("aObject have no database!"));
+       return err_nodatabase;
+}
+
+
+
+/*!
+ *     Remove table from buffer.
+ *     /param name - table name
+ *     /return err_notable if table not found
+ */
+ERR_Code
+aObject::tableRemove( const QString &name )
+{
+       if ( !dbtables[name] )
+       {
+               aLog::print(aLog::Error, tr("aObject table with name %1 not found").arg(name));
+               return err_notable;
+       }
+       dbtables.remove( name );
+       return err_noerror;
+}
+
+
+
+/*!
+ *
+ */
+QString
+aObject::trSysName( const QString & )
+{
+       return "";
+}
+
+
+
+/*!
+ * Gets system field value.
+ * \param name (in) -  field name.
+ * \return field value or QVariant::Invalid if field no exist.
+ */
+QVariant
+aObject::sysValue( const QString & name, const QString &tableName )
+{
+       aDataTable *t = table( tableName );
+       if ( t && t->sysFieldExists( name ) )
+       {
+               return  t->sysValue(name);
+       }
+       else return QVariant::Invalid;
+}
+
+
+
+/*!
+ * Sets system field value.
+ * \param name (in) - field name.
+ * \param value (in) - sets value.
+ */
+int
+aObject::setSysValue( const QString & name, QVariant value, const QString &tableName )
+{
+       aDataTable *t = table( tableName );
+       if ( t )
+       {
+               t->setSysValue( name, value );
+               return err_noerror;
+       }
+       return err_notable;
+}
+
+
+
+/*!
+ * Return field value of the primary object database table.
+ */
+QVariant
+aObject::Value( const QString & name, const QString &tableName )
+{
+
+        aDataTable *t = table( tableName );
+       QString trName = trSysName(name);
+
+       if ( trName != "" ) return sysValue( trName );
+       else
+       {
+               if ( t ) return t->value( name );
+       }
+        return QVariant("");
+}
+
+
+
+/*!
+ * Set field value of the primary object database table.
+ */
+int
+aObject::SetValue( const QString & name, const QVariant &value, const QString &tableName )
+{
+       aDataTable *t = table( tableName );
+       QString trName = trSysName(name);
+
+       if ( trName != "" ) return setSysValue( trName, value );
+       else
+       {
+               if ( t )
+               {
+                       t->setValue( name, value );
+                       return err_noerror;
+               }
+
+       }
+       return err_notable;
+//     return setTValue( "", name, value );
+}
+
+
+
+/*!
+ *     Check object selecting.
+ *     \return true if object record selected in database.
+ */
+bool
+aObject::IsSelected()
+{
+       return selected();
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObject::IsMarkDeleted(const QString & tname)
+{
+        aDataTable *t = table( tname );
+        if ( t && t->sysFieldExists( "df" ) ) return t->sysValue( "df" ).toInt() == 1;
+        return false;
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObject::IsMarked()
+{
+        aDataTable *t = table();
+        if ( t && t->sysFieldExists( "mf" ) ) return t->sysValue( "mf" ).toInt() == 1;
+        return false;
+}
+
+
+
+/*!
+ *
+ */
+/*
+int
+aObject::TableSetMarkDeleted( bool Deleted, const QString & tname )
+{
+        aDataTable *t = table( tname );
+        if ( t && t->sysFieldExists( "df" ) ) {
+                QString v = "0";
+                if ( Deleted ) v = "1";
+                t->setSysValue( "df", QVariant( v ) );
+                return err_noerror;
+        }
+        return err_incorrecttype; // Object can not be mark deleted
+}
+*/
+
+
+/*!
+ *
+ */
+int
+aObject::SetMarkDeleted( bool Deleted, const QString & tname )
+{
+       aDataTable *t = table( tname );
+       if ( t && t->sysFieldExists( "df" ) )
+       {
+               QString v = "0";
+               if ( Deleted ) v = "1";
+               t->setSysValue( "df", QVariant( v ) );
+               return err_noerror;
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aObject have no system field %1").arg("df"));
+               return err_incorrecttype; // Object can not be mark deleted
+       }
+}
+
+
+
+/*!
+ *
+ */
+int
+aObject::SetMarked( bool Marked )
+{
+        aDataTable *t = table();
+        if ( t && t->sysFieldExists( "mf" ) ) {
+                QString v = "";
+                if ( Marked ) v = "1";
+                t->setSysValue( "mf", QVariant( v ) );
+//                t->printRecord();
+                return err_noerror;
+        }
+       aLog::print(aLog::Error, tr("aObject have no system field %1").arg("mf"));
+        return err_incorrecttype; // Object can not be marked
+}
+
+
+
+/*!
+ * Add new object record in database.
+ */
+int
+aObject::New()
+{
+       aDataTable *t = table();
+
+       if ( !t ) return err_notable;
+       setSelected ( t->New() );
+/*     Q_ULLONG Uid = t->primeInsert()->value("id").toULongLong();
+       if ( t->insert() )
+       {
+               if ( t->select(QString("id=%1").arg(Uid), false) )
+                       if ( t->first() )
+                       {
+                               setSelected(true);
+                               return err_noerror;
+                       }
+               return err_selecterror;
+       }
+*/     if ( selected() ) return err_noerror;
+       return err_inserterror;
+}
+
+
+
+/*!
+ * Copy current selected object data in database.
+ */
+/*Q_ULLONG
+aObject::copy( const QString & tablename )
+{
+       aDataTable * t = table( tablename );
+
+       if ( !t ) return 0;
+       if ( !selected(tablename) ) return 0;
+       QSqlRecord * r = t->primeUpdate();
+       Q_ULLONG Uid = db->uid( t->id );
+       r->setValue("id",Uid);
+       if ( t->insert() ) return Uid;
+       else return 0;
+}
+*/
+
+
+/*!
+ *
+ */
+int
+aObject::Copy()
+{
+//     QSqlRecord r;
+
+//     Q_ULLONG Uid = copy();
+//     if ( !Uid ) return err_copyerror;
+       aDataTable *t = table();
+       if ( t->Copy() ) return err_noerror;
+//     if ( t->select(QString("id=%1").arg(Uid)) )
+//             if ( t->first() )
+//                     return err_noerror;
+       return err_copyerror;
+}
+
+
+
+/*!
+* Delete curent selected object record from database.
+*/
+int
+aObject::Delete()
+{
+       aDataTable * t = table();
+       if ( !t ) return err_notable;
+       db->markDeleted(getUid());
+       t->Delete();
+//     if ( !selected() ) return err_notselected;
+//     t->primeDelete();
+//     t->del();
+       setSelected (false);
+       return err_noerror;
+}
+
+
+
+/*!
+ *\~english
+ *     Update curent selected object record to database.
+ *\~russian
+ *\~
+ */
+int
+aObject::Update()
+{
+       aDataTable *t = table();
+       QSqlRecord *r;
+       int i;
+
+       if ( !t ) return err_notable;
+       t->Update();
+/*
+       r = t->primeUpdate();
+       t->printRecord();
+       for ( i=0;i<r->count();i++ ) r->setValue( i, t->value( i ) );
+
+       t->update();
+*/
+       if ( t->lastError().type() )
+       {
+               //debug_message("update error %i %s\n",t->lastError().type(), ( const char *)t->lastError().text());
+
+               aLog::print(aLog::Error, tr("aObject update error. Driver message: %1").arg(t->lastError().text()));
+               return err_updateerror;
+       }
+       else {
+               return err_noerror;
+       }
+}
+
+
+
+/*!
+ *\~english
+ *     Update object attributes from curent selected object database record.
+ *\~russian
+ *\~
+ *//*
+void
+aObject::updateAttributes( const QString & tname )
+{
+       aDataTable *t = table();
+
+}
+*/
+
+/*!
+ *\~english
+ *     Conduct document.
+ *     Do nothing. Added for wDocument compatibility.
+ *\~russian
+ *     Проводит документ.
+ *     Ничего не делает. Предназначена для совместимости и работы в wDocument.
+ *\~
+ *\return \~english error code - abstract object.\~russian код ошибки - абстрактный обект.\~
+ */
+int
+aObject::Conduct()
+{
+       return err_abstractobj;
+}
+
+/*!
+ *\~english
+ *     UnConduct document.
+ *     Do nothing. Added for wDocument compatibility.
+ *\~russian
+ *     Распроводит документ.
+ *     Ничего не делает. Предназначена для совместимости и работы в wDocument.
+ *\~
+ *\return \~english error code - abstract object.\~russian код ошибки - абстрактный обект.\~
+ */
+int
+aObject::UnConduct()
+{
+       return err_abstractobj;
+}
+
+bool
+aObject::IsConducted()
+{
+       return 0;
+}
+
+
+
+/*!
+ *\~english
+ *     Return document database id.
+ *     always return 0. Added for wJournal compatibility.
+ *\~russian
+ *     Возвращает id документа в базе данных.
+ *     Всегда возвращает 0. Предназначена для совместимости и работы в wJournal.
+ *\~
+ *\return \~english 0.\~russian 0.\~
+ */
+qulonglong
+aObject::docId()
+{
+       return 0;
+}
+
+
+/*!
+ * \ru
+ *     Позиционирует указатель в БД на запись, соотвествующую объекту
+ *     с указанным идентификатором.
+ *     \param id - Идентификатор объекта.
+ *     \return возвращает код ошибки или 0 в случае успеха.
+ * \_ru
+ */
+ERR_Code
+aObject::select( qulonglong id )
+{
+       aDataTable * t = table();
+       if ( !t ) return err_notable;
+       setSelected (false);
+       long otype = db->uidType( id );
+//     debug_message("otype=%li\n",otype);
+       if ( !otype ) return err_objnotfound;
+       if ( concrete && ( otype != t->getMdObjId() ) ) return err_incorrecttype;
+       if ( !concrete )
+       {
+               aCfgItem tmpObj = md->find( otype );
+               if ( tmpObj.isNull() ) return err_objnotfound;
+               setObject ( tmpObj );
+       }
+       if ( t->select( QString("id=%1").arg(id), false ) )
+               if ( t->first() )
+               {
+//                     t->primeUpdate();
+                       setSelected (true);
+//                     t->printRecord();
+                       return err_noerror;
+               }
+               else return err_notselected;
+       return err_selecterror;
+}
+
+
+
+/*!
+ *
+ */
+ERR_Code
+aObject::select(const QString & query, const QString &tableName)
+{
+       aDataTable * t = table(tableName);
+       if ( !t ) return err_notable;
+       if (t->select(query))
+               if( t->first() )
+               {
+                       setSelected (true);
+                       return err_noerror;
+               }
+               else return err_notselected;
+       return err_selecterror;
+}
+
+
+
+/*!
+ * Return field value of the secondary object database table.
+ */
+QVariant
+aObject::tValue( const QString & tablename, const QString & name )
+{
+        aDataTable *t = table( tablename );
+//CHECK_POINT
+        if ( t ) return t->value( name );
+        return QVariant("");
+}
+
+
+
+/*!
+ * Set field value of the secondary object database table.
+ */
+ERR_Code
+aObject::setTValue( const QString & tablename, const QString & name, const QVariant &value )
+{
+       aDataTable *t = table( tablename );
+       if ( t )
+       {
+               t->setValue( name, value );
+               return err_noerror;
+       }
+       return err_notable;
+}
+
+
+
+/*!
+ *
+ */
+ERR_Code
+aObject::decodeDocNum( QString nm, QString & pref, int & num)
+{
+
+       aLog::print(aLog::Debug, tr("aObject decode doc number %1").arg(nm));
+       int pos = -1;
+       for ( uint i = nm.length(); i > 0; i-- )
+       {
+               if ( ( nm.at(i-1) >='0' ) && ( nm.at(i-1) <= '9' ) )
+                       continue;
+               else
+               {
+                       pos = i;
+                       break;
+               }
+       }
+       if ( pos == -1 )
+       {
+//CHECK_POINT
+               pref = "";
+               num = nm.toInt();
+               return err_incorrectname;
+       }
+       if ( pos == ( int ) nm.length() )
+       {
+//CHECK_POINT
+               pref = nm;
+               num = -1;
+               return err_incorrectname;
+       }
+//CHECK_POINT
+       pref = nm.left( pos );
+       num = nm.mid(pos).toInt();
+       aLog::print(aLog::Debug, tr("aObject decode doc number ok, pref=%1 num=%2").arg(pref).arg(num));
+       return err_noerror;
+}
+
+
+
+/*!
+ *
+ */
+/*
+bool
+aObject::Next()
+{
+       return table()->next();
+//     return dbtables[""]->next();
+}
+*/
+
+
+/*!
+ *
+ */
+/*
+bool
+aObject::Prev()
+{
+//     return dbtables[""]->prev();
+       return table()->prev();
+}
+*/
+
+
+/*!
+ *
+ */
+/*
+bool
+aObject::First()
+{
+//     return dbtables[""]->first();
+       return table()->first();
+}
+*/
+
+
+/*!
+ *
+ */
+/*
+bool
+aObject::Last()
+{
+//     return dbtables[""]->last();
+       return table()->last();
+}
+*/
+
+
+/*!
+ *
+ */
+bool
+aObject::Next( const QString& tableName )
+{
+       return table(tableName)->next();
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObject::Prev( const QString& tableName )
+{
+       return table(tableName)->prev();
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObject::First( const QString& tableName )
+{
+       return table(tableName)->first();
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObject::Last( const QString& tableName )
+{
+       return table(tableName)->last();
+}
+
+/*!
+ *     \ru
+ *     Возвращает уникальный идентификатор объекта из базы данных.
+ *     В качестве объекта например может выступать "Приходная накладная" от такого-то числа за таким то номером.
+ *     Каждый вновь созданный в системе документ или элемент справочника, включая группы справочника имеет свой уникальный
+ *     неповторяющийся идентификатор. Если какое-либо поле, какого-либо объекта имеет тип Объект (например Document.Накладная),
+ *     то в качестве значения ему нужно задавать уникальный идентификатор объекта, возвращаемый функцией Uid().
+ *     Не существует возможности изменить существующий идентификатор какого-либо объекта. Созданием и управлением
+ *     идентификаторами объектов занимается система.
+ *     \return строка со значением уникального идентификатора.
+ *     \_ru
+ */
+QString
+aObject::Uid()
+{
+       return QString::number(getUid());
+}
+
+
+/*!
+ *
+ */
+qulonglong
+aObject::getUid()
+{
+       qulonglong Uid = 0;
+       if ( selected() ) Uid = table()->sysValue("id").toULongLong();
+       return Uid;
+}
+
+
+
+/*!
+ *
+ */
+void
+aObject::setSelected( bool sel, const QString & tablename )
+{
+       if ( tablename == "" ) selectFlag = sel;
+       else table(tablename)->selected = sel;
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObject::selected( const QString & tablename )
+{
+       if ( tablename == "" ) return selectFlag;
+       else return table(tablename)->selected;
+}
+
+
+
+/*!
+ *
+ */
+ERR_Code
+aObject::setTFilter( const QString & tname, const QString & valname, const QVariant & value )
+{
+       aDataTable * t = dbtables[tname];
+       if ( !t ) return err_notable;
+       if ( t->setFilter( valname, value ) ) return err_noerror;
+       else return err_fieldnotfound;
+}
+
+
+
+/*!
+ *
+ */
+ERR_Code
+aObject::clearTFilter( const QString & tname )
+{
+       aDataTable * t = dbtables[tname];
+       if ( !t ) return err_notable;
+       t->clearFilter();
+       return err_noerror;
+}
+
+
+
+/*!
+ *
+ */
+int
+aObject::SetFilter( const QString & valname, const QVariant & value )
+{
+       int err = setTFilter( "", valname, value );
+       filtred = !err;
+       return err;
+}
+
+
+
+/*!
+ *
+ */
+int
+aObject::ClearFilter()
+{
+       filtred = false;
+       return clearTFilter("");
+}
+
+
+
+/*!
+ *
+ */
+int
+aObject::TableSetFilter( const QString & tname, const QString & valname, const QVariant & value )
+{
+       return setTFilter( tname, valname, value );
+}
+
+
+
+/*!
+ *
+ */
+int
+aObject::TableClearFilter( const QString & tname )
+{
+       return clearTFilter(tname);
+}
+
+
+
+/*!
+ * \ru
+ *     Обновляет базу данных данными табличной части объекта. Обычно вызывается
+ *     после метода TableSetValue.
+ *     \param tablename - имя таблицы. Необходим для указания имени, так как
+ *     в объекте возможно наличие нескольких табличных частей.
+ *     \return возвращает код ошибки или 0 в случае успеха.
+ * \_ru
+ */
+int
+aObject::TableUpdate( const QString & tablename )
+{
+       aDataTable *t = table( tablename );
+       if ( !t )
+       {
+
+               aLog::print(aLog::Error, tr("aObject table update: no table found with name %1").arg(tablename));
+               return err_notable;
+       }
+//     t->primeUpdate();
+       t->Update();
+       if (t->lastError().type())
+       {
+
+               aLog::print(aLog::Error, tr("aObject update error. Driver message: %1").arg(t->lastError().text()));
+               return err_updateerror;
+       }
+       return err_noerror;
+}
+
+
+
+/*!
+ *
+ */
+QString
+aObject::displayString()
+{
+       QString res="***";
+        int stdfc = 0, fid;
+        aCfgItem sw, f;
+
+       sw = displayStringContext();
+//     if ( md->objClass( obj ) == md_catalogue ) {
+//             sw = md->find( md->find( obj, md_element ), md_string_view );
+//     } else {
+//             sw = md->find( obj, md_string_view );
+//     }
+        if ( !sw.isNull() ) {
+                stdfc = md->attr( sw, mda_stdf ).toInt();
+                switch ( stdfc ) {
+                case 0:
+                        fid = md->sText( sw, md_fieldid ).toInt();
+                        res = table()->sysValue( QString( "uf%1" ).arg( fid ) ).toString();
+//printf("fid=%i res=%s\n",fid, ( const char *) res );
+                        break;
+                case 1:
+                        break;
+                case 2:
+                        break;
+                }
+        }
+       else
+       {
+
+               aLog::print(aLog::Debug, tr("aObject display string context is null"));
+       }
+//     res =
+       return res;
+}
+
+
+
+
+aCfgItem
+aObject::displayStringContext()
+{
+       return md->find( obj, md_string_view );
+}
+
+
+
+/**
+ * \ru
+ *     Вид объекта, так как он описан в метаданных.
+ *  \_ru
+ */
+QString
+aObject::Kind( const QString & name )
+{
+       QString wasKind = md->objClass( obj );
+       if ( !name.isEmpty() ) {
+       // Set new kind.
+
+       }
+       return wasKind;
+}
diff --git a/src/lib/objects/aobject.h b/src/lib/objects/aobject.h
new file mode 100644 (file)
index 0000000..22ff56e
--- /dev/null
@@ -0,0 +1,170 @@
+/****************************************************************************
+** $Id: aobject.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of the Ananas Object of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AOBJECT_H
+#define AOBJECT_H
+
+#include <qdatetime.h>
+#include "acfg.h"
+#include "asqltable.h"
+
+
+class aDatabase;
+
+
+
+/*!
+ * \en
+ *     The parent object for hi level not visual objects
+ *     for worcs with SQL database
+ *     \_en
+ *     \ru
+ *     \brief Базовый класс для невизуальных классов (моделей в терминологии MVC) Ананаса,
+ *     которым необходим доступ к базе данных.
+ *     Наследует QObject.
+ *
+ *     Как правило такие классы предоставляют методы
+ *     для работы с пользовательскими "объектами" типа "Журнал операций",
+ *     первичный учетный документ "Приходная накладная", "Справочник товаров",
+ *     "Элемент справочника товаров" и др.
+ *
+ *     Для доступа к данным базы данных через методы такого объекта
+ *     сначала необходимо создать объект, указав в параметре вызова
+ *     конструктора имя элемента метаданных, описывающего модель данных объекта,
+ *     затем вызвать метод New().
+ *     \_ru
+ */
+class  ANANAS_EXPORT aObject : public QObject
+{
+       Q_OBJECT
+public:
+       aCfg * md;
+       aCfgItem obj;
+       aDatabase * db;
+
+       aObject( QObject *parent = 0, const char *name = 0 );
+       aObject( const QString &oname, aDatabase *adb, QObject *parent = 0, const char *name = 0 );
+       aObject( aCfgItem context, aDatabase *adb, QObject *parent = 0, const char *name = 0 );
+       virtual ~aObject();
+
+       virtual bool checkStructure();
+
+       ERR_Code init();
+//     aCfgItem *getMDObject();
+//     void setMDObject( aCfgItem object );
+       ERR_Code decodeDocNum( QString nm, QString & pref, int & num);
+       virtual ERR_Code select( qulonglong id );
+       qulonglong getUid();
+       bool selected( const QString & tablename = "" );
+       //void selectTable(const QString & tablename = "");
+       ERR_Code select(const QString & query, const QString &tableName = "");
+       aDataTable *table( const QString &name = "" );
+
+//     void updateAttributes( const QString & tname = "" );
+       virtual qulonglong docId();
+
+
+       virtual bool Next(const QString &tableName = "" );
+       virtual bool Prev(const QString &tableName = "" );
+       virtual bool First(const QString &tableName = "" );
+       virtual bool Last(const QString &tableName = "" );
+
+public slots:
+       virtual QString Uid();
+       virtual bool IsSelected();
+       virtual bool IsMarkDeleted( const QString & tname = "" );
+       virtual bool IsMarked();
+//     virtual int TableSetMarkDeleted( bool Deleted, const QString & tablename = "" );//depricated
+       virtual int SetMarkDeleted( bool Deleted, const QString & tablename = "" );
+       virtual int SetMarked( bool Marked );
+
+//     virtual aObject *GetAttrib( const QString & AttribName );
+//     virtual void SetAttrib( const QString & AttribName, const *aObject );
+
+       virtual int New();
+       virtual int Copy();
+       virtual int Delete();
+       virtual int Update();
+       virtual int Conduct();
+       virtual int UnConduct();
+       virtual bool IsConducted();
+       virtual QString Kind( const QString & name = QString::null );
+//     virtual ERR_Code Select( QString num ){return err_incorrecttype;};
+//     virtual ERR_Code Select( QDateTime from, QDateTime to, QString mdName){return err_incorrecttype;};
+//     virtual ERR_Code Select( aObject* ){return err_incorrecttype;};
+
+       virtual QVariant Value( const QString & name, const QString &tableName = "" );
+       virtual int SetValue( const QString & name, const QVariant &value, const QString &tableName = "" );
+
+       virtual QVariant sysValue( const QString & name, const QString &tableName = "" );
+       virtual int setSysValue( const QString & name, QVariant value, const QString &tableName = "" );
+
+//     virtual bool Next();
+//     virtual bool Prev();
+//     virtual bool First();
+//     virtual bool Last();
+
+       virtual int SetFilter( const QString & valname, const QVariant & value );
+       virtual int ClearFilter();
+       virtual int TableSetFilter( const QString & tname, const QString & valname, const QVariant & value );
+       virtual int TableClearFilter( const QString & tname );
+       virtual bool IsFiltred() {return filtred;};
+       virtual int TableUpdate( const QString & tablename );
+       virtual QString displayString();
+
+protected:
+       bool concrete;
+       virtual aCfgItem displayStringContext();
+//     Q_ULLONG lastUid;
+       virtual ERR_Code setObject( aCfgItem newobject );
+//     virtual ERR_Code initObject( aDatabase *adb );
+       virtual ERR_Code initObject();
+       bool isInited() { return vInited; };
+       void setInited( bool flag ){ vInited = flag; };
+       ERR_Code tableInsert( const QString &dbname, aCfgItem obj, const QString &name = "" );
+       ERR_Code tableInsert( const QString &dbname, const QString &name = "" );
+       ERR_Code tableRemove( const QString &name = "" );
+
+       virtual QVariant tValue( const QString & tablename, const QString & name );
+       virtual ERR_Code setTValue(const QString & tablename, const QString & name, const QVariant &value);
+       virtual QString trSysName( const QString & sname );
+//     Q_ULLONG copy(const QString & tablename = "");
+       void    setSelected( bool sel, const QString & tablename = "" );
+       virtual ERR_Code setTFilter( const QString & tname, const QString & valname, const QVariant & value );
+       virtual ERR_Code clearTFilter( const QString & tname );
+
+private:
+       bool vInited, selectFlag, filtred;
+       Q3Dict <aDataTable> dbtables;
+
+//     QDict <aDataRecord> attributes;
+};
+
+
+#endif
diff --git a/src/lib/objects/aobjectlist.cpp b/src/lib/objects/aobjectlist.cpp
new file mode 100644 (file)
index 0000000..cc2d52a
--- /dev/null
@@ -0,0 +1,548 @@
+/****************************************************************************
+** $Id: aobjectlist.cpp,v 1.3 2008/11/09 21:09:11 leader Exp $
+**
+** Code file of the Ananas Objects List of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2005-2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qobject.h>
+#include <q3sqlcursor.h>
+#include <q3sqlpropertymap.h>
+#include <qdialog.h>
+#include "adatabase.h"
+#include "aobjectlist.h"
+#include "aform.h"
+#include "alog.h"
+
+
+/*!
+ *     \en
+ *     Craeate abstract aObjectListList.
+ *     \param parent - parent object
+ *     \param name - name of object
+ *     \_en
+ *     \ru
+ *     Создает абстрактный не связанный с базой данных объект управления данными.
+ *     Созданный таким образом объект не использует информацию из метаданных о составе и
+ *     типах полей. То есть он не является какой-либо моделью данных. И на самом деле малопригоден
+ *     для использования. В дазе данных ни как не отражается создание этого объекта. Для того,
+ *     что бы зарегистрировать вновь созданный абстрактный объект в базе данных, необходимо
+ *     сначала проинициализировать его с использованием метаданных, а затем вызвать метод New().
+ *     \_ru
+ */
+aObjectList::aObjectList( QObject *parent, const char *name )
+:QObject( parent, name )
+{
+       db = 0;
+       vInited = false;
+       filtred = false;
+       selectFlag = false;
+}
+
+
+
+/*!
+ *     \en
+ *     Create aObjectList, inited by md object.
+ *     md object finding by name
+ *     \param oname - md name of object, name contens prefix
+ *                             Document. for documents,
+ *                             InfoRegister. for information registers,
+ *                             Catalogue. for catalogues,
+ *                             AccumulationRegister. for Accumulation registers,
+ *                             DocJournal. for journals
+ *     \param adb - link on object aDataBase used for work
+ *     \param parent - parent object
+ *     \param name - name of object
+ *     \_en
+ *     \ru
+ *     Создает объект как модель данных, описанную в метаданных. На описание в метаданных
+ *     указывает один из передаваемых при вызове параметров - имя элемента метаданных.
+ *     После успешного создания объекта с ним можно работать как с объектом данных со структурой,
+ *     описанной в метаданных, и индентифицируемой именем, переданным в параметрах вызова.
+ *
+ *     \_ru
+ */
+aObjectList::aObjectList( const QString &oname, aDatabase *adb, QObject *parent, const char *name )
+:QObject( parent, name )
+{
+       vInited = false;
+       filtred = false;
+       selectFlag = false;
+       db = adb;
+       if ( adb )
+       {
+               obj = adb->cfg.find( oname );
+               setObject( obj );
+       }
+}
+
+
+
+/*!
+ *     Create aObjectList, inited by md object.
+ *     \param context - hi leve md object
+ *     \param adb - link on object aDataBase used for work
+ *     \param parent - parent object
+ *     \param name - name of object
+ */
+aObjectList::aObjectList( aCfgItem context, aDatabase *adb, QObject *parent, const char *name )
+:QObject( parent, name )
+{
+       filtred = false;
+       vInited = false;
+       db = adb;
+       if ( adb )
+       {
+               setObject( context );
+       }
+}
+
+
+
+/*!
+ *     virtual destructor.
+ */
+aObjectList::~aObjectList()
+{
+}
+
+
+
+/*!
+ *     Tune on metadata object and it's database tables.
+ *     \param adb - link on database object
+ *     \return error code
+ */
+ERR_Code
+aObjectList::init()
+{
+       if ( isInited() ) return err_noerror;
+       return initObject();
+}
+
+
+
+/*!
+ *     Set new object type after create
+ *     /param newobject - new md object
+ *     \return error code
+ */
+ERR_Code
+aObjectList::setObject( aCfgItem newobject )
+{
+       setInited( false );
+       obj = newobject;
+       return init();
+}
+
+
+
+/*!
+ *     Init object after create.
+ *     Need setObject( id ), where id - if of the metadata object of the adb->cfg loaded Configuration.
+ *     \return error code
+ */
+ERR_Code
+aObjectList::initObject()
+{
+       aCfgItem fg, f;
+       QString tname;
+
+       setInited( true );
+//     db = adb;
+       md = 0;
+       if ( db ) md = &db->cfg;
+       else
+       {
+               aLog::print(aLog::Error, tr("aObjectList have no database!"));
+               return err_nodatabase;
+       }
+       if ( obj.isNull() )
+       {
+               aLog::print(aLog::Error, tr("aObjectList md object not found"));
+               return err_objnotfound;
+       }
+       return err_noerror;
+}
+
+
+
+
+
+/*!
+ * Return field value of the primary object database table.
+ */
+QVariant
+aObjectList::Value( const QString & name )
+{
+
+       aDataTable *t = table;
+        if ( t ) return t->value( name );
+        return QVariant("");
+}
+
+
+
+/*!
+ * Set field value of the primary object database table.
+ */
+int
+aObjectList::SetValue( const QString & name, const QVariant &value )
+{
+       aDataTable *t = table;
+       if ( t )
+       {
+               t->setValue( name, value );
+               return err_noerror;
+       }
+       return err_notable;
+}
+
+
+
+/*!
+ *     Check object selecting.
+ *     \return true if object record selected in database.
+ */
+bool
+aObjectList::IsSelected()
+{
+       return selected();
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObjectList::IsMarkDeleted()
+{
+        aDataTable *t = table;
+        if ( t && t->sysFieldExists( "df" ) ) return t->sysValue( "df" ).toInt() == 1;
+        return false;
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObjectList::IsMarked()
+{
+        aDataTable *t = table;
+        if ( t && t->sysFieldExists( "mf" ) ) return t->sysValue( "mf" ).toInt() == 1;
+        return false;
+}
+
+
+
+/*!
+ *
+ */
+int
+aObjectList::SetMarkDeleted( bool Deleted )
+{
+       aDataTable *t = table;
+       if ( t && t->sysFieldExists( "df" ) )
+       {
+               QString v = "0";
+               if ( Deleted ) v = "1";
+               t->setSysValue( "df", QVariant( v ) );
+               return err_noerror;
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aObjectList have no system field %1").arg("df"));
+               return err_incorrecttype; // Object can not be mark deleted
+       }
+}
+
+
+
+/*!
+ *
+ */
+int
+aObjectList::SetMarked( bool Marked )
+{
+        aDataTable *t = table;
+        if ( t && t->sysFieldExists( "mf" ) ) {
+                QString v = "";
+                if ( Marked ) v = "1";
+                t->setSysValue( "mf", QVariant( v ) );
+//                t->printRecord();
+                return err_noerror;
+        }
+       aLog::print(aLog::Error, tr("aObjectList have no system field %1").arg("mf"));
+        return err_incorrecttype; // Object can not be marked
+}
+
+
+
+
+
+/*!
+ * \ru
+ *     Позиционирует указатель в БД на запись, соотвествующую объекту
+ *     с указанным идентификатором.
+ *     \param id - Идентификатор объекта.
+ *     \return возвращает код ошибки или 0 в случае успеха.
+ * \_ru
+ */
+ERR_Code
+aObjectList::select( qulonglong id )
+{
+       aDataTable * t = table;
+       if ( !t ) return err_notable;
+       setSelected (false);
+       long otype = db->uidType( id );
+       if ( !otype ) return err_objnotfound;
+//     if ( concrete && ( otype != t->getMdObjId() ) ) return err_incorrecttype;
+//     if ( !concrete )
+//     {
+               aCfgItem tmpObj = md->find( otype );
+               if ( tmpObj.isNull() ) return err_objnotfound;
+               setObject ( tmpObj );
+//     }
+       if ( t->select( QString("id=%1").arg(id), false ) )
+               if ( t->first() )
+               {
+//                     t->primeUpdate();
+                       setSelected (true);
+//                     t->printRecord();
+                       return err_noerror;
+               }
+               else return err_notselected;
+       return err_selecterror;
+}
+
+
+
+/*!
+ *
+ */
+ERR_Code
+aObjectList::select(const QString & query )
+{
+       aDataTable * t = table;
+       if ( !t ) return err_notable;
+       if (t->select(query))
+               if( t->first() )
+               {
+                       setSelected (true);
+                       return err_noerror;
+               }
+               else return err_notselected;
+       return err_selecterror;
+}
+
+
+
+
+
+/*!
+ *
+ */
+bool
+aObjectList::Next()
+{
+       return table->next();
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObjectList::Prev()
+{
+       return table->prev();
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObjectList::First()
+{
+       return table->first();
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObjectList::Last()
+{
+       return table->last();
+}
+
+/*!
+ *     \ru
+ *     Возвращает уникальный идентификатор объекта из базы данных.
+ *     В качестве объекта например может выступать "Приходная накладная" от такого-то числа за таким то номером.
+ *     Каждый вновь созданный в системе документ или элемент справочника, включая группы справочника имеет свой уникальный
+ *     неповторяющийся идентификатор. Если какое-либо поле, какого-либо объекта имеет тип Объект (например Document.Накладная),
+ *     то в качестве значения ему нужно задавать уникальный идентификатор объекта, возвращаемый функцией Uid().
+ *     Не существует возможности изменить существующий идентификатор какого-либо объекта. Созданием и управлением
+ *     идентификаторами объектов занимается система.
+ *     \return строка со значением уникального идентификатора.
+ *     \_ru
+ */
+QString
+aObjectList::Uid()
+{
+       return QString::number(getUid());
+}
+
+
+/*!
+ *
+ */
+qulonglong
+aObjectList::getUid()
+{
+       qulonglong Uid = 0;
+       if ( selected() ) Uid = table->sysValue("id").toULongLong();
+       return Uid;
+}
+
+
+
+/*!
+ *
+ */
+void
+aObjectList::setSelected( bool sel )
+{
+       selectFlag = sel;
+}
+
+
+
+/*!
+ *
+ */
+bool
+aObjectList::selected()
+{
+       return selectFlag;
+}
+
+
+
+/*!
+ *
+ */
+ERR_Code
+aObjectList::SetFilter( const QString & valname, const QVariant & value )
+{
+       aDataTable *t = table;
+       if ( !t ) return err_notable;
+       if ( t->setFilter( valname, value ) ) return err_noerror;
+       else return err_fieldnotfound;
+}
+
+
+
+/*!
+ *
+ */
+ERR_Code
+aObjectList::ClearFilter()
+{
+       aDataTable * t = table;
+       if ( !t ) return err_notable;
+       t->clearFilter();
+       return err_noerror;
+}
+
+
+
+
+/*!
+ *
+ */
+QString
+aObjectList::displayString()
+{
+       QString res="***";
+        int stdfc = 0, fid;
+        aCfgItem sw, f;
+
+       sw = displayStringContext();
+//     if ( md->objClass( obj ) == md_catalogue ) {
+//             sw = md->find( md->find( obj, md_element ), md_string_view );
+//     } else {
+//             sw = md->find( obj, md_string_view );
+//     }
+        if ( !sw.isNull() ) {
+                stdfc = md->attr( sw, mda_stdf ).toInt();
+                switch ( stdfc ) {
+                case 0:
+                        fid = md->sText( sw, md_fieldid ).toInt();
+                        res = table->sysValue( QString( "uf%1" ).arg( fid ) ).toString();
+//printf("fid=%i res=%s\n",fid, ( const char *) res );
+                        break;
+                case 1:
+                        break;
+                case 2:
+                        break;
+                }
+        }
+       else
+       {
+
+               aLog::print(aLog::Debug, tr("aObjectList display string context is null"));
+       }
+//     res =
+       return res;
+}
+
+
+
+
+aCfgItem
+aObjectList::displayStringContext()
+{
+       return md->find( obj, md_string_view );
+}
+
+
+
+aObject *
+aObjectList::currentObject() const
+{
+       return 0;
+}
diff --git a/src/lib/objects/aobjectlist.h b/src/lib/objects/aobjectlist.h
new file mode 100644 (file)
index 0000000..c2bf8a6
--- /dev/null
@@ -0,0 +1,112 @@
+/****************************************************************************
+** $Id: aobjectlist.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of the Ananas Objects List of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AOBJECTLIST_H
+#define AOBJECTLIST_H
+
+#include <qdatetime.h>
+#include "acfg.h"
+#include "asqltable.h"
+
+
+class aDatabase;
+class aObject;
+
+
+/*!
+ * \en
+ *     The parent object for hi level not visual objects lists
+ *     for worcs with SQL database
+ *     \_en
+ *     \ru
+
+*      \_ru
+ */
+class  ANANAS_EXPORT aObjectList : public QObject
+{
+       Q_OBJECT
+//     Q_PROPERTY( aObject currentObject READ currentObject )
+public:
+       aCfg * md;
+       aCfgItem obj;
+       aDatabase * db;
+
+       aObjectList( QObject *parent = 0, const char *name = 0 );
+       aObjectList( const QString &oname, aDatabase *adb, QObject *parent = 0, const char *name = 0 );
+       aObjectList( aCfgItem context, aDatabase *adb, QObject *parent = 0, const char *name = 0 );
+       virtual ~aObjectList();
+
+       ERR_Code init();
+       ERR_Code decodeDocNum( QString nm, QString & pref, int & num);
+       virtual ERR_Code select( qulonglong id );
+       qulonglong getUid();
+       bool selected();
+       void setSelected( bool sel );
+       ERR_Code select(const QString & query );
+
+//     virtual Q_ULLONG docId();
+
+
+public slots:
+       virtual aObject *currentObject() const;
+
+       virtual QString Uid();
+       virtual bool IsSelected();
+       virtual bool IsMarkDeleted();
+       virtual bool IsMarked();
+       virtual int SetMarkDeleted( bool Deleted );
+       virtual int SetMarked( bool Marked );
+       virtual QVariant Value( const QString & name );
+       virtual int SetValue( const QString & name, const QVariant &value );
+
+       virtual bool Next();
+       virtual bool Prev();
+       virtual bool First();
+       virtual bool Last();
+
+       virtual int SetFilter( const QString & valname, const QVariant & value );
+       virtual int ClearFilter();
+       virtual bool IsFiltred() {return filtred;};
+       virtual QString displayString();
+
+protected:
+       virtual aCfgItem displayStringContext();
+       virtual ERR_Code setObject( aCfgItem newobject );
+       virtual ERR_Code initObject();
+       bool isInited() { return vInited; };
+       void setInited( bool flag ){ vInited = flag; };
+private:
+       aDataTable *table;
+       bool vInited, selectFlag, filtred;
+       Q3Dict <aDataTable> dbtables;
+//     QDict <aDataRecord> attributes;
+};
+
+
+#endif
diff --git a/src/lib/objects/objects.pri b/src/lib/objects/objects.pri
new file mode 100644 (file)
index 0000000..6474384
--- /dev/null
@@ -0,0 +1,17 @@
+HEADERS += \
+    objects/aobject.h \
+    objects/aaregister.h \
+    objects/acatalogue.h \
+    objects/adocjournal.h \
+    objects/adocument.h \
+    objects/airegister.h \
+    objects/aobjectlist.h
+
+SOURCES += \
+    objects/aobject.cpp \ 
+    objects/aaregister.cpp \
+    objects/acatalogue.cpp \
+    objects/adocjournal.cpp \
+    objects/adocument.cpp \
+    objects/airegister.cpp \
+    objects/aobjectlist.cpp
diff --git a/src/lib/rclistviewitem.cpp b/src/lib/rclistviewitem.cpp
new file mode 100644 (file)
index 0000000..3a5a1e3
--- /dev/null
@@ -0,0 +1,69 @@
+/****************************************************************************
+** $Id: rclistviewitem.cpp,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Code file of the Ananas select database window
+** of Ananas Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include "rclistviewitem.h"
+#include "qpixmap.h"
+
+rcListViewItem::rcListViewItem( Q3ListView *parent,
+                       const QString &name,
+                       const QString &rc,
+                       bool fgroup): Q3ListViewItem( parent, name )
+       {
+               init( rc, fgroup );
+       };
+
+rcListViewItem::rcListViewItem( Q3ListView *parent,
+                       rcListViewItem* after,
+                       const QString &name,
+                       const QString &rc,
+                       bool fgroup ): Q3ListViewItem( parent, after, name )
+       {
+               init( rc, fgroup );
+       };
+
+rcListViewItem::rcListViewItem( rcListViewItem *parent,
+                       const QString &name,
+                       const QString &rc,
+                       bool fgroup): Q3ListViewItem( parent, name )
+       {
+               init( rc, fgroup );
+       };
+
+rcListViewItem::~rcListViewItem()
+       {
+//             rcfile = "";
+       };
+
+void
+rcListViewItem::init( const QString &rc, bool fgroup)
+       {
+               group = fgroup;
+               rcfile = rc;
+               if ( group ) setPixmap(0, QPixmap(":/images/lib_dbgroup.png") );
+               else setPixmap(0, QPixmap(":/images/lib_database.png") );
+       };
diff --git a/src/lib/rclistviewitem.h b/src/lib/rclistviewitem.h
new file mode 100644 (file)
index 0000000..8a99709
--- /dev/null
@@ -0,0 +1,71 @@
+/****************************************************************************
+** $Id: rclistviewitem.h,v 1.1 2008/11/05 21:16:28 leader Exp $
+**
+** Code file of the Ananas select database window
+** of Ananas Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef RCLISTVIEWITEM_H
+#define RCLISTVIEWITEM_H
+
+//#include <qdir.h>
+//#include <qstring.h>
+#include <q3listview.h>
+//#include <qlineedit.h>
+//#include <qstring.h>
+
+//#include "deditrc.h"
+//#include "acfgrc.h"
+//#include "atests.h"
+
+class Q3ListView;
+class Q3ListViewItem;
+
+class rcListViewItem : public Q3ListViewItem
+{
+public:
+       QString rcfile;
+       bool group;
+
+       rcListViewItem( Q3ListView *parent,
+                       const QString &name = QString::null,
+                       const QString &rc = QString::null,
+                       bool fgroup = false );
+
+       rcListViewItem( Q3ListView *parent,
+                       rcListViewItem* after,
+                       const QString &name = QString::null,
+                       const QString &rc = QString::null,
+                       bool fgroup = false );
+
+       rcListViewItem( rcListViewItem *parent,
+                       const QString &name = QString::null,
+                       const QString &rc = QString::null,
+                       bool fgroup = false );
+
+       virtual ~rcListViewItem();
+       void init( const QString &rc = QString::null, bool fgroup = false );
+};
+#endif
+
diff --git a/src/lib/report/acalctemplate.cpp b/src/lib/report/acalctemplate.cpp
new file mode 100644 (file)
index 0000000..393cbc6
--- /dev/null
@@ -0,0 +1,151 @@
+/****************************************************************************
+** $Id: acalctemplate.cpp,v 1.2 2008/11/08 20:16:36 leader Exp $
+**
+** Report metadata object header file of
+** Ananas application library
+**
+** Created : 20050202
+**
+** Copyright (C) 2003 by HaPK, email : theHaPK@yandex.ru
+** Copyright (C) 2003-2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "acalctemplate.h"
+#include "alog.h"
+
+#include <qdom.h>
+#include <qregexp.h>
+
+
+aCalcTemplate::aCalcTemplate() : aOOTemplate()
+{
+
+}
+
+aCalcTemplate::~aCalcTemplate()
+{
+}
+
+
+/**
+ *     \~english
+ *     Return true, if node contain tag
+ *     \~russian
+ *     Возвращает истину, когда текст ноды содержит тег с заданным именем.
+ *     \~
+ *     \param node - \~english context for searching \~russian узел, с которого осуществляется поиск. \~
+ *     \param sname - \~english tag name \~russian имя тега для поиска \~
+ *     \param params - \~english true, if find simple tag and false, if section
+ *                     \~russian true, если ищется обычный тег и false, если ищется тег секции \~
+ */
+bool
+aCalcTemplate::getNodeTags(QDomNode node, const QString &tagname, bool params )
+{
+       if(node.isText())
+       {
+               QString str = node.nodeValue();
+               QRegExp re;
+       //      printf("n->text=%s\n",str.ascii());
+               if(params)
+               {
+                       re.setPattern(QString("%1.*%2").arg(open_token).arg(close_token));
+               }
+               else
+               {
+                       re.setPattern(QString("%1.*%2").arg(open_token_section).arg(close_token_section));
+               }
+               re.setMinimal(true);
+               int pos = re.search(str,0);
+
+               while(pos != -1)
+               {
+       //              printf("find string =%s\n",str.mid(pos+2, re.matchedLength()-4).ascii());
+                       if(tagname == str.mid(pos+2, re.matchedLength()-4))
+                       {
+       //                      printf(">>>>>>>>>ok!\n");
+                               return true;
+                       }
+                       pos+= re.matchedLength();
+                       pos = re.search(str,pos);
+               }
+
+       }
+ return false;
+}
+
+
+
+QDomNode
+aCalcTemplate::getCellNode(QDomNode node)
+{
+       while(!node.parentNode().isNull())
+       {
+               QDomNode parent = node.parentNode();
+               if(parent.nodeName() == "table:table-cell")
+               {
+                       return parent;
+               }
+               else
+               {
+                       return getCellNode(parent);
+               }
+       }
+}
+
+ /**
+ *     \~english
+ *     Addes to tag value of parametr \a tagName
+ *     \~russian
+ *     Добавляет к тегу значение параметра \a tagName. После вызова этой функции тег не исчезает,
+ *     и к нему можно добавить еще значения, которые добавятся к концу текста, содержащего тег.
+ *     \~
+ *     \param node - \~english context \~russian узел к которому добавляется значение \~
+ *     \param sname - \~english tag name \~russian имя тега \~
+ */
+void
+aCalcTemplate::insertTagsValues(QDomNode node, const QString &tagName)
+{
+       QDomNode n = node;
+       QString val = getValue(tagName);
+       bool ok;
+       val.toDouble(&ok);
+       if(ok)
+       {
+               aLog::print(aLog::Debug, QString("aCalcTemplate  append  double value %1 to tag").arg(val));
+               QDomNode cellNode = getCellNode(n);
+               if(!cellNode.isNull())
+               {
+                       cellNode.toElement().setAttribute("office:value-type", "float");
+                       cellNode.toElement().setAttribute("office:value", val);
+               }
+               else
+               {
+                       aLog::print(aLog::Error, "aCalcTemplate cell not found\n");
+               }
+       }
+       else
+       {
+               aLog::print(aLog::Debug, "aCalcTemplate append string value to tag\n");
+       }
+       n.setNodeValue(n.nodeValue()+getValue(tagName));
+}
+
+
diff --git a/src/lib/report/acalctemplate.h b/src/lib/report/acalctemplate.h
new file mode 100644 (file)
index 0000000..0b43acd
--- /dev/null
@@ -0,0 +1,58 @@
+/****************************************************************************
+** $Id: acalctemplate.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Report metadata object header file of
+** Ananas application library
+**
+** Created : 20050202
+**
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef ACALCTEMPLATE_H
+#define ACALCTEMPLATE_H
+
+#include <qstring.h>
+#include <q3ptrlist.h>
+#include <q3valuestack.h>
+#include <qdom.h>
+
+#include "ananasglobal.h"
+#include "aootemplate.h"
+
+/**
+ * \en
+ * Class for work with pattern in OpenOffice Calc format
+ * \_en
+ * \ru
+ * \brief Класс определяет интерфейс для работы с шаблонами в формате OpenOffice Calc.
+ * \_ru
+ */
+class ANANAS_EXPORT aCalcTemplate : public aOOTemplate
+{
+public:
+       aCalcTemplate();
+       virtual ~aCalcTemplate();
+protected:
+       virtual bool getNodeTags(QDomNode node, const QString &tagname, bool params );
+       virtual void insertTagsValues(QDomNode node, const QString &tagName);
+       QDomNode getCellNode(QDomNode node);
+};
+#endif // ACALCTEMPLATE_H
diff --git a/src/lib/report/aootemplate.cpp b/src/lib/report/aootemplate.cpp
new file mode 100644 (file)
index 0000000..b42ac6d
--- /dev/null
@@ -0,0 +1,645 @@
+/****************************************************************************
+** $Id: aootemplate.cpp,v 1.2 2008/11/08 20:16:36 leader Exp $
+**
+** Report metadata object header file of
+** Ananas application library
+**
+** Created : 20050202
+**
+** Copyright (C) 2003 by HaPK, email : theHaPK@yandex.ru
+** Copyright (C) 2003-2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "aootemplate.h"
+#include "alog.h"
+
+#include <stdlib.h>
+#include <qfile.h>
+#include <q3dict.h>
+#include <qsqlquery.h>
+#include <q3process.h>
+#include <qdom.h>
+#include <qregexp.h>
+#include <qdatetime.h>
+#include <q3textstream.h>
+#include <QTextStream>
+
+
+aOOTemplate::aOOTemplate() : iTemplate()
+{
+
+}
+
+aOOTemplate::~aOOTemplate()
+{
+}
+
+/**
+ * \en
+ * Open pattern.
+ * \_en
+ * \ru
+ * Открывает шаблон. Распаковывает его во временный каталог в директории /tmp
+ * \_ru
+ * \param fname \ru имя шаблона\_ru
+ */
+bool
+aOOTemplate::open( const QString &fname )
+{
+       QDir dir;
+        QString temp;
+
+#ifndef Q_OS_WIN32
+       temp = getenv("TMPDIR");
+       if(temp=="" || temp.isEmpty())
+               temp = P_tmpdir;
+#else
+       temp = getenv("TEMP");
+#endif
+       copyName = QString(temp+"/%1").arg(QDateTime::currentDateTime().toTime_t());
+       copyName = QDir::convertSeparators(copyName);
+       aLog::print(aLog::Debug, tr("aOOTemplate temporary directory is %1").arg(copyName));
+//     printf("copy name = %s\n",copyName.ascii());
+       if(!dir.mkdir(copyName))
+       {
+               aLog::print(aLog::Error, tr("aOOTemplate create temporary directory %1").arg(copyName));
+               return false;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aOOTemplate create temporary directory %1").arg(copyName));
+       }
+#ifndef Q_OS_WIN32
+       Q3Process process( QString("unzip") );
+       process.setWorkingDirectory (templateDir);
+       process.addArgument( fname );
+       process.addArgument( "-d" );
+       process.addArgument( copyName );
+
+#else
+       Q3Process process( QString("7z") );
+       process.setWorkingDirectory ( templateDir);
+       //printf("working dir = `%s'\n", QString(templateDir).ascii());
+       process.addArgument( "x" );
+       process.addArgument( "-y" );
+       process.addArgument( QString("-o%1").arg(copyName) );
+       process.addArgument( fname );
+
+#endif
+
+       if( !process.start() )
+       {
+               aLog::print(aLog::Error, tr("aOOTemplate start unzip"));
+               return false;
+       }
+
+       while( process.isRunning() );
+
+       if( !process.normalExit() )
+       {
+               aLog::print(aLog::Error, tr("aOOTemplate unzip dead"));
+               return false;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aOOTemplate unzip normal"));
+       }
+       if( process.exitStatus() )
+       {
+               return false;
+       }
+
+       QFile content (QDir::convertSeparators( copyName+"/content.xml") );
+       docTpl.setContent( &content, false );
+
+       QFile style (QDir::convertSeparators( copyName+"/styles.xml") );
+       docStyle.setContent( &style, false );
+
+       aLog::print(aLog::Info, tr("aOOTemplate open"));
+return true;
+}
+/**
+ * \en
+ * Closes pattern. Deletes temporary files.
+ * \_en
+ *
+ * \ru
+ * Закрывает шаблон. Удаляет временные файлы.
+ * \_ru
+ */
+void
+aOOTemplate::close()
+{
+       values.clear();
+       //      QDir dir;
+       docTpl.clear();
+       docStyle.clear();
+#ifndef Q_OS_WIN32
+       system( "rm -Rf "+copyName);
+#else
+       system( "rd /S /Q \""+copyName+"\"");
+#endif
+       QDir dir;
+       dir.rmdir(copyName);
+
+}
+/**
+ * \en
+ * clears internal variable.
+ * \_en
+ * \ru
+ * Обнуляет внутренние переменные.
+ * \_ru
+ */
+void
+aOOTemplate::clear()
+{
+       values.clear();
+//     cleanUpTags();
+}
+/**
+ * \en
+ * Returns value parameter `name`
+ * \_en
+ * \ru
+ * Возвращает значение параметра по его имени.
+ * \_ru
+ */
+QString
+aOOTemplate::getValue( const QString &name )
+{
+       if(values.find( name )!=values.end())
+       {
+               return values.find( name ).data();
+       }
+       else
+       {
+               aLog::print(aLog::Info, tr("aOOTemplate value for field %1 not setted").arg(name));
+               return "";
+       }
+}
+
+/**
+ * \en
+ * Sets value parameter `name'
+ * \_en
+ * \ru
+ * Устанавливает значение параметра по его имени.
+ * \_ru
+ */
+void
+aOOTemplate::setValue( const QString &name, const QString &value )
+{
+       values[name]=value;
+}
+/**
+ * \en
+ * Execute replace tags to values.
+ * \_en
+ * \ru
+ * Выполняет подстановку значения параметра в шаблоне.
+ * Есть 2 типа тегов
+ *  \arg обычные теги
+ *  \arg секции - могут находиться ТОЛЬКО в строках таблицы.
+
+ * Для подстановки значений обычных тегов необходимо выполнить setValue() где name = PARAM (сейчас #define PARAM "param") а value - значение для подстановки. Потом выполнить exec() с параметром = имени тега.
+ * Для подстановки секций необходимо задать нужные параметры, используя setValue()
+ * а потом выполнить exec() с именем секции.
+ * exec может вызываться нужное число раз как для обычных тегов, так и для секций
+ * \_ru
+ */
+QString
+aOOTemplate::exec( const QString &sname )
+{
+       setValue(sname, getValue(PARAM));
+       //search tags in content
+       QDomNode n = docTpl.lastChild();
+       while( !n.isNull() )
+       {
+               searchTags(n, sname);
+               n = n.previousSibling();
+       }
+       //search tags in colontituls
+       n = docStyle.lastChild();
+       while( !n.isNull() )
+       {
+               searchTags(n, sname);
+               n = n.previousSibling();
+       }
+       return docTpl.toString();
+
+}
+/**
+ *     \~english
+ *     Added value to end tag with name `sname'. Don't deletes tag.
+ *     \~russian
+ *     Рекурсивная функция поиска и замены тегов на их значения в node.
+ *     Не заменяет теги, а дописывает значения в конец.
+ *     Для удаления тэгов используйте функцию cleanUpTags()
+ *     \~
+ *     \param node - \~english context for searching \~russian узел, с которого осуществляется поиск. \~
+ *     \param sname - \~english tag name \~russian имя тега для поиска \~
+ *     \see cleanUpTags() getNodeTags() insertRowValues()
+ */
+void
+aOOTemplate::searchTags(QDomNode node, const QString &sname )
+{
+QDomNode n = node.lastChild();
+       while( !n.isNull() )
+       {
+
+       //      printf("n->name=%s\n",n.nodeName().ascii());
+               bool res = getNodeTags(n, sname, false);
+               if( res )
+               {
+                       insertRowValues(n);
+               }
+               else
+               {
+                       res = getNodeTags(n, sname, true);
+                       if(res)
+                       {
+                               insertTagsValues(n, sname);
+                       }
+                       else
+                       {
+                               searchTags(n, sname);
+                       }
+               }
+               n = n.previousSibling();
+       }
+}
+/**
+ *     \~english
+ *     Return true, if node contain tag
+ *     \~russian
+ *     Возвращает истину, когда текст ноды содержит тег с заданным именем.
+ *     \~
+ *     \param node - \~english context for searching \~russian узел, с которого осуществляется поиск. \~
+ *     \param sname - \~english tag name \~russian имя тега для поиска \~
+ *     \param params - \~english true, if find simple tag and false, if section
+ *                     \~russian true, если ищется обычный тег и false, если ищется тег секции \~
+ */
+bool
+aOOTemplate::getNodeTags(QDomNode node, const QString &tagname, bool params )
+{
+       if(node.isText())
+       {
+               QString str = node.nodeValue();
+               QRegExp re;
+       //      printf("n->text=%s\n",str.ascii());
+               if(params)
+               {
+                       re.setPattern(QString("%1.*%2").arg(open_token).arg(close_token));
+               }
+               else
+               {
+                       re.setPattern(QString("%1.*%2").arg(open_token_section).arg(close_token_section));
+               }
+               re.setMinimal(true);
+               int pos = re.search(str,0);
+
+               while(pos != -1)
+               {
+       //              printf("find string =%s\n",str.mid(pos+2, re.matchedLength()-4).ascii());
+                       if(tagname == str.mid(pos+2, re.matchedLength()-4))
+                       {
+       //                      printf(">>>>>>>>>ok!\n");
+                               return true;
+                       }
+                       pos+= re.matchedLength();
+                       pos = re.search(str,pos);
+               }
+
+       }
+ return false;
+}
+
+/**
+ *     \~english
+ *     insert new row in table and replace tag to value
+ *     \~russian
+ *     Вставляет новую строку в таблицу, заменяет теги на значения, удаляет тег секции из строки таблицы.
+ *     Выполняет рекурсивный поиск узла, содержащего строку таблицы. У этого узла в OpenOffic'е есть
+ *     специальное имя, которое распознается функцией. После того, как узел найден, строка строка дублируется,
+ *     а из текущей строки удаляются все теги секции, чтобы избежать мнократного размножения строк таблицы.
+ *     \~
+ *     \see searchTags()
+ */
+void
+aOOTemplate::insertRowValues(QDomNode node)
+{
+       QDomNode n = node;
+       while(!n.parentNode().isNull())
+       {
+               n = n.parentNode();
+               if( n.nodeName()=="table:table-row" )
+               {
+                       n.parentNode().insertAfter(n.cloneNode(true),n);
+                       clearTags(n,true);
+                       QMap<QString,QString>::Iterator it;
+                       for ( it = values.begin(); it != values.end(); ++it )
+                       {
+                               searchTags(n,it.key());
+                       }
+
+               }
+       }
+}
+
+
+ /**
+ *     \~english
+ *     Addes to tag value of parametr \a tagName
+ *     \~russian
+ *     Добавляет к тегу значение параметра \a tagName. После вызова этой функции тег не исчезает,
+ *     и к нему можно добавить еще значения, которые добавятся к концу текста, содержащего тег.
+ *     \~
+ *     \param node - \~english context \~russian узел к которому добавляется значение \~
+ *     \param sname - \~english tag name \~russian имя тега \~
+ */
+void
+aOOTemplate::insertTagsValues(QDomNode node, const QString &tagName)
+{
+       QDomNode n = node;
+       n.setNodeValue(n.nodeValue()+getValue(tagName));
+}
+
+/**
+ * \en
+ * clears all tags from pattern
+ * \_en
+ * \ru
+ * Удаляет все теги из документа, а также строки, в которых содержится тег секции
+ * \_ru
+ */
+void
+aOOTemplate::cleanUpTags()
+{
+
+       //clear tags in content
+       QDomNode n = docTpl.lastChild();
+       while( !n.isNull() )
+       {
+               clearTags(n,false);
+       //      clearRow(n);
+               n = n.previousSibling();
+       }
+       n = docTpl.lastChild();
+       while( !n.isNull() )
+       {
+       //      clearTags(n,false);
+               clearRow(n);
+               n = n.previousSibling();
+       }
+
+       //clear tags in colontituls
+       n = docStyle.lastChild();
+       while( !n.isNull() )
+       {
+               clearTags(n,false);
+       //      clearRow(n);
+               n = n.previousSibling();
+       }
+       n = docStyle.lastChild();
+       while( !n.isNull() )
+       {
+       //      clearTags(n,false);
+               clearRow(n);
+               n = n.previousSibling();
+       }
+}
+
+
+
+ /**
+ *     \~english
+ *     Deletes tags from \a node
+ *     \~russian
+ *     Удаляет рекурсивно теги из \a node.
+ *     \~
+ *     \param node - \~english context \~russian узел из которого нужно удалить теги \~
+ *     \param section - \~russian true, если надо удалить тег секции \~
+ */
+void
+aOOTemplate::clearTags(QDomNode node, bool section )
+{
+       if(node.isNull()) return;
+
+       QDomNode n = node.lastChild();
+       while( !n.isNull() )
+       {
+               if(n.isText())
+               {
+                       QString str = n.nodeValue();
+                       QRegExp re;
+       //              printf("n->text tag = %s\n",str.ascii());
+                       if(section)
+                       {
+                               re.setPattern(QString("%1.*%2").arg(open_token_section).arg(close_token_section));
+                       }
+                       else
+                       {
+                               re.setPattern(QString("%1.*%2").arg(open_token).arg(close_token));
+                       }
+                       re.setMinimal(true);
+                       int pos = re.search(str,0);
+
+                       while(pos != -1)
+                       {
+                               str = str.remove(re);
+                               //printf("str = %s\n",str.ascii());
+                               pos = re.search(str,0);
+                       }
+                       n.setNodeValue(str);
+
+               }
+               else
+               {
+                       clearTags(n,section);
+               }
+               n = n.previousSibling();
+       }
+
+}
+
+/**
+ *     \~english
+ *     Deletes row, having section tag
+ *     \~russian
+ *     Рекурсивная функция. Удаляет строки, содержащие тег секции
+ *     \~
+*      \param node - \~english context \~russian узел из которого нужно удалить строки \~
+ */
+void
+aOOTemplate::clearRow(QDomNode node)
+{
+QDomNode n = node.lastChild();
+       while( !n.isNull() )
+       {
+               if(n.isText())
+               {
+                       QString str = n.nodeValue();
+                       QRegExp re;
+       //printf("n->text row=%s\n",str.ascii());
+                       re.setPattern(QString("%1.*%2").arg(open_token_section).arg(close_token_section));
+                       re.setMinimal(true);
+                       int pos = re.search(str,0);
+                       if(pos!=-1)
+                       {
+       //                      printf(">>>find string =%s\n",str.ascii());
+                               QDomNode tmp = n;
+                               while(!tmp.parentNode().isNull())
+                               {
+                                       tmp = tmp.parentNode();
+                                       if( tmp.nodeName()=="table:table-row" )
+                                       {
+       //                                      printf("row removed\n");
+                                               tmp.parentNode().removeChild(tmp);
+                                               break;
+                                       }
+                               }
+                       }
+                       //n.setNodeValue(str);
+
+               }
+               else
+               {
+                       //clearTags(n);
+                       clearRow(n);
+               }
+               n = n.previousSibling();
+       }
+
+}
+/**
+ * \en
+ * Returns patten
+ * \_en
+ * \ru
+ * Возвращает результат, т.е. шаблон в текстовом виде. Включена в интерфейс временно.
+ * \_ru
+ */
+QString
+aOOTemplate::result()
+{
+       return docTpl.toString();
+}
+/**
+ * \en
+ * Save pattern
+ * \_en
+ * \ru
+ * Сохраняет шаблон в файл с заданным именем. Перед сохранением необходимо выполнить функцию cleanUpTags() чтобы удалить тэги из сохраняемого документа.
+ * \_ru
+ */
+bool
+aOOTemplate::save( const QString & fname )
+{
+
+       QString homeDir = QString("%1").arg(QDir::convertSeparators(QDir::homeDirPath ()));
+       QFile fContent( QDir::convertSeparators(copyName+"/content.xml") );
+       if( !fContent.open( QIODevice::WriteOnly ) )
+       {
+               aLog::print(aLog::Error, tr("aOOTemplate save %1 open for write").arg(fContent.name()));
+               return false;
+       }
+       QTextStream stream4content(&fContent);
+       docTpl.save(stream4content,2);
+       fContent.close();
+
+       QFile fStyle( QDir::convertSeparators(copyName+"/styles.xml") );
+       if( !fStyle.open( QIODevice::WriteOnly ) )
+       {
+               aLog::print(aLog::Error, tr("aOOTemplate save %1 open for write").arg(fContent.name()));
+               return false;
+       }
+       QTextStream stream4styles(&fStyle);
+       docStyle.save(stream4styles,2);
+       fStyle.close();
+
+
+
+       QString curDir;// = QDir::convertSeparators(QDir::irPath());
+       curDir = QDir::convertSeparators(templateDir);
+       aLog::print(aLog::Debug, tr("aOOTemplate save working dir =%1").arg(curDir));
+
+#ifndef Q_OS_WIN32
+
+       Q3Process process( QString("zip") );
+       process.setWorkingDirectory(copyName);
+       process.addArgument( "-r" );
+       process.addArgument( fname );
+       process.addArgument(".");
+#else
+       Q3Process process( QString("7z") );
+       process.setWorkingDirectory(copyName);
+       process.addArgument( "a" );
+       process.addArgument( "-tzip" );
+       process.addArgument( fname );
+       process.addArgument( "-r" );
+       process.addArgument(".");
+#endif
+
+
+
+       if( !process.start() )
+       {
+               aLog::print(aLog::Error, tr("aOOTemplate start zip"));
+               return false;
+       }
+
+       while( process.isRunning() );
+
+       if( !process.normalExit() )
+       {
+               aLog::print(aLog::Error, tr("aOOTemplate zip dead"));
+               return false;
+       }
+       else
+       {
+               aLog::print(aLog::Debug, tr("aOOTemplate zip normal to %1").arg(fname));
+       }
+       if( process.exitStatus() )
+       {
+               return false;
+       }
+       return true;
+}
+void
+aOOTemplate::setDir(const QString &dir)
+{
+       templateDir = dir;
+}
+
+QString
+aOOTemplate::getDir()
+{
+       QString homeDir = QString("%1").arg(QDir::convertSeparators(QDir::homeDirPath ()));
+#ifdef Q_OS_WIN32
+       if(homeDir.right(1)!="\\") homeDir.append("\\");
+#else
+
+       if(homeDir.right(1)!="/") homeDir.append("/");
+#endif
+       return QDir::convertSeparators(homeDir);
+}
+
diff --git a/src/lib/report/aootemplate.h b/src/lib/report/aootemplate.h
new file mode 100644 (file)
index 0000000..3a83ce9
--- /dev/null
@@ -0,0 +1,146 @@
+/****************************************************************************
+** $Id: aootemplate.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Report metadata object header file of
+** Ananas application library
+**
+** Created : 20050202
+**
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef AOOTEMPLATE_H
+#define AOOTEMPLATE_H
+
+#include <qstring.h>
+#include <q3ptrlist.h>
+#include <q3valuestack.h>
+#include <qdom.h>
+#include <QMap>
+
+#define open_token "<:"
+#define close_token ":>"
+#define open_token_section "\\[:"
+#define close_token_section ":\\]"
+#define PARAM "param"
+
+#include "ananasglobal.h"
+#include "itemplate.h"
+
+/**
+ * \en
+ * Class for work with pattern in OpenOffice format
+ * \_en
+ * \ru
+ * \brief Класс определяет интерфейс для работы с шаблонами в формате OpenOffice. Наследует iTemplate.
+ *
+ * Описание шаблона: \n
+ * Шаблон представляет собой обычный документ OpenOffice.
+ * Он предназначен для того, чтобы быстро создавать отчеты.
+ * Внешне шаблон отличается от того документа, который необходимо сгенерировать
+ * только наличием специальных тегов.
+ * Эти теги при генерации заменяются на конкретные значения. \n
+ * Предусмотрено два типа тегов: \n
+ * 1) Тег секции \n
+ * С помощью него можно размножать строки таблицы.
+ * Для этого надо просто записать его в любую ячейку строки. \n
+ * Формат тега [:имя тега:] \n
+ * В имени допустимы любые символы. \n
+ * При вызове exec() с параметром = имени этого тега к таблице будет добавлена еще
+ * одна строка. Если в этой строке есть простые теги,
+ * то произойдет замена тега на значение, заданное с помощью функции setValue() \n
+ * 2) Простой тег. \n
+ * С помощью него можно вставлять в документ обычный текст, дату, и т.п. \n
+ * формат тега <:имя тега:> \n
+ * При вызове exec() с параметром = имени этого тега, рядом допишется значение,
+ * предварительно заданное с помощью функции setValue() \n
+ * Функция setValue() задает значения для подстановки.
+ * Для прстых тегов надо задавать setValue("param",значение для подстановки);
+ * после чего надо выполнить exec(имя простого тега) \n
+ * Для тегов секции setValue(имя простого тега, значение для подстановки);
+ * после чего выполнить exec(имя секции);
+ * \_ru
+ */
+class ANANAS_EXPORT aOOTemplate : public iTemplate
+{
+public:
+       aOOTemplate();
+       virtual ~aOOTemplate();
+       virtual bool open( const QString &fname );
+       virtual void close();
+       virtual void clear();
+       virtual QString getValue( const QString &name );
+       virtual void setValue( const QString &name, const QString &value );
+       virtual QString exec( const QString &sname );
+       virtual QString result();
+       virtual bool save( const QString & fname );
+       virtual void setDir( const QString &dirName );
+       virtual QString getDir();
+       virtual void cleanUpTags();
+protected:
+/**
+ * \en
+ * directory name for unzip
+ * \_en
+ * \ru
+ * Имя директории для распаковки
+ * \_ru
+ */
+       QString copyName;
+       protected:
+/**
+ * \en
+ * directory template name
+ * \_en
+ * \ru
+ * Имя директории шаблонов
+ * \_ru
+ */
+       QString templateDir;
+
+       QMap<QString,QString> values;
+
+       void searchTags(QDomNode node, const QString &sname );
+       virtual bool getNodeTags(QDomNode node, const QString &tagname, bool params );
+       void insertRowValues(QDomNode node);
+       virtual void insertTagsValues(QDomNode node, const QString &tagName);
+       void clearTags(QDomNode node, bool section );
+       void clearRow(QDomNode node);
+/**
+ * \en
+ *     Variable for store unpacking teplate content
+ * \_en
+ * \ru
+ *     Переменная для хранения содержимого распакованного шаблона.
+ * \_ru
+ */
+       QDomDocument docTpl;
+
+/**
+ * \en
+ *     Variable for store unpacking teplate stales
+ * \_en
+ * \ru
+ *     Переменная для хранения стилей (колонтитулы в т.ч.) распакованного шаблона.
+ * \_ru
+ */
+       QDomDocument docStyle;
+};
+#endif // AOOTEMPLATE_H
diff --git a/src/lib/report/areport.cpp b/src/lib/report/areport.cpp
new file mode 100644 (file)
index 0000000..9216c61
--- /dev/null
@@ -0,0 +1,574 @@
+/****************************************************************************
+** $Id: areport.cpp,v 1.2 2008/11/08 20:16:36 leader Exp $
+**
+** Report metadata object implementation file of
+** Ananas application library
+**
+** Created : 20040701
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include       <qlayout.h>
+#include       <q3toolbar.h>
+#include       <qaction.h>
+#include       <q3vbox.h>
+#include       <q3simplerichtext.h>
+#include       <qpainter.h>
+#include       <q3paintdevicemetrics.h>
+#include       <qkeysequence.h>
+#include       <qprinter.h>
+#include       <q3process.h>
+#include       <qmessagebox.h>
+#include       <q3filedialog.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include       "acfg.h"
+#include       "aobject.h"
+#include       "adatabase.h"
+#include       "areport.h"
+#include       "acalctemplate.h"
+#include       "aservice.h"
+#include       "alog.h"
+#include       "stdlib.h"
+/*!
+*      \en
+*      Constuct object
+*      \_en
+*      \ru
+*      Создает объект
+*      \_ru
+*/
+aReportBrowser::aReportBrowser(  QWidget *parent, const char *name, Qt::WFlags f )
+:Q3MainWindow( parent, name, f )
+{
+       QAction *a;
+
+       Q3ToolBar *t = new Q3ToolBar( this, "ReportTool" );
+       a = new QAction(
+       //QPixmap::fromMimeSource("print.png"),
+       QPixmap(":/images/print.png"),
+       tr("Print"),
+       QKeySequence("Ctrl+P"),
+       t,
+       tr("Print report")
+       );
+       a->addTo( t );
+       connect( a, SIGNAL( activated() ), this, SLOT( print() ) );
+       t->show();
+
+       textBrowser = new Q3TextBrowser( this, "textBrowser" );
+       textBrowser->setTextFormat( Qt::RichText );
+       textBrowser->setFocus();
+//     textBrowser->showMaximized();
+       setCentralWidget( textBrowser );
+//     if ( layout() ) delete layout();
+//     QGridLayout *l = new QGridLayout( this );
+//     l->addWidget( textBrowser, 1, 0 );
+       languageChange();
+}
+
+
+
+/*!
+*      \en
+*      Appends text to browser.
+*      \_en
+*      \ru
+*      Добавляет текст в браузер
+*      \_ru
+*      \param text - \en text to append \_en \ru текст для добавления \_ru
+*/
+void
+aReportBrowser::append( const QString &text )
+{
+       textBrowser->append( text );
+}
+
+
+
+/*!
+*      \en
+*      Clears browser.
+*      \_en
+*      \ru
+*      Очищает браузер
+*      \_ru
+*/
+void
+aReportBrowser::clear()
+{
+       textBrowser->clear();
+}
+
+
+
+/*!
+*      \en
+*      Print browser content.
+*      \_en
+*      \ru
+*      Печатает содержимое браузера.
+*      \_ru
+*/
+void
+aReportBrowser::print()
+{
+       QPrinter printer;
+       QPainter p;
+
+       if (!printer.setup()) return;
+       if ( p.begin( &printer ) ){
+            Q3PaintDeviceMetrics metrics( p.device() );
+            int dpiy = metrics.logicalDpiY();
+            int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins
+            QRect body( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin );
+            Q3SimpleRichText richText( textBrowser->text(),
+                                      QFont(),
+                                      textBrowser->context(),
+                                      textBrowser->styleSheet(),
+                                      textBrowser->mimeSourceFactory(),
+                                      body.height() );
+            richText.setWidth( &p, body.width() );
+            QRect view( body );
+            int page = 1;
+            do {
+                richText.draw( &p, body.left(), body.top(), view, colorGroup() );
+                view.moveBy( 0, body.height() );
+                p.translate( 0 , -body.height() );
+                p.drawText( view.right() - p.fontMetrics().width( QString::number( page ) ),
+                            view.bottom() + p.fontMetrics().ascent() + 5, QString::number( page ) );
+                if ( view.top()  >= richText.height() )
+                    break;
+                printer.newPage();
+                page++;
+            } while (TRUE);
+       }
+}
+
+
+
+/**!
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void aReportBrowser::languageChange()
+{
+}
+
+
+
+/*!
+*      \en
+*      Constuct object
+*      \_en
+*      \ru
+*      Создает объект
+*      \param context - объект метаданных для инициализации.
+*      \param report_type - тип отчета. RT_text - для отчета в формате HTML, RT_office - для отчета в формате OpenOffice
+*      \param e - енжин.
+*      \_ru
+*/
+aReport::aReport( aCfgItem context, RT_type report_type, aEngine * e )
+:aObject( context, 0, 0, "aReport")
+{
+       engine = e;
+       md = e->md;
+       browser = new aReportBrowser( e->ws );
+       type = report_type;
+       if(report_type==RT_text)
+       {
+               tpl = new aTemplate();
+       }
+       if(report_type == RT_office_writer)
+       {
+               tpl = new aOOTemplate();
+       }
+       if(report_type==RT_office_calc)
+       {
+               tpl = new aCalcTemplate();
+       }
+}
+
+
+
+/*!
+*      \en
+*      Constuct object
+*      \_en
+*      \ru
+*      Создает объект
+*      \param name - имя объекта.
+*      \param report_type - тип отчета. RT_text - для отчета в формате HTML, RT_office - для отчета в формате OpenOffice
+*      \param e - енжин.
+*      \_ru
+*/
+aReport::aReport(QString name, RT_type report_type, aEngine * e )
+:aObject( name, 0, 0, "aReport")
+{
+       engine = e;
+       md = e->md;
+       browser = new aReportBrowser( e->ws );
+       type = report_type;
+       if(report_type==RT_text)
+       {
+               tpl = new aTemplate();
+       }
+       if(report_type == RT_office_writer)
+       {
+               tpl = new aOOTemplate();
+       }
+       if(report_type == RT_office_calc)
+       {
+               tpl = new aCalcTemplate();
+       }
+}
+
+
+
+/*!
+*      \en
+*      Destructor
+*      \_en
+*      \ru
+*      Деструктор
+*      \_ru
+*/
+aReport::~aReport()
+{
+       if(tpl)
+       {
+               delete tpl;
+               tpl=0;
+       }
+}
+
+
+
+/*!
+*      \en
+*      Init object.
+*      \_en
+*      \ru
+*      Инициализирует объект. Объект не содержит никаких таблиц в базе данных.
+*      \_ru
+*/
+ERR_Code
+aReport::initObject()
+{
+       ERR_Code err = aObject::initObject();
+       if ( err ) return err;
+       return err_noerror;
+}
+
+
+
+/*!
+*      \en
+*      Set template.
+*      \_en
+*      \ru
+*      Задает имя файла шаблона. Расширение указывать необходимо.
+*      \_ru
+*      \param name - \en template name \_en \ru имя шаблона \_ru
+*      \see path2workdir()
+*/
+void
+aReport::setTable( const QString &name )
+{
+       tpl->setDir(path2workdir());
+       tpl->open( name );
+       tplName = name;
+}
+
+
+
+/*!
+*      \en
+*      Sets tag value.
+*      \_en
+*      \ru
+*      Задает значение тега.
+*      \_ru
+*      \param name - \en tag name \_en \ru имя тега \_ru
+*      \param value - \en tag value \_en \ru значение тега \_ru
+*/
+void
+aReport::setValue( const QString &name, const QString &value )
+{
+       tpl->setValue( name, value );
+}
+
+
+
+/*!
+*      \en
+*      Gets tag value.
+*      \_en
+*      \ru
+*      Возвращает значение тега.
+*      \_ru
+*      \param name - \en tag name \_en \ru имя тега \_ru
+*      \return \en tag value \_en \ru значение тега \_ru
+*/
+QString
+aReport::value( const QString &name )
+{
+       return tpl->getValue( name );
+}
+
+
+
+/*!
+*      \en
+*      Clear browser content.
+*      \_en
+*      \ru
+*      Очищает содержимое браузра. Используется для текстово отчета.
+*      \_ru
+*/
+void
+aReport::clear()
+{
+       browser->clear();
+}
+
+
+
+/*!
+*      \en
+*      Update report value.
+*      \_en
+*      \ru
+*      Обновляет репорт на основе заданных перед этим функцией setValue() значений.
+*      \_ru
+*/
+void
+aReport::exec( const QString &section )
+{
+       tpl->exec( section );
+}
+
+
+
+/*!
+*      \en
+*      Shows report.
+*      \_en
+*      \ru
+*      Показывает отчет.
+*      \_ru
+*/
+void
+aReport::show()
+{
+       if(type==RT_text)
+       {
+               browser->textBrowser->setText( tpl->result() );
+               browser->show();
+       }
+       if(type==RT_office_writer || type==RT_office_calc)
+       {
+               QString fileName = getName4NewTemplate();
+               tpl->cleanUpTags();
+               tpl->save(fileName);
+               QString startCatalog = "/usr/bin";
+               QString filter;
+               bool sofficeFound = false;
+
+               bool ok;
+               QString oowriter = aService::readConfigVariable("OpenOfficeExecutable", &ok);
+               if(!ok || oowriter == "" )
+               {
+#ifdef Q_OS_WIN32
+                       aLog::print(aLog::Info,tr("aReport OpenOfficeExecutable not found in registery"));
+                       startCatalog = QString("%1\\Program Files\\OpenOffice.org1.1.1\\program").arg(getenv("HOMEDRIVE"));
+                       QFile soffice(startCatalog + "\\soffice.exe");
+                       if(!soffice.exists())
+                       {
+                               startCatalog = QString("%1\\Program Files\\OpenOffice.org 2.0\\program").arg(getenv("HOMEDRIVE"));
+                               soffice.setName(startCatalog + "\\soffice.exe");
+                               if(!soffice.exists())
+                               {
+                                       startCatalog = QString("%1\\Program Files").arg(getenv("HOMEDRIVE"));
+                               }
+                               else
+                               {
+                                       aService::writeConfigVariable("OpenOfficeExecutable",startCatalog + "\\soffice.exe");
+                                       aLog::print(aLog::Info,tr("aReport OpenOfficeExecutable found %1").arg(startCatalog + "\\soffice.exe"));
+                               }
+                       }
+                       else
+                       {
+                               aService::writeConfigVariable("OpenOfficeExecutable",startCatalog + "\\soffice.exe");
+                               aLog::print(aLog::Info,tr("aReport OpenOfficeExecutable found %1").arg(startCatalog + "\\soffice.exe"));
+                       }
+                       filter = "Executable files (*.exe)";
+#else
+                       aLog::print(aLog::Info,tr("aReport OpenOfficeExecutable not found in ~/.ananas/configrc"));
+                       QFile soffice(startCatalog + "/ooffice");
+                       if(!soffice.exists())
+                       {
+                               soffice.setName(startCatalog + "/ooffice2");
+                               if(soffice.exists())
+                               {
+                                       aService::writeConfigVariable("OpenOfficeExecutable",startCatalog + "/ooffice2");
+                                       aLog::print(aLog::Info,tr("aReport OpenOfficeExecutable found %1").arg(startCatalog + "/ooffice2"));
+                               }
+                       }
+                       else
+                       {
+                               aService::writeConfigVariable("OpenOfficeExecutable",startCatalog + "/ooffice");
+                               aLog::print(aLog::Info,tr("aReport OpenOfficeExecutable found %1").arg(startCatalog + "/ooffice"));
+                       }
+#endif
+               }
+               oowriter = aService::readConfigVariable("OpenOfficeExecutable", &ok);
+               if(!ok || oowriter == "" )
+               {
+
+                       Q3FileDialog dlg(0,"select_file_dialog",true);
+                       dlg.addFilter( filter );
+                       dlg.setMode(Q3FileDialog::ExistingFile);
+                       dlg.setDir(QDir(startCatalog));
+                       dlg.setCaption("Для отображения отчета необходим OpenOffice. Укажите исполняемый файл OpenOffice");
+                       if(dlg.exec()==QDialog::Accepted)
+                       {
+                               oowriter = dlg.selectedFile();
+                               //printf("select %s", oowriter.ascii());
+                               Q3Process process( oowriter );
+                               process.addArgument( "-n" );
+                               process.addArgument( QDir::convertSeparators( fileName ) );
+                               if( !process.start() )
+                               {
+                                       QMessageBox::warning(0, tr("Warning"), tr("Unable to start OpenOffice (%1)").arg(oowriter), QMessageBox::Ok,QMessageBox::NoButton);
+//                      printf("Unable to start OpenOffice Writer\n");
+                               }
+                               else
+                               {
+                                       aService::writeConfigVariable("OpenOfficeExecutable",oowriter);
+                                       aLog::print(aLog::Info,tr("aReport OpenOfficeExecutable set to %1").arg(oowriter));
+                               }
+                       }
+               }
+               else
+               {
+
+                       Q3Process process( oowriter );
+                       process.addArgument( "-n" );
+                       process.addArgument( QDir::convertSeparators( fileName ) );
+                       if( !process.start() )
+                       {
+                               QMessageBox::warning(0, tr("Warning"), tr("Unable to start OpenOffice (%1)").arg(oowriter), QMessageBox::Ok,QMessageBox::NoButton);
+//                      printf("Unable to start OpenOffice Writer\n");
+                       }
+                       else
+                       {
+                               aService::writeConfigVariable("OpenOfficeExecutable",oowriter);
+                               aLog::print(aLog::Info,tr("aReport OpenOfficeExecutable set to %1").arg(oowriter));
+                       }
+               }
+
+               //tpl->open( tplName );
+       }
+}
+
+
+
+/*!
+*      \en
+*      Return path to working dir.
+*      \_en
+*      \ru
+*      Возвращает путь к рабочей директории.
+*      \_ru
+*      \see setTable( const QString &name )
+*/
+QString
+aReport::path2workdir()
+{
+       QString res;
+#ifndef Q_OS_WIN32
+       res = "/usr/share/ananas/";
+#else
+       res = "";
+#endif
+       if(md!=NULL)
+       {
+               res = md->rc.value("workdir");
+       }
+       aLog::print(aLog::Debug, tr("aReport working dir = %1").arg(res));
+       return res;
+}
+
+
+
+/*!
+*      \en
+*      Close report.
+*      \_en
+*      \ru
+*      Закрывает отчет. Удаляет временные файлы.
+*      \_ru
+*/
+void
+aReport::close()
+{
+       tpl->close();
+}
+
+
+/*!
+*      \en
+*      Gets name for new template. Need for OpenOffice v2.
+*      \_en
+*      \ru
+*      Получение имени для нового шаблона. Нужна из-за блокировок в OpenOffice v2.
+*      \_ru
+*/
+QString
+aReport::getName4NewTemplate()
+{
+       uint count=0;
+       QFile tmpf;
+       QString suff = ".odt";
+       QString fname;
+       if(type==RT_office_calc) suff = ".ods";
+       do
+       {
+               // tpl->getDir() должно заканчиваться на /
+               fname =  QDir::convertSeparators(QString(tpl->getDir()+".ananas-report%1%2").arg(count).arg(suff));
+               tmpf.setName(fname);
+               if(tmpf.exists())
+               {
+                       if(tmpf.remove()) break;
+                       else ++count;
+               }
+               else
+               {
+                       break;
+               }
+       }while(count<100);
+
+       aLog::print(aLog::Debug, tr("aReport name for template = %1").arg(fname));
+       return fname;
+}
diff --git a/src/lib/report/areport.h b/src/lib/report/areport.h
new file mode 100644 (file)
index 0000000..5e59def
--- /dev/null
@@ -0,0 +1,121 @@
+/****************************************************************************
+** $Id: areport.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Report metadata object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AREPORT_H
+#define AREPORT_H
+
+#include       <q3mainwindow.h>
+#include       <q3textbrowser.h>
+#include       <qworkspace.h>
+#include       "acfg.h"
+#include       "aobject.h"
+#include       "engine.h"
+#include       "atemplate.h"
+#include       "aootemplate.h"
+
+class aDatabase;
+
+/**
+ * \ru
+ *     \brief Класс для показа отчета в формате HTML. Наследует QMainWindow.
+ *
+ *     \see aTemplate aReport
+ * \_ru
+ */
+class  ANANAS_EXPORT aReportBrowser :public Q3MainWindow
+{
+       Q_OBJECT
+public:
+       QWorkspace *ws;
+       Q3TextBrowser *textBrowser;
+       aReportBrowser(  QWidget *parent = 0, const char *name = 0, Qt::WFlags f = Qt::WDestructiveClose );
+       void append( const QString &text );
+       void clear();
+public slots:
+       void print();
+
+protected slots:
+       virtual void languageChange();
+};
+
+/**
+ * \ru
+ *     \brief Определяет программный интерфейс для работы со всеми типами отчетов.
+ *     Наследует aObject.
+ *
+ *     Применяется для генерирования документов для печати в форматах OpenOffice *.odt,*ods и HTML.
+ *     \see aTemplate aOOTemplate
+ * \_ru
+ */
+
+class  ANANAS_EXPORT aReport :public aObject
+{
+       Q_OBJECT
+public:
+
+/*!
+ * \ru
+ * Перечисление типов возможных отчетов.
+ * \_ru
+ */
+       enum RT_type    {
+                       RT_text/**отчет в формате HTML*/,
+                       RT_office_writer/**отчет в формате OpenOffice Writer*/,
+                       RT_office_calc/**отчет в формате OpenOffice Calc*/
+                       };
+
+       aEngine *engine;
+               iTemplate *tpl;
+       aReportBrowser *browser;
+       RT_type type;
+
+       aReport( aCfgItem context, RT_type r_type = RT_text, aEngine * e = 0 );
+       aReport( QString name, RT_type r_type = RT_text, aEngine * e = 0 );
+       virtual ~aReport();
+       virtual ERR_Code initObject();
+
+       QString path2workdir();
+
+public slots:
+       void setTable( const QString &name );
+       void setValue( const QString &name, const QString &value );
+       QString value( const QString &name );
+       void clear();
+       void exec( const QString &section );
+       void close();
+       void show();
+protected:
+       QString getName4NewTemplate();
+private:
+       QString tplName;
+
+};
+
+#endif// AREPORT_H
diff --git a/src/lib/report/atemplate.cpp b/src/lib/report/atemplate.cpp
new file mode 100644 (file)
index 0000000..8637dd3
--- /dev/null
@@ -0,0 +1,208 @@
+/****************************************************************************
+** $Id: atemplate.cpp,v 1.2 2008/11/08 20:16:36 leader Exp $
+**
+** Report metadata object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <qfile.h>
+#include <qdir.h>
+#include <QTextStream>
+
+#include "atemplate.h"
+#include "alog.h"
+
+aTemplate::aTemplate()
+    : iTemplate()
+{
+    clear();
+}
+
+
+
+aTemplate::~aTemplate()
+{
+}
+
+
+
+bool
+aTemplate::open( const QString &fname )
+{
+       QFile file( QDir::convertSeparators(QDir::currentDirPath()+"/"+templateDir+"/"+fname) );
+    if ( file.open( QIODevice::ReadOnly ) )
+    {
+        QTextStream stream( &file );
+        tpl = stream.read();
+        file.close();
+       return true;
+    }
+    else
+    {
+           return false;
+    }
+}
+
+
+
+void
+aTemplate::close()
+{
+    freeValues();
+}
+
+
+
+QString
+aTemplate::getValue( const QString &name )
+{
+       QString * pStr=values.find( name );
+       return pStr==0?(QString::null):*pStr;
+}
+
+
+
+void
+aTemplate::setValue( const QString &name, const QString &value )
+{
+    values.remove( name );
+    if ( !value.isEmpty() ) values.insert( name, new QString( value ) );
+}
+
+
+
+void
+aTemplate::freeValues()
+{
+    values.clear();
+}
+
+
+QString
+aTemplate::exec( const QString &sname )
+{
+    int c = 0, c1 = 0, sec_start = 0, sec_end = 0, sec_len = 0, sfound = 0, l;
+    QString token, tname, tparam, sec_buf = "", v;
+
+    if ( tpl.isEmpty() ) return "";
+
+    while ( !sfound ) {
+       sec_len = 0;
+       c = tpl.find( token_open, c );
+       if ( c >= 0 ) {
+           c += strlen( token_open );
+           c1 = tpl.find( token_close, c );
+           if ( c1 >= 0 ) {
+               l = c1 - c;
+               token = tpl.mid( c, l );
+               tname = token.section( " ", 0, 0 );
+               tparam = token.section( " ", 1, 1 );
+               if ( tname == "section" && tparam == sname ) {
+                   sec_end = tpl.find( QString(token_open"endsection"token_close), c1 );
+                   if ( sec_end > 0 ) {
+                       sfound = 1;
+                       sec_start = c1 + QString( token_close ).length();
+                       sec_len = sec_end - sec_start;
+                   } else break;
+               }
+           } else break;
+       } else break;
+    }
+
+    if ( sfound && sec_len ) {
+       c = sec_start;
+       while ( c < sec_end ) {
+           c1 = tpl.find( token_open, c );
+           l = c1 - c;
+           if ( l ) sec_buf.append( tpl.mid( c, l ) );
+           if ( c1 < sec_end ) {
+               c = c1 + QString( token_open ).length();
+               c1 = tpl.find( token_close, c );
+               if ( c1 ) {
+                   l = c1 - c;
+                   token = tpl.mid( c, l );
+                   tname = token.section( " ", 0, 0 );
+                   tparam = token.section( " ", 1, 1 );
+                   c1 += QString( token_close ).length();
+                   v = getValue( tname );
+                   if ( !v.isEmpty() ) sec_buf.append( v );
+               } else break;
+           }
+           c = c1;
+       }
+    }
+    buf.append( sec_buf );
+//     printf("%s",( const char *) sec_buf.local8Bit() );
+    return sec_buf;
+}
+
+
+
+bool
+aTemplate::save( const QString & fname)
+{
+       QFile file( QDir::convertSeparators(QDir::currentDirPath()+"/"+templateDir+"/"+fname) );
+       if ( file.open( QIODevice::WriteOnly ) )
+       {
+               QTextStream stream( &file );
+               stream << result();
+               file.close();
+               aLog::print(aLog::Info, tr("aTemplate save file %1").arg(file.name()));
+               return true;
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aTemplate save file %1").arg(file.name()));
+               return false;
+       }
+}
+
+
+
+void
+aTemplate::cleanUpTags()
+{
+}
+
+
+
+void
+aTemplate::setDir(const QString &dir)
+{
+       templateDir = dir;
+}
+
+
+
+QString
+aTemplate::getDir()
+{
+       return templateDir;
+}
+
diff --git a/src/lib/report/atemplate.h b/src/lib/report/atemplate.h
new file mode 100644 (file)
index 0000000..275491e
--- /dev/null
@@ -0,0 +1,134 @@
+/****************************************************************************
+** $Id: atemplate.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Report metadata object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ATEMPLATE_H
+#define ATEMPLATE_H
+
+#include "ananasglobal.h"
+#include "itemplate.h"
+
+#define token_open "<#"
+#define token_close "#>"
+
+#include <qobject.h>
+#include <q3dict.h>
+#include <qstringlist.h>
+
+/**
+ * \en
+ * Class for work with pattern in HTML format
+ * \_en
+ * \ru
+ *     \brief Класс для работы с шаблонами в HTML формате.
+ *     Наследует iTemplate.
+ *
+ * Приведенный пример показывает создание таблицы размеров 10х10.
+ *     \code
+ *     function printreport()
+ *     {
+ *             p = new Report("Report1");
+ *             p.setTable("report.tpl");
+ *             p.setValue("title","Заголовок таблицы :"+Value("eHeader") + Value("fNDS"));
+ *             p.exec("main");
+ *             for ( i = 1; i<10; i++)
+ *             {
+ *                     p.setValue("value", String(i) );
+ *                     p.exec("trow");
+ *                     for ( j=1; j<10; j++)
+ *                     {
+ *                             p.setValue("value", String(i)+":"+String(j) );
+ *                             p.exec("col");
+ *                     }
+ *                     p.exec("endrow");
+ *             }
+ *             p.exec("endmain");
+ *             p.show();
+ *             delete p;
+ *     }
+ *     \endcode
+ *     Шаблон:
+ *     \code
+<#section main#>
+<html>
+<header>
+<title>Ananas HTTP Server</title>
+</header>
+<body bgcolor=gray>
+<img src="a-system.png"><#title#>
+<table border=1 cellspacing=0 cellpadding=0 spacing=0>
+<#endsection#>
+
+<#section endmain#>
+</table>
+</body></html>
+<#endsection#>
+
+<#section trow#><tr><td width=100 bgcolor=lightblue><#value#>)</td><#endsection#>
+
+<#section endrow#></tr>
+<#endsection#>
+
+<#section col#><td align=center><#value#></td><#endsection#>
+ *     \endcode
+ * \_ru
+ */
+class  ANANAS_EXPORT aTemplate : public iTemplate
+{
+    Q_OBJECT
+public:
+
+    aTemplate();
+    virtual ~aTemplate();
+
+    bool open( const QString &fname );
+    void close();
+    void clear(){ buf="";};
+
+    QString getValue( const QString &name );
+    void setValue( const QString &name, const QString &value );
+    QString exec( const QString &sname );
+    QString result(){ return buf;};
+    bool save( const QString & fname );
+    void cleanUpTags();
+       virtual void setDir(const QString &dir);
+       virtual QString getDir();
+
+protected:
+               QString templateDir;
+
+private:
+    QString buf;
+    QString tpl;
+    Q3Dict<QString> values;
+
+    void freeValues();
+};
+
+#endif //ATEMPLATE_H
diff --git a/src/lib/report/itemplate.cpp b/src/lib/report/itemplate.cpp
new file mode 100644 (file)
index 0000000..d40db4d
--- /dev/null
@@ -0,0 +1,108 @@
+/****************************************************************************
+** $Id: itemplate.cpp,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Report metadata object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+//#include <sys/types.h>
+//#include <sys/stat.h>
+//#include <stdlib.h>
+//#include <qfile.h>
+
+#include "itemplate.h"
+
+
+iTemplate::iTemplate()
+    : QObject()
+{
+}
+
+iTemplate::~iTemplate()
+{
+}
+
+bool
+iTemplate::open( const QString &)
+{
+       return true;
+}
+
+void
+iTemplate::close()
+{
+}
+
+QString
+iTemplate::getValue( const QString & )
+{
+       return "";
+}
+
+
+void
+iTemplate::setValue( const QString &, const QString & )
+{
+}
+
+
+bool
+iTemplate::save( const QString & )
+{
+       return true;
+}
+
+
+QString
+iTemplate::exec( const QString & )
+{
+       return "";
+}
+
+void
+iTemplate::clear()
+{
+}
+
+QString
+iTemplate::result()
+{
+       return "";
+}
+void
+iTemplate::cleanUpTags()
+{
+}
+void
+iTemplate::setDir(const QString &)
+{
+}
+
+QString
+iTemplate::getDir()
+{
+       return "";
+}
diff --git a/src/lib/report/itemplate.h b/src/lib/report/itemplate.h
new file mode 100644 (file)
index 0000000..a334087
--- /dev/null
@@ -0,0 +1,184 @@
+/****************************************************************************
+** $Id: itemplate.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Report metadata object header file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ITEMPLATE_H
+#define ITEMPLATE_H
+
+#include "ananasglobal.h"
+
+#include <qobject.h>
+//#include <qdict.h>
+//#include <qstringlist.h>
+
+/**
+ * \~english
+ * Interface for work with report
+ * \~russian
+ * \brief Интерфейс для работы с отчетами. Наследует QObject.
+ *
+ * Классы, генерирующие отчеты, должны использовать этот интерфейс.
+ * Содержит чистые виртуальные функции, не допускается создание объектов этого класса напрямую.
+ * Пример:
+ * \code
+ * iTemplate *tpl = new aTemplate(); // aTemplate должен реализовывать интерфейс iTemplate
+ * tpl->open("test.tpl");
+ * tpl->close();
+ * delete tpl;
+ * \endcode
+ * \~
+ */
+class  ANANAS_EXPORT iTemplate : public QObject
+{
+    Q_OBJECT
+public:
+/**
+ * \en
+ * Constructor
+ * \_en
+ * \ru
+ * Конструктор.
+ * \_ru
+ */
+    iTemplate();
+/**
+ * \en
+ * Destructor
+ * \_en
+ * \ru
+ * Деструктор
+ * \_ru
+ */
+    virtual ~iTemplate();
+
+/**
+ * \en
+ * Opens pattern
+ * \_en
+ * \ru
+ * Открывает шаблон.
+ * \_ru
+ */
+    virtual bool open( const QString &fname )=0;
+/**
+ * \en
+ * Closes pattern.
+ * \_en
+ * \ru
+ * Закрывает шаблон.
+ * \_ru
+ */
+    virtual void close();
+/**
+ * \en
+ * Clears internal variable.
+ * \_en
+ * \ru
+ * Обнуляет внутренние переменные.
+ * \_ru
+ */
+    virtual void clear();
+/**
+ * \en
+ * Get value of parameter `name'
+ * \_en
+ * \ru
+ * Возвращает значение параметра по его имени.
+ * \_ru
+ */
+    virtual QString getValue( const QString &name );
+/**
+ * \en
+ * Set value of parameter `name'
+ * \_en
+ * \ru
+ * Устанавливает значение параметра по его имени.
+ * \_ru
+ */
+    virtual void setValue( const QString &name, const QString &value );
+/**
+ * \en
+ * Replaces tads to values
+ * \_en
+ * \ru
+ * Выполняет подстановку значения параметра в шаблоне.
+ * Может вызываться несколько раз.
+ * \_ru
+ */
+    virtual QString exec( const QString &sname );
+/**
+ * \en
+ * Returns document.
+ * \_en
+ * \ru
+ * Возвращает результат, т.е. шаблон в текстовом виде. Включена в интерфейс временно.
+ * \_ru
+ */
+    virtual QString result();
+/**
+ * \en
+ * Saves document to file
+ * \_en
+ * \ru
+ * Сохраняет документ в файл с заданным именем.
+ * \_ru
+ */
+    virtual bool save( const QString & fname );
+/**
+ * \en
+ * Clears all tags
+ * \_en
+ * \ru
+ * Очищает все теги
+ * \_ru
+ */
+
+    virtual void cleanUpTags();
+/**
+ * \en
+ * Sets  working directory
+ * \_en
+ * \ru
+ * Устанавливает рабочую директорию
+ * \_ru
+ */
+    virtual void setDir(const QString &dir);
+
+ /**
+ * \en
+ * Gets  working directory
+ * \_en
+ * \ru
+ * Возвращает рабочую директорию
+ * \_ru
+ */
+    virtual QString getDir();
+};
+
+#endif //ITEMPLATE_H
diff --git a/src/lib/report/report.pri b/src/lib/report/report.pri
new file mode 100644 (file)
index 0000000..9fc0be5
--- /dev/null
@@ -0,0 +1,13 @@
+HEADERS += \
+    report/acalctemplate.h \
+    report/aootemplate.h \
+    report/areport.h \
+    report/atemplate.h \
+    report/itemplate.h
+
+SOURCES += \
+    report/acalctemplate.cpp \
+    report/aootemplate.cpp \
+    report/areport.cpp \
+    report/atemplate.cpp \
+    report/itemplate.cpp 
diff --git a/src/lib/sys/aapplication.cpp b/src/lib/sys/aapplication.cpp
new file mode 100644 (file)
index 0000000..2e064c2
--- /dev/null
@@ -0,0 +1,46 @@
+/****************************************************************************
+** $Id: aapplication.cpp,v 1.1 2008/11/09 21:08:09 leader Exp $
+**
+** Code file of the Ananas Library of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "aapplication.h"
+#include "dselectdb.h"
+#include "dlogin.h"
+
+
+AApplication::AApplication(  int & argc, char ** argv, AApplicationType aat )
+    :QApplication( argc, argv, true )
+{
+    v_aat = aat;
+}
+
+int
+AApplication::applicationType()
+{
+    return v_aat;
+}
+
diff --git a/src/lib/sys/aapplication.h b/src/lib/sys/aapplication.h
new file mode 100644 (file)
index 0000000..65a533f
--- /dev/null
@@ -0,0 +1,55 @@
+/****************************************************************************
+** $Id: aapplication.h,v 1.2 2008/11/21 20:58:12 leader Exp $
+**
+** Header file of the Ananas Library of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AAPPLICATION_H
+#define AAPPLICATION_H
+
+#include "ananasglobal.h"
+#include <QApplication>
+
+class ANANAS_EXPORT AApplication : public QApplication
+{
+Q_OBJECT
+public:
+            
+    enum AApplicationType {
+        Unknown,
+        Ananas,
+        Designer,
+        Administrator
+    };
+
+    AApplication(  int & argc, char ** argv, AApplicationType aat = Unknown );
+    int applicationType();
+    
+private:
+    int v_aat;        
+};
+
+#endif
diff --git a/src/lib/sys/adatabase.cpp b/src/lib/sys/adatabase.cpp
new file mode 100644 (file)
index 0000000..a0a91e3
--- /dev/null
@@ -0,0 +1,1668 @@
+/****************************************************************************
+** $Id: adatabase.cpp,v 1.6 2008/12/10 21:04:03 leader Exp $
+**
+** Database abstaraction layer
+** of Ananas Project
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail.ru >, Yoshkar-Ola
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/*
+*/
+/*
+for mysql server set variable in /var/lib/mysql/my.cnf
+default-character-set=utf8
+
+*/
+#include <QObject>
+#include <qfile.h>
+#include <qdom.h>
+#include <qstringlist.h>
+#include <q3textstream.h>
+#include <qsqlrecord.h>
+#include <qstringlist.h>
+//Added by qt3to4:
+#include <QSqlQuery>
+#include <Q3SqlCursor>
+#include <QSqlError>
+#include <Q3SqlRecordInfo>
+#include <QMessageBox>
+
+#include "alog.h"
+
+#include "asqltable.h"
+#include "aapplication.h"
+
+#include "adatabase.h"
+
+
+QStringList dd;
+
+static aDatabase aDatabase_default;
+
+/*!
+ *
+ */
+QString
+qds_field ( const QString fname, const QString &tdef, const QString &descr = "" )
+{
+        int n1, n2;
+        bool notnull, serial;
+        char t=' ';
+        QString st, dt="F="+fname+"|"+descr+"|";
+
+        if ( tdef.isEmpty() ) return "";
+        n1=0; n2=0;
+        st = tdef.section ( " ", 0, 0 ).lower();
+        n1 = tdef.section ( " ", 1, 1 ).toInt();
+        n2 = tdef.section ( " ", 2, 2 ).toInt();
+        if ( !st.isEmpty() ) t = ( ( const char * ) st ) [0];
+        serial = ( st.mid ( 1 ).contains ( 's' ) > 0 );
+        notnull = ( st.mid ( 1 ).contains ( 'n' ) > 0 );
+//      if ( serial && t=='l') t='i';
+        switch ( t )
+        {
+                case 'i':
+                        dt.append ( "I|0|0|" );
+                        break;
+                case 'l':
+                        dt.append ( "L|0|0|" );
+                        break;
+                case 'c':
+                        dt.append ( QString ( "S|%1|0|" ).arg ( n1 ) );
+                        break;
+                case 'n':
+                        dt.append ( QString ( "N|%1|%2|" ).arg ( n1 ).arg ( n2 ) );
+                        break;
+                case 'd':
+                        dt.append ( "D|0|0|" );
+                        break;
+                case 'o':
+                        dt.append ( "L|0|0|" );
+                        break;
+                case 'b':
+                        dt.append ( "C|1|0|" );
+                        break;
+                default:
+                        dt.append ( "I|0|0|" );
+                        break;
+        }
+        if ( !serial && notnull ) dt.append ( "N" );
+        if ( serial ) dt.append ( "PS" );
+        return dt;
+}
+
+
+
+void
+qds_fields ( aCfg &cfg, aCfgItem context )
+{
+
+        int j, ifld;
+        QString t, flddef="";
+        aCfgItem of, item;
+        int id, n=0;
+        aCfgItem dim_field;
+
+        /*
+                if(cfg.objClass(context) == md_field && cfg.objClass(cfg.parent(context))== md_dimensions)
+                {
+                        dim_field = context;
+                        t = cfg.attr( dim_field, mda_type );
+                        if ( !t.isEmpty() )
+                        {
+                                if(t[0]!=' ')
+                                {
+                                        flddef.append( QString("uf%1 %2,").arg(cfg.id(dim_field)).arg(t) );
+                                }
+                        }
+                }
+        */
+        ifld = cfg.count ( context, md_field );
+        for ( j = 0; j < ifld; j++ )
+        {
+                item = cfg.find ( context, md_field, j );
+                id = cfg.id ( item );
+                if ( id )
+                {
+                        t = cfg.attr ( item, mda_type );
+                        if ( !t.isEmpty() )
+                        {
+                                if ( t[0]!=' ' )
+                                {
+                                        dd<<qds_field ( QString ( "uf%1" ).arg ( id ), t, cfg.attr ( item, mda_name ) );
+                                        if ( t.section ( " ", 3, 3 ).lower() =="i" )
+                                        {
+                                                dd<<QString ( "I=IDX_uf%1||uf%2|" ).arg ( id ).arg ( id );
+                                        };
+                                        n++;
+                                }
+                        }
+                }
+        }
+}
+
+
+
+void
+qds_dd ( aCfg &cfg )
+{
+
+        dd.clear();
+        dd<<"D=ANANAS|Ananas data schema|UTF-8|0000-0000-0000-0000";
+
+        //================== Системные таблицы
+
+        dd<<"T=uniques|Uniques table|U";
+        dd<<"F=id|ID|L|0|0|NSP";
+        dd<<"F=otype|Object type|I|0|0|";
+        dd<<"F=df|Deleted flag|C|1|0|";
+        dd<<"I=I1|Index 1|otype|";
+        dd<<"I=I2|Index 2|df|";
+
+        dd<<"T=netusers|Network users|U";
+        dd<<"F=users|Users count|I|0|0|";
+        dd<<"F=updates|Updates count|I|0|0|";
+
+        dd<<"T=locks|Locked objects|U";
+        dd<<"F=userid|User ID|I|0|0|";
+        dd<<"F=id|Object id|L|1|0|NP";
+        dd<<"I=I1|Index 1|userid|";
+
+        dd<<"T=a_journ|Journals|U";
+        dd<<"F=id|ID|L|0|0|PN";
+        dd<<"F=typej|Journal type|I|0|0|";
+        dd<<"F=idd|ID of document|L|0|0|";
+        dd<<"F=typed|Document type|I|0|0|";
+        dd<<"F=ddate|Document date|D|0|0|";
+        dd<<"F=pnum|Prefix number|C|254|0|N";
+        dd<<"F=num|Document number|I|0|0|";
+        dd<<"F=mf|Marked flag|C|1|0|";
+        dd<<"F=df|Deleted flag|C|1|0|";
+        dd<<"F=cf|Conducted flag|C|1|0|";
+        dd<<"I=I1|Index 1|typej|";
+        dd<<"I=I2|Index 2|idd|";
+        dd<<"I=I3|Index 3|typed|";
+        dd<<"I=I4|Index 4|ddate|";
+        dd<<"I=I5|Index 5|pnum|";
+        dd<<"I=I6|Index 6|num|";
+        dd<<"I=I7|Index 7|mf|";
+        dd<<"I=I8|Index 8|df|";
+        dd<<"I=I9|Index 9|cf|";
+
+        dd<<QString ( "T=%1|Users|U" ).arg ( db_users );
+        dd<<"F=id       |ID                           |L|0|0|NP";
+        dd<<"F=fname    |First name                   |C|25|0|";
+        dd<<"F=lname    |Last name                    |C|30|0|";
+        dd<<"F=login    |Login name                   |C|20|0|";
+        dd<<"F=password |Password                     |C|100|0|";
+        dd<<"F=active0  |Active Ananas unknown app    |I|0|0|";
+        dd<<"F=active1  |Active Ananas engine         |I|0|0|";
+        dd<<"F=active2  |Active Ananas designer       |I|0|0|";
+        dd<<"F=active3  |Active Ananas Administrator  |I|0|0|";
+        dd<<"I=I1|Index 1|fname|";
+        dd<<"I=I2|Index 2|lname|";
+        dd<<"I=I3|Index 3|login|";
+        dd<<"I=I4|Index 4|password|";
+
+        dd<<QString ( "T=%1|User Roles|U" ).arg ( db_user_roles );
+        dd<<"F=id|ID|L|0|0|P";
+        dd<<"F=idr|ID role|I|0|0|";
+        dd<<"I=I1|Index 1|idr|";
+
+
+        dd<<QString ( "T=%1|Roles|U" ).arg ( db_roles );
+        dd<<"F=id|ID|L|0|0|P";
+        dd<<"F=name|Role name|C|50|0|";
+        dd<<"I=I1|Index 1|name|";
+
+        dd<<QString ( "T=%1|Roles rights|U" ).arg ( db_right_roles );
+        dd<<"F=id|ID|L|0|0|";
+        dd<<"F=permission|Role permission|I|0|0|";
+        dd<<"F=object|Role object|L|0|0|";
+        dd<<"I=I1|Index 1|id|";
+        dd<<"I=I2|Index 2|object|";
+
+        dd<<QString ( "T=%1|???|U" ).arg ( db_indices );
+        dd<<"F=tname|Table name|C|40|0|";
+        dd<<"F=uindices|???|C|240|0|";
+        dd<<"F=idxname|???|C|64|0|";
+        dd<<"I=I1|Index 1|tname|";
+        dd<<"I=I2|Index 2|uindices|";
+        dd<<"I=I3|Index 3|idxname|";
+
+        //================== Справочники
+
+        aCfgItem gcont, cont, item;
+        long id;
+        int n, i;
+
+        gcont = cfg.find ( cfg.find ( mdc_metadata ), md_catalogues, 0 );
+        n = cfg.count ( gcont, md_catalogue );
+        for ( i = 0; i<n; i++ )
+        {
+                item = cfg.find ( gcont, md_catalogue, i );
+                if ( !item.isNull() )
+                {
+                        id = cfg.id ( item );
+                        cont = cfg.findChild ( item, md_element, 0 );
+                        if ( !cont.isNull() )
+                        {
+                                dd<<QString ( "T=%1|Elements:%2|U" ).arg ( aDatabase::tableDbName ( cfg, cont ) ).arg ( cfg.attr ( item, mda_name ) );
+                                dd<<"F=id|ID|L|0|0|NP";
+                                dd<<"F=df|Mark deletede flag|C|1|0|";
+                                dd<<"F=idg|ID group|L|0|0|";
+                                dd<<"F=ido|ID owner|L|0|0|";
+                                dd<<"I=I1|Index 1|df|";
+                                dd<<"I=I2|Index 2|idg|";
+                                dd<<"I=I3|Index 3|ido|";
+                                qds_fields ( cfg, cont );
+                        }
+                        cont = cfg.findChild ( item, md_group, 0 );
+                        if ( !cont.isNull() )
+                        {
+                                dd<<QString ( "T=%1|Groups:%2|U" ).arg ( aDatabase::tableDbName ( cfg, cont ) ).arg ( cfg.attr ( item, mda_name ) );
+                                dd<<"F=id|ID|L|0|0|NP";
+                                dd<<"F=df|Mark deletede flag|C|1|0|";
+                                dd<<"F=level|tree level (0..n)|L|0|0|";
+                                dd<<"F=idp|Parent group ID ( 0 = root )|L|0|0|";
+                                dd<<"I=I1|Index 1|df|";
+                                dd<<"I=I2|Index 2|level|";
+                                dd<<"I=I3|Index 3|idp|";
+                                qds_fields ( cfg, cont );
+                        }
+                }
+        }
+
+        //================= Документы
+
+        aCfgItem rcont, tcont;
+        int tn, ti;
+
+        rcont = cfg.find ( cfg.find ( mdc_metadata ), md_documents, 0 );
+        n = cfg.count ( rcont, md_document );
+        for ( i = 0; i<n; i++ )
+        {
+                item = cfg.find ( rcont, md_document, i );
+                if ( !item.isNull() )
+                {
+                        cont = cfg.findChild ( item, md_header, 0 );
+                        if ( !cont.isNull() )
+                        {
+                                dd<<QString ( "T=%1|%2|U" ).arg ( aDatabase::tableDbName ( cfg, cont ) ).arg ( cfg.attr ( item, mda_name ) );
+                                dd<<"F=id|ID|L|0|0|NP";
+                                qds_fields ( cfg, cont );
+                        }
+                        tcont = cfg.find ( item, md_tables, 0 );
+                        tn = cfg.count ( tcont, md_table );
+                        for ( ti = 0; ti < tn; ti++ )
+                        {
+                                cont = cfg.findChild ( tcont, md_table, ti );
+                                if ( !cont.isNull() )
+                                {
+                                        dd<<QString ( "T=%1|Groups:%2|U" ).arg ( aDatabase::tableDbName ( cfg, cont ) ).arg ( cfg.attr ( item, mda_name ) );
+                                        dd<<"F=id|ID|L|0|0|NP";
+                                        dd<<"F=idd|Document ID|L|0|0|";
+                                        dd<<"F=ln|Line number|L|0|0|";
+                                        dd<<"I=I1|Index 1|idd|";
+                                        dd<<"I=I2|Index 2|ln|";
+                                        qds_fields ( cfg, cont );
+                                }
+                        }
+                }
+        }
+
+        //=================== Регистр оборотный
+
+        QString filds;
+
+        rcont = cfg.find ( cfg.find ( mdc_metadata ), md_iregisters, 0 );
+        n = cfg.count ( rcont, md_iregister );
+        for ( i = 0; i<n; i++ )
+        {
+                item = cfg.find ( rcont, md_iregister, i );
+                if ( !item.isNull() )
+                {
+                        dd<<QString ( "T=%1|%2|U" ).arg ( aDatabase::tableDbName ( cfg, item ) ).arg ( cfg.attr ( item, mda_name ) );
+                        dd<<"F=id|ID|L|0|0|NP";
+                        dd<<"F=idd|Document ID|L|0|0|";
+                        dd<<"F=iddt|Document table line ID|L|0|0|";
+                        dd<<"F=ln|Line number|L|0|0|";
+                        dd<<"I=I1|Index 1|idd|";
+                        dd<<"I=I2|Index 2|iddt|";
+                        dd<<"I=I3|Index 3|ln|";
+                        qds_fields ( cfg, item );
+                }
+        }
+
+        //=================== Регистр накопительный
+
+        aCfgItem res, dim;
+
+        rcont = cfg.find ( cfg.find ( mdc_metadata ), md_aregisters, 0 );
+        n = cfg.count ( rcont, md_aregister );
+        for ( i = 0; i<n; i++ )
+        {
+                item = cfg.find ( rcont, md_aregister, i );
+                if ( !item.isNull() )
+                {
+                        dd<<QString ( "T=%1|%2|U" ).arg ( aDatabase::tableDbName ( cfg, item ) ).arg ( cfg.attr ( item, mda_name ) );
+                        dd<<"F=id|ID|L|0|0|NP";
+                        dd<<"F=idd|Document ID|L|0|0|";
+                        dd<<"F=iddt|Document table line ID|L|0|0|";
+                        dd<<"F=ln|Line number|L|0|0|";
+                        dd<<"F=date|Document date|D|0|0|";
+                        dd<<"I=I1|Index 1|idd|";
+                        dd<<"I=I2|Index 2|iddt|";
+                        dd<<"I=I3|Index 3|ln|";
+                        dd<<"I=I4|Index 4|date|";
+                        qds_fields ( cfg, item );
+
+                        res = cfg.find ( item, md_resources );
+                        dim = cfg.find ( item, md_dimensions );
+                        if ( !res.isNull() && !dim.isNull() )
+                        {
+                                aCfgItem d;
+                                for ( int k=0; k<cfg.count ( dim,md_field );k++ )
+                                {
+                                        d = cfg.findChild ( dim,md_field,k );
+                                        dd<<QString ( "T=%1|%2.%3|U" ).arg ( aDatabase::tableDbName ( cfg, d ) ).arg ( cfg.attr ( item, mda_name ) ).arg ( cfg.attr ( d, mda_name ) );
+                                        dd<<"F=date|Document date|D|0|0|";
+                                        dd<<"I=I1|Index 1|date|";
+                                        qds_fields ( cfg, dim );
+                                        qds_fields ( cfg, d );
+                                        qds_fields ( cfg, res );
+                                }
+                        }
+                }
+        }
+};
+
+//==========================================================================
+
+/*!
+ *     \~english
+ *     Constructor has no arguments.
+ *     \~russian
+ *     Конструктор без параметров.
+ *     \~
+ */
+aDatabase::aDatabase() : QObject()
+{
+    dataBase = 0;
+    qds = 0;
+    v_updatesCount = 0;
+    v_timerId = 0;
+}
+
+
+
+/*!
+ *     \~english
+ *     Destructor.
+ *     \~russian
+ *     Деструктор.
+ *     \~
+ */
+aDatabase::~aDatabase()
+{
+        done();
+//        if ( qds ) delete qds;
+}
+
+
+
+/*!
+ *     \~english
+ *     Return current database driver name.
+ *     Translate name for unicode MySQL driver to standart name.
+ *     \~russian
+ *     Возвращает имя драйвера базы данных.
+ *     Переводит имя для драйвера MySQL с поддержкой utf8 в стандартное имя.
+ *     \~
+ *     \return \~english QT current Database driver name \~russian имя драйвера. \~
+ */
+QString
+aDatabase::driverName()
+{
+        QString name = db()->driverName();
+        if ( name == "QMYSQL" ) name = "QMYSQL";
+        return name;
+}
+
+
+/*!
+ *     \~english
+ *     Return text feature for dynamic SQL by feature name.
+ *     \~russian
+ *     Возвращает код реализации какой либо осбенности сервера БД по ее ключу.
+ *     \~
+ *     \return \~english Code for dynamic SQL creation  \~russian Код для формирования динамического SQL \~
+ */
+QString
+aDatabase::feature(const QString& featureName)
+{
+       QString res = QString::null;
+        if(driverName() == "QMYSQL")
+       {
+               res = featuresMySQL[featureName];
+       }
+        if(driverName() == "QSQLITE")
+       {
+               res = featuresSQLite[featureName];
+       }
+        if(driverName() == "QPSQL7")
+       {
+               res = featuresPostgreSQL[featureName];
+       }
+        return res;
+}
+
+/*!
+ *     \~english
+ *     This is overloaded method, provided for convenience.
+ *     \~russian
+ *     Перегружет метод init( aCfgRc *rc, const QString &dbname )
+ *     \~
+ *     \see init( aCfgRc *rc, const QString &dbname )
+ *     \param rcname (in) - \~english rc file name. \~russian имя файла ресурса \~
+ *     \param dbname (in) - \~english parameter to pass trough. \~russian имя базы данных \~
+ *     \return \~english true, if no error \~russian  true, если ошибок не было \~
+ */
+bool
+aDatabase::init( const QString &rcname, const QString &dbname )
+{
+       if ( rcname.isEmpty() ) return false;
+       if ( cfg.readrc( rcname ) ) return false;
+       return init( &cfg.rc, dbname );
+}
+
+/**
+ * \en
+ *      \brief Creates database on SQL server.
+ *
+ *      Uses rc file parameters values and makes connection to database server.
+ *      Then creates database with name obtained from rc file.
+ *      \param rc (in) - rc object reference.
+ *      \param dbname (in) - unused now.
+ *      \return true, if no error
+ * \_en \ru
+ *      \brief Открывает соединение с базой данных на SQL сервере или создает базу данных.
+ *
+ *      Если БД не удалось открыть, метод пытается создать базу данных на SQL сервере,
+ *      используя переданные параметры соединения с SQL сервером. При этом создается пустая база данных
+ *      без таблиц и других элементов.
+ *      \param rc (in) - ссылка на инициализированный объект,
+ *      хранящий данные файла ресурсов, необходимые для установления соединения. Проще говоря, объект
+ *      с параметрами соединения.
+ *      \param dbname (in) - не используется
+ *      \return frue, если не было ошибок
+ * \_ru
+ *      \see init( const QString &rcname, const QString &dbname )
+ */
+bool
+aDatabase::init ( aCfgRc *rc, const QString &dbname )
+{
+        fillFeatures();
+        if ( !rc ) return false;
+        if ( !prepareDatabaseConnect ( rc ) ) return false;
+
+        qds_dd ( cfg );
+        qds->setDataDictionary ( dd );
+        if ( qds->open() )
+        {
+                aLog::print ( aLog::Info,tr ( "aDatabase open connection to %1" ).arg ( rc->value ( "dbname" ) ) );
+        }
+        else
+        {
+                cfg_message ( 3, ( const char * ) tr ( "Can't open database connection\n" ).utf8() );
+                aLog::print ( aLog::Error,tr ( "aDatabase open connection to %1" ).arg ( rc->value ( "dbname" ) ) );
+        };
+        QSqlQuery q = db()->exec ( QString ( "SELECT * FROM %1" ).arg ( qds->tableName ( "netusers" ) ) );
+        if ( !q.first() )
+        {
+                db()->exec ( QString ( "INSERT INTO %1 (users,updates) VALUES (0,0)" ).arg ( qds->tableName ( "netusers" ) ) );
+        }
+        v_updatesCount = updatesCount();
+        v_timerId = startTimer ( 5000 );
+        return true;
+}
+
+/**
+ * \ru
+ *      \brief  Инициализирует драйвер sql соединения.
+ *
+ *      Для инициализации используются параметры из файла ресурсов бизнес схемы.
+ *      \param dbParams - объект хранящий данные файла ресурсов.
+ *      \return true, если драйвер успешно инициализирован. false, если возникла ошибка.
+ * \_ru
+ */
+bool
+aDatabase::prepareDatabaseConnect ( aCfgRc* dbParams )
+{
+        QString driver = "UNKNOWN";
+        QString dbtype;
+
+        dbtype = dbParams->value ( "dbtype" );
+        done();
+
+        /**/
+        QString qds_dbtype = "QSQLITE";
+        if ( dbtype=="internal" ) qds_dbtype = "QSQLITE";
+        if ( dbtype=="mysql" )  qds_dbtype = "QMYSQL";
+        if ( dbtype=="postgres" ) qds_dbtype = "QPOSTGRESQL";
+
+        if ( qds==0 ) qds = new QDataSchema ( qds_dbtype, "ANANAS" );
+        //qds->setNameSpace("qds_");
+
+        qds->db()->setDatabaseName ( dbParams->value ( "dbname" ) );
+        qds->db()->setUserName ( dbParams->value ( "dbuser" ) );
+        qds->db()->setPassword ( dbParams->value ( "dbpass" ) );
+        qds->db()->setHostName ( dbParams->value ( "dbhost","localhost" ) );
+        qds->db()->setPort ( dbParams->value ( "dbport","0" ).toInt() );
+
+        dataBase = qds->db();
+        return true;
+}
+
+
+
+void
+aDatabase::fillFeatures()
+{
+        featuresMySQL["autoincrement"] = "select last_insert_id()";
+        featuresMySQL["encoding"] = "character set utf8";
+        featuresMySQL["systemDatabase"] = "mysql";
+        featuresPostgreSQL["autoincrement"] = "select currval('uniques_id_seq')";
+        featuresPostgreSQL["encoding"] = "with encoding='UTF-8'";
+        featuresPostgreSQL["systemDatabase"] = "template1";
+        featuresSQLite["autoincrement"] = "select last_insert_rowid()";
+        featuresSQLite["encoding"] = "";
+}
+
+/*!
+ *      \~english
+ *      Closes database connection.
+ *      \~russian
+ *      Закрывает соединение с базой данных и освобождает все занятые ресурсы.
+ *      \~
+ */
+void
+aDatabase::done()
+{
+        killTimer( v_timerId );
+//        if ( db() )
+//        {
+//                db()->close();
+//        }
+        if ( qds )
+        {
+                delete qds;
+                qds = 0;
+        }
+}
+
+
+
+/**
+ * \en
+ *      \brief Returns database connection.
+ *
+ *      \param dbname (in) - database connection name. Default value used if dbname is empty.
+ *      \return  database connection.
+ * \_en \ru
+ *      \brief Возвращает ссылку на соединение с базой данных.
+ *
+ *      \param dbname (in) - имя базы данных
+ *      \return  соединение с базой данных. Возвращаемый объект удалять не следует.
+ */
+QSqlDatabase*
+aDatabase::db ( const QString &dbname )
+{
+        if ( qds ) return qds->db();
+        return 0;
+}
+
+
+/*!
+ *      \~english
+ *      Check database structure.
+ *      \~russian
+ *      проверяет структуру базы данных.
+ *      \~
+ *      \return  \~english true, if structure is valid. \~russian true, если база данных корректна \~
+ */
+bool
+aDatabase::checkStructure()
+{
+        if ( qds )
+        {
+                if ( qds->verifyStructure() )
+                {
+                        return false;
+                }
+                else return true;
+        }
+        return false;
+}
+
+
+
+/*!
+ *      \~english
+ *      Helper method.
+ *      \~russian
+ *      Вспомогательный метод. Создает новую базу данных.
+ *      \~
+ *      \see createdb()
+ */
+bool
+aDatabase::create()
+{
+        return createdb ( false );
+}
+
+bool
+aDatabase::drop ( const QString& dbname )
+{
+
+        QString query = QString ( "drop database %1" ).arg ( dbname );
+        if ( !dataBase ) return true;
+        if ( dataBase->exec ( query ).lastError().type() ==QSqlError::None )
+        {
+                aLog::print ( aLog::Error,tr ( "aDatabase drop database %1" ).arg ( dbname ) );
+        }
+        query = QString ( "create database %1 %2" ).arg ( dbname ).arg ( feature ( "encoding" ) );
+        //if ( driverName() == "QPSQL7" ) query.append( " with encoding='UTF-8'" );
+//#ifdef MYSQL_UTF8
+        //if ( driverName() == "QMYSQL3" ) query.append( " character set utf8" );
+//#endif
+        //printf("query = %s\n",query.ascii());
+        QSqlQuery q = db()->exec ( query );
+        if ( db()->lastError().type() !=QSqlError::None )
+        {
+                reportError ( db()->lastError(),query );
+        }
+        dataBase->setDatabaseName ( dbname );
+        if ( !dataBase->open() )
+        {
+                cfg_message ( 3, ( const char * ) tr ( "Can't open database connection\n" ).utf8() );
+                aLog::print ( aLog::Error,tr ( "aDatabase open connection to %1" ).arg ( dbname ) );
+                return false;
+        }
+        else
+        {
+                aLog::print ( aLog::Info,tr ( "aDatabase open connection to %1" ).arg ( dbname ) );
+
+        }
+        return false;
+}
+
+
+/*!
+ *      \~english
+ *      Helper method.
+ *      \~russian
+ *      Вспомогательный метод. Обновляет структуру базы данных.
+ *      \~
+ *      \see createdb()
+ */
+bool
+aDatabase::update()
+{
+        return createdb ( true );
+}
+
+
+
+/*!
+ *      Creates aDataTable object for browsing and editing sql table in current database.
+ *      \param name (in) - sql table name.
+ *      \return newly created object.
+ */
+aDataTable *
+aDatabase::table ( const QString & name )
+{
+        aDataTable *t = 0;
+
+        if ( tableExists ( name ) )
+        {
+                t = new aDataTable ( qds->tableName ( name ), this );
+        }
+        else
+        {
+                t = new aDataTable ( QString::null, this );
+        }
+        return t;
+}
+
+
+/*!
+ *      \~english
+ *      Helper metod. Returns sql table name for metadata object.
+ *      \~russian
+ *      Вспомогательный метод. Возвращает имя sql таблицы для объекта метаданных.
+ *      \~
+ *      \see tableDbName( aCfg &md, aCfgItem context, long * tid )
+ *      \param md (in) - \~english metadata tree object. \~russian дерево метаданных. \~
+ *      \param context (in) - \~english node of metadata tree which represents metadata Class. \~russian объект метаданных \~
+ *      \return \~english sql table name. \~russian имя таблицы в базе данных \~
+ */
+QString
+aDatabase::tableDbName ( aCfg &md, aCfgItem context )
+{
+        long dummy;
+        return tableDbName ( md,context,&dummy );
+}
+
+
+/*!
+*       \~english
+*       Returns sql table name for metadata object.
+*       \~russian
+*       Возвращает имя sql таблицы для объекта метаданных.
+*       \~
+*       \see tableDbName( aCfg &md, aCfgItem context, long * tid )
+*       \param md (in) - \~english metadata tree object. \~russian дерево метаданных. \~
+*       \param context (in) - \~english node of metadata tree which represents metadata Class. \~russian объект метаданных \~
+*       \param tid (out) - \~english id of metadata Class. \~russian идентификатор объекта метаданных, которому принадлежит таблица \~
+*       \return \~english sql table name. \~russian имя таблицы в базе данных \~
+*/
+QString
+aDatabase::tableDbName ( aCfg &md, aCfgItem context, long * tid )
+{
+        aCfgItem parent = context;
+        QString oclass, tname = "";
+        long id, idp=0, temp=0;
+        if ( context.isNull() ) return "";
+        oclass = md.objClass ( context );
+        id = md.id ( context );
+        while ( idp == 0 && ! parent.isNull() )
+        {
+                parent = md.parent ( parent );
+                idp = md.id ( parent );
+        }
+        if ( oclass == md_element )
+        {
+                tname = QString ( db_catalog_element ).arg ( idp );
+                temp = idp;
+        }
+        if ( oclass == md_group )
+        {
+                tname =  QString ( db_catalog_group ).arg ( idp );
+                temp = idp;
+        }
+        if ( oclass == md_header )
+        {
+                tname =  QString ( db_document_header ).arg ( idp );
+                temp = idp;
+        }
+        if ( oclass == md_iregister )
+        {
+                tname = QString ( db_iregister ).arg ( id );
+                temp = id;
+        }
+        if ( oclass == md_aregister )
+        {
+                tname = QString ( db_aregister ).arg ( id );
+                temp = id;
+        }
+        if ( oclass == md_table )
+        {
+                if ( md.objClass ( parent ) == md_document )
+                {
+                        tname = QString ( db_document_table ).arg ( idp ).arg ( id );
+                        temp = id;
+                }
+        }
+        if ( oclass == md_resources )
+        {
+                if ( md.objClass ( parent ) == md_aregister )
+                {
+                        tname = QString ( db_areg_remainder ).arg ( idp );
+                        temp = idp;
+                }
+        }
+        if ( oclass == md_field )
+        {
+                if ( md.objClass ( parent ) == md_aregister )
+                {
+                        tname = QString ( db_areg_dim ).arg ( idp ).arg ( id );
+                        temp = idp;
+                }
+        }
+        *tid = temp;
+//      printf("tname = %s\n",tname.ascii());
+        return tname;
+}
+
+
+
+/*!
+ *      \~english
+ *      Generates new unique id for system object.
+ *      \~russian
+ *      Генерирует новый уникальный номер. Эти номера являются невосполнимым ресурсом системы.
+ *      \~
+ *      \param otype (in) - \~english object type (e.g. document, catalog, journal etc.) \~russian тип объекта \~
+ *      \return \~english newly generated unique id. \~russian новый сгенерированный номер \~
+ */
+Q_ULLONG
+aDatabase::uid ( int otype )
+{
+        Q_ULLONG uid = 0;
+        QString query;
+        QString drv = driverName();
+//      printf("driver name =%s\n",drv.ascii());
+        query.sprintf ( "insert into uniques (otype) values (%d)", otype );
+        QSqlQuery q = db()->exec ( query );
+        if ( db()->lastError().type() !=QSqlError::None )
+        {
+                reportError ( db()->lastError(),query );
+        }
+        query = feature ( "autoincrement" );
+        q = db()->exec ( query );
+        if ( db()->lastError().type() !=QSqlError::None )
+        {
+                reportError ( db()->lastError(),query );
+        }
+        if ( q.first() )
+        {
+                uid = q.value ( 0 ).toULongLong();
+        }
+        else
+        {
+                aLog::print ( aLog::Error,tr ( "aDatabase generate new unique number for object type %1" ).arg ( otype ) );
+        }
+//      printf("uid=%llu, otype=%d\n",uid,otype);
+        aLog::print ( aLog::Debug,tr ( "aDatabase generate new unique number %1 for objecttype %2" ).arg ( uid ).arg ( otype ) );
+        return uid;
+}
+
+
+
+/*!
+ *      \~english
+ *      Returns type of object identified by its uid.
+ *      \~russian
+ *      Возвращает тип объекта по его идентификатору.
+ *      \~
+ *      \see uid( int otype )
+ *      \param uid (in) - \~english object's uid. \~russian уникальный идентификатор объекта \~
+ *      \return \~english object's type \~russian тип объекта \~
+ */
+int
+aDatabase::uidType ( Q_ULLONG uid )
+{
+        QSqlQuery q = db()->exec ( QString ( "SELECT otype FROM uniques WHERE id=%1" ).arg ( uid ) );
+        if ( q.first() )
+                return q.value ( 0 ).toInt();
+        else
+                aLog::print ( aLog::Error,tr ( "aDatabase get object type for unique id=%1" ).arg ( uid ) );
+        return 0;
+}
+
+
+
+/*!
+ *      \~english
+ *      Checks table existence.
+ *      \~russian
+ *      Проверяет, существует ли таблица в базе данных.
+ *      \~
+ *      \param name (in) - \~english table name to check for. \~russian имя проверяемой таблицы \~
+ *      \return \~english true, if table exists in current database \~russian true, если таблица существует \~
+ */
+bool
+aDatabase::tableExists ( const QString & name )
+{
+        return qds->tableExists ( qds->tableName ( name ) );
+}
+
+
+/*!
+ *
+ */
+bool
+aDatabase::createdb ( bool update )
+{
+        bool rc = false;
+
+        if ( qds )
+        {
+                qds_dd ( cfg );
+                qds->setDataDictionary ( dd );
+                if ( qds->verifyStructure() )
+                {
+                        // need to update
+                        printf ( "verify log:\n%s\n", ( const char * ) qds->verifyLog().join ( "\n" ) );
+                        printf ( "update structure query:\n%s\n", ( const char * ) qds->updateStructureQuery().join ( "\n" ) );
+                        if ( qds->updateStructure() !=0 )
+                        {
+                                rc = false;
+                                cfg_message ( 2, ( const char * ) tr ( "Data base update error\n" ) );
+                        }
+                        else
+                        {
+                                rc = true;
+                                cfg_message ( 0, ( const char * ) tr ( "Data base update successfull\n" ) );
+                        }
+                }
+        }
+        return rc;
+}
+
+
+
+/*!
+ *      \~english
+ *      Sets delete flag to true in system table for \a uid.
+ *      \~russian
+ *      Устанавливает флаг удаления в true в системной таблице для заданного \a uid
+ *      \~
+ *      \see deleteMarked()
+ *      \param uid - \~english id for mark deleted \~russian id для пометки на удаление \~
+ */
+void
+aDatabase::markDeleted ( Q_ULLONG uid )
+{
+        db()->exec ( QString ( "UPDATE uniques SET df='1' WHERE id=%1" ).arg ( uid ) );
+}
+
+
+/*!
+ *      \~english
+ *      Delete all marked records.
+ *      \~russian
+ *      Удаляет все помеченные записи.
+ *      \~
+ *      \see markDeleted(Q_ULLONG uid)
+ */
+void
+aDatabase::deleteMarked()
+{
+        db()->exec ( "DELETE FROM uniques WHERE df='1'" );
+}
+
+
+QStringList
+aDatabase::supportedDriverList()
+{
+        QStringList l;
+        l<<"internal";
+        l<<"mysql";
+        l<<"postgresql";
+        return l;
+}
+
+
+bool
+aDatabase::exchangeDataSystables ( QDomDocument &xml, bool import )
+{
+        bool res = false;
+        if ( import )
+        {
+                qds->databaseImport ( "import.xml", false );
+                res |= importTableData ( xml,"a_journ" );
+                res |= importTableData ( xml,db_users );
+                res |= importTableData ( xml,db_user_roles );
+                res |= importTableData ( xml,db_roles );
+                res |= importTableData ( xml,db_right_roles );
+                res |= importTableData ( xml,db_indices );
+
+        }
+        else
+        {
+                qds->databaseExport ( "export.xml" );
+                res |= exportTableData ( xml,"a_journ" );
+                res |= exportTableData ( xml,db_users );
+                res |= exportTableData ( xml,db_user_roles );
+                res |= exportTableData ( xml,db_roles );
+                res |= exportTableData ( xml,db_right_roles );
+                res |= exportTableData ( xml,db_indices );
+        }
+        return res;
+}
+
+bool
+aDatabase::exchangeDataUniques ( QDomDocument &xml, bool import )
+{
+        bool res = false;
+        if ( import )
+        {
+                res |= importTableData ( xml,"uniques" );
+        }
+        else
+        {
+                res |= exportTableData ( xml,"uniques" );
+        }
+        return res;
+}
+
+bool
+aDatabase::exchangeDataCatalogues ( QDomDocument &xml, bool import )
+{
+        aCfgItem gcont, cont, item;
+        long id;
+        int n, i;
+        bool rc = false;
+
+        gcont = cfg.find ( cfg.find ( mdc_metadata ), md_catalogues, 0 );
+        n = cfg.count ( gcont, md_catalogue );
+        for ( i = 0; i<n; i++ )
+        {
+                item = cfg.find ( gcont, md_catalogue, i );
+                if ( !item.isNull() )
+                {
+//                      printf("cat = %s\n", (const char *) cfg.attr( item, mda_name ) );
+                        id = cfg.id ( item );
+                        cont = cfg.findChild ( item, md_element, 0 );
+                        if ( !cont.isNull() )
+                        {
+                                if ( import )
+                                {
+                                        rc |= importTableData ( xml, tableDbName ( cfg, cont ) );
+                                }
+                                else
+                                {
+                                        rc|= exportTableData ( xml, tableDbName ( cfg, cont ) );
+                                }
+                        }
+                        cont = cfg.findChild ( item, md_group, 0 );
+                        if ( !cont.isNull() )
+                        {
+                                if ( import )
+                                {
+                                        rc |= importTableData ( xml, tableDbName ( cfg, cont ) );
+                                }
+                                else
+                                {
+                                        rc|= exportTableData ( xml, tableDbName ( cfg, cont ) );
+                                }
+                        }
+                        cfg_message ( 0, ( const char * ) tr ( "Catalogue %s processed\n" ).utf8(), ( const char * ) cfg.attr ( item, mda_name ).utf8() );
+                        if ( import )
+                        {
+                                aLog::print ( aLog::Info,tr ( "aDatabase catalogue %1 import" ).arg ( cfg.attr ( item, mda_name ) ) );
+                        }
+                        else
+                        {
+                                aLog::print ( aLog::Info,tr ( "aDatabase catalogue %1 export" ).arg ( cfg.attr ( item, mda_name ) ) );
+                        }
+                }
+        }
+        return rc;
+//      return true;
+}
+
+
+bool
+aDatabase::exchangeDataDocuments ( QDomDocument &xml, bool import )
+{
+        aCfgItem rcont, cont, item, tcont;
+        int n, i, tn, ti;
+        bool rc = false;
+
+        rcont = cfg.find ( cfg.find ( mdc_metadata ), md_documents, 0 );
+        n = cfg.count ( rcont, md_document );
+        for ( i = 0; i<n; i++ )
+        {
+                item = cfg.find ( rcont, md_document, i );
+                if ( !item.isNull() )
+                {
+                        //      printf("doc = %s\n", (const char *) cfg.attr( item, mda_name ) );
+                        cont = cfg.findChild ( item, md_header, 0 );
+                        if ( !cont.isNull() )
+                        {
+                                if ( import )
+                                {
+                                        rc |= importTableData ( xml, tableDbName ( cfg, cont ) );
+                                }
+                                else
+                                {
+                                        rc|= exportTableData ( xml, tableDbName ( cfg, cont ) );
+                                }
+                        }
+                        tcont = cfg.find ( item, md_tables, 0 );
+                        tn = cfg.count ( tcont, md_table );
+                        for ( ti = 0; ti < tn; ti++ )
+                        {
+                                cont = cfg.findChild ( tcont, md_table, ti );
+                                if ( !cont.isNull() )
+                                {
+                                        if ( import )
+                                        {
+                                                rc |= importTableData ( xml, tableDbName ( cfg, cont ) );
+                                        }
+                                        else
+                                        {
+                                                rc|= exportTableData ( xml, tableDbName ( cfg, cont ) );
+                                        }
+                                }
+                        }
+                }
+                cfg_message ( 0, ( const char * ) tr ( "Document %s processed\n" ).utf8(), ( const char * ) cfg.attr ( item, mda_name ).utf8() );
+                if ( import )
+                {
+                        aLog::print ( aLog::Info,tr ( "aDatabase document %1 import" ).arg ( cfg.attr ( item, mda_name ) ) );
+                }
+                else
+                {
+                        aLog::print ( aLog::Info,tr ( "aDatabase document %1 export" ).arg ( cfg.attr ( item, mda_name ) ) );
+                }
+        }
+        return rc;
+}
+
+
+bool
+aDatabase::exchangeDataJournals ( QDomDocument &xml, bool import )
+{
+        return false;
+}
+
+
+bool
+aDatabase::exchangeDataInfoRegisters ( QDomDocument &xml, bool import )
+{
+        aCfgItem rcont, cont, item;
+        int n, i;
+        bool rc = false;
+        QString filds;
+
+        rcont = cfg.find ( cfg.find ( mdc_metadata ), md_iregisters, 0 );
+        n = cfg.count ( rcont, md_iregister );
+        for ( i = 0; i<n; i++ )
+        {
+                item = cfg.find ( rcont, md_iregister, i );
+                if ( !item.isNull() )
+                {
+
+                        if ( import )
+                        {
+                                rc |= importTableData ( xml, tableDbName ( cfg, cont ) );
+                        }
+                        else
+                        {
+                                rc|= exportTableData ( xml, tableDbName ( cfg, cont ) );
+                        }
+                }
+                cfg_message ( 0, ( const char * ) tr ( "Information registers %s processed\n" ).utf8(), ( const char * ) cfg.attr ( item, mda_name ).utf8() );
+                if ( import )
+                {
+                        aLog::print ( aLog::Info,tr ( "aDatabase information register %1 import" ).arg ( cfg.attr ( item, mda_name ) ) );
+                }
+                else
+                {
+                        aLog::print ( aLog::Info,tr ( "aDatabase information register %1 export" ).arg ( cfg.attr ( item, mda_name ) ) );
+                }
+        }
+        return rc;
+}
+
+
+bool
+aDatabase::exchangeDataAccumulationRegisters ( QDomDocument &xml, bool import )
+{
+        aCfgItem rcont, cont, item, res, dim;
+        int n, i;
+        bool rc = false;
+        QString filds;
+        rcont = cfg.find ( cfg.find ( mdc_metadata ), md_aregisters, 0 );
+        n = cfg.count ( rcont, md_aregister );
+        for ( i = 0; i<n; i++ )
+        {
+                item = cfg.find ( rcont, md_aregister, i );
+                if ( !item.isNull() )
+                {
+                        if ( import )
+                        {
+                                rc |= importTableData ( xml, tableDbName ( cfg, item ) );
+                        }
+                        else
+                        {
+                                rc|= exportTableData ( xml, tableDbName ( cfg, item ) );
+                        }
+                        res = cfg.find ( item, md_resources );
+                        dim = cfg.find ( item, md_dimensions );
+                        if ( !res.isNull() && !dim.isNull() )
+                        {
+                                aCfgItem d;
+                                for ( uint k=0; k<cfg.count ( dim,md_field );k++ )
+                                {
+                                        d = cfg.findChild ( dim,md_field,k );
+                                        if ( import )
+                                        {
+                                                rc |= importTableData ( xml, tableDbName ( cfg, d ) );
+                                        }
+                                        else
+                                        {
+                                                rc|= exportTableData ( xml, tableDbName ( cfg, d ) );
+                                        }
+                                }
+                        }
+                }
+                cfg_message ( 0, ( const char * ) tr ( "Accumulation registers %s processed\n" ).utf8(), ( const char * ) cfg.attr ( item, mda_name ).utf8() );
+                if ( import )
+                {
+                        aLog::print ( aLog::Info,tr ( "aDatabase accumulation register %1 import" ).arg ( cfg.attr ( item, mda_name ) ) );
+                }
+                else
+                {
+                        aLog::print ( aLog::Info,tr ( "aDatabase accumulation register %1 export" ).arg ( cfg.attr ( item, mda_name ) ) );
+                }
+        }
+        return rc;
+}
+
+
+bool
+aDatabase::exportTableData ( QDomDocument& xml, const QString &tableName )
+{
+        aDataTable *dataTable = table ( tableName );
+        dataTable->select();
+        QDomElement xml_root = xml.documentElement();
+        if ( xml_root.isNull() )
+        {
+                aLog::print ( aLog::Error,tr ( "aDatabase export table: invalid XML file" ) );
+//              printf("xml has no root element");
+                return true;
+        }
+        QDomElement table = xml.createElement ( "table" );
+        table.setAttribute ( "name",tableName );
+        QDomElement row;
+        QDomElement field;
+        xml_root.appendChild ( table );
+        if ( !dataTable->first() ) return false;
+        do
+        {
+                uint countField = dataTable->count();
+                QVariant val;
+                row = xml.createElement ( "row" );
+                table.appendChild ( row );
+                for ( uint i=0; i<countField; i++ )
+                {
+                        val = dataTable->value ( i );
+                        if ( val.isValid() )
+                        {
+                                field = xml.createElement ( "field" );
+                                field.setAttribute ( "name",dataTable->fieldName ( i ) );
+                                field.appendChild ( xml.createTextNode ( val.toString() ) );
+                                row.appendChild ( field );
+                        }
+                }
+        }
+        while ( dataTable->next() );
+        return false;
+}
+
+
+bool
+aDatabase::importTableData ( QDomDocument &xml, const QString &tableName )
+{
+//      printf("import table data %s\n",tableName.ascii());
+        QDomElement root = xml.documentElement();
+        if ( root.nodeName() != "AnanasDump" )
+        {
+
+                aLog::print ( aLog::Error,tr ( "aDatabase import table: invalid XML file" ) );
+                //printf("uncnown data format\n");
+                return true;
+        }
+        QDomNodeList tables = root.childNodes();
+        uint countTables = tables.count();
+        for ( uint i=0; i<countTables; i++ )
+        {
+                //      printf("tableName==%s\n", tables.item(i).toElement().attribute("name").ascii());
+                if ( tables.item ( i ).toElement().attribute ( "name" ) == tableName )
+                {
+                        // found table
+                        aDataTable *tbl;
+                        if ( !tableExists ( tableName ) )
+                        {
+                                aLog::print ( aLog::Error,tr ( "aDatabase import table: table %1 not exists" ).arg ( tableName ) );
+                                //printf("table %s not exists\n",tableName.ascii());
+                                return true;
+                        }
+                        //printf("table exists\n");
+                        tbl = table ( tableName );
+                        if ( !tbl )
+                        {
+                                aLog::print ( aLog::Error,tr ( "aDatabase import table: get table %1" ).arg ( tableName ) );
+                                //printf("table is NULL\n");
+                                return true;
+                        }
+                        QDomNodeList rows = tables.item ( i ).childNodes();
+                        QDomNodeList fields;
+                        uint countRows = rows.count();
+                        uint countFields;
+                        QSqlRecord *buffer;
+                        QDomElement field;
+                        QString query = "delete from uniques";
+                        if ( tableName=="uniques" )
+                        {
+                                db()->exec ( query );
+                        }
+                        for ( uint j=0; j<countRows; j++ )
+                        {
+                                fields = rows.item ( j ).childNodes();
+                                countFields = fields.count();
+                                if ( tableName=="uniques" )
+                                {
+                                        // удаляем все строки в таблице
+                                        if ( fields.item ( 0 ).toElement().hasChildNodes() && fields.item ( 1 ).toElement().hasChildNodes() )
+                                        {
+                                                query = QString ( "INSERT INTO %1 (id,otype) values(%2,%3)" )
+                                                        .arg ( tableName )
+                                                        .arg ( fields.item ( 0 ).toElement().toElement().text() )
+                                                        .arg ( fields.item ( 1 ).toElement().toElement().text() );
+                                                //              printf("query = %s\n",query.ascii());
+                                                // добавляем записи с правильными идентификатораи
+                                                db()->exec ( query );
+
+                                        }
+                                }
+                                else
+                                {
+                                        buffer = tbl->primeInsert();
+                                        for ( uint k=0; k<countFields; k++ )
+                                        {
+                                                field = fields.item ( k ).toElement();
+                                                if ( field.hasChildNodes() )
+                                                {
+                                                        //      printf("node have child\n");
+
+                                                        buffer->setValue ( field.attribute ( "name" ),field.toElement().text() );
+                                                }
+                                        }
+                                        tbl->insert();
+                                }
+                        }
+                        break;
+                }
+        }
+        return false;
+}
+
+void
+aDatabase::reportError ( QSqlError er, const QString &query )
+{
+        aLog::print ( aLog::Error, QObject::tr ( "aDatabase query: %1" ).arg ( query ) );
+        aLog::print ( aLog::Error, QObject::tr ( "aDatabase text: %1" ).arg ( er.text() ) );
+        aLog::print ( aLog::Error, QObject::tr ( "aDatabase database text: %1" ).arg ( er.databaseText() ) );
+        aLog::print ( aLog::Error, QObject::tr ( "aDatabase driver text: %1" ).arg ( er.driverText() ) );
+}
+
+//start transaction
+bool aDatabase::transaction()
+{
+        if ( dataBase )
+                return dataBase->transaction();
+        return false;
+}
+
+//commit transaction
+bool aDatabase::commit()
+{
+        if ( dataBase )
+                return dataBase->commit();
+        return false;
+}
+
+//rollback transaction
+bool aDatabase::rollback()
+{
+        if ( dataBase )
+                return dataBase->rollback();
+        return false;
+}
+
+
+QStringList
+aDatabase::users()
+{
+        QStringList l;
+        l << "user1";
+        l << "user2";
+        l << "user3";
+        return l;
+}
+
+
+int
+aDatabase::loginUsersCount()
+{
+        QSqlQuery q = db()->exec ( QString ( "SELECT users FROM netusers" ) );
+        if ( q.first() ) return q.value ( 0 ).toInt();
+        else aLog::print ( aLog::Error,tr ( "aDatabase get users count" ) );
+        return 0;
+}
+
+
+bool
+aDatabase::login ( const QString &username, const QString &password, int applicationId )
+{
+        QSqlQuery q, q1;
+        int count = 0, role_id, md_id, perm, isActive = 0;
+        bool userOk = false;
+
+        v_user_id = 0;
+        v_app_id = applicationId;
+
+        if ( applicationId < 0 || applicationId > 3 ) applicationId = 0;
+        q = db()->exec ( QString ( "SELECT count(*) FROM %1" ).arg ( qds->tableName ( db_users ) ) );
+        if ( q.first() ) count = q.value ( 0 ).toInt();
+        if ( !count )
+        {
+                userOk = true;
+        }
+        else
+        {
+                q = db()->exec ( QString ( "SELECT id,active%4 FROM %1 WHERE login='%2' AND password='%3'" ).arg ( qds->tableName ( db_users ) ).arg ( username ).arg ( password ).arg ( applicationId ) );
+                if ( q.first() )
+                {
+                        v_user_id = q.value ( 0 ).toInt();
+                        isActive = q.value ( 1 ).toInt();
+                        userOk = true;
+                }
+                else aLog::print ( aLog::Error,tr ( "aDatabase get users count" ) );
+        }
+        if ( userOk )
+        {
+            if ( isActive !=0 && applicationId !=AApplication::Administrator ){
+                QMessageBox::information ( 0, "Ananas",tr ( "User already logged in" ), 0, 0, 0 );
+//                return false;
+            }
+                db()->exec ( QString ( "UPDATE %1 SET users=users+1" ).arg ( qds->tableName ( "netusers" ) ) );
+                if ( count )
+                {
+                        db()->exec ( QString ( "UPDATE %1 SET active%2=1 WHERE id=%3" ).arg ( qds->tableName ( db_users ) ).arg ( applicationId ).arg ( v_user_id ) );
+                }
+                printf ( "login user id = %i OK\n", v_user_id );
+
+// Считаем набор прав пользователя
+                q = db()->exec ( QString ( "SELECT idr FROM %1 WHERE id=%2" ).arg ( qds->tableName ( db_user_roles ) ).arg ( v_user_id ) );
+                while ( q.next() )
+                {
+                        role_id = q.value ( 0 ).toInt();
+                        q1 = db()->exec ( QString ( "SELECT object,permission FROM %1 WHERE id=%2" ).arg ( qds->tableName ( db_right_roles ) ).arg ( role_id ) );
+                        while ( q1.next() )
+                        {
+                                md_id = q1.value ( 0 ).toInt();
+                                perm  = q1.value ( 1 ).toInt();
+                                if ( accessRights.contains ( md_id ) )
+                                {
+                                        accessRights[ md_id ] |= perm;
+                                }
+                                else accessRights[ md_id ] = perm;
+                        }
+                }
+                QMap<int,int>::Iterator it;
+                for ( it = accessRights.begin(); it != accessRights.end(); ++it )
+                {
+                        printf ( "P %i:%04x\n",
+                                 it.key(),
+                                 it.data() );
+                }
+
+                return true;
+        }
+        return false;
+}
+
+
+void
+aDatabase::logout()
+{
+        db()->exec ( QString ( "UPDATE %1 SET users=CASE WHEN users>0 THEN users-1 ELSE 0 END" ).arg ( qds->tableName ( "netusers" ) ) );
+        objectUnlock ( 0 );
+        db()->exec ( QString ( "UPDATE %1 SET active%2=0 WHERE id=%3" ).arg ( qds->tableName ( db_users ) ).arg ( v_app_id ).arg ( v_user_id ) );
+        if ( !loginUsersCount() )
+        {
+                db()->exec ( QString ( "DELETE FROM %1" ).arg ( qds->tableName ( "locks" ) ) );
+        }
+}
+
+
+void
+aDatabase::netupdate()
+{
+        printf ( "UPDATE++\n" );
+        db()->exec ( QString ( "UPDATE %1 SET updates=updates+1" ).arg ( qds->tableName ( "netusers" ) ) );
+        v_updatesCount++;
+}
+
+
+
+bool
+aDatabase::isObjectLocked ( Q_ULLONG id )
+{
+        if ( !id ) return false;
+        QSqlQuery q = db()->exec ( QString ( "SELECT id FROM %1 WHERE userid=%2 AND id=%3" ).arg ( qds->tableName ( "locks" ) ).arg ( v_user_id ).arg ( id ) );
+        if ( q.first() )
+        {
+                QMessageBox::information ( 0, "Ananas",tr ( "Object locked by another user" ), 0, 0, 0 );
+                return true;
+        }
+        return false;
+}
+
+
+bool
+aDatabase::objectLock ( Q_ULLONG id )
+{
+        if ( !id ) return true;
+//    printf("LOCK user=%i obj=%Lu\n", v_user_id, id);
+        db()->exec ( QString ( "INSERT INTO %1 (userid,id) VALUES (%2,%3)" ).arg ( qds->tableName ( "locks" ) ).arg ( v_user_id ).arg ( id ) );
+        if ( db()->lastError().type() ==0 ) return true;
+        QMessageBox::information ( 0, "Ananas",tr ( "Object locked by another user" ), 0, 0, 0 );
+        return false;
+}
+
+void
+aDatabase::objectUnlock ( Q_ULLONG id )
+{
+//    printf("UNLOCK user=%i obj=%Lu\n", v_user_id, id);
+        QString query ( QString ( "DELETE FROM %1 WHERE userid=%2" ).arg ( qds->tableName ( "locks" ) ).arg ( v_user_id ) );
+        if ( id ) query.append ( QString ( " AND id=%1" ).arg ( id ) );
+        db()->exec ( QString ( query ) );
+}
+
+
+aDatabase *
+aDatabase::database()
+{
+        return &aDatabase_default;
+}
+
+
+int
+aDatabase::updatesCount()
+{
+        QSqlQuery q = db()->exec ( QString ( "SELECT updates FROM %1" ).arg ( qds->tableName ( "netusers" ) ) );
+        if ( q.first() ) return q.value ( 0 ).toInt();
+        return 0;
+}
+
+
+
+void
+aDatabase::timerEvent ( QTimerEvent * )
+{
+        int uc;
+       if ( !db()->isOpen() ) return;
+        uc = updatesCount();
+        if ( uc > v_updatesCount )
+        {
+                v_updatesCount = uc;
+                emit refresh();
+//        printf( "EMIT refresh\n" );
+        }
+}
+
+
+
+bool
+aDatabase::isAccessRights ( int md_type, Q_ULLONG obj_id, DBPermission req_operation )
+{
+        bool res = false;
+
+        if ( accessRights.contains ( md_type ) )
+        {
+                res = ( accessRights[ md_type ] & req_operation ) != 0;
+        }
+        else res = true;
+        if ( ! res )
+        {
+                QMessageBox::information ( 0, "Ananas",tr ( "No access rights" ), 0, 0, 0 );
+        }
+        return res;
+}
+
+
+int
+aDatabase::rolePermission ( int role_id, int md_id )
+{
+        int perm = 0;
+
+        QSqlQuery q = db()->exec ( QString ( "SELECT permission FROM %1 WHERE id=%2 AND object=%3" ).arg ( qds->tableName ( db_right_roles ) ).arg ( role_id ).arg ( md_id ) );
+        if ( q.first() ) perm = q.value ( 0 ).toInt();
+        else perm = DBP_All;
+        return perm;
+}
+
+
+void
+aDatabase::setRolePermission ( int role_id, int md_id, int new_permission )
+{
+        QString query;
+
+        printf ( "SET PERMISSIONS role = %i, obj_id=%i perm=%08x\n", role_id, md_id, new_permission );
+
+        QSqlQuery q = db()->exec ( QString ( "SELECT permission FROM %1 WHERE id=%2 AND object=%3" ).arg ( qds->tableName ( db_right_roles ) ).arg ( role_id ).arg ( md_id ) );
+        if ( q.first() ) query = QString ( "UPDATE %1 SET permission=%4 WHERE id=%2 AND object=%3" ).arg ( qds->tableName ( db_right_roles ) ).arg ( role_id ).arg ( md_id ).arg ( new_permission );
+        else query = QString ( "INSERT INTO %1 (id,object,permission) VALUES (%2,%3,%4)" ).arg ( qds->tableName ( db_right_roles ) ).arg ( role_id ).arg ( md_id ).arg ( new_permission );
+        q = db()->exec ( query );
+        if ( db()->lastError().type() !=0 ) printf ( "error query %s\n", ( const char* ) query );
+}
diff --git a/src/lib/sys/adatabase.h b/src/lib/sys/adatabase.h
new file mode 100644 (file)
index 0000000..cece630
--- /dev/null
@@ -0,0 +1,208 @@
+/****************************************************************************
+** $Id: adatabase.h,v 1.2 2008/11/09 21:08:09 leader Exp $
+**
+** Header file of the ananas database of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail dot ru >, Yoshkar-Ola
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef ADATABASE_H
+#define ADATABASE_H
+#include <QObject>
+#include <qstringlist.h>
+#include <qsqldatabase.h>
+#include <q3dict.h>
+//Added by qt3to4:
+#include <QSqlError>
+#include "acfg.h"
+#include <qwidget.h>
+#include <QMap>
+#include <qdataschema.h>
+
+
+/**
+ *     Константы, используемые для формирования имен sql таблиц в зависимости от соответствия
+ *     sql таблицы и бизнес объекта Ананаса
+ */
+#define db_document_header     "dh%1"
+#define db_document_table      "dt%1_%2"
+#define db_catalog_element     "ce%1"
+#define db_catalog_group       "cg%1"
+#define db_iregister           "ri%1"
+#define db_aregister           "ra%1"
+#define db_areg_remainder      "ra%1_rem"
+#define db_user_roles          "usr_rl"
+#define db_users               "usr"
+#define db_roles               "rl"
+#define db_right_roles         "r_rl"
+#define db_indices             "idc"
+#define db_areg_dim            "ra%1_d%2"
+
+class aDatabase;
+class aCfgRc;
+class aDataTable;
+
+/*!
+ *\~english
+ *     Database abstraction layer class.
+ *     Used for working with SQL database on metadata context.
+ *\~russian
+ *     \brief Класс для работы с СУБД. Ananas Data Abstraction Layer.
+ *     Наследует QObject.
+ *
+ *     Обеспечивает унифицированный программный интерфейс доступа к данным, независимый от используемой СУБД.
+ *     Используется для работы с базой данных в контексте бизнес схемы.
+ *\~
+ */
+class  ANANAS_EXPORT aDatabase: public QObject
+{
+       Q_OBJECT
+
+public slots:
+
+public:
+
+        enum DBPermission {
+            DBP_NoAccess    = 0,
+            DBP_View        = 1 << 0,
+            DBP_Update      = 1 << 1,
+            DBP_Insert      = 1 << 2,
+            DBP_Delete      = 1 << 3,
+            DBP_Execute     = 1 << 4,
+            DBP_TurnOn      = 1 << 5,
+            DBP_TurnOff     = 1 << 6,
+            DBP_All         = 0xFFFF
+        };
+
+       /*! \~english type of database drivers \~russian перечисление типов баз данных \~ */
+       enum dbServer
+       {
+       /*!     \~english Unknown driver (not supported)\~russian   Неизвестный драйвер (не поддерживается)\~ */
+       unknown,
+       /*!     \~english MySQL driver \~russian MySQl драйвер \~ */
+       mysql,
+       /*!     \~english PostgreSQL driver \~russian PostgreSQL драйвер \~ */
+       postgresql,
+       /*!     \~english ODBC driver (not supported)\~russian ODBC драйвер (не поддерживается) \~ */
+       odbc,
+       /*!     \~english Oracle driver (not supported)\~russian Oracle драйвер (не поддерживается) \~ */
+       oracle,
+       /*!     \~english MSSQL driver (not supported)\~russian MSSQL драйвер (не поддерживается) \~ */
+       mssql,
+       /*!     \~english Sybase driver (not supported)\~russian Sybase драйвер (не поддерживается) \~ */
+       sybase };
+       /*! \~english link to database \~russian ссылка на базу данных \~ */
+       QSqlDatabase ddb;
+       /*! \~english metadata object \~russian метаданные \~ */
+       aCfg cfg;
+        QDataSchema *qds;
+
+       aDatabase();
+       ~aDatabase();
+       bool init( aCfgRc *rc, const QString &dbname = QString::null );
+       bool init( const QString &rcname, const QString &dbname = QString::null );
+       bool            prepareDatabaseConnect( aCfgRc *rc );
+       void done();
+       QSqlDatabase *db(const QString &dbname = QString::null );
+       bool checkStructure();
+       bool create();
+       bool drop( const QString &);
+       bool update();
+       Q_ULLONG uid( int otype );
+//     int otype( Q_ULLONG uid );
+       int uidType ( Q_ULLONG uid );
+       aDataTable *table( const QString & name = QString::null );
+       bool tableExists( const QString & name );
+       void markDeleted(qulonglong uid);
+       void deleteMarked();
+        QString driverName();
+
+        bool isAccessRights( int md_type, Q_ULLONG obj_id, DBPermission req_operation );
+
+       static QStringList supportedDriverList();
+       static QStringList getUniqueIndices(const QString & flddef);
+       static QString tableDbName( aCfg &md, aCfgItem context, long * tid);
+       static QString tableDbName( aCfg &md, aCfgItem context);
+
+       bool exchangeDataSystables       ( QDomDocument &xml, bool import );
+       bool exchangeDataCatalogues      ( QDomDocument &xml, bool import );
+       bool exchangeDataDocuments       ( QDomDocument &xml, bool import );
+       bool exchangeDataJournals        ( QDomDocument &xml, bool import );
+       bool exchangeDataInfoRegisters   ( QDomDocument &xml, bool import );
+       bool exchangeDataAccumulationRegisters   ( QDomDocument &xml, bool import );
+       bool exchangeDataUniques         ( QDomDocument &xml, bool import );
+
+       bool transaction();
+       bool commit();
+       bool rollback();
+
+        QStringList users();
+        int  loginUsersCount();
+        bool login( const QString &username, const QString &password, int applicationId = 0 );
+        void logout();
+        void netupdate();
+
+        bool isObjectLocked( Q_ULLONG id );
+        bool objectLock( Q_ULLONG id );
+        void objectUnlock( Q_ULLONG id=0 );
+//        QDataSchema *qds();
+
+        int  rolePermission( int role_id, int md_id );
+        void setRolePermission( int role_id, int md_id, int new_permission );
+        
+        static aDatabase *database();
+signals:
+        void refresh();
+protected:
+        void timerEvent ( QTimerEvent * );
+private:
+       /**
+        * \en
+        *      link to database 
+        * \_en \ru
+        *      \brief Ссылка на объект доступа к базе данных sql сервера.
+        * \_ru
+        */
+       QSqlDatabase *dataBase;
+        int v_user_id, v_app_id;
+        int v_updatesCount;
+        int v_timerId;
+
+        int updatesCount();
+       bool exportTableData(QDomDocument& xml, const QString &tableName);
+       bool importTableData(QDomDocument& xml, const QString &tableName);
+       void reportError(QSqlError er, const QString &query);
+
+       bool isExists(const QString fname, QStringList *f_lst, QString &match);
+       bool createdb( bool update );
+        bool dumpTable( QDomDocument& xml, const QString &tableName);
+       void fillFeatures();
+       QString feature(const QString& fetureName);
+
+       QMap<QString, QString> featuresMySQL, featuresSQLite, featuresPostgreSQL;
+        QMap<int, int> accessRights;
+};
+
+#endif
diff --git a/src/lib/sys/sys.pri b/src/lib/sys/sys.pri
new file mode 100644 (file)
index 0000000..565fc56
--- /dev/null
@@ -0,0 +1,7 @@
+HEADERS += \
+    sys/adatabase.h \ 
+    sys/aapplication.h 
+
+SOURCES += \
+    sys/adatabase.cpp \
+    sys/aapplication.cpp 
diff --git a/src/lib/widgets/awidget.cpp b/src/lib/widgets/awidget.cpp
new file mode 100644 (file)
index 0000000..6cbb20f
--- /dev/null
@@ -0,0 +1,1108 @@
+/****************************************************************************
+** $Id: awidget.cpp,v 1.2 2008/11/08 20:16:36 leader Exp $
+**
+** Code file of the Ananas visual bject of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qobject.h>
+#include <q3sqlcursor.h>
+#include <q3sqlpropertymap.h>
+#include <qdialog.h>
+#include <qlineedit.h>
+//Added by qt3to4:
+#include <Q3SqlForm>
+#include <QLabel>
+#include <QKeyEvent>
+#include "adatabase.h"
+#include "awidget.h"
+#include "wfield.h"
+#include "wdbfield.h"
+#include "wdbtable.h"
+#include "aform.h"
+#include "alog.h"
+
+
+/*!
+ *\en
+ *     Abstract Ananas widget object.
+ *\_en
+ *\ru
+ *     Конструктор, создающий абстрактный объект. Абстрактность в данном случае означает
+ *     отстутствие привязки к базе данных. \n
+ *     Вызывает конструктор базового класса QWidget.
+ *     \param parent - указатель на родительский виджет.
+ *     \param name - имя создаваемого объекта.
+ *     \param fl - флаги используемые при создании виджета. Передаются в конструктор базового класса.
+ *\_ru
+ */
+aWidget::aWidget( QWidget *parent, const char *name, Qt::WFlags fl )
+:QWidget( parent, name, fl )
+{
+       vId = 0;
+       db = 0;
+        dbobj = 0;
+       engine = 0;
+       vFormMode = 0;
+       vInited = false;
+}
+
+/*!
+ * \ru
+ *     Конструктор, использующий для создания объекта имя элемента метаданных.\n
+ *     У класса есть также конструктор, использующий для создания объекта ссылку на объект с описанием элемента метаданных.
+ *     \param itemname - имя элемента метаданных.
+ *     \param adb - ссылка на объект доступа к базе данных.
+ *     \param parent - указатель на родительский виджет (передается в конструктор базового класса).
+ *     \param name - имя создаваемого объекта (передается в конструктор базового класса).
+ *     \param fl - флаги, используемые конструктором базового класса.
+ * \_ru
+ */
+aWidget::aWidget( const QString &itemname, aDatabase *adb, QWidget *parent, const char *name, Qt::WFlags fl )
+:QWidget( parent, name, fl )
+{
+       vId = 0;
+        dbobj = 0;
+       vInited = false;
+       engine = 0;
+       vFormMode = 0;
+       if ( adb ) {
+               obj = adb->cfg.find( itemname );
+               init( adb );
+       }
+}
+
+
+/*!
+ * \ru
+ *     Конструктор, использующий для создания объекта ссылку на объект элемента метаданных.\n
+ *     У класса есть также конструктор, использующий для создания объекта имя элемента метаданных.
+ *     \param context - ссылка на объект элемента метаданных.
+ *     \param adb - ссылка на объект доступа к базе данных.
+ *     \param parent - указатель на родительский виджет (передается в конструктор базового класса).
+ *     \param name - имя создаваемого объекта (передается в конструктор базового класса).
+ *     \param fl - флаги, используемые конструктором базового класса.
+ * \_ru
+ */
+aWidget::aWidget( aCfgItem context, aDatabase *adb, QWidget *parent, const char *name, Qt::WFlags fl )
+:QWidget( parent, name, fl )
+{
+       vId = 0;
+        dbobj = 0;
+       vInited = false;
+       engine = 0;
+       obj = context;
+       vFormMode = 0;
+       init( adb );
+}
+
+aWidget::~aWidget()
+{
+       delete dbobj;
+       dbobj = 0;
+}
+
+
+
+/*!
+ *\en
+ *     Create database object.
+ *\_en
+ *\ru
+ *     Пока ничего не делает. Возвращает 0;
+ *\_ru
+ */
+aObject *
+aWidget::createDBObject(  aCfgItem , aDatabase * )
+{
+       return 0;
+}
+
+
+
+
+/*!
+ *\en
+ *     Create toolbar for QMainWindow owner object.
+ *\_en
+ *\ru
+ *     Пока ничего не делает. Возвращает 0;
+ *\_ru
+ */
+Q3ToolBar*
+aWidget::createToolBar( Q3MainWindow * )
+{
+       return 0;
+}
+
+
+/*!
+ *\ru
+ *     Если объект не был проинициализирован, вызывает initObject(adb).
+ *\_ru
+ */
+
+void
+aWidget::init( aDatabase *adb )
+{
+       if ( isInited() ) return;
+//     aWidget *pc = parentContainer( this );
+//     if ( pc ) if ( !pc->isInited() ) pc->init( adb );
+       initObject( adb );
+}
+
+
+
+/*!
+ *\en
+ *     Init object after create.
+ *     Need setId( id ), where id - if of the metadata object of the adb->cfg loaded Configuration.
+ *\_en
+ *\ru
+ *     Инизиализирует созданный объект.
+ *     Необходимо выполнить setId(id), где id идентификатор обекта в конфигурации.
+ *\_ru
+ *\param adb - \en ananas database object. \_en \ru объект доступа к базе данных. \_ru
+ */
+void
+aWidget::initObject( aDatabase *adb )
+{
+       aCfgItem fg, f;
+       QString tname;
+
+       aLog::print(aLog::Debug, tr("aWidget init widget %1 form mode %2").arg(name()).arg(formMode()) );
+       // Init myself.
+       setInited( true );
+
+       //<для чего?
+       Q3SqlPropertyMap *pm = new Q3SqlPropertyMap();
+       //>
+
+
+       db = adb;
+       md = 0;
+       if ( db )
+       {
+               md = &db->cfg;
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aWidget init: invalid database") );
+               return;
+       }
+
+       if ( obj.isNull() )
+       {
+               obj = md->find( getId() );
+       }
+
+
+       //<для чего?
+       form = new Q3SqlForm( this );
+       pm->insert("wDBField","value");
+       form->installPropertyMap( pm );
+       //>
+
+
+       if ( obj.isNull() )
+       {
+               aLog::print(aLog::Error, tr("aWidget init: invalid meta object") );
+               return;
+       }
+       dbobj = createDBObject( obj, adb );
+       QObjectList l = this->queryList( "QWidget" );
+       QListIterator<QObject*>  it( l );
+       QObject *obj;
+       while ( it.hasNext() )
+       {
+               obj = it.next();
+               if ( parentContainer( ( QWidget *) obj ) != this ) continue;
+
+               //debug_message("SCAN: Widget class name=%s\n", obj->className() );
+
+               if ( obj->className()==QString("wDBTable") )
+               {
+
+                       aLog::print(aLog::Debug, tr("aWidget init: connect signals wDBTable") );
+                       connect( this, SIGNAL( changeObj(const QString &) ),
+                               //(wDBTable*)
+                               obj, SLOT( newFilter(const QString &) ));
+                       connect( this, SIGNAL( changeObjId(const qulonglong) ),
+                               //(wDBTable*)
+                               obj, SLOT( newDataId(const qulonglong) ));
+               }
+       //      if ( obj->className()==QString("wDBField") )
+       //      {
+//                     connect( this, SIGNAL( changeObj(const QString &) ),
+//                             //(wDBTable*)
+//                             obj, SLOT( newFilter(const QString &) ));
+       //      }
+       }
+       //--delete l; // delete the list, not the objects
+       //--l=0;
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+ /*
+void
+aWidget::formInsert( QWidget *widget, const QString &field )
+{
+       form->insert( widget, field );
+}
+*/
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+/*
+void
+aWidget::formRemove( const QString &field )
+{
+       form->remove( field );
+}
+*/
+
+
+/*!
+ *\en
+ *\_en
+ *\ru
+ *     Ничего не делает. Возвращает false.
+ *\_ru
+ */
+bool
+aWidget::checkStructure()
+{
+       return false;
+}
+
+
+
+/*!
+ *\en
+ *\_en
+ *\ru
+ *     Возвращает значение свойства vName.
+ *\_ru
+ */
+/*QString
+aWidget::getName() const       {
+//     if (vName.isEmpty()) return name();
+       return vName;
+}
+*/
+
+
+/*!
+ *\en
+ *\_en
+ *\ru
+ *     Устанавливает значение свойства vName.
+ *\_ru
+ */
+ /*
+void
+aWidget::setName(QString fn){
+       vName = fn;
+}
+*/
+
+
+/*!
+ *\en
+ *\_en
+ *\ru
+ *     Ничего не делает. Возвращает 0.
+ *\_ru
+ */
+QDialog*
+aWidget::createEditor( QWidget * )
+{
+       return 0;
+}
+
+
+
+/*!
+ *\en
+ *\_en
+ *\ru
+ *     Вызывает редактор свойств, если значение передаваемого параметра равно true.
+ *     Редактор свойств предоставляет пользователю диалог задания значений свойств виджета.
+ *     Например, для такого виджета как wDBField редактор свойств позволяет выбрать элемент метаданных
+ *     описывающий поле базы данных, значение которого будет редактироваться с использованием виджета.
+ *     То есть осуществить привязку данных (data bindings).
+ *\param fn - параметр, значение которого должно быть равно true, для того чтобы был вызван
+ *     редактор свойств.
+ *\_ru
+ */
+void
+aWidget::setOpenEditor( bool fn )
+{
+       if(fn) widgetEditor();
+}
+
+
+
+/*!
+ *\en
+ *     Emit signal setData( object, md ).
+ *\_en
+ *\ru
+ *     Посылает сигнал setData( object, md ).
+ *\_ru
+ */
+void
+aWidget::setObjectData( QWidget *object, aCfg *md )
+{
+        emit( setData( object, md ) );
+}
+
+
+
+/*!
+ *\en
+ *     Emit signal getData( object ).
+ *\_en
+ *\ru
+ *     Посылает сигнал getData( object ).
+ *\_ru
+ */
+void
+aWidget::getObjectData( QWidget *object )
+{
+        emit( getData( object ) );
+}
+
+
+
+/*!
+ *\en
+ *     Return toplevel metadata configuration.
+ *\_en
+ *\ru
+ *     Возвращает объект конфигурации для виджета верхнего уровня.
+ *\_ru
+ */
+aCfg*
+aWidget::getMd()
+{
+       aCfg *md = 0;
+       QWidget *mw = topLevelWidget();
+       if (mw->name() == QString("ananas-designer_mainwindow") )
+       {
+               connect( this, SIGNAL( getMd( aCfg ** ) ), mw, SLOT( getMd( aCfg ** ) ));
+               emit ( getMd( &md ) );
+       }
+       return md;
+}
+
+
+
+/*!
+ *\~english
+ *     Get id from database.
+ *     Get id for current database record or 0 if database object not created.
+ *\~russian
+ *     Возвращает id объекта базы данных.
+ *     Возвращает id текущей записи в базе данных или 0 если обект
+ *     для работы с базой не создан. Id является уникальным и идентифицирует конкретный
+ *     экземпляр обекта.
+ *\~
+ *\return \~english current database record id\~russian id текущей записи в базе данных.\~
+ */
+qulonglong
+aWidget::uid()
+{
+       if ( dbobj )
+       {
+               return dbobj->getUid();
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aWidget invalid data source object") );
+       }
+       return 0;
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+void
+aWidget::widgetEditor()
+{
+       aWidget::widgetEditor( this, createEditor( topLevelWidget() ) );
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+void
+aWidget::widgetEditor(  QWidget *object, QDialog *editor )
+{
+        aCfg *md = 0;
+       QWidget *mw = object->topLevelWidget();
+        aWidget o( mw );
+       if ( mw->name() == QString( "ananas-designer_mainwindow" ) )
+       {
+                md = o.getMd();
+               if ( !md )
+               {
+                       aLog::print(aLog::Error, tr("aWidget widgetEditor: invalid metadata object") );
+                       return;
+               }
+               if ( editor ) {
+                       connect( &o, SIGNAL( setData( QWidget *, aCfg* ) ), editor, SLOT( setData( QWidget *, aCfg* ) ) );
+                       connect( &o, SIGNAL( getData( QWidget * ) ), editor, SLOT( getData( QWidget * ) ) );
+                       o.setObjectData( object, md );
+                       if ( editor->exec() == QDialog::Accepted )
+                       {
+                               o.getObjectData( object );
+                               //o.updateProp();
+                       }
+                       delete editor;
+                       editor = 0;
+               }
+       }
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+aWidget *
+aWidget::parentContainer( QWidget *w )
+{
+        while ( w )
+       {
+                w = w->parentWidget();
+                if ( w )
+               {
+                       if ( w->inherits("aWidget") )
+                       {
+                               if ( ( ( aWidget *) w )->isContainer()) break;
+                       }
+               }
+        }
+        return ( aWidget *) w;
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+aForm *
+aWidget::parentForm( QWidget *w )
+{
+        while ( w )
+       {
+                if ( w->inherits("aForm") ) break;
+                w = w->parentWidget(true);
+        }
+        return ( aForm *) w;
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+aCfgItem *
+aWidget::getMDObject()
+{
+    return &obj;
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+void
+aWidget::setMDObject( aCfgItem object )
+{
+    obj = object;
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+aSQLTable *
+aWidget::table( const QString &name )
+{
+        if ( dbobj )
+       {
+               return dbobj->table( name );
+       }
+       aLog::print(aLog::Error, tr("aWidget table: invalid data source object") );
+        return 0;
+}
+
+/*
+bool
+aWidget::tableInsert( const QString &name )
+{
+       if ( db ) {
+               aSQLTable *t = db->table( name );
+               if ( !t ) return false;
+               dbtables.insert( name, t );
+               return true;
+       }
+       return false;
+}
+
+
+bool
+aWidget::tableRemove( const QString &name )
+{
+       dbtables.remove( name );
+       return true;
+}
+*/
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+QString
+aWidget::displayString()
+{
+       return "";
+}
+
+
+
+
+/*!
+ *\~english
+ *     Create new database record object.
+ *     New object create with using wirtual function aObject::New() of aObject
+ *     and it's childs.
+ *\~russian
+ *     Создает новый объект для работы с записями базы данных.
+ *     Объект создается испоьлзуя виртуальную функцию aObject::New() объекта aObject
+ *     и его потомков.
+ *\~
+ *\return \~engilsh error code. \~russian код ошибки.\~
+ */
+ERR_Code
+aWidget::New()
+{
+       if ( dbobj )
+       {
+               return dbobj->New();
+       }
+       aLog::print(aLog::Error, tr("aWidget new: invalid data source object") );
+       return err_abstractobj;
+
+}
+
+
+
+/*!
+ *\~english
+ *     Select object in database.
+ *\~russian
+ *     Выбирает объект в базе данных.
+ *\~
+ *\param id -\~english database record id.\~russian id объекта в базе данных.\~
+ *\return \~english error code.\~russian код ошибки.\~
+ */
+ERR_Code
+aWidget::Select( qulonglong id )
+{
+       int rc = 0;
+       if ( dbobj )
+       {
+               bool res;
+               res = dbobj->select( id );
+               if(res) rc = err_noerror;
+               else rc = err_selecterror;
+               //Refresh();
+               return rc;
+       }
+       aLog::print(aLog::Error, tr("aWidget select: invalid data source object") );
+       return err_abstractobj;
+}
+
+
+
+/*!
+ *\~english Update data
+ *\~russian Обновляет данные по данному виджету в базе
+ *\~
+ */
+ERR_Code
+aWidget::Update()
+{
+       QString fname;
+       if ( dbobj )
+       {
+
+               QObjectList l = this->queryList( "wDBField" );
+               QListIterator<QObject*> it( l );
+               aWidget *obj;
+               while ( it.hasNext() )
+               {
+                       obj = qobject_cast<aWidget*>(it.next());
+                       fname= obj->getFieldName();
+                       dbobj->SetValue( fname,( ( aWidget *) obj )->value() );
+               }
+               //--delete l; // delete the list, not the objects
+               //--l=0;
+/*
+               while ( (obj = (aWidget*) tit.current()) != 0 ){
+                       ++tit;
+                       ((QDataTable*)obj)->refresh();
+               }
+               delete tl; // delete the list, not the objects
+
+               return err_noerror;
+*/
+               return dbobj->Update();
+       }
+       aLog::print(aLog::Error, tr("aWidget update: invalid data source object") );
+       return err_incorrecttype;
+}
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+ERR_Code
+aWidget::Refresh()
+{
+       QString fname;
+       QObjectList l = this->queryList( "wDBField" );
+       QListIterator<QObject*> it( l );
+       QObjectList tl = this->queryList( "wDBTable" );
+       QListIterator<QObject*> tit( tl );
+       aWidget *obj;
+       while ( it.hasNext() ){
+               obj = qobject_cast<aWidget*>(it.next());
+               if ( parentContainer( obj ) != this ) continue;
+               fname= obj->getFieldName();
+               obj->setValue(dbobj->Value(fname).toString());
+       }
+       //--delete l; // delete the list, not the objects
+       //--l=0;
+
+    Q3DataTable* obj2;
+       while ( tit.hasNext() ){
+               obj2 = qobject_cast<Q3DataTable*>(tit.next());
+               obj2->refresh();
+       }
+       //--delete tl; // delete the list, not the objects
+
+       return err_noerror;
+}
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+ERR_Code
+aWidget::TurnOn()
+{
+       return err_incorrecttype;
+}
+
+
+
+/*!
+ *\~english
+ *     Get field value.
+ *     get value for field with such name.
+ *\~russian
+ *     Возвращает значение поля.
+ *     Возвращает значение поля с именем name.
+ *\~
+ *\param name - \~english field md name. \~russian имя поля в конфигурации.\~
+ *\return \~english field value. \~russian значение поля.\~
+ */
+QVariant
+aWidget::value( const QString & nameWidget )
+{
+       QObject *w;
+       QVariant res;
+/*
+       aObject *o = 0;
+        if ( mainWidget ) o = mainWidget->dataObject();
+        if ( o ) {
+                res = o->Value( name );
+        }
+        if ( res.type() != QVariant::Invalid ) return res;
+        else printf("no field %s in data object\n", ( const char *) name );
+*/
+       w = Widget( nameWidget );
+       if ( w ) {
+               if (w->inherits("aWidget")){
+                       res=( (aWidget*)w )->textValue();//value();
+//             } else if (w->inherits("wField")){
+//                     res=( (wField*)w )->text();//value();
+               } else if (!strcmp(w->className(),"QPushButton")){
+                       res=((QPushButton *)w)->text();
+               } else if (!strcmp(w->className(),"QLabel")){
+                       res=((QLabel*)w)->text();
+               } else if (!strcmp(w->className(),"QLineEdit")){
+                       res=((QLineEdit*)w)->text();
+               } else if (!strcmp(w->className(),"QCheckBox")){
+                       res=((QCheckBox*)w)->text();
+               } else if (!strcmp(w->className(),"QDateEdit")){
+                       res=((Q3DateEdit*)w)->date().toString(Qt::ISODate);
+               }
+       } else {
+       //      debug_message(tr("Error! Can't find widget by name==`%s`\n"),(const char*) name.local8Bit());
+
+               aLog::print(aLog::Error, tr("aWidget value not fount widget with name %1").arg(nameWidget) );
+       }
+       return res;
+//     if ( dbobj ) return dbobj->Value(name);
+//CHECK_POINT
+//     return QVariant("");
+}
+
+
+
+/*!
+ *\~english
+ *     Setting form widgets value.
+ *     Support type of widgets: wField, wDBField, QPushButton, QLabel, QLineEdit, QCheckBox.
+ *\~russian
+ *     Установка значения виджетов формы.
+ *     Поддерживаемые типы виджетов: wField, wDBField, QPushButton, QLabel, QLineEdit, QCheckBox.
+ *\~
+ *\param nameWidget -\~english Widget name.
+               \~russian Имя виджета.
+               \~
+ *\param value -\~english value.
+               \~russian Значение виджета.
+               \~
+ */
+int
+aWidget::setValue( const QString & nameWidget, const QVariant &value )
+{
+       QObject *w;
+       int     rc= err_noerror;
+
+       w = Widget( nameWidget );
+       if ( w ) {
+               if (w->inherits("wField")){
+                       ((aWidget*)w)->setValue(value.toString());
+//             } else if (w->inherits("wField")){
+//                     ((wField*)w)->setValue(value.toString());
+               } else if (!strcmp(w->className(),"QPushButton")){
+                       ((QPushButton *)w)->setText( value.toString() );
+               } else if (!strcmp(w->className(),"QLabel")){
+                       ((QLabel*)w)->setText( value.toString() );
+               } else if (!strcmp(w->className(),"QLineEdit")){
+                       ((QLineEdit*)w)->setText( value.toString() );
+               } else if (!strcmp(w->className(),"QCheckBox")){
+                       ((QCheckBox*)w)->setText(value.toString() );
+               } else if (!strcmp(w->className(),"QDateEdit")){
+                       ((Q3DateEdit*)w)->setDate( value.toDate() );
+               }
+       } else {
+               //debug_message(tr("aForm::SetValue() Error! Can't find widget by name==`%s`\n"),(const char*) name.local8Bit());
+               aLog::print(aLog::Error, tr("aWidget set value: not fount widget with name %1").arg(nameWidget) );
+               rc = err_nowidgetfound;
+       }
+       return rc;
+}
+
+
+
+/*!
+ *\~english
+ *     Setting form widgets value.
+ *     Must be implemented in inherited class.
+ *\~russian
+ *     Функция установки значения виджетов формы.
+ *     Должна быть реализована в наследующем классе.
+ *\~
+ *\param value -\~english value.
+               \~russian Значение виджета. Имя у виджета уже есть в момент вызова этой функции.
+               \~
+ */
+void
+aWidget::setValue( const QString & value)
+{
+}
+/*!
+ *\~english
+ *     Setting form widgets value of object type.
+ *     Support type of widgets: wField, wDBField.
+ *\~russian
+ *     Установка значения виджетов формы сложного типа.
+ *     Поддерживаемые типы виджетов: wField, wDBField.
+ *\~
+ *\param nameWidget -\~english Widget name.
+               \~russian Имя виджета.
+               \~
+ *\param value -\~english value.
+               \~russian Значение виджета.
+               \~
+ */
+int
+aWidget::setObjValue( const QString & nameWidget, aObject *value )
+{
+       QObject *w;
+       int     rc= err_noerror;
+       w = Widget( nameWidget );
+       if ( w ) {
+               if (w->inherits("wField") && value){
+                       ((aWidget*)w)->setValue(QString("%1").arg(value->getUid()));
+               }
+       } else {
+               //debug_message(tr("aForm::SetValue() Error! Can't find widget by name==`%s`\n"),(const char*) name.local8Bit());
+               aLog::print(aLog::Error, tr("aWidget set value: not fount widget with name %1").arg(nameWidget) );
+               rc = err_nowidgetfound;
+       }
+       return rc;
+}
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ */
+bool
+aWidget::isContainer()
+{
+       return false;
+}
+
+
+
+/*!
+ *\~english
+ *     Seting widget readonly flag.
+ *     When widget readonly it's fields can't be edit, and make updatе action
+ *\~russian
+ *     Устанавливает флаг толко чтение.
+ *     Когда установлен этот флаг, запрещается редактирование полей виджета,
+ *     и сохранение изменений в базу.
+ *\~
+ *\param status - \~english New readonly flag.\~russian Новое значение флага только чтение.\~
+ */
+void
+aWidget::SetReadOnly ( bool status )
+{
+//CHECK_POINT
+       QObjectList l;// = this->queryList( "wField" );
+       QObject *obj;
+       l = this->queryList( "aWidget" );
+       QListIterator<QObject*> itl( l );
+       while ( itl.hasNext() )
+       {
+//     CHECK_POINT
+               obj = itl.next();
+               (( aWidget *)obj)->SetReadOnly( status );
+       }
+       //--delete l; // delete the list, not the objects
+       l = this->queryList( "QFrame" );
+       QListIterator<QObject*> tl( l );
+       while ( tl.hasNext() )
+       {
+               //printf("QFrame classname '%s'\n", (const char*) obj->className() );
+               obj = tl.next();
+               if (obj->inherits("QTable")) (( Q3Table * )obj)->setReadOnly(true);
+               //else (( QFrame *)obj)->setDisabled( status );
+       }
+       //--delete l; // delete the list, not the objects
+       //--l=0;
+}
+
+
+/*!
+ *
+ */
+qulonglong
+aWidget::docId()
+{
+       if ( dbobj )
+       {
+               return dbobj->docId();
+       }
+       aLog::print(aLog::Error, tr("aWidget doc Id: invalid data source object") );
+       return 0;
+}
+
+
+
+QString
+aWidget::widgetName(QWidget *obj)
+{
+       QString res="";
+       if (obj)
+       {
+               if (obj->inherits("wDBField"))
+               {
+                       res= ((aWidget*)obj)->getFieldName();
+               }
+               else
+               {
+                       res=obj->name();
+               }
+       }
+       return res;
+}
+
+
+
+
+/*!
+ *\~english
+ *     Return form widget pointer by name.
+ *\~russian
+ *\~
+*/
+QWidget*
+aWidget::Widget( QWidget *owner, QString name )
+{
+       QWidget *res = 0;
+       QWidget* obj;
+       QObjectList list = owner->queryList("QWidget");
+
+       QListIterator<QObject*> it(list);
+       while ( it.hasNext() ) {
+                       obj = qobject_cast<QWidget*>(it.next());
+                       if (!obj) continue;
+                       if ( name == aWidget::widgetName( obj ) ) {
+                               res = obj;
+                               break;
+                       }
+       }
+       return res;
+}
+
+
+
+/*!
+ *\~english
+ *     Return form widget pointer by name.
+ *\~russian
+ *\~
+*/
+QWidget *
+aWidget::Widget( QString name, bool onlyMyWidgets )
+{
+       QWidget *res = aWidget::Widget( this, name );
+       if ( onlyMyWidgets && parentContainer( res ) != this ) res = 0;
+       return res;
+}
+
+
+
+/*!
+ *\~english
+ *     Return form widget pointer by name.
+ *\~russian
+ *\~
+*/
+aDataField*
+aWidget::getAttribute( const QString & name )
+{
+       aDataField *f = 0;
+
+       return f;
+}
+
+
+
+/*!
+ *\~english
+ *     Return form widget pointer by name.
+ *\~russian
+ *\~
+*/
+int
+aWidget::setAttribute( const QString & name, const aDataField *value )
+{
+       return 0;
+}
+
+
+/*!
+ *\~english
+ *
+ *\~russian
+ * Обрабатывает события при нажатии кнопок клавиатуры.
+ *\~
+ */
+void
+aWidget::keyPressEvent ( QKeyEvent *e )
+{
+//     switch ( e->key() ){
+//     case Qt::Key_Escape:
+//             printf("ESC\n");
+//             break;
+//     default:
+//             e->ignore();
+//             break;
+//     }
+
+       QWidget::keyPressEvent( e );
+}
+
diff --git a/src/lib/widgets/awidget.h b/src/lib/widgets/awidget.h
new file mode 100644 (file)
index 0000000..e1fe08b
--- /dev/null
@@ -0,0 +1,156 @@
+/****************************************************************************
+** $Id: awidget.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of the Ananas visual bject of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef AWIDGET_H
+#define AWIDGET_H
+#include <q3sqlform.h>
+#include <q3toolbar.h>
+#include <q3mainwindow.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include "ananas.h"
+
+class QWidget;
+
+
+
+/*!
+ *\~english
+ *     Base visual object.
+ *\~russian
+ *     \brief Базовый класс для визуальных объектов.
+ *     Наследует QWidget.
+ *
+ *     От него наследуют свойства и методы такие визуальные объекты
+ *     как контейнеры wDocument, wJournal, wCatalog, wDocument, wReport и виджеты wField, wDBField.\n
+ *
+ */
+class  ANANAS_EXPORT aWidget : public QWidget
+{
+       Q_OBJECT
+//     Q_PROPERTY( QString Name READ getName WRITE setName STORED true DESIGNABLE false )
+       Q_PROPERTY( int Id READ getId WRITE setId STORED true DESIGNABLE false )
+       Q_PROPERTY( bool openEditor READ getOpenEditor WRITE setOpenEditor STORED false )
+       Q_PROPERTY( int FormMode READ formMode WRITE setFormMode STORED true )
+public:
+       aDatabase*      db;
+       aCfg*           md;
+       aEngine*        engine;
+
+       aWidget( QWidget *parent = 0, const char *name = 0, Qt::WFlags fl = 0 );
+       aWidget( const QString &oname, aDatabase *adb, QWidget *parent = 0, const char *name = 0, Qt::WFlags fl = 0 );
+       aWidget( aCfgItem context, aDatabase *adb, QWidget *parent = 0, const char *name = 0, Qt::WFlags fl = 0 );
+       virtual ~aWidget();
+
+       virtual bool            checkStructure();
+       virtual void            initObject( aDatabase *adb );
+       virtual void            widgetEditor();
+        static void            widgetEditor( QWidget *object, QDialog *editor );
+       virtual QDialog*        createEditor( QWidget *parent );
+       virtual Q3ToolBar*      createToolBar( Q3MainWindow *parent );
+        virtual aObject*       createDBObject( aCfgItem obj, aDatabase * );
+       virtual QString         displayString();
+
+       void                    init( aDatabase *adb );
+       bool                    getOpenEditor() const { return false; };
+       void                    setOpenEditor( bool );// { widgetEditor(); };
+       bool                    isInited() { return vInited; };
+       virtual bool            isContainer();
+       void                    setInited( bool flag ){ vInited = flag; };
+//     void                    formInsert( QWidget *widget, const QString &field );
+//     void                    formRemove( const QString &field );
+       static aWidget*         parentContainer( QWidget *w );
+       static aForm*           parentForm( QWidget *w );
+       aCfgItem*               getMDObject();
+       void                    setMDObject( aCfgItem object );
+       aSQLTable*              table( const QString &name = "" );
+//     bool tableInsert( const QString &name );
+//     bool tableRemove( const QString &name );
+       void                    setObjectData( QWidget *object, aCfg *md );
+       void                    getObjectData( QWidget *object );
+       aCfg*                   getMd();
+       virtual qulonglong      uid();
+       virtual ERR_Code        New();
+       virtual ERR_Code        Update();
+       virtual ERR_Code        TurnOn();
+       virtual ERR_Code        Select( qulonglong id );
+       aObject*                dataObject(){ return dbobj; };
+
+       virtual qulonglong      docId();
+       int                     formMode() const { return vFormMode; };
+       virtual void            setFormMode( int mode ){ vFormMode = mode; };
+       virtual QString         getFieldName()  const   { return "";    };
+
+       static QString          widgetName( QWidget *w );
+       static QWidget*         Widget( QWidget *owner, QString name );
+
+//     QString                 getName() const;
+//     void                    setName( QString fn );
+       int                     getId() const { return vId ;};
+       void                    setId( int fn ){ vId = fn; };
+
+public slots:
+       virtual QVariant        value( const QString & name );
+       virtual QString         value() const {return QString::null;};
+       virtual QString         textValue() {return QString::null;};
+       virtual void            setValue( const QString &);
+       virtual int             setValue( const QString & name, const QVariant &value );
+       virtual int             setObjValue( const QString & nameWidget, aObject *value );
+       virtual void            SetReadOnly(bool);
+       virtual int             Refresh();
+       QWidget*                Widget( QString name, bool onlyMyWidgets = true );
+
+       virtual aDataField*     getAttribute( const QString & name );
+       virtual int             setAttribute( const QString & name, const aDataField *value );
+
+signals:
+       void setData( QWidget *, aCfg * );
+       void getData( QWidget * );
+       void getMd( aCfg ** );
+       void valueChanged( const QString &, const QVariant & );
+       void valueChanged( const QString &, const QVariant &, const QString & );
+       void changeObj(const QString &);
+       void changeObjId(const qulonglong);
+       void keyPressed(QKeyEvent *e);
+
+protected:
+       aObject *dbobj;
+       virtual void updateProp() {};
+       virtual void keyPressEvent ( QKeyEvent * e );
+private:
+       bool            vInited;
+       QString         vName;
+       int             vId, vFormMode;
+       aCfgItem        obj;
+       Q3SqlForm*      form;
+//     QDict <aSQLTable> dbtables;
+};
+
+
+#endif
diff --git a/src/lib/widgets/widgets.pri b/src/lib/widgets/widgets.pri
new file mode 100644 (file)
index 0000000..bc23eaf
--- /dev/null
@@ -0,0 +1,5 @@
+HEADERS += \
+    widgets/awidget.h 
+
+SOURCES += \
+    widgets/awidget.cpp 
diff --git a/src/plugins/README b/src/plugins/README
new file mode 100644 (file)
index 0000000..d360b41
--- /dev/null
@@ -0,0 +1,69 @@
+_Введение_
+В каждом каталоге находится код, реализующий ровно один плагин (plugin), предназначенный для
+использования в QSA Designer.
+С помощью этих плагинов реализуется связывание данных (data binding)
+элементов настраиваемого пользовательского интерфейса Ананаса с базами,
+хранящимися на SQL сервере, облегчающее
+прикладному программисту-настройщику создание экранных форм-диалогов.
+
+
+_Спецификация_
+Визуальные плагины ананас состоят из двух модулей:
+- плагин, реализующий функциональность
+- диалог конфигурации плагина в дизайнере Ананас
+
+Плагин реализует _только_ функциональность, необходимую для работы
+в инициализированной форме диалога. Он не должен содержать функции,
+необходимые для поддержки форм диалога. Плагин всегда вставляется в
+объект-контейнер. Для получения дополнительной информации для
+инициализации использовать функцию:
+static aWidget *aWidget::parentContainer( QWidget *w );
+
+Диалог конфигурации считывает и отображает свойства плагина,
+позволяет редактировать их, используя статические функции
+aWidget и aObject для получения указателей на метаданные,
+контейнер плагина и дополнительной информации,сохраняет свойства
+в плагине для записи в структуру формы.
+Диалог должен считать всю необходимую информацию из метаданных
+при установке параметров и в дальнейшем к метаданным не обращаться.
+Функции для получения дополнительной информации:
+static aWidget *aWidget::parentContainer( QWidget *w );
+
+В режиме настройки плагин должен использовать _только_ метаданные
+без обращения к базе данных, так как информация в БД не актуальна до
+момента обновления структуры при сохранении метаданных.
+
+_Компилирование_
+
+Makefile'ы генерируются командой qmake на основе содержимого *.pro файлов.
+Для изменения процедуры компиляции следует вносить изменения в *.pro файлы.
+
+компилирование заключается в задании двух команд
+qmake
+make
+
+в каждом подкаталоге
+
+
+_Установка_
+
+После успешной компиляции необходимо скопировать получившиеся динамические библиотеки
+в каталог /usr/lib, а лучше создать ссылку.
+А также проверить появились ли они в каталоге
+$(QTDIR)/plugins/designer
+
+
+_Возможные проблеммы_
+
+Если компиляция и копирование библиотек выполнено, а при запуске designer плагины
+не отображаются в списке виджелов, попробуйте исправить содержимое файла *.pro,
+убрав параметр
+thread
+в строке, начинающейся со слова CONFIG
+
+Удачи!
+
+
+
+
+
diff --git a/src/plugins/actionbutton/actionbutton.pri b/src/plugins/actionbutton/actionbutton.pri
new file mode 100644 (file)
index 0000000..caf0592
--- /dev/null
@@ -0,0 +1,15 @@
+HEADERS += \
+    actionbutton/eactionbutton.h \
+    actionbutton/wactionbutton.h \
+    actionbutton/wactionbutton_plugin.h \
+    actionbutton/wactionbutton_taskmenu.h \
+
+SOURCES += \
+    actionbutton/eactionbutton.cpp \
+    actionbutton/wactionbutton.cpp \
+    actionbutton/wactionbutton_plugin.cpp \
+    actionbutton/wactionbutton_taskmenu.cpp \
+        
+FORMS += \
+    actionbutton/eactionbutton.ui 
+    
\ No newline at end of file
diff --git a/src/plugins/actionbutton/eactionbutton.cpp b/src/plugins/actionbutton/eactionbutton.cpp
new file mode 100644 (file)
index 0000000..76d9263
--- /dev/null
@@ -0,0 +1,138 @@
+#include "eactionbutton.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <qseditor.h>
+#include <stdlib.h>
+
+/*
+ *  Constructs a eActionButton as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+eActionButton::eActionButton(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+eActionButton::~eActionButton()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void eActionButton::languageChange()
+{
+    retranslateUi(this);
+}
+
+void eActionButton::Action_toggled( bool o )
+{
+    Script->setChecked( !o );
+    //else
+}
+
+
+void eActionButton::Script_toggled( bool o )
+{
+    Action->setChecked( !o );
+}
+
+void eActionButton::setData(  wActionButton *b )
+{
+    if ( !b ) return;
+    if ( b->isAction() ) Action->setChecked( TRUE );
+    if ( b->isActionUpdate() ) cbUpdate->setChecked( TRUE );
+    if ( b->isActionTurnOn() ) cbTurnon->setChecked( TRUE );
+    if ( b->isActionClose() ) cbClose->setChecked( TRUE );
+    if ( b->isScript() ) Script->setChecked( TRUE );
+//    cbAction->setCurrentItem(b->getAction())
+    // eCode->setText( b->getScriptCode() );
+//    button = b;
+    aWidget *wd = aWidget::parentContainer( b );
+    if ( !strcmp(wd->name(),"Catalogue") )
+    {
+           cbTurnon->setChecked( false );
+           cbTurnon->setHidden( TRUE );
+
+//     b->setActionTurnOn( FALSE );
+    }
+    aCfg *md = wd->getMd();
+    QStringList l_name;
+    aCfgItem parent = md->find(mdc_actions);
+    l_id.clear();
+    loadActions(&l_name, &l_id, parent, md);
+    cbAction->clear();
+    cbAction->insertStringList(l_name);
+    cbAction->setCurrentItem( l_id.findIndex( QString("%1").arg(b->getActionId()) ) );
+
+}
+
+
+void eActionButton::getData( wActionButton *button)
+{
+    if ( !button ) return;
+    button->setAction( Action->isChecked() );
+    button->setActionUpdate( cbUpdate->isChecked() );
+    button->setActionTurnOn( cbTurnon->isChecked() );
+    button->setActionClose( cbClose->isChecked() );
+    button->setScript( Script->isChecked() );
+    button->setActionUpdate( cbUpdate->isChecked() );
+    if(cbAction->isEnabled())
+    {
+
+       button->setActionId ( atoi(l_id[cbAction->currentItem()].ascii()));
+    }
+    else
+    {
+           button->setActionId(0);
+    }
+//    button->setScriptCode( eCode->text() );
+}
+
+void eActionButton::destroy()
+{
+    //getData();
+}
+
+
+void
+eActionButton::loadActions( QStringList *lst, QStringList *id,  aCfgItem p, aCfg *md )
+{
+       aCfgItem cobj;
+       QString oclass;
+       if(p.isNull())
+       {
+               p = md->find(mdc_actions);
+       //      printf("parent were NULL, set parent to %s\n",md->objClass(p).ascii());
+       }
+
+       if(p.isNull()) return;
+       cobj = md->firstChild ( p );
+       while ( !cobj.isNull() )
+       {
+               oclass = md->objClass ( cobj );
+               if ( oclass == md_actiongroup )
+                       loadActions ( lst, id, cobj, md );
+               if ( oclass == md_action )
+               {
+                       lst->append(md->attr(cobj,mda_name));
+                       id->append(md->attr(cobj,mda_id));
+               }
+               cobj = md->nextSibling ( cobj );
+       }
+}
+
diff --git a/src/plugins/actionbutton/eactionbutton.h b/src/plugins/actionbutton/eactionbutton.h
new file mode 100644 (file)
index 0000000..592bdb9
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef EACTIONBUTTON_H
+#define EACTIONBUTTON_H
+
+#include "ui_eactionbutton.h"
+
+
+class eActionButton : public QDialog, public Ui::eActionButton
+{
+    Q_OBJECT
+
+public:
+    eActionButton(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~eActionButton();
+
+public slots:
+    virtual void Action_toggled( bool o );
+    virtual void Script_toggled( bool o );
+    virtual void setData( wActionButton *o );
+    virtual void getData( wActionButton *o );
+
+protected:
+    virtual void loadActions( QStringList *lst, QStringList *id,  aCfgItem parent, aCfg *md);
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    QStringList l_id;
+
+    void destroy();
+
+};
+
+#endif // EACTIONBUTTON_H
diff --git a/src/plugins/actionbutton/eactionbutton.ui b/src/plugins/actionbutton/eactionbutton.ui
new file mode 100644 (file)
index 0000000..e3d4541
--- /dev/null
@@ -0,0 +1,206 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>eActionButton</class>\r
+  <widget class="QDialog" name="eActionButton" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>484</width>\r
+        <height>228</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Action button</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item row="0" column="0" >\r
+        <widget class="Q3ButtonGroup" name="Action" >\r
+          <property name="sizePolicy" >\r
+            <sizepolicy>\r
+              <hsizetype>3</hsizetype>\r
+              <vsizetype>5</vsizetype>\r
+              <horstretch>0</horstretch>\r
+              <verstretch>0</verstretch>\r
+            </sizepolicy>\r
+          </property>\r
+          <property name="midLineWidth" >\r
+            <number>0</number>\r
+          </property>\r
+          <property name="title" >\r
+            <string>Simple action</string>\r
+          </property>\r
+          <property name="checkable" >\r
+            <bool>true</bool>\r
+          </property>\r
+          <property name="checked" >\r
+            <bool>false</bool>\r
+          </property>\r
+          <property name="exclusive" >\r
+            <bool>false</bool>\r
+          </property>\r
+          <property name="radioButtonExclusive" >\r
+            <bool>false</bool>\r
+          </property>\r
+          <layout class="QGridLayout" >\r
+            <item row="0" column="0" >\r
+              <layout class="QGridLayout" >\r
+                <item row="0" column="0" >\r
+                  <widget class="QCheckBox" name="cbUpdate" >\r
+                    <property name="text" >\r
+                      <string>Update</string>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item row="3" column="0" >\r
+                  <widget class="QCheckBox" name="cbClose" >\r
+                    <property name="text" >\r
+                      <string>Close</string>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item row="1" column="0" >\r
+                  <widget class="QCheckBox" name="cbTurnon" >\r
+                    <property name="text" >\r
+                      <string>Turn on</string>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+              </layout>\r
+            </item>\r
+          </layout>\r
+        </widget>\r
+      </item>\r
+      <item row="1" column="0" >\r
+        <widget class="Q3ButtonGroup" name="Script" >\r
+          <property name="title" >\r
+            <string>User action</string>\r
+          </property>\r
+          <property name="checkable" >\r
+            <bool>true</bool>\r
+          </property>\r
+          <property name="checked" >\r
+            <bool>false</bool>\r
+          </property>\r
+          <property name="exclusive" >\r
+            <bool>false</bool>\r
+          </property>\r
+          <property name="radioButtonExclusive" >\r
+            <bool>false</bool>\r
+          </property>\r
+          <layout class="QVBoxLayout" >\r
+            <item>\r
+              <layout class="QHBoxLayout" >\r
+                <item>\r
+                  <widget class="QLabel" name="textLabel1" >\r
+                    <property name="sizePolicy" >\r
+                      <sizepolicy>\r
+                        <hsizetype>0</hsizetype>\r
+                        <vsizetype>5</vsizetype>\r
+                        <horstretch>0</horstretch>\r
+                        <verstretch>0</verstretch>\r
+                      </sizepolicy>\r
+                    </property>\r
+                    <property name="text" >\r
+                      <string>Execute</string>\r
+                    </property>\r
+                    <property name="wordWrap" >\r
+                      <bool>false</bool>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item>\r
+                  <widget class="QComboBox" name="cbAction" />\r
+                </item>\r
+              </layout>\r
+            </item>\r
+          </layout>\r
+        </widget>\r
+      </item>\r
+      <item rowspan="2" row="0" column="1" colspan="1" >\r
+        <layout class="QVBoxLayout" >\r
+          <item>\r
+            <widget class="QPushButton" name="pushButton1" >\r
+              <property name="sizePolicy" >\r
+                <sizepolicy>\r
+                  <hsizetype>1</hsizetype>\r
+                  <vsizetype>0</vsizetype>\r
+                  <horstretch>0</horstretch>\r
+                  <verstretch>0</verstretch>\r
+                </sizepolicy>\r
+              </property>\r
+              <property name="text" >\r
+                <string>OK</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="pushButton2" >\r
+              <property name="sizePolicy" >\r
+                <sizepolicy>\r
+                  <hsizetype>1</hsizetype>\r
+                  <vsizetype>0</vsizetype>\r
+                  <horstretch>0</horstretch>\r
+                  <verstretch>0</verstretch>\r
+                </sizepolicy>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Cancel</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <spacer name="spacer1" >\r
+              <property name="sizeHint" >\r
+                <size>\r
+                  <width>20</width>\r
+                  <height>121</height>\r
+                </size>\r
+              </property>\r
+              <property name="sizeType" >\r
+                <enum>Expanding</enum>\r
+              </property>\r
+              <property name="orientation" >\r
+                <enum>Vertical</enum>\r
+              </property>\r
+            </spacer>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="5" margin="5" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >wactionbutton.h</include>\r
+    <include location="local" >awidget.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>Action</sender>\r
+      <signal>toggled(bool)</signal>\r
+      <receiver>eActionButton</receiver>\r
+      <slot>Action_toggled(bool)</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>Script</sender>\r
+      <signal>toggled(bool)</signal>\r
+      <receiver>eActionButton</receiver>\r
+      <slot>Script_toggled(bool)</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>pushButton1</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eActionButton</receiver>\r
+      <slot>accept()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>pushButton2</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eActionButton</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/actionbutton/wactionbutton.cpp b/src/plugins/actionbutton/wactionbutton.cpp
new file mode 100644 (file)
index 0000000..fb7bd7a
--- /dev/null
@@ -0,0 +1,106 @@
+/****************************************************************************
+** $Id: wactionbutton.cpp,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of the table plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "wactionbutton.h"
+#include "eactionbutton.h"
+#include <q3mainwindow.h>
+#include <q3header.h>
+#include <qvariant.h>
+#include "qobject.h"
+#include "qobject.h"
+//Added by qt3to4:
+#include <QKeyEvent>
+
+//--#include "command.h"
+//--#include "formwindow.h"
+//--#include "mainwindow.h"
+//--#include "mainform.h"
+
+#include "adatabase.h"
+
+wActionButton::wActionButton( QWidget *parent, const char *name )
+    : QPushButton( parent, "wActionButton")
+{
+    action = true;
+    actionId=0;
+    actionUpdate = actionTurnOn = actionClose = false;
+    connect( this, SIGNAL(clicked()), this, SLOT(onClick()) );
+
+}
+
+
+wActionButton::~wActionButton()
+{
+}
+
+
+void
+wActionButton::openEditor()
+{
+       eActionButton *e = new eActionButton(this->topLevelWidget());
+       aCfg *md;
+       e->setData(this);
+       if ( e->exec()==QDialog::Accepted )
+       {
+               e->getData(this);
+               //updateProp();
+       }
+       delete e;
+       e=0;
+}
+
+
+
+void
+wActionButton::onClick()
+{
+//CHECK_POINT
+}
+
+void
+wActionButton::keyPressHandler ( QKeyEvent * e )
+{
+       CHECK_POINT
+       switch(e->key())
+       {
+               case Qt::Key_Return:
+               break;
+               case Qt::Key_Escape:
+                       if(accel() == QKeySequence(Qt::Key_Escape))
+                       {
+                               emit(clicked());
+                               e->accept();
+                       }
+               break;
+
+       }
+       //printf("key pressed %c",e->ascii());
+       //QWidget::keyPressEvent ( e );
+       e->ignore();
+}
diff --git a/src/plugins/actionbutton/wactionbutton.h b/src/plugins/actionbutton/wactionbutton.h
new file mode 100644 (file)
index 0000000..d0d0823
--- /dev/null
@@ -0,0 +1,90 @@
+/****************************************************************************
+** $Id: wactionbutton.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of the table plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef WACTIONBUTTON_H
+#define WACTIONBUTTON_H
+
+#include <qpushbutton.h>
+#include <qwidgetplugin.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include "acfg.h"
+
+class QWidget;
+
+class QT_WIDGET_PLUGIN_EXPORT wActionButton : public QPushButton
+{
+    Q_OBJECT
+    Q_PROPERTY( bool openEditor READ getOpenEditor WRITE setOpenEditor STORED false )
+    Q_PROPERTY( bool action READ isAction WRITE setAction DESIGNABLE true )
+    Q_PROPERTY( bool actionUpdate READ isActionUpdate WRITE setActionUpdate DESIGNABLE true )
+    Q_PROPERTY( bool actionTurnOn READ isActionTurnOn WRITE setActionTurnOn DESIGNABLE true)
+    Q_PROPERTY( bool actionClose READ isActionClose WRITE setActionClose DESIGNABLE true)
+    Q_PROPERTY( int actionId READ getActionId WRITE setActionId DESIGNABLE true)
+    Q_PROPERTY( bool script READ isScript WRITE setScript DESIGNABLE true)
+//    Q_PROPERTY( QString scriptCode READ getScriptCode WRITE setScriptCode DESIGNABLE false)
+public:
+
+    wActionButton( QWidget *parent = 0, const char *name = 0 );
+    virtual ~wActionButton();
+
+    void openEditor();
+
+
+public slots:
+
+    void onClick();
+    void keyPressHandler ( QKeyEvent * e );
+
+    bool getOpenEditor() const { return false; };
+    void setOpenEditor( bool b ) { if( b ) openEditor(); };
+    bool isAction()            const   { return action;        };
+    bool isActionUpdate()      const   { return actionUpdate;  };
+    bool isActionTurnOn()      const   { return actionTurnOn;  };
+    bool isActionClose()       const   { return actionClose;   };
+    int         getActionId()          const   { return actionId;      };
+    bool isScript()            const   { return !action;       };
+    QString getScriptCode()    const   { return scriptCode;    };
+
+    void setAction( bool a )           { action = a;           };
+    void setActionUpdate( bool a )     { actionUpdate = a;     };
+    void setActionTurnOn( bool a )     { actionTurnOn = a;     };
+    void setActionClose( bool a )      { actionClose = a;      };
+    void setActionId( int a )          { actionId = a;         };
+    void setScript( bool a )           { action = !a;          };
+    void setScriptCode( QString a )    { scriptCode = a;       };
+private:
+
+    bool action, actionUpdate, actionTurnOn, actionClose;
+    int actionId;
+    QString scriptCode;
+};
+
+#endif //WACTIONBUTTON_H
+
diff --git a/src/plugins/actionbutton/wactionbutton_plugin.cpp b/src/plugins/actionbutton/wactionbutton_plugin.cpp
new file mode 100644 (file)
index 0000000..31026db
--- /dev/null
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "wactionbutton_plugin.h"
+
+#include <QtPlugin>
+#include <QDesignerFormEditorInterface>
+#include <QExtensionManager>
+
+#include "wactionbutton_taskmenu.h"
+#include "wactionbutton.h"
+
+
+wActionButtonPlugin::wActionButtonPlugin(QObject *parent)
+    : QObject(parent), m_initialized(false)
+{
+    m_initialized = false;
+}
+
+bool wActionButtonPlugin::isContainer() const
+{
+    return false;
+}
+
+bool wActionButtonPlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void wActionButtonPlugin::initialize(QDesignerFormEditorInterface *core)
+{
+    if (m_initialized)
+        return;
+    Q_UNUSED(core);
+
+    QExtensionManager *manager = core->extensionManager();
+    Q_ASSERT(manager != 0);
+    manager->registerExtensions(new wActionButtonTaskMenuFactory(manager),
+                                Q_TYPEID(QDesignerTaskMenuExtension));
+
+    m_initialized = true;
+}
+
+QWidget *wActionButtonPlugin::createWidget(QWidget *parent)
+{
+    wActionButton *w = new wActionButton(parent);
+    return w;
+}
+
+QString wActionButtonPlugin::name() const
+{
+    return QLatin1String("wActionButton");
+}
+
+QString wActionButtonPlugin::group() const
+{
+    return QLatin1String("Ananas");
+}
+
+QString wActionButtonPlugin::toolTip() const
+{
+    return QString("Ananas for QT Action button Widget");
+}
+
+QString wActionButtonPlugin::whatsThis() const
+{
+    return QString();
+}
+
+QString wActionButtonPlugin::includeFile() const
+{
+    return QLatin1String("wactionbutton.h");
+}
+
+QIcon wActionButtonPlugin::icon() const
+{
+    //return QIcon();
+    return QIcon(":/images/wactionbutton.png");
+}
+
+QString wActionButtonPlugin::domXml() const
+{
+    return "<widget class=\"wActionButton\" name=\"wActionButton_1\">\n</widget>\n";
+}
diff --git a/src/plugins/actionbutton/wactionbutton_plugin.h b/src/plugins/actionbutton/wactionbutton_plugin.h
new file mode 100644 (file)
index 0000000..9b03290
--- /dev/null
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef WACTIONBUTTON_PLUGIN_H
+#define WACTIONBUTTON_PLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+#include "qwidgetplugin.h"
+
+
+class QT_WIDGET_PLUGIN_EXPORT wActionButtonPlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+    wActionButtonPlugin(QObject *parent=0);
+
+    bool isContainer() const;
+    bool isInitialized() const;
+    void initialize(QDesignerFormEditorInterface *core);
+    QWidget *createWidget(QWidget *parent);
+
+    QString name() const;
+    QString group() const;
+    QString toolTip() const;
+    QString whatsThis() const;
+    QString includeFile() const;
+    QIcon icon() const;
+    QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+#endif // WACTIONBUTTON_PLUGIN_H
diff --git a/src/plugins/actionbutton/wactionbutton_taskmenu.cpp b/src/plugins/actionbutton/wactionbutton_taskmenu.cpp
new file mode 100644 (file)
index 0000000..3605c9e
--- /dev/null
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include <QDesignerFormEditorInterface>
+
+#include <QAction>
+
+#include "wactionbutton_taskmenu.h"
+#include "wactionbutton.h"
+#include "eactionbutton.h"
+
+
+wActionButtonTaskMenu::wActionButtonTaskMenu(wActionButton *widget, QObject *parent)
+    : QObject(parent)
+{
+    m_widget = widget;
+
+    m_editAction = new QAction(tr("Edit ..."), this);
+    connect(m_editAction, SIGNAL(triggered()), this, SLOT(edit()));
+}
+
+void wActionButtonTaskMenu::edit()
+{
+    //eActionButton e(m_widget->topLevelWidget());
+    /*eActionButton e;
+
+       e.setData(m_widget);
+       if (e.exec() == QDialog::Accepted)
+       {
+               e.getData(m_widget);
+       }*/
+       m_widget->openEditor();
+}
+
+QAction *wActionButtonTaskMenu::preferredEditAction() const
+{
+    return m_editAction;
+}
+
+QList<QAction *> wActionButtonTaskMenu::taskActions() const
+{
+    QList<QAction *> list;
+    list.append(m_editAction);
+    return list;
+}
+
+wActionButtonTaskMenuFactory::wActionButtonTaskMenuFactory(QExtensionManager *parent)
+    : QExtensionFactory(parent)
+{
+}
+
+QObject *wActionButtonTaskMenuFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
+{
+    if (iid != Q_TYPEID(QDesignerTaskMenuExtension))
+        return 0;
+
+    if (wActionButton *ab = qobject_cast<wActionButton*>(object))
+        return new wActionButtonTaskMenu(ab, parent);
+
+    return 0;
+}
diff --git a/src/plugins/actionbutton/wactionbutton_taskmenu.h b/src/plugins/actionbutton/wactionbutton_taskmenu.h
new file mode 100644 (file)
index 0000000..4d68b96
--- /dev/null
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef WACTIONBUTTON_TASKMENU_H
+#define WACTIONBUTTON_TASKMENU_H
+
+#include <QDesignerTaskMenuExtension>
+#include <QExtensionFactory>
+
+
+class QExtensionManager;
+class QAction;
+class wActionButton;
+
+class wActionButtonTaskMenu: public QObject, public QDesignerTaskMenuExtension
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerTaskMenuExtension)
+public:
+    wActionButtonTaskMenu(wActionButton *widget, QObject *parent);
+
+    QAction *preferredEditAction() const;
+    QList<QAction *> taskActions() const;
+
+private slots:
+    void edit();
+
+private:
+    QAction *m_editAction;
+    wActionButton *m_widget;
+};
+
+class wActionButtonTaskMenuFactory: public QExtensionFactory
+{
+    Q_OBJECT
+public:
+    wActionButtonTaskMenuFactory(QExtensionManager *parent = 0);
+
+protected:
+    QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
+};
+
+#endif // WACTIONBUTTON_TASKMENU_H
diff --git a/src/plugins/aform.cpp b/src/plugins/aform.cpp
new file mode 100644 (file)
index 0000000..a108061
--- /dev/null
@@ -0,0 +1,1896 @@
+/****************************************************************************
+** $Id: aform.cpp,v 1.3 2008/12/10 21:04:56 leader Exp $
+**
+** Code file of Ananas forms of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2006 Leader InfoTech.  All rights reserved.
+** Copyright (C) Andrey Paskal <app at lrn dot ru>, Yoshkar-Ola
+** Copyright (C) Grigory Panov <gr1313 at mail dot ru>, Yoshkar-Ola
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+//--#include <qwidgetfactory.h>
+#include <QFormBuilder>
+#include <QDesignerCustomWidgetInterface>
+#include <QCoreApplication>
+#include <qdialog.h>
+#include <qobject.h>
+#include <qdialog.h>
+#include <qbuffer.h>
+#include <q3cstring.h>
+#include <qiodevice.h>
+#include <qstring.h>
+#include <qfile.h>
+#include <qdir.h>
+#include <qsinterpreter.h>
+//--#include <qbutton.h>
+#include <qpushbutton.h>
+//--#include <qfocusdata.h>
+#include <qlabel.h>
+#include <q3mainwindow.h>
+#include <q3datetimeedit.h>
+#include <qstatusbar.h>
+#include <qlineedit.h>
+#include <qlayout.h>
+#include <qbuffer.h>
+#include <qiodevice.h>
+#include <qmessagebox.h>
+#include <qstatusbar.h>
+#include <q3sqlcursor.h>
+#include <q3sqlpropertymap.h>
+#include <q3sqlform.h>
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <Q3ValueList>
+#include <q3mimefactory.h>
+
+#include "aform.h"
+#include "wcatalogue.h"
+#include "wdocument.h"
+#include "wjournal.h"
+#include "wreport.h"
+#include "wfield.h"
+#include "wdbfield.h"
+#include "wtable.h"
+#include "wdbtable.h"
+#include "wactionbutton.h"
+#include "alog.h"
+/*!
+Base form object.
+*/
+aForm::aForm( QWidget *parent,  aEngine *eng )
+:QObject( eng, (QString("aForm%1").arg(eng->next_obj_id++)).ascii())
+{
+       engine = eng;
+       db = eng->db;
+       md = &db->cfg;
+       parentWidget = parent;
+       form = 0;
+       closeAfterSelect = false;
+       RO=false;
+       callerWidget = NULL;
+       mode = 0;
+       db_uid=0;
+       objid=0;
+       init();
+}
+
+
+
+aForm::aForm( QWidget *parent,  aEngine *eng,  Q_ULONG form_mid, aWidget* caller )
+:QObject( eng, (QString("aForm%1").arg(eng->next_obj_id++)).ascii() )
+{
+       aCfgItem obj;
+
+       engine = eng;
+       db = eng->db;
+       md = engine->md;
+       parentWidget = parent;
+       form = 0;
+       closeAfterSelect = false;
+       mdObj = md->find( form_mid );
+       objid = form_mid;
+       db_uid=0;
+       RO=false;
+       callerWidget = caller;
+       mode = 0;
+       init();
+}
+
+aForm::aForm( QWidget *parent,  aEngine *eng, QString oftype, QObject *aobj )
+:QObject( eng, (QString("aForm%1").arg(eng->next_obj_id++)).ascii())
+{
+       engine = eng;
+       db = eng->db;
+       md = &db->cfg;
+       parentWidget = parent;
+       db_uid=0;
+       objid=0;
+       form = 0;
+       closeAfterSelect = false;
+       RO=false;
+       mode = 0;
+       init();
+
+}
+
+
+
+aForm::~aForm()
+{
+}
+
+aWidget *
+aForm::parentContainer( QWidget *w )
+{
+        w = w->parentWidget();
+        while ( w ) {
+                if ( w->inherits("aWidget") ) break;
+                w = w->parentWidget();
+        }
+       return ( aWidget *) w;
+}
+
+
+/*!
+ *\~english
+ *     Init container object, that not inherits from aWidget.
+ *\~russian
+ *     Инициализирует объекты, которые не унаследованы от aWidget, но
+ *     требуют инициализации, например wDBTable.
+ *\~
+ */
+void
+aForm::initWidget( QWidget *widget, aDatabase *adb )
+{
+       QString oclass = widget->className();
+       if (oclass == "wDBTable") ( ( wDBTable* ) widget )->init( adb, engine );
+}
+
+
+/*!
+ *\~english
+ *     Recursive init all form containers and widgets.
+ *\~russian
+ *     Инициализирует все виджеты, унаследованные от aWidget
+ *\~
+ */
+void
+aForm::initContainer( aWidget *widget, aDatabase *adb ){
+
+       // Init subobjects.
+       if ( !widget->isContainer() ) return;
+
+       widget->engine = engine;
+       widget->init( adb );
+       QObjectList l = widget->queryList( "QWidget" );
+       QListIterator<QObject*> it( l ); // iterate over all subwidgets
+       QObject *obj;
+       QString oclass;
+       aWidget *aw;
+//     QWidget *w;
+       // Init all container owned widgets
+       while ( it.hasNext()  ) {
+               // for each found object...
+               obj = it.next();
+               if ( !obj ) continue;
+               if ( parentContainer( ( QWidget *) obj ) != widget ) continue;
+               if ( obj->inherits("aWidget") ) {
+                       aw = ( aWidget* ) obj;
+                       aw->engine = engine;
+                       if ( !aw->isContainer() )
+                       {
+                               aw->init( adb );
+                       }
+                       if ( form->inherits( "QMainWindow" ) ) aw->createToolBar( ( Q3MainWindow *) form );
+               } else initWidget( ( QWidget *) obj, adb );
+       }
+       it.toFront();
+       // Init all container subcontainers
+       while ( it.hasNext() ) {
+               obj = it.next();
+               if ( !obj ) continue;
+                if ( obj == widget ) continue;
+               if ( parentContainer( ( QWidget*) obj ) != widget ) continue;
+               if ( obj->inherits("aWidget") ) {
+                       aw = ( aWidget* ) obj;
+                       aw->engine = engine;
+                       if ( aw->isContainer() ) initContainer( aw, adb );
+               }
+       }
+       //delete l;
+}
+
+
+/*!
+ *\~english
+ *     Init form, reparent central widget of form, if it needed. Evaluate script module.
+ *\~russian
+ *     Инициализирует форму, меняет родителя у центрального виджера формы, если это необходимо.
+ *     Обрабатывает также модуль скрипта, благодаря этому впоследствии можно вызывать
+ *     функции, определенные в этом модуле.
+ *\~
+ */
+void
+aForm::init()
+{
+       QString ui, sModule;
+       aCfgItem obj;
+       static QMutex mutex;
+       mainWidget = 0;
+       if ( !mdObj.isNull() && md ) {
+               ui = md->sText( mdObj, md_formdesign );
+               sModule = md->sText( mdObj, md_sourcecode );
+               if ( !ui.isEmpty() ) {
+                   //aLog::print(aLog::Debug, ui);
+                   QByteArray buf = ui.toUtf8();
+                       QBuffer b(&buf);
+                       //--b.open(QIODevice::WriteOnly);
+
+                       //--b.writeBlock( ( const char *) ui, strlen( ( const char *) ui) );
+                       //--b.close();
+                       b.open(QIODevice::ReadOnly );
+                       aLog::print(aLog::Info, tr("aForm creating form from ui"));
+                       //--form = QWidgetFactory::create( &b );
+                       QFormBuilder fb;
+                       fb.addPluginPath(QCoreApplication::applicationDirPath() /*"/plugins/designer"*/);
+                       /*QList<QDesignerCustomWidgetInterface*> l = fb.customWidgets();
+                       int i;
+                       for (i=0; i<l.size(); i++)
+                       {
+                           aLog::print(aLog::Info, l[i]->name());
+                       }*/
+            form = fb.load(&b);
+                       aLog::print(aLog::Info, tr("aForm form create from ui ok"));
+                       b.close();
+               }
+       }
+       if (form) {
+               Q3MainWindow *mw = new Q3MainWindow( parentWidget, "main form", Qt::WDestructiveClose );
+               mw->statusBar()->hide();
+               mw->setCaption( form->caption() );
+
+               printf("try find in windowslist %d, %llu\n ", objid, db_uid);
+               if ( engine->wl->find( objid, db_uid ) )
+               {
+                       printf("found, remove\n");
+                       engine->wl->remove( objid, db_uid );
+               }
+               else
+               {
+                       printf("not found\n");
+               }
+               engine->wl->insert( objid, mw, db_uid );
+               printf("insert new in wl ok\n");
+               if ( form->inherits("QMainWindow" )){
+                       ((Q3MainWindow *) form)->statusBar()->hide();
+               }
+               mainWidget = 0;
+               aCfgItem par = md->parent( md->parent( mdObj ) );
+               if ( !form->inherits("aWidget"))
+               {
+                       aLog::print(aLog::Error, tr("aForm do not inherits aWidget!"));
+                       QMessageBox::critical( 0, tr("Error"), tr("Error while open dialog form. Init hasn't been completed.") );
+                       return;
+               }
+                // Create main widgets container.
+               if ( md->objClass( par ) == md_catalogue ) {
+                        mainWidget = ( wCatalogue *) form; //new wCatalogue( mw );
+                        mw->setIcon( rcIcon("wcatalogue.png"));
+                }
+               if ( md->objClass( par ) == md_document ) {
+                        mainWidget = ( wDocument *) form; //new wDocument( mw );
+                        mw->setIcon( rcIcon("wdocument.png"));
+                }
+               if ( md->objClass( par ) == md_journal ) {
+                        mainWidget = ( wJournal *) form; //new wJournal( mw );
+                        mw->setIcon( rcIcon("wjournal.png"));
+                       mw->statusBar()->show();
+                       mw->statusBar()->message(tr("New document - <Ins>, Edit - <Enter>, View - <Shift+Enter>"));
+               }
+               if ( md->objClass( par ) == md_report ) {
+                        mainWidget = ( wReport *) form;
+                        mw->setIcon( rcIcon("wreport.png"));
+                }
+
+               if ( !mainWidget ) {
+                       form->reparent( parentWidget, Qt::WDestructiveClose, QPoint(0, 0));
+                        delete mw;
+                } else {
+                       form = mw;
+                       mainWidget->setFormMode( md->attr( mdObj, mda_type ).toInt());
+                       mainWidget->createToolBar( mw );
+                       mw->resize( mainWidget->size() );
+                       mainWidget->reparent( mw, 0, QPoint(0, 0));
+                       mw->setCentralWidget( mainWidget );
+                       initContainer( mainWidget, db );
+                       mainWidget->show();
+                       form = mw;
+                       mw->setFocusPolicy( Qt::NoFocus );
+                }
+            //--
+            ((QWorkspace*)engine->ws)->addWindow(form);
+            form->show();
+
+               connectSlots();
+               if ( !sModule.isEmpty() )
+               {
+               //      engine->project.addObject(this);
+                       engine->project.interpreter()->evaluate(sModule,this );
+                       aLog::print(aLog::Debug, tr("aForm load form module script"));
+                       QStringList lst = engine->project.interpreter()->functions(this);
+                       for(uint i=0; i<lst.count();i++)
+                       {
+                               aLog::print(aLog::Debug, tr("aForm defined function %1").arg(lst[i]));
+                       }
+               }
+               else
+               {
+                       aLog::print(aLog::Debug, tr("aForm form module script is empty"));
+               }
+               if ( md->attr( mdObj, mda_readonly ).toInt()) SetReadOnly(true);
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aForm form not found"));
+               QMessageBox::critical( 0, tr("Error"), tr("Error open dialog form. Form not found.") );
+
+       }
+}
+
+/*!
+ *\~english
+ *     Return ananas contaner object for widget.
+ *     Use for widget->init() function.
+ *\~russian
+ *     Возвращает объект-контейнер для заданного виджета.
+ *     \param widget - виджет, для которого необходимо найти объект-контейнер.
+ *     \return объект контейнер.
+ *\~
+*/
+QWidget *
+aForm::aParent( QWidget *widget )
+{
+       QWidget *p = widget->parentWidget();
+       QString pc;
+       while ( p ){
+               pc = p->className();
+               if ( pc == "wCatalogue") break;
+               if ( pc == "wDocument") break;
+               p = p->parentWidget();
+       }
+       return p;
+}
+
+
+/*!
+ *\~english
+ *     Show form. Move it in left top corner of workspace.
+ *\~russian
+ *     \brief ScriptAPI. Показывает форму на экране.
+ *
+ *     Перемещает ее в левый верхний угол рабочего пространства. Вызывает функцию on_formstart() скрипта модуля
+ *     экранной формы, если функция определена в модуле.
+ *
+ *     \see close
+ *\~
+*/
+void
+aForm::Show()
+{
+       if ( form )
+       {
+               if ( engine->project.interpreter()->functions( this ).findIndex("on_formstart")!=-1)
+               {
+                       engine->project.interpreter()->call("on_formstart", QVariantList(), this);
+               }
+               form->show();
+               ((QWidget*)form->parent())->move(0,0);
+               connect( form, SIGNAL(destroyed()), this, SLOT(close()) );
+    }
+}
+
+/**
+ * \brief Deprecated. See Show()
+ */
+void
+aForm::show() {
+       aLog::print(aLog::Debug,tr("Deprecated method call: aForm::show()"));
+       this->Show();
+}
+
+
+/*!
+ *\~english
+ *     Close form. Delete this pointer after close.
+ *\~russian
+ *     \brief ScriptAPI. Закрывает и уничтожает форму.
+ *
+ *     Вызывает функцию on_formstop()
+ *     скрипта модуля экранной формы, если функция определена в модуле.
+ *
+ *     \see show
+ *\~
+*/
+void
+aForm::Close() {
+        // don't call function name() in this place in Win32 - crash
+       emit(closeForm(selectedCatId()));
+       on_form_close(); //to run ananas-script
+       
+       if( form ) {
+               if( form->isShown() ) {
+                       aLog::print(aLog::Debug,tr("aForm::Close() hides form"));
+                       disconnect( form );
+                       form->hide();
+               }
+       }
+       if( engine && engine->wl ) {
+               engine->wl->remove( objid, db_uid );
+       }
+    deleteLater();
+}
+
+/**
+ * \brief Deprecated
+ */
+void
+aForm::close() {
+       aLog::print(aLog::Debug,tr("Deprecated method call: aForm::close(). Use aForm::Close() instead"));
+       this->Close();
+}
+
+/**
+ *     \brief Deprecated
+ */
+int
+aForm::turn_on(){
+       aLog::print(aLog::Debug,tr("Deprecated method call: aForm::turn_on()"));
+       return SignIn();
+}
+
+/*!
+ *\~english
+ *     Turn on document.
+ *\~russian
+ *     \brief ScriptAPI. Проводит (регистрирует) документ.
+ *
+ *     Вызывает функцю on_conduct() кода Ананас.скрипта модуля экранной формы.
+ *     В скрипте вы можете проверить условия проведения документа,
+ *     и, если они не выполняются, вернуть в функции false.
+ *     Если функция возвращает false, то отметка о проведении не ставится.
+ *\~
+ */
+int
+aForm::SignIn(){
+       QVariant res;
+       if ( form && !mainWidget->dataObject()->IsConducted())
+       {
+               if ( engine->project.interpreter()->functions( this ).findIndex("on_conduct")!=-1)
+               {
+                       res  = engine->project.interpreter()->call("on_conduct",QVariantList(), this);
+               }
+       }
+       //--if(res.type()==QSArgument::Variant)
+       {
+               // if return false
+               if(res.toBool()==false && res.type()!=QVariant::Invalid)
+               {
+                       aLog::print(aLog::Info, tr("aForm conduct: function on_conduct() return false, document not conducted"));
+                       return 0;
+               }
+       }
+       return mainWidget->TurnOn();
+}
+
+/**
+ *     \brief Deprecated
+ */
+int
+aForm::turn_off(){
+       aLog::print(aLog::Debug,tr("Deprecated method call: aForm::turn_off()"));
+       return SignOut();
+}
+
+/*!
+ *\~english
+ *     Turn off document. Do nothing.
+ *\~russian
+ *     \brief ScriptAPI. Отменяет проведение (регистрацию) документа.
+ *
+ *     На самом деле ничего не делает. Отмена проведения производится при открытии
+ *     документа.
+ *\~
+ */
+int
+aForm::SignOut(){
+       return 0;
+}
+
+/**
+ *     \brief Depticated
+ */
+ERR_Code
+aForm::update(){
+       aLog::print(aLog::Debug,tr("Deprecated method call: aForm::update()"));
+       return this->UpdateDB();
+}
+
+/*!
+ *\~english
+ *     Update object.
+ *\~russian
+ *     \brief ScriptAPI. Обновляет данные в базе.
+ *\~
+ */
+ERR_Code
+aForm::UpdateDB()
+{
+       ERR_Code        rc = err_noerror;
+       aWidget*        aw = NULL;
+
+       if ( RO ) return err_readonly;
+       rc = mainWidget->Update();
+       if (!rc && callerWidget!=NULL)
+       {
+               emit( changedData());
+               emit( update( db_uid ) );
+       }
+       return rc;
+}
+
+/*!
+ *\~english
+ *     do nothing.
+ *\~russian
+ *     Ничего не делает.
+ *\~
+char*
+aForm::formMetaObjectId(QString filename){
+//     if (filename==""){
+//     }
+//     return aot_doc;
+    return "";
+}
+ */
+
+
+
+//QString
+//aForm::widgetName(QObject *obj){
+//     return aWidget::widgetName( ( QWidget *) obj );
+/*
+       QString res="";
+
+       if (obj) {
+*/
+/*
+               if (!strcmp(obj->className(),"QAnanasField")) res=((QAnanasField *)obj)->getName();
+               else
+               if (!strcmp(obj->className(),"QAnanasDBField")) res=((QAnanasDBField *)obj)->getName();
+               else
+               if (!strcmp(obj->className(),"QAnanasTable")) res=((QAnanasTable *)obj)->getName();
+               else
+*/
+/*             if (!strcmp(obj->className(),"wDBField")) {
+                       res= ((wDBField*)obj)->getMdFieldName();
+//                     printf("wdbfield name=%s\n",(const char*)((wDBField*)obj)->getMdFieldName().local8Bit());
+               } else {
+                       res=obj->name();
+               }
+       }
+       return res;
+*/
+//}
+
+
+
+/*!
+ *\~english
+ *     Return form widget pointer by name.
+ *\~russian
+ *     \brief ScriptAPI. Возвращает указатель на виджет по его имени.
+ *
+ *     Очень полезная функция для работы с QT виджетами, находящимися в экранной форме. Используя этот метод,
+ *     можно получить доступ к методам любого виджета, лежащего в форме.
+ *     ВАЖНО! Из Ананас скрипта вы сможете обратиться только к публичным слотам и свойствам виджета. Публичные методы
+ *     виджета из Ананас скрипта недоступны.
+ *     Документацию по свойствам и методам QT виджетов смотрите на сайте http://trolltech.com
+ *
+ *     \code
+ *     // допустим в экранной форме есть виджет myCheckBox, являющийся экземпляром класса QCheckBox
+ *
+ *     var myBox = Widget("myCheckBox"); //возвращает указатель на объект
+ *     if ( myBox.checked ) {          // Проверяем значение свойства checked
+ *             sys.Message(0, "Yes" );
+ *     } else {
+ *             sys.Message(0, "No" );
+ *     }
+ *
+ *     // К сожалению мы не имеем доступа к методам  setChecked() и isChecked(), так как они не являются публичными слотами.
+ *
+ *     \endcode
+ *     \see aWidget::Widget()
+ *\~
+*/
+QWidget *
+aForm::Widget( QString name )
+{
+       return mainWidget->Widget( name );
+}
+
+//QObject *
+//aForm::findWidget( QString name ){
+
+//     return mainWidget->Widget( name );
+/*
+       QObject *res=NULL;
+       QObject* obj;
+       QObjectList* list = form->queryList("QWidget");
+
+       QObjectListIt it(*list);
+       while ( ( obj = it.current() ) !=0 ) {
+                       ++it;
+                       if (!obj) continue;
+                       if (name==widgetName(obj)) {
+                               res=obj;
+                               break;
+                       }
+       }
+       delete list;
+       return res;
+*/
+//}
+
+
+/*!
+ *\~english
+ *     Connecting widget slots to form.
+ *\~russian
+ *     Коннектит некоторые слоты объектов формы.
+ *     Обеспечивает работу функций ананас скрипта
+ *     on_valuechanged(), on_button(), on_tabvaluechanged(), etc.
+ *\~
+ */
+void
+aForm::connectSlots()
+{
+       QObject* obj;
+       if ( !form ) return;
+       QObjectList list = form->queryList("QWidget");
+       if ( mainWidget->inherits("aWidget") )
+               connect( mainWidget, SIGNAL( valueChanged( const QString &, const QVariant & ) ),\
+                                this, SLOT( on_valueChanged( const QString &, const QVariant & ) ) );
+
+       QListIterator<QObject*> it(list);
+       while ( it.hasNext() ) {
+                       obj = it.next();
+                       if (!obj) continue;
+                       if ( obj->inherits("wActionButton" )){
+                               connect( obj, SIGNAL( clicked() ), this, SLOT( on_actionbutton() ) );
+                               connect( mainWidget, SIGNAL( keyPressed(QKeyEvent*) ), obj, SLOT( keyPressHandler(QKeyEvent*) ) );
+                        //        continue;
+                       }
+                       if ( obj->inherits("QPushButton" )){
+                               connect( obj, SIGNAL( clicked() ), this, SLOT( on_button() ) );
+                                continue;
+                       }
+                       if ( obj->inherits("wDBTable" )){
+                               connect( obj, SIGNAL( currentChanged(  QSqlRecord * ) ), this, SLOT( on_dbtablerow( QSqlRecord * ) ) );
+                               connect( obj, SIGNAL( deleteLine( QSqlRecord * ) ), this, SLOT( on_tabupdate( QSqlRecord * ) ) );
+
+                               connect(obj,    SIGNAL(updateCurr(int,int) ),
+                                       this,   SLOT( on_tabvalueChanged(int, int) ) );
+//                             connect( obj, SIGNAL( primeUpdate(  QSqlRecord * ) ), this, SLOT( on_tabupdate( QSqlRecord * ) ) );
+                               connect( obj, SIGNAL( selected( qulonglong ) ), this, SLOT( on_tabselected( qulonglong ) ) );
+                               connect( obj, SIGNAL( selectRecord( qulonglong ) ), this, SLOT( on_tablerow( qulonglong ) ) );
+                                continue;
+                       }
+       }
+       //--delete list;
+}
+
+void
+aForm::on_tabupdate( QSqlRecord *rec )
+{
+}
+
+/*!
+ * \ru
+ *             \brief ScriptAPI. Возвращает значение поля экранной формы.
+ *
+ *             Например, значение поля шапки "Номер" приходной накладной.
+ *             Слот предназначен для использования Ананас-Скриптом.
+ *             \param name - имя поля, как оно определено в метаданных. Например, "Номер" или "Покупатель".
+ *             \return значение поля. Необходимо понимать, что если поле имеет сложный тип данных, например
+ *             его значение задается выбором элемента из справочника товаров, то будет возвращено текстовое
+ *             представление товара (его название), а не ссылка на составной объект, хранящий все атрибуты товара.
+ *             Для того что бы получить доступ к составному объекту, для обращения ко всем атрибутам товара
+ *             необходимо воспользоваться функцией DBValue();
+ *\see aForm::DBValue()
+
+Пример кода для размещения в модуле экранной формы. Экранная форма содержит одну кнопку с именем Button1 и
+поле ввода LineEdit1.
+После ввода значения, следует нажать на кнопку и в окно сообщений будет выведено только что введенное значение.
+
+
+\code
+function on_button(buttonName) // обработчик нажатия кнопки
+{
+       if(buttonName=="Button1") // Button1 - имя кнопки, данное ей в дизайнере
+       {
+               // Получаем значение поля LineEdit1 экранной формы
+               str = Value("LineEdit1");
+
+               // Выводим в окно сообщений, полученное значение
+               StatusMessage(str);
+       }
+}
+\endcode
+ * \_ru
+ */
+QVariant
+aForm::Value(const QString &name)
+{
+       QVariant res= mainWidget->value( name ); //value();
+       if(res.type()==QVariant::ULongLong || res.type()==QVariant::LongLong)
+       {
+               res = res.toString();
+       }
+       //if(res.type()==QVariant::DateTime)
+       //{
+       //      res = res.toDateTime().toString(ISODate);
+       //}
+       return res;
+
+/*
+       aObject *o = 0;
+        if ( mainWidget ) o = mainWidget->dataObject();
+        if ( o ) {
+                res = o->Value( name );
+        }
+        if ( res.type() != QVariant::Invalid ) return res;
+        else printf("no field %s in data object\n", ( const char *) name );
+*/
+/*
+       w = findWidget( name );
+       if ( w ) {
+               if (!strcmp(w->className(),"wDBField")){
+                       res=( (wDBField*)w )->text(); //value();
+               } else if (w->inherits("wField")){
+                       res=( (wField*)w )->text(); //value();
+               } else if (!strcmp(w->className(),"QPushButton")){
+                       res=((QPushButton *)w)->text();
+               } else if (!strcmp(w->className(),"QLabel")){
+                       res=((QLabel*)w)->text();
+               } else if (!strcmp(w->className(),"QLineEdit")){
+                       res=((QLineEdit*)w)->text();
+               } else if (!strcmp(w->className(),"QDateEdit")){
+                       res=((QDateEdit*)w)->date().toString(Qt::ISODate);
+               }
+       } else {
+               debug_message(tr("Error! Can't find widget by name==`%s`\n"),(const char*) name.local8Bit());
+       }
+       return res;
+*/
+}
+
+
+/*!
+ *\~english
+ *     Getting widgets value, inherited aWidget.
+ *\~russian
+ *     \brief ScriptAPI. Возвращает значение атрибута <name> бизнес объекта Ананаса.
+ *
+ *     Предназначен для использования в контексте экранной формы редактирования бизнес объекта.
+ *     Или, говоря по другому, в модуле экранной формы.
+ *     Тип возвращаемого значения такой же, как задан в метаданных у соответствующего атрибута бизнес объекта.
+ *     Для поля типа Каталог или Документ функция вернет число (id).
+ *     Функция необходима, если нужно заполнять поля сложных типов.
+ *     Для остальных случаев можно использовать aForm::Value(), обеспечивающее доступ к значению виджета экранной формы,
+ *     в контексте которой исполняется Скрипт.
+ *\~
+ *\param name -\~english Widget name. For wDBField this parameter must be name field of metadata.
+               \~russian Имя атрибута бизнес объекта, как задано в метаданных.
+               \~
+
+Пример кода для размещения в модуле экранной формы. Экранная форма содержит одну кнопку с именем Button1.
+При нажатии на кнопку в окно сообщений будет выведено значение атрибута "Покупатель" редактируемого бизнес объекта.
+
+
+\code
+function on_button(buttonName) // обработчик нажатия кнопки
+{
+       if(buttonName=="Button1") // Button1 - имя кнопки, данное ей в дизайнере
+       {
+               // Получаем значение атрибута "Покупатель" редактируемого бизнес объекта
+               contragent = DBValue("Покупатель");
+
+               // Выводим в окно сообщений, полученное значение
+               StatusMessage(contragent);
+       }
+}
+\endcode
+\~
+ */
+QVariant
+aForm::DBValue(const QString &name)
+{
+       QObject *w;
+       QVariant res;
+       w = Widget( name );
+       if ( w )
+       {
+               if (!strcmp(w->className(),"wDBField"))
+               {
+                       res=( (wDBField*)w )->value(); //value();
+                       if(res.type()==QVariant::ULongLong || res.type()==QVariant::LongLong)
+                       {
+                               res = res.toString();
+                       }
+                       //if(res.type()==QVariant::DateTime)
+                       //{
+                       //      res = res.toDateTime().toString(ISODate);
+                       //}
+               }
+               else
+               {
+                       if (w->inherits("wField"))
+                       {
+                               res=( (wField*)w )->value(); //value();
+                       }
+                       if(res.type()==QVariant::ULongLong || res.type()==QVariant::LongLong)
+                       {
+                               res = res.toString();
+                       }
+                       //if(res.type()==QVariant::DateTime)
+                       //{
+                       //      res = res.toDateTime().toString(ISODate);
+                       //}
+               }
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aForm not found widget with name %1").arg(name));
+       }
+       return res;
+}
+
+
+/*!
+ *\~english
+ *     Setting form widgets value of object type.
+ *\~russian
+ *     \brief ScriptAPI. Устанавливает значения виджетов формы сложных типов (aDocument, aCatalogue)
+ *
+ *     Обычно для установки значения используют SetValue(...)
+ *\~
+ *     \see SetValue(...)
+ *\param tname -\~english Widget name.
+               \~russian Имя виджета.
+               \~
+ */
+int
+aForm::SetObjValue(const QString &name, aObject *value)
+{
+       return mainWidget->setObjValue( name, value );
+}
+
+/*!
+ *\~english
+ *     Setting form widgets value.
+ *\~russian
+ *     \brief ScriptAPI. Устанавливает значения виджетов экранной формы.
+ *\~
+ *     \see aWidget::setValue()
+ *\param name -\~english Widget name.
+               \~russian Имя виджета.
+               \~
+ *\param value -\~english Widget value.
+               \~russian Значение виджета. Для сложных типов (Документ,Каталог) должен использоваться идентификатор.
+ *             Если идентификатор недоступен, используйте функция SetObjValue(), которая принимает в качестве
+ *             параметра ссылку на объект.
+               \~
+ */
+int
+aForm::SetValue(const QString &name, QVariant value)
+{
+       return mainWidget->setValue( name, value );
+/*
+       QObject *w;
+       int     rc= err_noerror;
+
+       w = findWidget( name );
+       if ( w ) {
+               if (!strcmp(w->className(),"wDBField")){
+                       ((wDBField*)w)->setValue(value.toString());
+               } else if (w->inherits("wField")){
+                       ((wField*)w)->setValue(value.toString());
+               } else if (!strcmp(w->className(),"QPushButton")){
+                       ((QPushButton *)w)->setText( value.toString() );
+               } else if (!strcmp(w->className(),"QLabel")){
+                       ((QLabel*)w)->setText( value.toString() );
+               } else if (!strcmp(w->className(),"QLineEdit")){
+                       ((QLineEdit*)w)->setText( value.toString() );
+               }
+       } else {
+               debug_message(tr("aForm::SetValue() Error! Can't find widget by name==`%s`\n"),(const char*) name.local8Bit());
+               rc = err_nowidgetfound;
+       }
+       return rc;
+*/
+}
+
+/*!
+ *\~english
+ *     Setting column readonly flag.
+ *     When column readonly, user can't edit value of this column.
+ *\~russian
+ *     \brief ScriptAPI. Устанавливает для столбца таблицы флаг только чтение.
+ *
+ *     Когда установлен этот флаг, пользователь не может редактировать значения в этом столбце.
+ *\~
+ *\param tname - \~english Table name.\~russian Имя таблицы.\~
+ *\param numCol - \~english Column number.\~russian Номер столбца.\~
+ *\param ro - \~english `Readonly' flag value.\~russian Значение флага `только чтение'.\~
+ */
+void
+aForm::SetColumnReadOnly(const QString &tname, int numCol, bool ro)
+{
+       QObject *w;
+       w = Widget( tname );
+       if ( w )
+       {
+               if (!strcmp(w->className(),"wDBTable"))
+               {
+                       ((wDBTable*)w)->setColumnReadOnly(numCol,ro);
+               }
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aForm not found widget with name %1").arg(tname));
+       }
+
+       return;
+}
+
+
+/*!
+ *\~english
+ *     Count table row.
+ *\~russian
+ *     \brief ScriptAPI. Возвращает количество строк в табличном виджете wDBTable.
+ *
+ *     Если табличный виджет не является объектом класса wDBTable,
+ *     метод запишет в лог сообщение об ошибке и вернет 0.
+ *\~
+ *\param tname - \~english Table name.\~russian Имя таблицы.\~
+ *\return - \~english Number rows of table.\~russian Количество строк в таблице.\~
+ */
+int
+aForm::TabCount(const QString &tname)
+{
+       int res=0;
+       QObject *w;
+       w = Widget( tname );
+       if ( w )
+       {
+               if (!strcmp(w->className(),"wDBTable"))
+               {
+                       res=( (wDBTable*)w )->numRows() ; //value();
+               }
+               else
+               {
+                       aLog::print(aLog::Error, tr("Expected wDBTable widget but found %1").arg(w->className()));
+               }
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aForm not found widget with name %1").arg(tname));
+       }
+
+        return res;
+
+}
+
+/**
+ * \ru
+ *     \brief ScriptAPI. Добавляет новую строку в табличный виджет wDBTable.
+ *
+ *     \param tname - имя виджета
+ * \_ru
+ */
+void
+aForm::TabNewLine(const QString &tname)
+{
+       QObject *w;
+
+       w = Widget( tname );
+       if ( w  && !strcmp(w->className(),"wDBTable"))
+       {
+               wDBTable *wdb = (wDBTable*)w;
+               Q3SqlCursor *cur = wdb->sqlCursor();
+               QSqlRecord *buffer = cur->primeInsert();
+               wdb->lineInsert(buffer);
+               cur->insert();
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aForm not found wDBTabe widget with name %1").arg(tname));
+       }
+}
+
+void
+aForm::TabUpdate(const QString &tname)
+{
+       QObject *w;
+
+       w = Widget( tname );
+       if ( w  && !strcmp(w->className(),"wDBTable"))
+       {
+               wDBTable *wdb = (wDBTable*)w;
+               Q3SqlCursor *cur = wdb->sqlCursor();
+               //QSqlRecord *buffer = cur->primeInsert();
+             //  wdb->lineInsert(buffer);
+               cur->primeUpdate();
+              cur->update();
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aForm not found wDBTabe widget with name %1").arg(tname));
+       }
+}
+/**
+ * \ru
+ *     \brief ScriptAPI. Возвращает значение ячейки табличного виджета wDBTable.
+ *
+ *
+ *     Если табличный виджет не является объектом класса wDBTable, метод запишет сообщение
+ *     об ошибке в лог и вернет строку "Unknown".
+ *     То есть он предназначен только для работы с таблицами привязанными (binded) к
+ *     табличным частям бизнес объектов Ананаса. Если в ячейке хранится сложный тип данных (Документ, Элемент справочника)
+ *     будет возвращен уникальный идентификатор объекта, а не его текстовое представление, которое видит пользователь.
+ *     Для получения текстового представления сложного объекта воспользуйтесь методом aForm::TabDBValue.
+ *
+ *     \param tname - имя виджета
+ *     \param row - индекс строки таблицы
+ *     \param col - индекс столбца таблицы
+ *     \return значение ячейки табличного виджета
+ *     \see aForm::TabDBValue(...)
+ * \_ru
+ *
+ */
+QVariant
+aForm::TabValue(const QString &tname, int row, int col)
+{
+       return tabValue(tname,row,col,true);
+}
+
+/**
+ * \ru
+ *     \brief ScriptAPI. Возвращает значение ячейки табличного виджета wDBTable для сложного типа данных.
+ *
+ *
+ *     Если табличный виджет не является объектом класса wDBTable, метод запишет сообщение
+ *     об ошибке в лог и вернет строку "Unknown".
+ *     То есть он предназначен только для работы с таблицами привязанными (binded) к
+ *     табличным частям бизнес объектов Ананаса.
+ *     В отличие от aForm::TabValue, который вернет числовой идентификатор, в случае, если ячейка имеет сложный тип данных,
+ *     aForm::TabDBValue вернет текстовое представление, которое видит в таблице пользователь.
+ *
+ *     \param tname - имя виджета
+ *     \param row - индекс строки таблицы
+ *     \param col - индекс столбца таблицы
+ *     \return значение ячейки табличного виджета
+ *     \see aForm::TabValue(...)
+ * \_ru
+ *
+ */
+QVariant
+aForm::TabDBValue(const QString &tname, int row, int col)
+{
+       return tabValue(tname,row,col,false);
+}
+
+
+QVariant
+aForm::tabValue(const QString &tname, int row, int col, bool dbval)
+{
+       QVariant res=QString::QString("Unknown");
+       QObject *w;
+       QStringList l;
+       w = Widget( tname );
+       if ( w  && !strcmp(w->className(),"wDBTable"))
+       {
+               wDBTable *wdb = (wDBTable*)w;
+                       if(wdb->getDefIdList().count()>col && col>=0)
+                       {
+                               long f_oid = wdb->getDefIdList()[col].toLong();
+                               QString type = wdb->getFieldType(f_oid);
+                               if(row==-1)
+                               {
+                                       row = wdb->currentRow();
+                               }
+                               if(type.left(1) == "O" && dbval)
+                               {
+                                       res = ananas_objectstr(db, wdb->value(row,col).toULongLong(), type.section(' ',1,1).toInt());
+                               }
+                               else
+                               {
+                                       res = wdb->value(row,col);
+                                       //if( res.type() == QVariant::DateTime || res.type() == QVariant::Date )
+                                       //{
+                                       //      res = QString("%1").arg(res.toDateTime().toString(Qt::ISODate));
+                                       //}
+                               }
+                       }
+                       else
+                       {
+                               aLog::print(aLog::Error, tr("aForm table value: column out of range"));
+                       }
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aForm not found widget with name %1").arg(tname));
+       }
+        return res;
+}
+
+
+/*!
+ *\~english
+ *     Return column index in table \param tname.
+ *\~russian
+ *     \brief ScriptAPI. Возвращает индекс столбца таблицы tname по его имени в метаданных.
+ *\~
+ * \param tname - \~english Table name.\~russian Имя таблицы.\~
+ * \param colname - \~english Column name.\~russian Имя столбца.\~
+ * \return  \~english Column index.\~russian Индекс столбца.\~
+ */
+int
+aForm::ColIndex(const QString &tname, const QString &colname)
+{
+       int res;
+       QObject *w;
+       int col=-1;
+       w = Widget( tname );
+       if ( w  && !strcmp(w->className(),"wDBTable"))
+       {
+                       wDBTable *wdb = ((wDBTable*)w );
+                       col= wdb->getDefFields().findIndex(colname);
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aForm not found widget with name %1").arg(tname));
+       }
+       return col;
+}
+
+
+/**
+ * \ru
+ *     \brief ScriptAPI. Задает значение ячейки табличного виджета wDBTable.
+ *
+ *     \param tname - имя таблицы
+ *     \param colname - имя столбца
+ *     \param row - номер строки
+ *     \param value - значение
+ * \_ru
+ */
+void
+aForm::SetTabValue(const QString &tname, const QString &colname, int row, QVariant value)
+{
+       QObject *w;
+       w = Widget( tname );
+       if ( w  && !strcmp(w->className(),"wDBTable"))
+       {
+       //      printf(">>>>>>>>>>>>>>Set tab value %s, for %s, rov = %d, value = %s\n",(const char*)tname.local8Bit(), (const char *)colname.local8Bit(), row, (const char*)value.toString().local8Bit() );
+               wDBTable *wdb = (wDBTable*)w;
+               aSQLTable *t = ( aSQLTable *) wdb->sqlCursor();
+               t->select(QString("idd=%1").arg(mainWidget->uid()));
+               t->first();
+               if(t->seek(row))
+               {
+                       t->setValue(colname,value);
+                       t->Update();
+                       //t->update();
+               }
+               wdb->refresh();//updateCurrent();
+                       //      wdb->setValue(row, col, value);
+                               //res = wdb->text(row,col);
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("aForm not found wDBTable widget with name %1").arg(tname));
+       }
+
+        return;
+
+}
+
+
+
+/**
+ *     \brief Deprecated
+ */
+void
+aForm::done( int rc ){
+       aLog::print(aLog::Debug,tr("Deprecated method call: aForm::done(...)"));
+       rc=rc;
+//     if (form) form->done(rc);
+}
+
+/**
+ *     \brief Deprecated
+ */
+void
+aForm::setfocus(QString fname){
+       aLog::print(aLog::Debug,tr("Deprecated method call: aForm::setfocus()"));
+//     QWidget *w;
+//     w=(QWidget *) form->child(fname,"QWidget");
+//     if (w) w->setFocus();
+}
+
+/**
+ *
+ */
+void
+aForm::SetFocus(){
+//     aLog::print(aLog::Debug,tr("Deprecated method call: aForm::setfocus()"));
+//     QWidget *w;
+//     w=(QWidget *) form->child(fname,"QWidget");
+       if(form) form->setFocus();
+}
+
+void
+aForm::on_button(){
+       if ( engine->project.interpreter()->functions(this).findIndex("on_button")!=-1)
+       {
+               engine->project.interpreter()->call("on_button",QVariantList()<<sender()->name(),this);
+//             engine->code->evaluate("on_button(\""+sender()->name()+"\")", this);
+       }
+}
+
+
+
+/*!
+ *\~english
+ *     Action button pressed.
+ *\~russian
+ *\~
+ */
+void
+aForm::on_actionbutton()
+{
+        wActionButton *b = ( wActionButton *) sender();
+        if ( b ) {
+                if ( b->isAction() ) {
+                        if ( b->isActionUpdate() ) update();
+                        if ( b->isActionTurnOn() ) turn_on();
+                        if ( b->isActionClose() )
+                        {
+                               if(form)
+                               if( form->isShown() )
+                               {
+//#ifndef _Windows
+                                       form->disconnect();
+                                       form->hide();
+//#endif
+                               }
+                               close();
+                         }
+                } else {
+                       if(b->getActionId())
+                       {
+                               aCfgItem item = md->find(b->getActionId());
+                               engine->execAction( item, this);
+                        }
+                }
+        }
+}
+
+
+
+void
+aForm::on_return(){
+}
+
+
+void
+aForm::on_lostfocus(){
+}
+
+
+void
+aForm::on_form_close(){
+       if(!engine) return;
+       if ( engine->project.interpreter()->functions(this).findIndex("on_formstop")!=-1) {
+               engine->project.interpreter()->call("on_formstop", QVariantList(),this);
+       }
+}
+
+
+void
+aForm::on_valueChanged(const QString &s){
+//     char buf[200];
+/*
+       const QObject *sobj=sender();
+       QString objName=widgetName((QObject *) sobj);
+       cfg_message(0, "value changed %s (%s)\n", (const char *) objName.utf8(), (const char *) dbobject->className());
+       cfg_message(0, "classname %s\n", (const char *) sobj->className());
+       if (strcmp(sobj->className(),"QAnanasDBField")==0) {
+//     if (sobj->className()=="QAnanasDBField") {
+               cfg_message(0,"OK");
+               if (dbobject->className()=="QAdoc"){
+                       ((QAdoc *)dbobject)->setfield(objName, s);
+               }
+               if (dbobject->className()=="QAcat"){
+                       cfg_message(0,"Поле справочника %s=%s\n",(const char *) objName.utf8(), (const char *) s.utf8());
+                       ((QAcat *)dbobject)->setfield(objName, s);
+               }
+       }
+*/
+}
+
+
+
+/*!
+ *\~english
+ *     Process field value changed.
+ *     Connect on main widget signal, and work only with it fields.
+ *     Call afta widget process change field value signal.
+ *\~russian
+ *     Обрабатывает изменение значения поля
+ *     Присоединяется на сигнал главнов виджета формы
+ *     и обрабатывает только изменение его полей.
+ *     Сигнал вызывается виджетом, после того, как он сам обработает новое значение.
+ *\~
+ *\param name - \~english field metedata name \~russian имя поля в конфигурации.\~
+ *\param value - \~english new field value \~russian новое значение поля. \~
+ */
+void
+aForm::on_valueChanged( const QString & name, const QVariant & val )
+{
+
+       if ( engine->project.interpreter()->functions(this).findIndex("on_valuechanged")!=-1)
+       {
+               Q3ValueList<QVariant> lst;
+               lst << name;
+               lst << val;
+//             if(!val.isNull() && !val.isValid()) v = val;
+               engine->project.interpreter()->call("on_valuechanged",QVariantList(lst), this);
+       //      printf("aForm change value field %s to %s\n",(const char*)name.local8Bit(), val.toString().ascii());
+       }
+}
+
+
+void
+aForm::on_tabvalueChanged(int row, int col)
+{
+
+       if ( engine->project.interpreter()->functions(this).findIndex("on_tabupdate")!=-1)
+       {
+               Q3ValueList<QVariant> lst;
+               lst << row;
+               lst << col;
+               lst << sender()->name();
+
+               engine->project.interpreter()->call("on_tabupdate",QVariantList(lst), this);
+       }
+/*
+       const QObject *sobj=sender();
+       QString objName=widgetName((QObject *) sobj);
+       cfg_message(0, "value changed %s (%s)\n", (const char *) objName.utf8(), (const char *) dbobject->className());
+       cfg_message(0, "classname %s\n", (const char *) sobj->className());
+       if (strcmp(sobj->className(),"QAnanasDBTable")==0) {
+//     if (sobj->className()=="QAnanasDBField") {
+*/
+/*             cfg_message(0,"OK");
+               if (dbobject->className()=="QAdoc"){
+                       ((QAdoc *)dbobject)->setfield(objName, s);
+               }
+               if (dbobject->className()=="QAcat"){
+                       cfg_message(0,"Поле справочника %s=%s\n",(const char *) objName.utf8(), (const char *) s.utf8());
+                       ((QAcat *)dbobject)->setfield(objName, s);
+               }
+*/
+//     }
+}
+
+
+void
+aForm::on_dbtablerow( QSqlRecord *r )
+{
+        unsigned int i;
+        aObject *o = 0;
+        QVariant tv;
+        if ( mainWidget ) o = mainWidget->dataObject();
+        if ( o )
+       {
+               aSQLTable *t = o->table();
+               id = t->value(0).toULongLong();
+        }
+       if ( engine->project.interpreter()->functions(this).findIndex("on_tablerow")!=-1) {
+               engine->project.interpreter()->call("on_tablerow", QVariantList()<<sender()->name(), this);
+       }
+}
+
+void
+aForm::on_event( const QString &source, const QString &data )
+{
+       Q3ValueList<QVariant> lst;
+       lst << source;
+       lst << data;
+       if ( engine->project.interpreter()->functions(this).findIndex("on_event")!=-1) {
+               engine->project.interpreter()->call("on_event", QVariantList(lst), this);
+       }
+}
+
+
+
+void
+aForm::on_tabselected( qulonglong uid )
+{
+       emit selected( uid );
+       if ( closeAfterSelect ) {
+               aLog::print(aLog::Debug, QObject::tr("aForm::on_tabselected(...),   closeAfterSelect is true"));
+               close();
+       } else {
+               aLog::print(aLog::Debug, QObject::tr("aForm::on_tabselected(...),   closeAfterSelect is false"));
+       }
+}
+
+void
+aForm::on_tablerow( qulonglong uid )
+{
+       Q3ValueList<QVariant> lst;
+       lst << sender()->name();
+       lst << QString("%1").arg(uid);
+       if ( engine->project.interpreter()->functions(this).findIndex("on_tabrowselected")!=-1) {
+               engine->project.interpreter()->call("on_tabrowselected", QVariantList(lst), this);
+       }
+}
+
+int
+aForm::New()
+{
+        if ( mainWidget ) {
+//             printf("try find in windowslist %d, %llu\n ", objid, db_uid);
+               if ( engine->wl->find( objid, db_uid ) )
+               {
+//                     printf("found, remove\n");
+                       engine->wl->remove( objid, db_uid );
+               }
+               else
+               {
+//                     printf("not found\n");
+               }
+                mainWidget->New();
+               db_uid = mainWidget->uid();
+               printf(">>>>>db_uid = %llu\n",db_uid);
+               if(engine->wl->find( objid, db_uid ))
+               {
+                       engine->wl->get(objid, db_uid )->setFocus();
+               }
+               else
+               {
+                       engine->wl->insert( objid, form , db_uid );
+               }
+        }
+        return 0;
+}
+
+
+int
+aForm::Select( qulonglong id )
+{
+        if ( mainWidget ) {
+//             printf("try find in windowslist %d, %llu\n ", objid, db_uid);
+               if ( engine->wl->find( objid, db_uid ) )
+               {
+//                     printf("found, remove\n");
+                       engine->wl->remove( objid, db_uid );
+               }
+               else
+               {
+//                     printf("not found\n");
+               }
+//             printf("insert new in wl ok\n");
+//             printf("form->select()\n");
+               mainWidget->Select( id );
+               mainWidget->Refresh();
+               db_uid = id;
+               if(engine->wl->find( objid, db_uid ))
+               {
+                       engine->wl->get(objid, db_uid )->setFocus();
+               }
+               else
+               {
+                       engine->wl->insert( objid, form, db_uid );
+               }
+        }
+        return 0;
+}
+
+
+int
+aForm::SelectGroup( qulonglong id )
+{
+       if ( mainWidget && !strcmp(mainWidget->className(),"wCatalogue"))
+        {
+               if ( engine->wl->find( objid, db_uid ) )
+               {
+//                     printf("found, remove\n");
+                       engine->wl->remove( objid, db_uid );
+               }
+               ((wCatalogue*)mainWidget)->SelectGroup ( id );
+               db_uid = id;
+               if(engine->wl->find( objid, db_uid ))
+               {
+                       engine->wl->get(objid, db_uid )->setFocus();
+               }
+               else
+               {
+                       engine->wl->insert( objid, form, db_uid );
+               }
+        }
+        return 0;
+}
+
+/*
+int
+aForm::select( Q_ULLONG id )
+{
+CHECK_POINT
+//  Select( id );
+       QObject *res=NULL;
+       QObject* obj;
+       QObjectList* list = form->queryList("wDBField");
+       aCfgItem o;
+       QString fieldName;
+       QObjectListIt it(*list);
+       while ( ( obj = it.current() ) !=0 )
+       {
+               ++it;
+               if (!obj) continue;
+               ((aWidget*)obj)->Select(id);
+               //      if (name==widgetName(obj)) {
+               //o = md->find(((wDBField*)obj)->getId());
+               //if(o.isNull()) continue;
+               fieldName = ((wDBField*)obj)->getMdFieldName();
+               ((wDBField*)obj)->setValue(mainWidget->table()->value(fieldName).toString());
+
+  //debug_message("mainWidget class = %s\n", mainWidget->className() );
+                       //      break;
+               //      }
+       }
+       //return res;
+
+        return 0;
+}
+*/
+
+
+/**
+ * \ru
+ *     \brief ScriptAPI. Обновляет экранную форму.
+ * \_ru
+ */
+int
+aForm::Update()
+{
+        if ( mainWidget ) {
+                mainWidget->Update();
+        }
+        return err_noerror;
+}
+
+
+
+/*!
+ *\~english
+ *     Seting form readonly flag.
+ *     When form readonly we can't edit database fields, and make updatе action
+ *\~russian
+ *     \brief ScriptAPI. Устанавливает флаг "только чтение".
+ *
+ *     Когда установлен этот флаг, запрещается редактирование полей формы,
+ *     и сохранение изменений в базу.
+ *\~
+ *\param status - \~english New readonly flag.\~russian Новое значение флага только чтение.\~
+ */
+void
+aForm::SetReadOnly ( bool status )
+{
+       RO = status;
+       if ( mainWidget )
+       {
+               if(status)
+               {
+                       aLog::print(aLog::Info, tr("aForm set read only"));
+               }
+               else
+               {
+                       aLog::print(aLog::Info, tr("aForm set read/write"));
+               }
+               mainWidget->SetReadOnly( status );
+       }
+/*     QObjectList *l = mainWidget->queryList( "wDBField" );
+       QObjectListIt it( *l );
+       QObject *obj;
+       while ( (obj = it.current()) != 0 )
+       {
+CHECK_POINT
+               ++it;
+               (( wDBField *)obj)->setDisabled( status );
+       }
+       delete l; // delete the list, not the objects*/
+}
+
+
+
+/*!
+ *\~english
+ *     Geting form readonly flag.
+ *\~russian
+ *     \brief ScriptAPI. Возвращает значение флага "только чтение".
+ *\~
+ *\return \~english true if form open in read only mode.
+ *             \~russian true если форма открыта в режиме только чтение.\~
+ */
+bool
+aForm::IsReadOnly()
+{
+       return RO;
+}
+
+/*!
+ *\~english
+ *     Convert number to russian language text format.
+ *\~russian
+ *     \brief Конвертирует число в его текстовое представление c указанием единиц измерения.
+ *
+ *     Параметры позволяют настроить вид результата. По умолчанию валюта - рубли, копейки выводятся.
+ *
+ *     примеры использования:
+ *     \li Propis("20301.34") = Двадцать тысяч триста один рубль 34 копейки
+ *     \li Propis("20301.34", false) = Двадцать тысяч триста один рубль
+ *     \li Propis("20301.34", false, false, "штук", "штука", "штуки") = Двадцать тысяч триста одна штука
+ *     \li Propis("2", false, true, "слонёнков", "слонёнок", "слонёнка") = Два слонёнка
+ *     \li Propis("5", false, false, "мартышек", "мартышка", "мартышки") = Пять мартышек
+ *     \li Propis("38.5", false, true, "попугаев", "попугай", "попугая") = Тридцать восемь попугаев
+ *
+ *     пример неправильного использования:
+ *     \li Propis("38.5", true, true, "попугаев", "попугай", "попугая") = Тридцать восемь попугаев 50 копеек
+ *
+ *\~
+ * \param val - \~english number to convert \~russian число для конвертирования\~
+ * \param need_kopeyki - \~english wtite to output decimal part \~russian записывать в результат копейки (по умолчанию - да)\~
+ * \param male - \~english  male \~russian конвертируемая единица - мужского рода (по умолчанию - да)\~
+ * \param end1 - \~english end1 \~russian окончание для нуля конвертируемых единиц (по умолчанию - `рублей')\~
+ * \param end2 - \~english end2 \~russian окончание для одной конвертируемой единицы (по умолчанию - `рубль')\~
+ * \param end3 - \~english end3 \~russian окончание для двуx конвертируемых единиц (по умолчанию - `рубля')\~
+ * \return - \~english text representetion of number \~russian текстовое представление числа \~
+ * \see Propis()
+ */
+QString
+aForm::Propis( QString val, bool need_kopeyki, bool male, const QString &end1, const QString &end2, const QString &end3)
+{
+       return aService::number2money(QVariant(val).toDouble(),need_kopeyki,male, end1, end2, end3);
+}
+
+
+/**
+ * \ru
+ *             \brief  Конвертирует числовое представление денег в пропись с учетом указанной валюты.
+ *             \param amount - сумма денег для преобразование в пропись.
+ *             \param currency - строка с обозначением валюты. Допустимые значения: "RUR" - рубль, "USD" - доллар, "EUR" - евро.
+ *             \returns значение суммы прописью.
+ * \_ru
+ */
+QString
+aForm::MoneyToText( QString amount , QString currency ) {
+       return aService::number2money( currency, QVariant(amount).toDouble());
+}
+
+
+/*!
+ * \ru
+ *     \brief ScriptAPI. Используя идентификатор редактируемого виджетами формы документа, настраивает объект aDocument на доступ к
+ *     документу с таким же идентификатором.
+ *
+ *     То есть к тому же документу. Используется в Ананас.Скрипте для передачи
+ *     ссылки на документ в другие объекты. Например в регистры. Для примера смотри код на Ананас.Cкрипте,
+ *     отрабатываемый при проведении Приходной накладной в бизнес схеме Inventory.
+ *     \param doc - документ, который необходимо настроить.
+ *     \return void.
+ * \_ru
+ */
+void
+aForm::SelectByCurrent(aObject *doc)
+{
+       if(mainWidget)
+       {
+               int res = doc->select(mainWidget->uid());
+               aLog::print(aLog::Debug, QObject::tr("aForm SelectByCurrent %1 ended with %1").arg(mainWidget->uid()).arg(res));
+       }
+}
+
+/**
+ * \ru
+ *     \brief Устаревшая. Смотри SelectByCurrent()
+ * \_ru
+ * \en
+ *     \brief Deprecated. See SelectByCurrent()
+ * \_en
+ */
+void
+aForm::SetCurrent( aObject *doc) {
+       SelectByCurrent( doc );
+}
+
+/*!
+ *\~english
+ *     Return current data object of form.
+ *\~russian
+ *     \brief ScriptAPI. Возвращает ссылку на бизнес объект, редактируемый данной экранной формой.
+ *
+ *     По свему назначению метод аналогичен SelectByCurrent()
+ *\~
+ * \return - \~english current data object \~russian текущий объект формы \~
+ * \see SelectByCurrent()
+ */
+aObject*
+aForm::Current()
+{
+       if(mainWidget)
+       {
+               return mainWidget->dataObject();
+       }
+       else return 0;
+}
+
+/*!
+ *\~english
+ *     Get value of attribute
+ *\~russian
+ *     \brief Возвращает значение атрибута формы.
+ *\~
+ *\param name - \~english Name of attribute.\~russian Имя атрибута.\~
+aDataField*
+aForm::getAttribute(const QString &name)
+{
+       QString oname, aname;
+       aWidget *w = mainWidget;
+       QVariant v;
+       aDataField *f = 0;
+
+       oname = name.section(".",0,0);
+       aname = name.section(".",1);
+       if ( oname.isEmpty() ) aname = oname;
+       else {
+       }
+       v = w->value( aname );
+//     f  = new aDataField( this, aname );
+       return f;
+}
+ */
+
+
+/*!
+ *\~english
+ *     Sets attribute value
+ *\~russian
+ *     Устанавливает значение атрибута формы.
+ *\~
+ *     *Not implemented*
+ *\param name - \~english Name of attribute.\~russian Имя атрибута.\~
+int
+aForm::setAttribute(const QString &name, aDataField *value)
+{
+       return 1;
+}
+ */
+
+/*!
+ *\~english
+ *     Convert number to currensy format.
+ *\~russian
+ *     \brief ScriptAPI. Конвертирует число  в денежный формат (#0.00 :) ). Используется для вывода на печать.
+ *
+ *     Для конвертирования числа в текстовое представление используйте Propis()
+ *\~
+ * \param number - \~english number to convert \~russian число для конвертирования\~
+ * \return - \~english rounded number \~russian округленное до 2-х цифр после запятой число \~
+ * \see Propis()
+ */
+QString
+aForm::ConvertNumber2MoneyFormat(double number)
+{
+       return aService::convertNumber2MoneyFormat(number);
+}
+
+/*!
+ *\~english
+ *     Convert date to local format.
+ *\~russian
+ *     \brief ScriptAPI. Конвертирует дату в локальный формат. Используется для вывода на печать.
+ *
+ *     Все функции работы с датой оперируют датой в ISO формате. (yyyy-MM-ddThh:mm:ss)
+ *     Данная функция предназначена для конвертации такой даты в читаемый вид.
+ *\~
+ * \param ISODate - \~english date in ISO format \~russian дата в ISO формате (yyyy-MM-ddThh:mm:ss)\~
+ * \return - \~english date in local format \~russian дату в локальном формате \~
+ */
+QString
+aForm::ConvertDateFromIso(const QString &ISODate)
+{
+       return aService::Date2Print(ISODate);
+}
+
+
+/*!
+ *\~english
+ *     Date of end day.
+ *\~russian
+ *     \brief ScriptAPI. Возвращает дату-время на конец дня.
+ *     \param ISODate - строка, содержащая дату в формате ISO (YYYY-MM-DD).
+ *\~
+ * \return - \~english date \~russian дату вида yyyy-mm-ddT23:59:59 \~
+ */
+QString
+aForm::EndOfDay(const QString& ISODate)
+{
+       return QString("%1T%2").arg(ISODate.section('T',0,0)).arg("23:59:59");
+}
+
+/*!
+ *\~english
+ *     Sets form mode.
+ *\~russian
+ *     \brief ScriptAPI. Устанавливает режим формы.
+ *     \param m - Допустим один из трех режимов открытия формы: 0 - новая, 1 - редактирование, 2- просмотр.
+ *\~
+ * \see GetMode()
+ */
+void
+aForm::setMode(int m)
+{
+       this->mode = m;
+}
+
+/*!
+ *\~english
+ *     Get form mode. 0 - new, 1- edit, 2- browse
+ *\~russian
+ *     \brief ScriptAPI. Получение режима открытия формы.
+ *     \return 0 - новая, 1 - редактирование, 2- просмотр.
+ *\~
+ * \return - \~english mode \~russian режим открытия формы \~
+ */
+int
+aForm::GetMode()
+{
+       return this->mode;
+}
diff --git a/src/plugins/aform.h b/src/plugins/aform.h
new file mode 100644 (file)
index 0000000..993ea6f
--- /dev/null
@@ -0,0 +1,207 @@
+/****************************************************************************
+** $Id: aform.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of Ananas forms of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2005 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/*!
+*/
+#ifndef AFORM_H
+#define AFORM_H
+
+#include "ananasglobal.h"
+
+#include <qobject.h>
+#include <q3buttongroup.h>
+#include <qsproject.h>
+#include <qsinterpreter.h>
+//--#include <qsargument.h>
+#include <qmutex.h>
+//Added by qt3to4:
+#include <Q3SqlForm>
+
+#include "engine.h"
+#include "adatabase.h"
+#include "adocument.h"
+#include "acfg.h"
+
+
+class QWidget;
+class Q3SqlForm;
+class aWidget;
+
+
+
+/*!
+ *\~english
+ *     Ananas form.
+ *\~russian
+ *     \brief Определяет программный интерфейс экранных форм Ананаса, предназначенный для использования
+ *     Ананас.Скриптом модуля экранной формы Документа и других бизнес объектов Ананаса.
+ *
+ *     Любая экранная форма, спроектированная в Ананас.Дизайнере имеет методы этого класса.
+ *     Объект данного класса создается при создании формы. Программный код, написанный на Ананас.Скрипте и хранящийся
+ *     в модуле экранной формы (вкладка "Модуль" в Дизайнере) может обращаться к методам этого объекта напрямую,
+ *     без указания имени объекта.
+ *
+ *     Кроме того, класс обеспечивает вызов некоторых функций на Ананас.Скрипте, определенных в модуле экранной формы,
+ *     при наступлении определенных событий, например открытии или закрытии формы, изменения значения виджетов формы и т.п
+ *     Полный список этих событий и функций можно посмотеть на сайте Ананаса в разделе руководства по Ананас.Дизайнеру.
+ *\~
+ */
+class  QT_WIDGET_PLUGIN_EXPORT aForm : public QObject
+{
+       Q_OBJECT
+public:
+       aEngine*        engine;
+       aDatabase*      db;
+       aCfg*           md;
+       aCfgItem        mdObj;
+       QWidget*        parentWidget;
+       bool            closeAfterSelect;
+
+       aForm();
+       aForm( QWidget *parent, aEngine *eng );
+       aForm( QWidget *parent,  aEngine *eng,  Q_ULONG form_mid = 0, aWidget* caller = NULL);
+       aForm( QWidget *parent,  aEngine *eng, QString oftype, QObject *aobj = NULL);
+       ~aForm();
+       QWidget *form;
+       void            init();
+       QWidget*        aParent( QWidget *widget );
+       int             New();
+       int             Select( qulonglong id );
+       int             SelectGroup( qulonglong id );
+       qulonglong      selectedCatId(){ return db_uid;} // Return uid, selected in Catalogue
+       qulonglong      selectedId(){ return id;} // Return uid, selected in  main wDBTable
+signals:
+       void selected( qulonglong uid );
+       void closeForm( qulonglong );
+       void changedData();
+       void update( ANANAS_UID );
+public:
+
+       QVariant        tabValue(const QString &tname, int row, int col, bool dbval=false);
+       void            setMode(int m);
+
+public slots:
+//     QObject *       object(const QString &name);
+       void            done( int rc );
+       void            Show();
+       void            Close();
+       void            show(); //depricated
+       void            close(); //depricated
+       QVariant        Value(const QString &name);
+       QVariant        DBValue(const QString &name);
+       int             SetValue(const QString &name, QVariant value);
+       int             SetObjValue(const QString &name, aObject *value);
+       void            SetColumnReadOnly(const QString &tname, int numCol, bool ro);
+       int             ColIndex(const QString &tname, const QString &colname);
+       int             TabCount(const QString &tname);
+//     QVariant        TabValue(const QString &tname, const QString &colname, int row =-1 );
+       QVariant        TabValue(const QString &tname, int row, int col);
+       QVariant        TabDBValue(const QString &tname, int row, int col);
+       void            TabNewLine(const QString &tname);
+       void            TabUpdate(const QString &tname);
+//     QVariant        TabDBValue(const QString &tname, const QString &colname , int row =-1);
+//     void            SetTabValue(const QString &tname, const QString &name, QVariant value);
+       void            SetTabValue(const QString &tname, const QString &colname, int row, QVariant value);
+       void            setfocus(QString fname);
+       void            SetFocus();
+       ERR_Code        UpdateDB(); // Обновить в БД
+       ERR_Code        update(); // Depricated
+       int             turn_on(); // Depricated
+       int             turn_off(); // Depricated
+       int             SignIn(); // Провести документ
+       int             SignOut(); // Отменить проведение документа
+//     void            formClose();
+       int             Update();
+       void            SetReadOnly( bool status );
+       bool            IsReadOnly();
+       int             GetMode();
+
+       QString         Propis(         QString val ,
+                                       bool need_kopeyki=true,
+                                       bool male=true,
+                                       const QString &end1="рублей",
+                                       const QString &end2="рубль",
+                                       const QString &end3="рубля");
+       QString         MoneyToText( QString amount , QString currency );
+       QString         ConvertNumber2MoneyFormat(double number);
+       QString         ConvertDateFromIso(const QString &ISODate);
+       QString         EndOfDay(const QString& ISODate);
+
+       void            SelectByCurrent(aObject *doc);
+       void            SetCurrent(aObject *doc);
+       aObject*        Current();
+
+       QWidget*        Widget( QString name );
+
+// after compleete will remove value() setValue()
+//     aDataField*     getAttribute(const QString &name);
+//     int             setAttribute(const QString &name, aDataField *value);
+
+/**
+ * Возвращает идентификатор объекта метаданных для которого создана форма.
+ * \input fn (in) - имя файла формы.
+ * \return один из предопределенных в cfg.h типов.
+ */
+//     char*           formMetaObjectId(QString fn);
+private slots:
+       void on_dbtablerow( QSqlRecord *r );
+        void on_tabupdate( QSqlRecord *r );
+       void on_button();//int id);
+       void on_actionbutton();
+       void on_form_close();
+       void on_return();
+       void on_lostfocus();
+       void on_valueChanged(const QString &s);
+       void on_valueChanged( const QString & name, const QVariant & value );
+       void on_tabvalueChanged(int row, int col);
+       void on_tabselected( qulonglong uid );
+       void on_event( const QString &source, const QString &data );
+       void on_tablerow( qulonglong uid );
+//     QObject *findWidget(QString name);
+//     QString widgetName(QObject *w);
+//     void openForm( int oid, int fid = 0 , int defaultfor = 1, int mode = 0, bool readonly = false );
+       void connectSlots();
+protected:
+       virtual void initWidget( QWidget *widget, aDatabase *adb );
+       virtual void initContainer( aWidget *widget, aDatabase *adb );
+       aWidget *parentContainer( QWidget *widget );
+private:
+       QObject*        dbobject;
+       int             tobj, objid;
+       int             mode;
+       qulonglong      id;
+       qulonglong      db_uid;
+       bool            RO;
+       aWidget*        mainWidget;
+       aWidget*        callerWidget;
+};
+
+
+#endif // AFORM_H
diff --git a/src/plugins/atoolbar.cpp b/src/plugins/atoolbar.cpp
new file mode 100644 (file)
index 0000000..ce607f1
--- /dev/null
@@ -0,0 +1,91 @@
+/****************************************************************************
+** $Id: atoolbar.cpp,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Code file of the Ananas Tool bar of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/******************************************************************
+ ******************************************************************/
+
+//#include <qimage.h>
+#include "atoolbar.h"
+//Added by qt3to4:
+#include <QPixmap>
+
+aToolBar::aToolBar( aCfg *cfg, aCfgItem &obj, aEngine *e, Q3MainWindow* parent , const char* name )
+: Q3ToolBar( parent, name )
+{
+       md = cfg;
+       en = e;
+       ReadTool( obj );
+}
+
+aToolBar::~aToolBar(){
+}
+
+void
+aToolBar::ReadTool( aCfgItem &obj )
+{
+    aCfgItem aobj, apix;       // action and pixmap XML data
+    QString aKey;      // key sequence
+    long pid;  // action id
+
+    aobj = md->firstChild( obj );      //from first child action
+    while ( !aobj.isNull() ) {         // foreach not null
+       aKey = md->sText ( aobj, md_key );      //key sequence
+       pid = md->id( aobj );   // action id
+       apix = md->findChild(
+               md->find(
+                       md->text( md->findChild( aobj, md_comaction, 0 ) ).toLong() ),
+                           md_active_picture,
+                               0
+               );      // first action pixmap cfg object
+       QPixmap pix( md->binary( apix ) );      // pixmap
+       QAction *a = new QAction(
+               QIcon(pix), // pixmap
+               md->attr( aobj, mda_name), // name
+               aKey, // key sequence
+               this, // owner
+               md->attr( aobj, mda_name) // name
+       );      // create new action
+       actions.insert( pid, a );       // add action to dict
+       a->addTo( this );       // put action into toolbar
+       connect( a, SIGNAL(activated()), this, SLOT(on_Item()) );       // connect to slot
+       aobj = md->nextSibling( aobj ); // get next action
+    }
+}
+
+void
+aToolBar::on_Item()
+{
+    Q3IntDictIterator<QAction> it( actions );  //dict iterator
+    for ( ; it.current(); ++it ) {     // foreach action
+       if ( it.current() == sender() ) {       // sender object
+           en->on_MenuBar( it.currentKey() );  // call slot
+           break;      // break cycle
+       }
+    }
+}
diff --git a/src/plugins/atoolbar.h b/src/plugins/atoolbar.h
new file mode 100644 (file)
index 0000000..5c7c129
--- /dev/null
@@ -0,0 +1,61 @@
+/****************************************************************************
+** $Id: atoolbar.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of the Ananas Tool bar of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/****************************************************************************
+****************************************************************************/
+
+#ifndef ATOOLBAR_H
+#define ATOOLBAR_H
+
+#include <q3toolbar.h>
+#include <qaction.h>
+
+#include "acfg.h"
+#include "ananas.h"
+
+class  QT_WIDGET_PLUGIN_EXPORT aToolBar : public Q3ToolBar
+{
+    Q_OBJECT
+private:
+    aCfg       *md;
+    aEngine *en;
+    Q3IntDict<QAction> actions;
+
+public:
+       aToolBar( aCfg *cfg, aCfgItem &obj, aEngine *e, Q3MainWindow* parent = 0, const char* name = 0 );
+       ~aToolBar();
+
+       void ReadTool( aCfgItem &obj );
+
+public slots:
+       void on_Item();
+};
+
+
+#endif // ATOOLBAR_H
diff --git a/src/plugins/awidgets_plugin.cpp b/src/plugins/awidgets_plugin.cpp
new file mode 100644 (file)
index 0000000..ca0a03a
--- /dev/null
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "awidgets_plugin.h"
+
+#include <QtPlugin>
+
+#include "acombobox_plugin.h"
+#include "wfield_plugin.h"
+#include "wdbfield_plugin.h"
+#include "wtable_plugin.h"
+#include "wdbtable_plugin.h"
+#include "wcatalogue_plugin.h"
+#include "wdocument_plugin.h"
+#include "wjournal_plugin.h"
+#include "wgrouptree_plugin.h"
+#include "wactionbutton_plugin.h"
+#include "wreport_plugin.h"
+
+
+aWidgetsCollection::aWidgetsCollection(QObject *parent)
+    : QObject(parent)
+{
+    widgets.append(new wActionButtonPlugin(this));
+    widgets.append(new wFieldPlugin(this));
+    widgets.append(new wDBFieldPlugin(this));
+    widgets.append(new wTablePlugin(this));
+    widgets.append(new wDBTablePlugin(this));
+    widgets.append(new wGroupTreePlugin(this));
+    widgets.append(new AComboBoxPlugin(this));
+    widgets.append(new wCataloguePlugin(this));
+    widgets.append(new wDocumentPlugin(this));
+    widgets.append(new wJournalPlugin(this));
+    widgets.append(new wReportPlugin(this));
+}
+
+QList<QDesignerCustomWidgetInterface*> aWidgetsCollection::customWidgets() const
+{
+    return widgets;
+}
+
+Q_EXPORT_PLUGIN2(aWidgetsCollection, aWidgetsCollection)
diff --git a/src/plugins/awidgets_plugin.h b/src/plugins/awidgets_plugin.h
new file mode 100644 (file)
index 0000000..db17ddb
--- /dev/null
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef AWIDGETS_PLUGIN_H
+#define AWIDGETS_PLUGIN_H
+
+#include <QDesignerCustomWidgetCollectionInterface>
+
+#include "qwidgetplugin.h"
+
+
+typedef QList<QDesignerCustomWidgetInterface*> aListInterfaces;
+
+class QT_WIDGET_PLUGIN_EXPORT aWidgetsCollection: public QObject, public QDesignerCustomWidgetCollectionInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
+
+public:
+    aWidgetsCollection(QObject *parent=0);
+
+    virtual aListInterfaces customWidgets() const;
+
+private:
+    aListInterfaces widgets;
+};
+
+#endif // AWIDGETS_PLUGIN_H
diff --git a/src/plugins/catalogue/catalogform.cpp b/src/plugins/catalogue/catalogform.cpp
new file mode 100644 (file)
index 0000000..cef8d59
--- /dev/null
@@ -0,0 +1,986 @@
+#include "catalogform.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include "alog.h"
+// TODO Remove!!!
+#include "../ananas/mainform.h"
+#include "aform.h"
+#include "aservice.h"
+
+#include <q3mimefactory.h>
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <Q3ValueList>
+#include <QPixmap>
+#include <QLabel>
+#include <QKeyEvent>
+/*
+ *  Constructs a CatalogForm as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+CatalogForm::CatalogForm(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+CatalogForm::~CatalogForm()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void CatalogForm::languageChange()
+{
+    retranslateUi(this);
+}
+
+/*!
+ * \return id selected element
+ */
+qulonglong
+CatalogForm::getId()
+{
+    return id;
+}
+
+/*!
+ * Function set initial data. Adds one element in each group.
+ * \param catalog (in) - object catalog for edit or select.
+ * \param mg (in) - map of catalog groups. Key - group id.
+ * \param Fname (in) - list of field names of elements.
+ * \param FnameGroup (in) - list of field names of groups.
+ */
+void
+CatalogForm::setData( aCatalogue* catalog,
+   QMap<qulonglong, Q3ListViewItem*> mg,
+   //QMap<Q_ULLONG, bool> map_d,
+   const QStringList & Fname,
+   const QStringList & FnameGroup,
+   qulonglong idElForm,
+   qulonglong idGrForm,
+   const bool toSelect)
+{
+       ListView->setDestination(toSelect);
+       aLog::print(aLog::Debug, tr("CatalogForm:setData begin"));
+       Q3ListViewItem* item;
+       uint i;
+       QPixmap pixmap(getElementPixmap());
+       QPixmap pixmap_mark_deleted(getMarkDeletedPixmap());
+       idElementForm = idElForm;
+       idGroupForm = idGrForm;
+       cat = catalog;
+       fieldName= Fname[0];
+       fieldList= Fname;
+       fieldListGroup = FnameGroup;
+       map_gr = mg;
+       ListView->setAllColumnsShowFocus ( true );
+       QMap<qulonglong, Q3ListViewItem *>::Iterator it = map_gr.begin();
+       cat->Select();
+       // added one element in each group
+       while(it!=map_gr.end())
+       {
+               cat->selectByGroup(it.key());// select elements in each group
+               if(cat->First()) // if group have elements
+               {
+                       item = new Q3ListViewItem(map_gr[it.key()]);
+                       aLog::print(aLog::Debug, tr("CatalogForm add first element in group"));
+                       //printf("add first element in group\n");
+                       if(cat->isElementMarkDeleted())
+                               item->setPixmap(0,pixmap_mark_deleted);
+                       else
+                               item->setPixmap(0,pixmap);
+                       for(i=0; i<fieldList.count(); i++)
+                       {
+                               item->setText(i,cat->sysValue(fieldList[i]).toString());
+                       }
+                        map_el.insert(cat->sysValue("id").toULongLong(),item);
+               }
+        ++it;
+       }
+
+       cat->selectByGroup(0);// select elements without group
+       if(cat->First())
+       {
+
+               aLog::print(aLog::Debug, tr("CatalogForm add elements into root"));
+               do
+               {
+                       item = new Q3ListViewItem(ListView);
+                       if(cat->isElementMarkDeleted())
+                               item->setPixmap(0,pixmap_mark_deleted);
+                       else
+                               item->setPixmap(0,pixmap);
+                       for(i=0; i<fieldList.count(); i++)
+                       {
+                               item->setText(i,cat->sysValue(fieldList[i]).toString());
+                       }
+                       map_el.insert(cat->sysValue("id").toULongLong(),item);
+
+               }while(cat->Next());
+       }
+       cat->Select();
+       setGeometry(aService::loadSizeFromConfig(QString("%1_embedded editor").arg(cat->md->attr(cat->obj, mda_name))));
+       ListView->setSelected(ListView->firstChild(),true);
+       aLog::print(aLog::Debug, tr("CatalogForm init"));
+}
+
+/*!
+ * Function set id, returned getId().
+ * \param idx (in) - id.
+ */
+void
+CatalogForm::setId(qulonglong idx )
+{
+       id = idx;
+}
+
+/*! Function search string s in table of elements and show list founding lines.
+ * Searching for length s >= constant LENGTH_NO_FIND.
+ * Displaing <= VISIBLE_ROWS lines.
+ * \param s (in) - string for search.
+ */
+void
+CatalogForm::find(const QString& s )
+{
+       int count=0;//,rows=0;
+       bool ok;
+       int tmp = aService::readConfigVariable("LengthAboveFind",&ok).toInt();
+       if(!ok) tmp = 3;
+       const int LENGTH_NO_FIND = tmp;
+
+       tmp = aService::readConfigVariable("VisibleRows",&ok).toInt();
+       if(!ok) tmp = 50;
+
+       const int VISIBLE_ROWS = tmp;
+
+       setId(0);
+       ListHint->clear();
+       if(s.length()>=LENGTH_NO_FIND) // show list hint
+       {
+               if(!ListHint->isVisible())
+               {
+                       ListHint->show(LineEdit, StatusFrame);
+                       StatusFrame->show();
+               }
+
+               cat->select(fieldName + " like '%"+s+"%'");// AND df<>'1'");
+               if(cat->First())
+               {
+                       do
+                       {
+                               if(count++<VISIBLE_ROWS)
+                               {
+                                       ListHint->insertItem(cat->sysValue(fieldName).toString(), cat->sysValue("id").toInt());
+                               }
+                       } while(cat->Next());
+               }
+               if(!ListHint->count()) // don't show empty list
+               {
+                       ListHint->hide();
+                       StatusFrame->hide();
+
+               }
+               else
+               {
+                       StatusFrame->repaint();
+                       StatusFrame->drawText(  5, StatusFrame->size().height()-3, QString(tr("displaying %1 from %2")).arg(ListHint->count()).arg(count) );
+               }
+
+       }
+       else // length < LENGTH_NO_FIND, don't show list hint
+       {
+               if(ListHint->isVisible())
+               {
+                       ListHint->hide();
+                       StatusFrame->hide();
+               }
+       }
+
+}
+
+/*!
+ * Handler signal press arrow for line edit
+ */
+void
+CatalogForm::pressArrow()
+{
+
+       if(ListHint->isVisible())
+       {
+               ListHint->setFocus();
+               ListHint->setSelected(ListHint->currentItem(),true);
+
+       }
+       else
+       {
+               find(LineEdit->text());
+               if(ListHint->isVisible())
+               {
+                       ListHint->setFocus();
+                       ListHint->setSelected(ListHint->currentItem(),true);
+               }
+
+       }
+}
+
+
+void
+CatalogForm::isPressArrow()
+{
+
+}
+
+/*!
+ * Function create visual objects and connect slots.
+ */
+void
+CatalogForm::init()
+{
+
+       ListView = new aListView(centralWidget(), "listView");
+       ListView->setGeometry(30,30,400,300);
+       ListView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+       LineEdit = new aLineEdit(centralWidget(), "lineEdit");
+       ListHint = new aListBox(centralWidget(), "listBox");
+       StatusFrame = new Q3Frame(centralWidget(), "statusFrame");
+
+       ListView->setRootIsDecorated( true );
+
+       StatusFrame->setGeometry( QRect( 0, 0, 50,5 ) );
+       StatusFrame->setFrameShape( Q3Frame::StyledPanel );
+       StatusFrame->setFrameShadow( Q3Frame::Raised );
+       StatusFrame->hide();
+
+       GridLayout = new Q3GridLayout(centralWidget(), 1, 1, 11, 6, "GridLayout");
+       GridLayout->addMultiCellWidget( ListView, 2,3, 0 , 0 );
+       GridLayout->addWidget( LineEdit, 1, 0 );
+       GridLayout->addWidget( bCancel, 3, 1 );
+       QLabel *lb = new QLabel(tr("Search"),centralWidget());
+       lb->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, lb->sizePolicy().hasHeightForWidth() ) );
+       GridLayout->addWidget( lb ,0,0);
+       QSpacerItem* spacer = new QSpacerItem( 20, 390, QSizePolicy::Minimum, QSizePolicy::Expanding );
+       GridLayout->addMultiCell( spacer, 0,2,1, 1);
+
+       QPixmap  pix= rcIcon("cat.png");
+       if(pix.isNull())
+       {
+               aLog::print(aLog::Info, tr("Catalog Form image cat.png not loaded"));
+       }
+       else
+       {
+               setIcon( pix );
+       }
+       //setFocusPolicy();
+  //  connect(this,    SIGNAL  (destoyed()),
+//         this,       SLOT    (close());
+
+    connect(ListView,  SIGNAL  (newItemRequest(Q3ListViewItem*)),
+           this,       SLOT    (new_item(Q3ListViewItem*)));
+
+    connect(ListView,  SIGNAL  (newGroupRequest(Q3ListViewItem*)),
+           this,       SLOT    (new_group(Q3ListViewItem*)));
+
+    connect(ListView,  SIGNAL  (delItemRequest(Q3ListViewItem*)),
+           this,       SLOT    (del_item(Q3ListViewItem*)));
+
+    connect(ListView,  SIGNAL  (markDeletedRequest(Q3ListViewItem*)),
+           this,       SLOT    (mark_deleted(Q3ListViewItem*)));
+
+    connect(ListView,  SIGNAL  (undoMarkDeletedRequest(Q3ListViewItem*)),
+           this,       SLOT    (undo_mark_deleted(Q3ListViewItem*)));
+
+    connect(ListView,  SIGNAL  (editRequest(Q3ListViewItem*, int)),
+           this,       SLOT    (edit(Q3ListViewItem*, int)));
+
+    connect(ListView,  SIGNAL  (selectRequest(Q3ListViewItem*)),
+           this,       SLOT    (select(Q3ListViewItem*)));
+
+    connect(LineEdit,  SIGNAL  (delayTextChanged(const QString&)),
+           this,       SLOT    (find(const QString&)));
+
+    connect(LineEdit,  SIGNAL  (keyArrowPressed()),
+           this,       SLOT    (pressArrow()));
+
+    connect(LineEdit,  SIGNAL  (keyEnterPressed()),
+           this,       SLOT    (go()));
+
+    connect(ListView,  SIGNAL  (expanded ( Q3ListViewItem *)),
+           this,       SLOT    (onLoadElements( Q3ListViewItem *)));
+
+    connect(ListHint,  SIGNAL  (lostFocus()),
+           LineEdit,   SLOT    (setFocus()));
+
+    connect(ListHint,  SIGNAL  (lostFocus()),
+          StatusFrame, SLOT    (hide()));
+
+    connect(ListHint,  SIGNAL  (lostFocus()),
+     ListHint,  SLOT (hide()));
+
+    connect(ListHint,  SIGNAL (keyArrowLRPressed()),
+     LineEdit,  SLOT (setFocus()));
+
+    connect(ListHint,  SIGNAL (keyArrowLRPressed(const QString&)),
+     this,  SLOT (setText(const QString&)));
+
+    connect(ListHint,  SIGNAL (keyEnterPressed()),
+     this,  SLOT (go()));
+
+    connect(ListHint,  SIGNAL (sendMessage(const QString &)),
+     this->statusBar(),  SLOT (message( const QString &)));
+
+    connect(ListView,  SIGNAL (sendMessage(const QString &)),
+     this->statusBar(),  SLOT (message( const QString &)));
+
+    connect(LineEdit,  SIGNAL (sendMessage(const QString &)),
+     this->statusBar(),  SLOT (message( const QString &)));
+
+    LineEdit->setFocus();
+}
+
+/*!
+ * Function delete objects, which were created in function init()
+ */
+void
+CatalogForm::destroy()
+{
+       aService::saveSize2Config(this->rect(),QString("%1_embedded editor").arg(cat->md->attr(cat->obj, mda_name)));
+       delete cat;
+       cat = 0;
+}
+
+/*!
+ * Function set text for line edit. Don't emit signals.
+ */
+void
+CatalogForm::setText( const QString & s )
+{
+    LineEdit->blockSignals ( true );
+    LineEdit->setText ( s );
+    setId(ListHint->getId(ListHint->currentItem()));
+    LineEdit->blockSignals ( false );
+}
+
+/*!
+ * Handler bGo::onClick() event.
+ */
+void
+CatalogForm::go()
+{
+       qulonglong ide=getId(), idg;
+       if(!getId())
+       {
+               ide = findFirst(LineEdit->text());
+               setId(ide);
+       }
+       idg = getIdg(ide);
+       loadElements(idg);
+       if(map_el.contains(getId()))
+       {
+               goToItem(map_el[getId()]);
+       }
+
+}
+/*!
+ * Ensures that item is visible, scrolling the list view vertically if necessary and opening (expanding) any parent items if this is required to show the item.
+ */
+void
+CatalogForm::goToItem( Q3ListViewItem *item)
+{
+       ListView->setSelected(item, true);
+       ListView->ensureItemVisible(item);
+       ListView->setFocus();
+}
+
+/*!
+ * Searching string s in table of elements.
+ * \param s (in) - stirng for search.
+ * \return id first founding line.
+ */
+long
+CatalogForm::findFirst( const QString &s )
+{
+       qulonglong res=0;
+       cat->select(fieldName + " like '%"+s+"%'");// AND df<>'1'");
+       //Cat->Select();
+       if(cat->First())
+       {
+               res = cat->sysValue("id").toULongLong();
+
+       }
+       return res;
+}
+
+/*!
+ * Loads elements in group, if then don't loaded.
+ * \param idGroup (in) - id group for load.
+ */
+void
+CatalogForm::loadElements( qulonglong idGroup )
+{
+  Q3ListViewItem * item;
+  Q3ListViewItem * p_item;
+  uint i;
+//  printf("load elements\n");
+//  printf("sel by group id = %lu\n",idGroup);
+  QPixmap pixmap(getElementPixmap());
+  QPixmap pixmap_mark_deleted(getMarkDeletedPixmap());
+  cat->selectByGroup(idGroup);
+//  printf("_sel by group\n");
+  if(cat->First())
+  {
+       do
+       {
+  //count++;
+               if(map_gr.contains(idGroup)
+                  && !map_el.contains(cat->sysValue("id").toULongLong()))
+               {
+                       p_item = map_gr[idGroup];
+                       item = new Q3ListViewItem(p_item);
+                       if(cat->isElementMarkDeleted())
+                               item->setPixmap(0,pixmap_mark_deleted);
+                       else
+                               item->setPixmap(0,pixmap);
+                       for(i=0; i<fieldList.count(); i++)
+                       {
+                       //      printf("i = %d\n",i);
+                               item->setText(i,cat->sysValue(fieldList[i]).toString());
+                       }
+                       map_el.insert(cat->sysValue("id").toULongLong(),item);
+               }
+       }while(cat->Next());
+  }
+//  printf("end load\n");
+}
+
+/*!
+ * Loads elemens in group, if then don't loaded.
+ * \param item (in) - group for load.
+ */
+void
+CatalogForm::onLoadElements( Q3ListViewItem *item )
+{
+       Q3ValueList<Q3ListViewItem*> lst = map_gr.values();
+       int ind = lst.findIndex(item);
+       qulonglong key;
+       if(ind!=-1)
+       {
+               Q3ValueList<qulonglong> listKey = map_gr.keys();
+               key = listKey[ind];
+               loadElements(key);
+       }
+}
+
+/*!
+ * Gets id parent group for element.
+ * \param ide (in) - id of element.
+ * \return id of group or 0 if no group.
+ */
+qulonglong
+CatalogForm::getIdg( qulonglong ide )
+{
+    return cat->idGroupByElement(ide);
+}
+
+
+/*!
+ * Adds new element.
+ * \param parentItem (in) - parent group. If parent group == 0, element not added.
+ */
+void
+CatalogForm::new_item( Q3ListViewItem * parentItem )
+{
+       if(!parentItem)
+       {
+               //cat->groupSelect(0);
+               cat->newElement(0);
+               //printf("id = %llu\n",id);
+               Q3ListViewItem* item = new Q3ListViewItem(ListView);
+               QPixmap pixmap(getElementPixmap());
+               item->setPixmap(0,pixmap);
+               map_el.insert(cat->sysValue("id").toULongLong(),item);
+               edit(item,true);
+               ListView->ensureItemVisible(item);
+       //      cfg_message(0,tr("Can't added element"));
+               return;
+       }
+       qulonglong id = getGroupId(parentItem);
+       QPixmap pixmap(getElementPixmap());
+       if(id) // parent item is group
+       {
+               cat->groupSelect(id);
+               if(!cat->isGroupMarkDeleted())
+               {
+                       cat->newElement(id);
+                       Q3ListViewItem* item = new Q3ListViewItem(map_gr[id]);
+                       item->setPixmap(0,pixmap);
+                       map_el.insert(cat->sysValue("id").toULongLong(),item);
+                       edit(item,true);
+                       ListView->ensureItemVisible(item);
+                       //ListView->setFocus();
+               }
+               else cfg_message(0,tr("Can't added new element to mark deleted group"));
+       }
+       else
+       {
+               new_item(parentItem->parent());
+       }//cfg_message(0,tr("Can't added element to element"));
+}
+
+/*!
+ * Gets group id.
+ * \param item (in) - group item.
+ */
+long
+CatalogForm::getGroupId( Q3ListViewItem * item )
+{
+       Q3ValueList<Q3ListViewItem*> lst = map_gr.values();
+       int ind = lst.findIndex(item);
+       qulonglong key=0;
+       if(ind!=-1)
+       {
+               Q3ValueList<qulonglong> listKey = map_gr.keys();
+               key = listKey[ind];
+       }
+return key;
+}
+
+/*!
+ * Adds new group.
+ * \param parentItem (in) - parent group. If parent group == 0, group adds in root.
+ */
+void
+CatalogForm::new_group( Q3ListViewItem * parentItem )
+{
+       qulonglong id = getGroupId(parentItem);
+       Q3ListViewItem * item;
+       QPixmap pixmap(getGroupPixmap());
+    //cat->groupSelect( id );
+       if(!id)
+       {
+               id = getElementId(parentItem);
+               if(id)
+               {
+                       cfg_message(0,tr("Can't added group to element"));
+                       return;
+               }
+               else
+               {
+//             printf(">>>>id=0\n");
+                       cat->newGroup(id);
+                       item = new Q3ListViewItem(ListView);
+                       ListView->insertItem(item);
+               }
+       }
+       else
+       {
+               //cat->groupSelect(id);
+               if(cat->isGroupMarkDeleted())
+               {
+                       cfg_message(0,tr("Can't added group to mark deleted group"));
+                       return;
+               }
+               cat->newGroup(id);
+               item = new Q3ListViewItem(map_gr[id]);
+       }
+       //item->setText(0,cat->GroupSysValue(fieldListGroup[0]).toString());
+       item->setPixmap(0,pixmap);
+       map_gr.insert(cat->GroupSysValue("id").toULongLong(),item);
+       edit(item,true);
+       ListView->ensureItemVisible(item);
+       ListView->setCurrentItem(item);
+       ListView->setSelected(item,true);
+       //ListView->setFocus();
+
+}
+
+/*!
+ * Gets pixmap for group.
+ * \return pixmap.
+ */
+QPixmap
+CatalogForm::getGroupPixmap()
+{
+ QPixmap  pixmap = rcIcon("group2.png");
+// pixmap.detach();
+       if(pixmap.isNull())
+       {
+               aLog::print(aLog::Info, tr("Catalog Form group pixmap not load"));
+       }
+return pixmap;
+}
+
+
+/*!
+ * Gets pixmap for element.
+ * \return pixmap.
+ */
+QPixmap
+CatalogForm::getElementPixmap()
+{
+       QPixmap  pixmap= rcIcon("field2.png");
+       if(pixmap.isNull())
+       {
+               aLog::print(aLog::Info, tr("Catalog Form element pixmap not load"));
+       }
+return pixmap;
+}
+
+/*!
+ * Gets pixmap for mark deleted element or group.
+ * \return pixmap.
+ */
+QPixmap
+CatalogForm::getMarkDeletedPixmap()
+{
+       QPixmap  pixmap = rcIcon("editdelete2.png");
+// pixmap.
+       if(pixmap.isNull())
+       {
+               aLog::print(aLog::Info, tr("Catalog Form mark deleted group pixmap not load"));
+       }
+return  pixmap;
+}
+/*!
+ * Delets current element or group (with subgroups).
+ * \param item (in) - deleted element or group item.
+ */
+void CatalogForm::del_item( Q3ListViewItem * item )
+{
+   // cat->groupSelect(getGroupId(item));
+       qulonglong id = getElementId(item);
+       if(id)
+       {
+               cat->select(id);
+               if(cat->First())
+               {
+                       cat->delElement();
+                       map_el.remove(id);
+                       delete item;
+                       item = 0;
+               }
+       }
+       else
+       {
+               id = getGroupId(item);
+               if(id)
+               {
+                       Q3ValueList<qulonglong> listDeletedId;
+                       cat->delGroup(id, listDeletedId);
+                       Q3ValueList<qulonglong>::iterator it = listDeletedId.begin();
+                       while(it!= listDeletedId.end())
+                       {
+                               if(map_el.contains(*it)) map_el.remove(*it);
+                               else  if(map_gr.contains(*it)) map_gr.remove(*it);
+                               ++it;
+                       }
+                       delete item; // destructor delete all subitems
+                       item = 0;
+               }
+       }
+}
+
+/*!
+ * Marks deleted current element or group (with subgroups).
+ * While for mark deleted items sets ahother pixmap only.
+ * \param item (in) - marked deleted element or group item.
+ */
+void CatalogForm::mark_deleted( Q3ListViewItem * item )
+{
+   qulonglong id = getElementId(item);
+   if(id)
+   {
+       cat->select(id);
+//     cat->setSelected(true);
+       if(cat->First())
+       {
+               cat->setMarkDeletedElement(id,true);
+               item->setPixmap(0,getMarkDeletedPixmap());
+       }
+   }
+   else
+   {
+       id = getGroupId(item);
+       if(id)
+       {
+               loadElements(id); // populate items in group
+               Q3ValueList<qulonglong> listDeletedId;
+               cat->getMarkDeletedList(id,listDeletedId);
+               Q3ValueList<qulonglong>::iterator it = listDeletedId.begin();
+               while(it != listDeletedId.end()) //first delete elements in this group
+               {
+                       if(map_el.contains(*it))
+                       {
+                               map_el[*it]->setPixmap(0, getMarkDeletedPixmap());
+                               cat->setMarkDeletedElement(*it,true);
+                               it = listDeletedId.remove(it);
+                       }
+                       else
+                       {
+                               ++it;
+                       }
+               }
+               it = listDeletedId.begin();
+               while(it != listDeletedId.end()) //second delete groups
+               {
+                       if(map_gr.contains(*it))
+                       {
+                               map_gr[*it]->setPixmap(0, getMarkDeletedPixmap());
+                               cat->setMarkDeletedGroup(*it,true);
+                               it = listDeletedId.remove(it);
+                               //map_el[*it]->invalidateHeight();// setHeight(10);
+                       }
+                       else
+                       {
+                               ++it;
+                       }
+               }
+       }
+   }
+}
+
+/*!
+ * Undo marks deleted current element or group (with subgroups).
+ * \param item (in) - marked deleted element or group item.
+ */
+void CatalogForm::undo_mark_deleted( Q3ListViewItem * item )
+{
+       qulonglong id = getElementId(item);
+       if(id)
+       {
+               cat->select(id);
+               if(cat->First())
+               {
+                       cat->setMarkDeletedElement(id,false);
+                       item->setPixmap(0,getElementPixmap());
+               }
+       }
+       else
+       {
+               id = getGroupId(item);
+               if(id)
+               {
+                 // cat->select(QString("id=%1").arg(id),md_group);
+                  //if(cat->FirstInGroupTable())
+                       Q3ValueList<qulonglong> listDeletedId;
+                  //   cat->setMarkDeletedGroup(id, listDeletedId,false);
+                       cat->getMarkDeletedList(id, listDeletedId);
+                       Q3ValueList<qulonglong>::iterator it = listDeletedId.begin();
+                       while(it != listDeletedId.end()) //first delete elements in this group
+                       {
+                               if(map_el.contains(*it))
+                               {
+                                       map_el[*it]->setPixmap(0, getElementPixmap());
+                                       cat->setMarkDeletedElement(*it,false);
+                                       it = listDeletedId.remove(it);
+                               }
+                               else
+                               {
+                                       ++it;
+                               }
+                       }
+                       it = listDeletedId.begin();
+                       while(it != listDeletedId.end()) //second delete groups
+                       {
+                               if(map_gr.contains(*it))
+                               {
+                                       map_gr[*it]->setPixmap(0, getGroupPixmap());
+                                       cat->setMarkDeletedGroup(*it,false);
+                                       it = listDeletedId.remove(it);
+                                       //map_el[*it]->invalidateHeight();// setHeight(10);
+                               }
+                               else
+                               {
+                                       ++it;
+                               }
+                       }
+               }
+       }
+}
+
+void CatalogForm::edit( Q3ListViewItem * item, int)
+{
+       edit( item, false);
+}
+
+void CatalogForm::edit( Q3ListViewItem * item, bool afterNew)
+{
+//     QWidget *wd = topLevelWidget();
+       aLog::print(aLog::Debug, tr("Catalog Form edit element start"));
+   MainForm * mw = (MainForm*) topLevelWidget();
+   if(mw)
+   {
+       qulonglong id = getElementId(item);
+       if(id)
+       {
+               aLog::print(aLog::Debug, tr("Catalog Form edit element with id=%1").arg(id));
+               cat->select(id);
+               if(idElementForm)
+               {
+                       if(!cat->isElementMarkDeleted())
+                       {
+                               aForm *editForm = new aForm(mw->ws, &mw->engine, (long int) idElementForm);
+                               if(editForm)
+                               {
+                                       if(afterNew) editForm->setMode(0);
+                                       else editForm->setMode(1);
+                                       editForm->Select(id);
+                                       connect(editForm, SIGNAL(closeForm(qulonglong)), this, SLOT(Refresh(qulonglong)));
+                                       editForm->show();
+                               }
+                               else
+                               {
+                                       aLog::print(aLog::Error, tr("Catalog Form edit element form is null"));
+                               }
+                       }
+                       else cfg_message(0, tr("Can't edit mark deleted element"));
+               }
+               else cfg_message(1,tr("Catalog haven't edit element form"));
+       }
+       else
+       {
+               id = getGroupId(item);
+               aLog::print(aLog::Debug, tr("Catalog Form edit group with id = %1").arg(id));
+               if(id)
+               {
+
+                       cat->groupSelect(id);
+                       if(idGroupForm)
+                       {
+                               if(!cat->isGroupMarkDeleted())
+                               {
+                                       aForm *editForm = new aForm(mw->ws, &mw->engine, (long int) idGroupForm);
+                                       if(editForm)
+                                       {
+                                               if(afterNew) editForm->setMode(0);
+                                               else editForm->setMode(1);
+
+                                               editForm->SelectGroup(id);
+                                               connect(editForm, SIGNAL(closeForm(qulonglong)), this, SLOT(Refresh(qulonglong)));
+                                               editForm->show();
+                                       }
+                                       else
+                                       {
+                                               aLog::print(aLog::Error, tr("Catalog Form edit group form is null"));
+                                       }
+                               }
+                               else cfg_message(0, tr("Can't edit mark deleted group"));
+                       }
+                       else cfg_message(1,tr("Catalog haven't edit group form"));
+               }
+       }
+  }
+  else
+  {
+       aLog::print(aLog::Error, tr("Catalog Form main widget is not 'MainForm'"));
+  }
+
+}
+
+/*!
+ * Selects current group or element.
+ * \param item (in) - selected element or group item
+ */
+void CatalogForm::select( Q3ListViewItem * item )
+{
+       qulonglong res = getGroupId(item);
+       if(!res)
+       {
+               res = getElementId(item);
+               cat->select(res);
+               if(!cat->isElementMarkDeleted())
+               {
+                       setId(res);
+                       doOk();
+               }
+       }
+       else
+       {
+               cat->groupSelect(res);
+               if(!cat->isGroupMarkDeleted())
+               {
+                       setId(res);
+                       doOk();
+               }
+       }
+       emit(selected(res));
+//    return res;
+}
+
+/*!
+ * Gets element id.
+ * \param item (in) - element item.
+ */
+qulonglong CatalogForm::getElementId( Q3ListViewItem * item )
+{
+       Q3ValueList<Q3ListViewItem*> lst = map_el.values();
+       int ind = lst.findIndex(item);
+       qulonglong key=0;
+       if(ind!=-1)
+       {
+               Q3ValueList<qulonglong> listKey = map_el.keys();
+               key = listKey[ind];
+       }
+return key;
+}
+
+
+void CatalogForm::doOk()
+{
+       close();
+}
+
+
+
+void CatalogForm::keyPressEvent( QKeyEvent * e )
+{
+       if ( e->key()==Qt::Key_Return)
+       {
+       }
+       if ( e->key()==Qt::Key_Escape)
+       {
+               close();
+       }
+       e->ignore();
+}
+
+
+void CatalogForm::Refresh( qulonglong id )
+{
+       Q3ListViewItem * item;
+       if( map_el.contains( id ))
+       {
+               item = map_el[id];
+               cat->select( id );
+               for(uint i=0; i<fieldList.count(); i++)
+               {
+
+                       item->setText(i,cat->sysValue(fieldList[i]).toString());
+                       ListView->setFocus();
+               }
+       }
+       else
+       {
+               if( map_gr.contains( id ) )
+               {
+                       item = map_gr[id];
+                       cat->groupSelect( id );
+                       item->setText(0,cat->GroupSysValue(fieldListGroup[0]).toString());
+                       ListView->setFocus();
+               }
+       }
+}
+
+//#include "catalogform.ui.h"
diff --git a/src/plugins/catalogue/catalogform.h b/src/plugins/catalogue/catalogform.h
new file mode 100644 (file)
index 0000000..891f884
--- /dev/null
@@ -0,0 +1,84 @@
+#ifndef CATALOGFORM_H
+#define CATALOGFORM_H
+
+#include "ui_catalogform.h"
+
+#include <Q3GridLayout>
+#include <Q3VBoxLayout>
+
+
+class CatalogForm : public Q3MainWindow, public Ui::CatalogForm
+{
+    Q_OBJECT
+
+public:
+    CatalogForm(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~CatalogForm();
+
+    aListView* ListView;
+    QString fieldName;
+    aLineEdit *LineEdit;
+    aListBox* ListHint;
+    Q3Frame* StatusFrame;
+    aCatalogue* cat;
+    bool FormToSelect;
+
+    virtual Q_ULLONG getId();
+    virtual void init();
+    virtual void destroy();
+    virtual long findFirst( const QString & s );
+    virtual Q_ULLONG getIdg( Q_ULLONG ide );
+    virtual QPixmap getGroupPixmap();
+    virtual void edit( Q3ListViewItem * item, bool );
+    virtual QPixmap getElementPixmap();
+    virtual QPixmap getMarkDeletedPixmap();
+
+public slots:
+    virtual void setData( aCatalogue * catalog, QMap<Q_ULLONG, Q3ListViewItem *> mg, const QStringList & Fname, const QStringList & FnameGroup, Q_ULLONG idElForm, Q_ULLONG idGrForm, const bool toSelect );
+    virtual void setId( Q_ULLONG idx );
+    virtual void find( const QString & s );
+    virtual void pressArrow();
+    virtual void isPressArrow();
+    virtual void setText( const QString & s );
+    virtual void go();
+    virtual void goToItem( Q3ListViewItem * item );
+    virtual void loadElements( Q_ULLONG idGroup );
+    virtual void onLoadElements( Q3ListViewItem * item );
+    virtual void new_item( Q3ListViewItem * parentItem );
+    virtual void new_group( Q3ListViewItem * parentItem );
+    virtual void del_item( Q3ListViewItem * item );
+    virtual void mark_deleted( Q3ListViewItem * item );
+    virtual void undo_mark_deleted( Q3ListViewItem * item );
+    virtual void edit( Q3ListViewItem * item, int );
+    virtual void select( Q3ListViewItem * item );
+    virtual void Refresh( Q_ULLONG id );
+
+signals:
+    void selected(Q_ULLONG);
+
+protected:
+    Q3GridLayout* GridLayout;
+    Q3VBoxLayout* layout1;
+    Q_ULLONG id,idElementForm,idGroupForm;
+    QStringList fieldList, fieldListGroup;
+
+    virtual long getGroupId( Q3ListViewItem * item );
+    virtual Q_ULLONG getElementId( Q3ListViewItem * item );
+
+protected slots:
+    virtual void languageChange();
+
+    virtual void keyPressEvent( QKeyEvent * e );
+
+
+private:
+    QMap<Q_ULLONG, Q3ListViewItem*> map_gr;
+    QMap<Q_ULLONG, Q3ListViewItem*> map_el;
+    QMap<Q_ULLONG,bool> map_deleted;
+
+private slots:
+    virtual void doOk();
+
+};
+
+#endif // CATALOGFORM_H
diff --git a/src/plugins/catalogue/catalogform.ui b/src/plugins/catalogue/catalogform.ui
new file mode 100644 (file)
index 0000000..f5411d8
--- /dev/null
@@ -0,0 +1,50 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>CatalogForm</class>\r
+  <widget class="Q3MainWindow" name="CatalogForm" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>610</width>\r
+        <height>466</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Catalogue</string>\r
+    </property>\r
+    <widget class="QWidget" >\r
+      <widget class="QPushButton" name="bCancel" >\r
+        <property name="geometry" >\r
+          <rect>\r
+            <x>530</x>\r
+            <y>410</y>\r
+            <width>70</width>\r
+            <height>24</height>\r
+          </rect>\r
+        </property>\r
+        <property name="text" >\r
+          <string>Cancel</string>\r
+        </property>\r
+      </widget>\r
+    </widget>\r
+  </widget>\r
+  <layoutdefault spacing="6" margin="11" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >wfield.h</include>\r
+    <include location="local" >catalogformwidgets.h</include>\r
+    <include location="global" >qmap.h</include>\r
+    <include location="local" >qstatusbar.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>bCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>CatalogForm</receiver>\r
+      <slot>close()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/catalogue/catalogformwidgets.cpp b/src/plugins/catalogue/catalogformwidgets.cpp
new file mode 100644 (file)
index 0000000..2d067d0
--- /dev/null
@@ -0,0 +1,435 @@
+/****************************************************************************
+** $Id: catalogformwidgets.cpp,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Catalogue metadata object implementation file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <q3popupmenu.h>
+#include <qtimer.h>
+#include <qmessagebox.h>
+//Added by qt3to4:
+#include <Q3Frame>
+#include <QKeyEvent>
+#include <QFocusEvent>
+
+#include "catalogformwidgets.h"
+/*!
+ * Constructor
+ */
+aListBox::aListBox(QWidget* parent, const char * name, Qt::WFlags f):Q3ListBox(parent,name,f)
+{
+
+       listPrivate = new Q3ListBox(parent);
+       listPrivate->hide();
+       setFocusPolicy (Qt::StrongFocus);
+       connect(this,   SIGNAL  ( doubleClicked( Q3ListBoxItem * ) ),
+               this,   SLOT    ( doubleClickHandler( Q3ListBoxItem * ) ));
+//     layout1 = new QVBoxLayout();
+//     statusBar = new QLabel(this,"statusBar");
+//     statusBar->
+//     layout1->addWidget(this,0);
+//     layout1->addWidget(statusBar,1);
+
+}
+/*!
+ * Destructor
+ */
+aListBox::~aListBox()
+{
+//     delete statusBar;
+       delete listPrivate;
+}
+/*!
+ * Function move and resize frame and list box.
+ *\param wd (in) - widget for pattern geometry.
+ * \param fr (in, out) - status frame.
+ */
+void
+aListBox::show(QWidget *wd, Q3Frame *fr)//, QLabel *lb)
+{
+       setGeometry(wd->x(),
+                   wd->y()+wd->size().height()+1,
+                   wd->size().width()+wd->x(),
+                   wd->size().height()+wd->y()+100);
+       QWidget::show();
+//     statusBar->setGeometry( size().higth(),
+//                             size()+10
+//     statusBar->setWidth(wd->size().width() );
+//     fr->resize(size());
+//     fr->setPos(pos());
+       fr->setGeometry(x(),
+                       size().height()+y(),
+                       size().width(),
+                       20);
+       emit(sendMessage(tr("Press arrow down for go to drop down list")));
+//     lb->move(fr->x()+2,fr->y()+2);
+}
+/*!
+ * Key press event handler.
+ * Emit signals keyArrowLRPressed if press arrow left or arrow rigth.
+ * \param e (in) - key press event.
+ */
+void
+aListBox::keyPressEvent(QKeyEvent *e)
+{
+       if(e->key()==Qt::Key_Left || e->key()==Qt::Key_Right)
+       {
+               emit(keyArrowLRPressed());
+               emit(keyArrowLRPressed(currentText()));
+               //printf("emit key pressed\n");
+       }
+       if(e->key() == Qt::Key_Return)
+       {
+               //printf("enter !!!\n");// return;
+               emit(keyArrowLRPressed());
+               emit(keyArrowLRPressed(currentText()));
+               emit(keyEnterPressed());
+               //printf("enter !!!\n");// return;
+       }
+       if(e->key() == Qt::Key_Escape)
+       {
+               this->clearFocus();
+
+//             emit(lostFocus());
+//             printf("Esc!\n");
+               e->accept();
+               return;
+
+       }
+       e->accept();
+       Q3ListBox::keyPressEvent(e);
+}
+/*!
+ * Inserts s in list and idx in list of id.
+ * \param s (in) - string for insert.
+ * \param idx (in) - id for insert.
+ * \param index (in) - position for insert.
+ */
+void
+aListBox::insertItem(const QString &s, long idx, int index)
+{
+       listPrivate->insertItem(QString("%1").arg(idx),index);
+       Q3ListBox::insertItem(s,index);
+}
+/*!
+ * Clears list and list of id.
+ */
+void
+aListBox::clear()
+{
+       listPrivate->clear();
+       Q3ListBox::clear();
+}
+/*!
+ * Focus out event handler. Emit signal lost focus.
+ * \param e - focus out event.
+ */
+void
+aListBox::focusOutEvent ( QFocusEvent *e )
+{
+       QWidget::focusOutEvent ( e );
+//     printf("focus is out\n");
+       emit(lostFocus());
+}
+
+void
+aListBox::setFocus()
+{
+       Q3ListBox::setFocus();
+       emit(sendMessage(tr("Use Enter for go to item and arrow for navigation")));
+}
+
+void
+aListBox::doubleClickHandler(Q3ListBoxItem *i)
+{
+//     printf("double click handler!\n");
+       emit(keyArrowLRPressed());
+       emit(keyArrowLRPressed(i->text()));
+       emit(keyEnterPressed());
+
+}
+aLineEdit::aLineEdit ( QWidget* parent, const char* name) : QLineEdit(parent,name)
+{
+       timer = new QTimer(this);
+       setFocusPolicy(Qt::StrongFocus);
+       connect(timer,  SIGNAL  (timeout()),
+               this,   SLOT    (timerDone()));
+       connect(this,   SIGNAL  (textChanged ( const QString & )),
+               this,   SLOT    (timerRestart(const QString &)));
+       connect(this,   SIGNAL  (lostFocus()),
+                       SLOT    (stopTimer()));
+}
+
+aLineEdit::~aLineEdit()
+{
+       if(timer)
+       {
+               delete timer;
+               timer=0;
+       }
+}
+
+/*! Key press event handler. Emit signal keyArrowPressed().
+ * \param e (in) - key press event.
+ */
+void
+aLineEdit::keyPressEvent(QKeyEvent *e)
+{
+//     timer->start(500,TRUE);
+       if(e->key()==Qt::Key_Return)//Key_Enter)
+       {
+               e->accept();
+               emit(keyEnterPressed());
+               //e->ignore();
+       }
+       if(e->key()==Qt::Key_Down)
+       {
+               emit(keyArrowPressed());
+       }
+       e->ignore();
+       QLineEdit::keyPressEvent(e);
+}
+void
+aLineEdit::timerDone()
+{
+       emit(delayTextChanged(text()));
+
+}
+
+void
+aLineEdit::timerRestart(const QString &)
+{
+       timer->start(500, false);
+}
+
+void
+aLineEdit::stopTimer()
+{
+       timer->stop();
+}
+
+void
+aLineEdit::setFocus()
+{
+       QLineEdit::setFocus();
+       emit(sendMessage(tr("Enter string for search")));
+}
+/*!
+ <* Constructor create list view and popup menu.
+ */
+aListView::aListView(QWidget* parent,
+                    const char* name,
+                    Qt::WFlags f) : Q3ListView(parent,name,f)
+{
+       menu = 0;
+       toSelect = true;
+
+       connect(this, SIGNAL( doubleClicked( Q3ListViewItem *, const QPoint&, int)),
+               this, SLOT( doubleClickHandler( Q3ListViewItem *, const QPoint&, int)));
+
+       connect(this, SIGNAL( contextMenuRequested (Q3ListViewItem*, const QPoint&, int)),
+               this, SLOT( showMenu( Q3ListViewItem*, const QPoint&, int)));
+
+}
+
+aListView::~aListView()
+{
+       delete menu;
+       menu = 0;
+}
+/*!
+ * Shows popup menu.
+ * \param item (in) - current item.
+ * \param p (in) - mouse pointer position.
+ * \param col (in) - current column.
+ */
+void
+aListView::showMenu( Q3ListViewItem* item, const QPoint& p, int col)
+{
+       delete menu;
+       menu = new Q3PopupMenu();
+       if(toSelect)
+       {
+               menu->insertItem(tr("Select"),  this,   SLOT(select()));
+               menu->insertSeparator();
+       }
+       menu->insertItem(tr("Edit"),    this,   SLOT(edit()));
+       menu->insertSeparator();
+       menu->insertItem(tr("New element"),     this,   SLOT(newItem()));
+       menu->insertItem(tr("New group"),       this,   SLOT(newGroup()));
+       menu->insertSeparator();
+       //menu->setItemEnabled(menu->idAt(3),false);
+       menu->insertItem(tr("Undo mark delete"),        this,   SLOT(undoMarkDeleted()));
+       menu->insertItem(tr("Delete (mark deleted)"),this,      SLOT(markDeleted()));
+       menu->insertItem(tr("Delete (phisical)"),       this,   SLOT(delItem()));
+       parentItem = item;
+       if(col==-1) col = 0;
+       columnClicked = col;
+       menu->popup( p );
+}
+
+void
+aListView::newItem()
+{
+       emit (newItemRequest(parentItem));
+}
+void
+aListView::newGroup()
+{
+       emit (newGroupRequest(parentItem));
+}
+void
+aListView::delItem()
+{
+       emit (delItemRequest(parentItem));
+}
+void
+aListView::markDeleted()
+{
+       emit (markDeletedRequest(parentItem));
+}
+void
+aListView::undoMarkDeleted()
+{
+       emit (undoMarkDeletedRequest(parentItem));
+}
+
+void
+aListView::edit()
+{
+       emit (editRequest(parentItem,columnClicked));
+}
+void
+aListView::select()
+{
+       emit (selectRequest(parentItem));
+}
+void
+aListView::setDestination(const bool dest)
+{
+       toSelect = dest;
+}
+bool
+aListView::getDestination()
+{
+       return toSelect;
+}
+/*! Key press event handler. Emit signal keyEnterPressed().
+ * \param e (in) - key press event.
+ */
+void
+aListView::keyPressEvent(QKeyEvent *e)
+{
+
+       switch(e->key())
+       {
+       case Qt::Key_Return:
+               e->accept();
+               parentItem = selectedItem();
+               columnClicked = 0;
+               if(toSelect)
+               {
+                       select();
+               }
+               else
+               {
+                       edit();
+               }
+               break;
+       case Qt::Key_Insert:
+               parentItem = selectedItem();
+               columnClicked = 0;
+               switch(QMessageBox::question(this,
+                               tr("Type of new item"),
+                               tr("<p align=\"center\">Select type of new item</p>"),
+                               tr("&Elemnt"), tr("&Group")))
+               {
+               case 0:
+                       newItem();
+                       break;
+               case 1:
+                       newGroup();
+                       break;
+               default:
+                       break;
+               }
+               break;
+       case Qt::Key_Delete:
+               parentItem = selectedItem();
+               columnClicked = 0;
+               switch(QMessageBox::question(this,
+                               tr("Delete item"),
+                               tr("<p align=\"center\">Mark deleted or delete?</p>"),
+                               tr("&Mark deleted"), tr("&Delete")))
+               {
+               case 0:
+                       markDeleted();
+                       break;
+               case 1:
+                       delItem();
+                       break;
+               default:
+                       break;
+               }
+               break;
+       default:
+               e->ignore();
+               break;
+       }
+       Q3ListView::keyPressEvent(e);
+
+}
+
+void
+aListView::setFocus()
+{
+       Q3ListView::setFocus();
+       if(toSelect)
+       {
+               emit(sendMessage(tr("<Enter> - select, <Ins> - add, <Del> - delete items")));
+       }
+       else
+       {
+               emit(sendMessage(tr("<Enter> - edit, <Ins> - add, <Del> - delete items")));
+       }
+}
+
+
+void
+aListView::doubleClickHandler( Q3ListViewItem *item, const QPoint& p, int col)
+{
+       parentItem = item;
+       columnClicked = col;
+       if(toSelect)
+       {
+               select();
+       }
+       else
+       {
+               edit();
+       }
+}
+
diff --git a/src/plugins/catalogue/catalogformwidgets.h b/src/plugins/catalogue/catalogformwidgets.h
new file mode 100644 (file)
index 0000000..f4b07a8
--- /dev/null
@@ -0,0 +1,154 @@
+/****************************************************************************
+** $Id: catalogformwidgets.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Catalogue metadata object implementation file of
+** Ananas application library
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef CATALOGFORMWIDGET_H
+#define CATALOGFORMWIDGET_H
+
+#include <stdlib.h>
+#include <qwidget.h>
+#include <qtimer.h>
+#include <q3listbox.h>
+#include <qlineedit.h>
+#include <q3listview.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qevent.h>
+#include <q3popupmenu.h>
+//Added by qt3to4:
+#include <Q3Frame>
+#include <QKeyEvent>
+#include <QFocusEvent>
+//class QVBoxLayout;
+
+class aListBox:public Q3ListBox
+{
+       Q_OBJECT
+public:
+       aListBox(QWidget *parent = 0, const char* name = 0, Qt::WFlags f = 0);
+       ~aListBox();
+       void insertItem(const QString &s, long idx, int index = -1);
+       void show(QWidget *w, Q3Frame *fr);//, QLabel *lb);
+
+       long getId(int ind) { return atol(listPrivate->text(ind).ascii()); };
+
+       void clear();
+       //void setId(long idx) {id = idx;};
+public slots:
+       virtual void setFocus();
+
+protected:
+
+       virtual void keyPressEvent ( QKeyEvent *e );
+       void focusOutEvent ( QFocusEvent *e );
+protected slots:
+       void doubleClickHandler(Q3ListBoxItem *i);
+       //      QVBoxLayout* layout1;
+//     QLabel * statusBar;
+signals:
+       void keyArrowLRPressed();
+       void keyArrowLRPressed(const QString&);
+       void keyEnterPressed();
+       void lostFocus();
+       void sendMessage(const QString &);
+private:
+       Q3ListBox* listPrivate;
+};
+
+
+class aLineEdit:public QLineEdit
+{
+       Q_OBJECT
+public:
+       aLineEdit( QWidget* parent, const char* name = 0 );
+       ~aLineEdit();
+
+protected:
+       virtual void keyPressEvent ( QKeyEvent *e );
+
+private:
+       QTimer *timer;
+
+public slots:
+       void    stopTimer();
+       virtual void    setFocus();
+protected slots:
+       void    timerDone();
+       void    timerRestart(const QString & s);
+
+signals:
+       void    keyArrowPressed();
+       void    delayTextChanged(const QString &);
+       void    keyEnterPressed();
+       void    sendMessage(const QString &);
+};
+
+class aListView : public Q3ListView
+{
+       Q_OBJECT
+public:
+       aListView(QWidget* parent = 0, const char* name = 0, Qt::WFlags f = 0);
+       ~aListView();
+
+       Q3PopupMenu *menu;
+       void setDestination(const bool dest);
+       bool getDestination();
+protected:
+       virtual void keyPressEvent ( QKeyEvent *e );
+
+public slots:
+
+       void    showMenu( Q3ListViewItem* item, const QPoint& p, int);
+       void    newItem();
+       void    newGroup();
+       void    delItem();
+       void    markDeleted();
+       void    undoMarkDeleted();
+       void    edit();
+       void    select();
+       virtual void    setFocus();
+
+protected slots:
+       void    doubleClickHandler( Q3ListViewItem *, const QPoint&, int col);
+
+signals:
+
+       void    sendMessage(const QString &);
+       void    newItemRequest(Q3ListViewItem* parentItem);
+       void    newGroupRequest(Q3ListViewItem* parentItem);
+       void    delItemRequest(Q3ListViewItem* item);
+       void    markDeletedRequest(Q3ListViewItem* item);
+       void    undoMarkDeletedRequest(Q3ListViewItem* item);
+       void    editRequest(Q3ListViewItem* item, int columnClicked);
+       void    selectRequest(Q3ListViewItem* item);
+private:
+       Q3ListViewItem* parentItem;
+       int columnClicked;
+       bool toSelect;
+};
+#endif
+
diff --git a/src/plugins/catalogue/catalogue.pri b/src/plugins/catalogue/catalogue.pri
new file mode 100644 (file)
index 0000000..85dbd8a
--- /dev/null
@@ -0,0 +1,19 @@
+HEADERS += \
+    catalogue/catalogform.h \
+    catalogue/catalogformwidgets.h \
+    catalogue/ecatalogue.h \
+    catalogue/wcatalogue.h \
+    catalogue/wcatalogue_plugin.h \
+    catalogue/wcatalogue_taskmenu.h 
+
+SOURCES += \
+    catalogue/catalogform.cpp \
+    catalogue/catalogformwidgets.cpp \
+    catalogue/ecatalogue.cpp \
+    catalogue/wcatalogue.cpp \
+    catalogue/wcatalogue_plugin.cpp \
+    catalogue/wcatalogue_taskmenu.cpp 
+        
+FORMS += \
+    catalogue/catalogform.ui \
+    catalogue/ecatalogue.ui
diff --git a/src/plugins/catalogue/ecatalogue.cpp b/src/plugins/catalogue/ecatalogue.cpp
new file mode 100644 (file)
index 0000000..2da761e
--- /dev/null
@@ -0,0 +1,203 @@
+#include "ecatalogue.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a eCatalogue as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+eCatalogue::eCatalogue(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+eCatalogue::~eCatalogue()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void eCatalogue::languageChange()
+{
+    retranslateUi(this);
+}
+
+
+#include "acfg.h"
+
+void eCatalogue::init()
+{
+/*
+       int oc, i, f, idx=0;
+       char *id, *name, *ot;
+       cfg_objptr o;
+       char otype[100];
+       QString named;
+
+       otypes.clear();
+       eType->clear();
+       otypes.append("D");
+       eType->insertItem(trUtf8("Дата"), idx++);
+       otypes.append("T");
+       eType->insertItem(trUtf8("Время"), idx++);
+       otypes.append("N %d %d");
+       eType->insertItem(trUtf8("Число"), idx++);
+       otypes.append("C %d");
+       eType->insertItem(trUtf8("Строка"), idx++);
+
+       oc=cfgobj_count(NULL, NULL);
+       for (i=1;i<=oc;i++) {
+               id=cfgobj_idn(NULL, NULL, i, &o);
+               ot=(char *)o->name;
+               name=cfgobj_attr(o, "name");
+               named="";
+               f=0;
+               if (strcmp((char *)ot, aot_doc)==0) {
+                       named=trUtf8("Документ.");
+                       f=1;
+               }
+               if (strcmp((char *)ot, aot_cat)==0) {
+                       named=trUtf8("Справочник.");
+                       f=1;
+               }
+               if (f) {
+                       named=named+trUtf8(name);
+                       sprintf(otype, "O %s", id);
+                       otypes.append(otype);
+                       eType->insertItem(named, idx++);
+               }
+       }
+*/
+}
+
+
+
+/*void eCatalogue::setData( aCatalogue *f, QWidget *mw )
+{
+       aCfg *md = 0;
+       if ( !f ) return;
+//     printf("name = '%s'\n", (const char *) mw->name() );
+       if (mw->name() == QString("ananas-designer_mainwindow") ) {
+//             printf("running under ananas designer\n");
+               CfgForm *cf = ( ( MainForm *) mw )->cfgForm();
+               if ( cf ) {
+                       md = &cf->cfg;
+//                     QString ts = f->getFieldType();
+//                     char t=' ';
+                       int w=0, d=0, idx=0;
+                       unsigned int i;
+                       long oid , id;
+
+                       id = f->getId();
+
+                       otypes.clear();
+                       eType->clear();
+
+                       QStringList tlist = md->types( md_catalogue );
+                       otypes.clear();
+                       eType->clear();
+                       for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
+                               otypes.append( (*it).section( "\t", 0, 0 ) );
+                               eType->insertItem( (*it).section("\t", 1, 1 ), idx++ );
+                       }
+                       for ( i = 0 ; i < otypes.count(); i++ ) {
+                               oid = 0;
+                               if( otypes[i][0] == 'O' ) {
+                                       sscanf( (const char *)otypes[ i ], "O %d", &oid );
+                                       if ( oid == id ) {
+                                               eType->setCurrentItem( i );
+                                               break;
+                                       }
+                               }
+                       }
+               } else reject();
+       }
+
+}
+*/
+
+void
+eCatalogue::setData( QWidget *o, aCfg *md )
+{
+//    const QObject *o = sender();
+    if ( o ) {
+       if ( o->className() != QString("wCatalogue") || !md ) {
+           reject();
+           return;
+       }
+    }
+    else {
+       reject();
+       return;
+    }
+    wCatalogue *f = ( wCatalogue*) o;
+    int w=0, d=0, idx=0;
+    unsigned int i;
+    long oid , id;
+
+    id = f->getId();
+
+    QStringList tlist = md->types( md_catalogue );
+    otypes.clear();
+    eType->clear();
+    for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
+       otypes.append( (*it).section( "\t", 0, 0 ) );
+       eType->insertItem( (*it).section("\t", 1, 1 ), idx++ );
+    }
+    for ( i = 0 ; i < otypes.count(); i++ ) {
+       oid = 0;
+       if( otypes[i][0] == 'O' ) {
+           sscanf( (const char *)otypes[ i ], "O %d", &oid );
+           if ( oid == id ) {
+               eType->setCurrentItem( i );
+               break;
+           }
+       }
+    }
+}
+
+
+void eCatalogue::getData( QWidget * o )
+{
+
+/*     int idx=eType->currentItem();
+       long oid = 0;
+
+       if (f) {
+               if( otypes[idx][0] == 'O' ) {
+                       sscanf( (const char *)otypes[ idx ], "O %d", &oid );
+                       f->setId( oid );
+               }
+       }
+*/
+//    const QObject *o = sender();
+    if ( !o ) return;
+    if ( o->className() != QString("wCatalogue") ) return;
+    wCatalogue *f = ( wCatalogue*) o;
+
+    int idx=eType->currentItem();
+    long oid = 0;
+
+    if (f) {
+       if( otypes[idx][0] == 'O' ) {
+           sscanf( (const char *)otypes[ idx ], "O %d", &oid );
+           f->setId( oid );
+       }
+    }
+
+}
+
diff --git a/src/plugins/catalogue/ecatalogue.h b/src/plugins/catalogue/ecatalogue.h
new file mode 100644 (file)
index 0000000..1fc2cbe
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef ECATALOGUE_H
+#define ECATALOGUE_H
+
+#include "ui_ecatalogue.h"
+
+
+class eCatalogue : public QDialog, public Ui::eCatalogue
+{
+    Q_OBJECT
+
+public:
+    eCatalogue(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~eCatalogue();
+
+    QStringList otypes;
+
+public slots:
+    virtual void init();
+    virtual void setData( QWidget * o, aCfg * md );
+    virtual void getData( QWidget * o );
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // ECATALOGUE_H
diff --git a/src/plugins/catalogue/ecatalogue.ui b/src/plugins/catalogue/ecatalogue.ui
new file mode 100644 (file)
index 0000000..4f847bf
--- /dev/null
@@ -0,0 +1,116 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>eCatalogue</class>\r
+  <widget class="QDialog" name="eCatalogue" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>348</width>\r
+        <height>106</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Catalogue</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item rowspan="1" row="3" column="0" colspan="4" >\r
+        <layout class="QHBoxLayout" />\r
+      </item>\r
+      <item rowspan="1" row="1" column="1" colspan="3" >\r
+        <widget class="QComboBox" name="eType" />\r
+      </item>\r
+      <item row="1" column="0" >\r
+        <widget class="QLabel" name="textLabel2" >\r
+          <property name="maximumSize" >\r
+            <size>\r
+              <width>100</width>\r
+              <height>32767</height>\r
+            </size>\r
+          </property>\r
+          <property name="text" >\r
+            <string>Type</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="4" column="0" >\r
+        <spacer name="spacer4" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>31</width>\r
+              <height>16</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Vertical</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+      <item rowspan="1" row="5" column="0" colspan="2" >\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QPushButton" name="bOK" >\r
+              <property name="text" >\r
+                <string>OK</string>\r
+              </property>\r
+              <property name="default" >\r
+                <bool>true</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="bCancel" >\r
+              <property name="text" >\r
+                <string>Cancel</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item rowspan="1" row="5" column="2" colspan="2" >\r
+        <spacer name="spacer2" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>91</width>\r
+              <height>31</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Horizontal</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="6" margin="11" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >ananas.h</include>\r
+    <include location="local" >wcatalogue.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>bOK</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eCatalogue</receiver>\r
+      <slot>accept()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eCatalogue</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/catalogue/wcatalogue.cpp b/src/plugins/catalogue/wcatalogue.cpp
new file mode 100644 (file)
index 0000000..e6d42a2
--- /dev/null
@@ -0,0 +1,443 @@
+/****************************************************************************
+** $Id: wcatalogue.cpp,v 1.2 2008/11/08 20:16:36 leader Exp $
+**
+** Code file of the catlogue plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qobject.h>
+#include <q3sqlcursor.h>
+#include <q3sqlpropertymap.h>
+#include <q3toolbar.h>
+#include <qaction.h>
+//--#include <qfocusdata.h>
+#include "adatabase.h"
+#include "wcatalogue.h"
+#include "ecatalogue.h"
+#include "wdbfield.h"
+#include "wdbtable.h"
+#include "wgrouptree.h"
+#include "alog.h"
+
+//extern aCfg *plugins_aCfg;
+
+
+/*!\en
+ *\_en \ru
+ *\_ru
+ */
+wCatalogue::wCatalogue( QWidget *parent, Qt::WFlags fl )
+:aWidget( parent, "wCatalogue", fl )
+{
+       setInited( false );
+       setFormMode( 0 );
+}
+
+
+wCatalogue::~wCatalogue()
+{
+}
+
+
+
+void
+wCatalogue::initObject( aDatabase *adb )
+{
+       aWidget::initObject( adb );
+       QObject *obj;
+       QObjectList lb = this->queryList( "QWidget" );
+       QListIterator<QObject*> itb( lb ); // iterate over all wDBFields
+       while ( itb.hasNext() )
+       {
+               obj = itb.next();
+               if(obj->inherits("wDBField"))
+               {
+//             if ( (wActionButtton*) obj )->isActionUpdate() )
+                       connect( (wDBField *)obj, SIGNAL(valueChanged( const QVariant & )),
+                               this, SLOT(valueChanged( const QVariant & )) );
+               }
+               if(obj->inherits("wGroupTree"))
+               {
+                       ((wGroupTree*)obj)->setId(getId());
+                       connect( (wGroupTree *)obj, SIGNAL(selectionChanged( const qulonglong )),
+                               this, SLOT(selectionChanged( const qulonglong )) );
+
+               }
+               if(obj->inherits("wDBTable"))
+               {
+                       connect( this, SIGNAL(newSelectionFilter( const QString&  )),
+                               (wDBTable*)obj, SLOT(newFilter( const QString& )) );
+                       connect( this, SIGNAL(newSelectionGroupId( const qulonglong  )),
+                               (wDBTable*)obj, SLOT(newDataId( const qulonglong )) );
+
+               }
+
+       }
+       //--delete lb; // delete the list, not the objects
+       //--focusData()->next()->setFocus();
+       focusNextChild();
+
+}
+
+
+
+/*!
+ *\~english
+ *     Processed field value changed.
+ *     Conected on signal valueChanged( const QVariant & ) for all
+ *     wDBField insert in the widget.
+ *     Decode field name and set new field value in database object.
+ *     Emit signal value change with field name and value.
+ *     Signal connectaed on aform slot, for future work.
+ *\~russian
+ *     Обрабатывает изменение значения поля
+ *     Присоединяется к сигналу valueChanged( const QVariant & ),
+ *     всех полей типа wDBField, вставленных в виджет.
+ *     Декодирует имя поля и сохраняет его новое значение в объекте для
+ *     работы с базой.
+ *     Посылает сигнал об изменении значения, который содержит имя поля
+ *     и его новое значение.
+ *     Сигнал присоединяется к слоту формы для последующей обработки.
+ *\~
+ *\param value - \~english new field value. \~russian новое значение поля. \~
+ */
+void
+wCatalogue::valueChanged( const QVariant & value )
+{
+       if ( sender()->className() != QString("wDBField") ) return;
+       wDBField * fld = ( wDBField * ) sender();
+       aCfgItem o_field,o_parent;
+       QString parent_name;
+       QVariant val = value;
+
+       o_field = md->find(fld->getId());
+       o_parent = md->parent(o_field);
+       const QString fname = fld->getFieldName();
+
+       parent_name = md->objClass( o_parent );
+       if( parent_name == QString(md_group) )
+       {
+
+               if (dbobj)// && dbobj->className() == QString("aCatalogue") )
+               {
+                       aLog::print(aLog::Debug, tr("wCatalogue group value changed to %1").arg(value.toString()));
+                       ((aCatalogue*)dbobj)->GroupSetValue( fname, value );
+               }
+
+
+       }
+
+       else
+       {
+
+               if (dbobj)
+               {
+                       aLog::print(aLog::Debug, tr("wCatalogue element value changed to %1").arg(value.toString()));
+                       dbobj->SetValue( fname, val );
+               }
+       }
+
+       emit aWidget::valueChanged( fname, value );
+}
+
+
+bool
+wCatalogue::checkStructure()
+{
+
+       return false;
+}
+
+
+QVariant
+wCatalogue::value( const QString &name )
+{
+
+       aLog::print(aLog::Error, tr("wCatalogue value for name %1 ").arg(name));
+       return QVariant("");
+}
+
+
+void
+wCatalogue::setValue( const QString &name, QVariant &value )
+{
+//     if ( formMode() == CATALOGUEFORMMODE_GROUP ) {
+//             ( aCatalogue *) dbobj->SetValue(name,value);
+//     } else {
+//     printf("wCatalogue::setValue(%s,%s)\n",name.ascii(),value.toString().ascii());
+       aLog::print(aLog::Debug, tr("wCatalogue set value %1 for name %2 ").arg(value.toString()).arg(name));
+       dbobj->SetValue(name,value);
+//     }
+       //dbobj->Update();
+//     debug_message("wCatalogue value changed to %s\n",value.toString().ascii());
+
+}
+
+
+QDialog*
+wCatalogue::createEditor( QWidget *parent )
+{
+    return new eCatalogue( parent );
+}
+
+
+int
+wCatalogue::select( qulonglong )//id )
+{
+       return 0;
+}
+
+
+qulonglong
+wCatalogue::insert()
+{
+    return 0;
+}
+
+
+int
+wCatalogue::update()
+{
+       if ( dbobj )
+       {
+               aLog::print(aLog::Debug, tr("wCatalogue update"));
+//             printf("wCatalogue:;update()\n");
+               return dbobj->Update();
+       }
+
+       aLog::print(aLog::Error, tr("wCatalogue have not data source object "));
+       return err_abstractobj;
+}
+
+
+int
+wCatalogue::markDelete()
+{
+    return 0;
+}
+
+
+QString
+wCatalogue::displayString()
+{
+       return "";
+}
+
+/*!
+ * Create aDocument database object.
+ */
+aObject *
+wCatalogue::createDBObject(  aCfgItem obj, aDatabase *adb )
+{
+//        printf("cat form mode = %i\n",formMode() );
+//     if ( formMode() == CATALOGUEFORMMODE_GROUP ) return new aCatGroup( obj, adb );
+        return new aCatalogue( obj, adb );
+}
+
+
+ERR_Code
+wCatalogue::Select( qulonglong id )
+{
+
+       //if ( formMode()==0 ) {
+
+       QObject *obj;
+       QObjectList lb = this->queryList( "wDBTable" );
+       QListIterator<QObject*> itb( lb ); // iterate over all wDBTable
+       while ( itb.hasNext() )
+       {
+               obj = itb.next();
+               ( (wDBTable *)obj )->setFocus();
+               ( (wDBTable *)obj )->Select( id );
+//             if ( (wActionButtton*) obj )->isActionUpdate() )
+//             connect( (wDBTable *)obj, SIGNAL(valueChanged( const QVariant & )),
+//                             this, SLOT(valueChanged( const QVariant & )) );
+       }
+       //--delete lb; // delete the list, not the objects
+       //--lb=0;
+//     return 0;
+
+
+
+//}
+//
+//
+       blockSignals( true );
+       ERR_Code err = aWidget::Select ( id ); //table()->select( id ); //aWidget::Select ( id );
+
+       blockSignals( true );
+       NewValues();
+       blockSignals( false );
+       return err_noerror;
+}
+
+
+
+ERR_Code
+wCatalogue::SelectGroup( qulonglong id )
+{
+
+       ERR_Code err = ((aCatalogue*)dbobj)->groupSelect( id );
+       if ( err )
+       {
+               aLog::print(aLog::Error, tr("wCatalogue select group error = %1 ").arg(err));
+               return err;
+       }
+       blockSignals( true );
+       NewValues();
+       blockSignals( false );
+       //emit( changeObj(QString("idd=%1").arg(id)));
+       return err_noerror;
+}
+
+
+/*!
+ *\~english
+ *     Set fields values from database.
+ *     Used for insert values into fields when create or open catalogue.
+ *\~russian
+ *     Устанавливает значения полей.
+ *     Устанавливает значения полей из базы данных,
+ *     используется при открытии формы или смене каталога.
+ *\~
+ */
+void
+wCatalogue::NewValues()
+{
+       aLog::print(aLog::Debug, tr("wCatalogue set new values for all fields"));
+       QString fname;
+       QObjectList l = this->queryList( "wDBField" );
+       QListIterator<QObject*> it( l );
+       QObject *obj;
+       //--obj = it.toFirst();
+       aCfgItem o_field,o_parent;
+       QString parent_name;
+       while ( it.hasNext() )
+       {
+               //++it;
+               //obj = it.current();
+               obj= it.next();
+               fname=((wDBField *)obj)->getFieldName();
+               o_field = md->find(((wDBField *)obj)->getId());
+               o_parent = md->parent(o_field);
+               //printf( "field name %s\n",(const char*)fname.local8Bit() );
+               parent_name = md->objClass( o_parent );
+               //printf("parent_name = %s\n", (const char*)parent_name );
+               if( parent_name == QString(md_group) )
+               {
+//                     debug_message("group set value\n");
+                       if (dbobj)// && dbobj->className() == QString("aCatalogue") )
+                       {
+
+                               aLog::print(aLog::Debug, tr("wCatalogue set new values for group field %1").arg(fname));
+                               ((wDBField*)obj)->setValue(((aCatalogue*)dbobj)->GroupValue( fname ).toString());
+                       }
+
+               }
+               else
+               {
+                       aLog::print(aLog::Debug, tr("wCatalogue value for element field %1 ").arg(fname));
+                       ((wDBField*)obj)->setValue(dbobj->Value(fname).toString());
+               }
+       }
+       //--delete l; // delete the list, not the objects
+       //--l=0;
+}
+
+
+
+void
+wCatalogue::setFormMode( int Mode )
+{
+       aWidget::setFormMode( Mode );
+}
+
+
+/*!
+ * Create toolbar for Catalogue.
+ */
+Q3ToolBar*
+wCatalogue::createToolBar( Q3MainWindow * owner )
+{
+       /*
+       QAction *a;
+       QToolBar *t = new QToolBar( owner, "CatalogueTools" );
+
+       a = new QAction(
+       QPixmap::fromMimeSource("doc_new.png"),
+       tr("New"),
+       QKeySequence(""),//Insert"),
+       t,
+       tr("New Element")
+       );
+       a->setToolTip(tr("New element (Ins)"));
+       a->addTo( t );
+       connect( a, SIGNAL( activated() ), this, SLOT( insert() ) );
+
+       a = new QAction(
+       QPixmap::fromMimeSource("doc_edit.png"),
+       tr("Edit"),
+       QKeySequence(""),//Return"),
+       t,
+       tr("Edit element")
+       );
+       a->setToolTip(tr("Edit element (Enter)"));
+       a->addTo( t );
+       connect( a, SIGNAL( activated() ), this, SLOT( update() ) );
+*/
+/*     a = new QAction(
+       QPixmap::fromMimeSource("doc_view.png"),
+       tr("View"),
+       QKeySequence("Shifh+Return"),
+       t,
+       tr("View element")
+       );
+       a->setToolTip(tr("View element (Shift+Enter)"));
+       a->addTo( t );
+       connect( a, SIGNAL( activated() ), this, SLOT( view() ) );
+*/
+/*
+       a = new QAction(
+       QPixmap::fromMimeSource("doc_view.png"),
+       tr("Delete"),
+       QKeySequence(""),//Delete"),
+       t,
+       tr("Delete element")
+       );
+       a->setToolTip(tr("Delete element (Shift+Enter)"));
+       a->addTo( t );
+       connect( a, SIGNAL( activated() ), this, SLOT( markDelete() ) );
+*/
+       return 0;
+}
+
+void
+wCatalogue::selectionChanged(const qulonglong groupId)
+{
+       aLog::print(aLog::Error, tr("wCatalogue selection changed to %1 ").arg(groupId));
+       emit(newSelectionGroupId(groupId));
+       emit(newSelectionFilter(QString("idg=%1").arg(groupId)));
+}
diff --git a/src/plugins/catalogue/wcatalogue.h b/src/plugins/catalogue/wcatalogue.h
new file mode 100644 (file)
index 0000000..8348a67
--- /dev/null
@@ -0,0 +1,79 @@
+/****************************************************************************
+** $Id: wcatalogue.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of the catlogue plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef WCATALOGUE_H
+#define WCATALOGUE_H
+#include <qwidgetplugin.h>
+//#include "ananas.h"
+#include "awidget.h"
+
+class QWidget;
+
+#define CATALOGUEFORMMODE_LIST         0 // Elements list
+#define CATALOGUEFORMMODE_ELEMENT      1 // Element form
+#define CATALOGUEFORMMODE_GROUP                2 // Group form
+
+
+class QT_WIDGET_PLUGIN_EXPORT wCatalogue : public aWidget
+{
+       Q_OBJECT
+public:
+       wCatalogue( QWidget *parent = 0, Qt::WFlags fl = 0 );
+       virtual ~wCatalogue();
+       bool checkStructure();
+       virtual void            initObject( aDatabase *adb );
+       virtual QDialog*        createEditor( QWidget *parent );
+       virtual QString         displayString();
+       virtual bool            isContainer() { return true; };
+        virtual aObject*       createDBObject(  aCfgItem obj, aDatabase *adb );
+       virtual Q3ToolBar*      createToolBar( Q3MainWindow *parent );
+       void setFormMode( int Mode );
+public slots:
+       virtual ERR_Code Select( qulonglong id );
+       virtual ERR_Code SelectGroup( qulonglong id );
+       void valueChanged( const QVariant & value );
+       QVariant value( const QString &name );
+       void setValue( const QString &name, QVariant &value );
+       int select( qulonglong id );
+       qulonglong insert();
+       int update();
+       int markDelete();
+       void selectionChanged(const qulonglong);
+
+private:
+
+       void NewValues();
+signals:
+       void newSelectionFilter(const QString &);
+       void newSelectionGroupId( const qulonglong );
+
+};
+
+
+#endif // WCATALOGUE_H
diff --git a/src/plugins/catalogue/wcatalogue_plugin.cpp b/src/plugins/catalogue/wcatalogue_plugin.cpp
new file mode 100644 (file)
index 0000000..d6733a6
--- /dev/null
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "wcatalogue_plugin.h"
+
+#include <QtPlugin>
+#include <QDesignerFormEditorInterface>
+#include <QExtensionManager>
+
+#include "wcatalogue_taskmenu.h"
+#include "wcatalogue.h"
+
+
+wCataloguePlugin::wCataloguePlugin(QObject *parent)
+    : QObject(parent), m_initialized(false)
+{
+    m_initialized = false;
+}
+
+bool wCataloguePlugin::isContainer() const
+{
+    return true;
+}
+
+bool wCataloguePlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void wCataloguePlugin::initialize(QDesignerFormEditorInterface *core)
+{
+    if (m_initialized)
+        return;
+    Q_UNUSED(core);
+
+    QExtensionManager *manager = core->extensionManager();
+    Q_ASSERT(manager != 0);
+    manager->registerExtensions(new wCatalogueTaskMenuFactory(manager),
+                                Q_TYPEID(QDesignerTaskMenuExtension));
+
+    m_initialized = true;
+}
+
+QWidget *wCataloguePlugin::createWidget(QWidget *parent)
+{
+    wCatalogue *w = new wCatalogue(parent, 0);
+    return w;
+}
+
+QString wCataloguePlugin::name() const
+{
+    return QLatin1String("wCatalogue");
+}
+
+QString wCataloguePlugin::group() const
+{
+    return QLatin1String("Ananas");
+}
+
+QString wCataloguePlugin::toolTip() const
+{
+    return QString();
+}
+
+QString wCataloguePlugin::whatsThis() const
+{
+    return QString();
+}
+
+QString wCataloguePlugin::includeFile() const
+{
+    return QLatin1String("wcatalogue.h");
+}
+
+QIcon wCataloguePlugin::icon() const
+{
+    //return QIcon();
+    return QIcon(":/images/wcatalogue.png");
+}
+
+QString wCataloguePlugin::domXml() const
+{
+    return "<widget class=\"wCatalogue\" name=\"wCatalogue_1\">\n</widget>\n";
+}
diff --git a/src/plugins/catalogue/wcatalogue_plugin.h b/src/plugins/catalogue/wcatalogue_plugin.h
new file mode 100644 (file)
index 0000000..2eab2b0
--- /dev/null
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef WCATALOGUE_PLUGIN_H
+#define WCATALOGUE_PLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+#include "qwidgetplugin.h"
+
+
+class QT_WIDGET_PLUGIN_EXPORT wCataloguePlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+    wCataloguePlugin(QObject *parent=0);
+
+    bool isContainer() const;
+    bool isInitialized() const;
+    void initialize(QDesignerFormEditorInterface *core);
+    QWidget *createWidget(QWidget *parent);
+
+    QString name() const;
+    QString group() const;
+    QString toolTip() const;
+    QString whatsThis() const;
+    QString includeFile() const;
+    QIcon icon() const;
+    QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+#endif // WCATALOGUE_PLUGIN_H
diff --git a/src/plugins/catalogue/wcatalogue_taskmenu.cpp b/src/plugins/catalogue/wcatalogue_taskmenu.cpp
new file mode 100644 (file)
index 0000000..3d3f1ba
--- /dev/null
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include <QDesignerFormEditorInterface>
+
+#include <QAction>
+
+#include "wcatalogue_taskmenu.h"
+#include "wcatalogue.h"
+#include "ecatalogue.h"
+
+
+wCatalogueTaskMenu::wCatalogueTaskMenu(wCatalogue *widget, QObject *parent)
+    : QObject(parent)
+{
+    m_widget = widget;
+
+    m_editAction = new QAction(tr("Edit ..."), this);
+    connect(m_editAction, SIGNAL(triggered()), this, SLOT(edit()));
+}
+
+void wCatalogueTaskMenu::edit()
+{
+    /*eCatalogue e;
+
+       e.setData(m_widget);
+       if (e.exec() == QDialog::Accepted)
+       {
+               e.getData(m_widget);
+       }*/
+       m_widget->widgetEditor();
+}
+
+QAction *wCatalogueTaskMenu::preferredEditAction() const
+{
+    return m_editAction;
+}
+
+QList<QAction *> wCatalogueTaskMenu::taskActions() const
+{
+    QList<QAction *> list;
+    list.append(m_editAction);
+    return list;
+}
+
+wCatalogueTaskMenuFactory::wCatalogueTaskMenuFactory(QExtensionManager *parent)
+    : QExtensionFactory(parent)
+{
+}
+
+QObject *wCatalogueTaskMenuFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
+{
+    if (iid != Q_TYPEID(QDesignerTaskMenuExtension))
+        return 0;
+
+    if (wCatalogue *cat = qobject_cast<wCatalogue*>(object))
+        return new wCatalogueTaskMenu(cat, parent);
+
+    return 0;
+}
diff --git a/src/plugins/catalogue/wcatalogue_taskmenu.h b/src/plugins/catalogue/wcatalogue_taskmenu.h
new file mode 100644 (file)
index 0000000..5f0d4da
--- /dev/null
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef WCATALOGUE_TASKMENU_H
+#define WCATALOGUE_TASKMENU_H
+
+#include <QDesignerTaskMenuExtension>
+#include <QExtensionFactory>
+
+
+class QExtensionManager;
+class QAction;
+class wCatalogue;
+
+class wCatalogueTaskMenu: public QObject, public QDesignerTaskMenuExtension
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerTaskMenuExtension)
+public:
+    wCatalogueTaskMenu(wCatalogue *widget, QObject *parent);
+
+    QAction *preferredEditAction() const;
+    QList<QAction *> taskActions() const;
+
+private slots:
+    void edit();
+
+private:
+    QAction *m_editAction;
+    wCatalogue *m_widget;
+};
+
+class wCatalogueTaskMenuFactory: public QExtensionFactory
+{
+    Q_OBJECT
+public:
+    wCatalogueTaskMenuFactory(QExtensionManager *parent = 0);
+
+protected:
+    QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
+};
+
+#endif // WCATALOGUE_TASKMENU_H
diff --git a/src/plugins/combobox/acombobox.cpp b/src/plugins/combobox/acombobox.cpp
new file mode 100644 (file)
index 0000000..044533c
--- /dev/null
@@ -0,0 +1,272 @@
+/****************************************************************************
+** $Id: acombobox.cpp,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Code file of the field plugin of Ananas
+** Designer and Engine applications
+**
+** Copyright (C) 2006 Andrey Paskal.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**
+**********************************************************************/
+
+#include "acombobox.h"
+//Added by qt3to4:
+#include <QPixmap>
+#include <Q3StrList>
+#include <QEvent>
+
+AComboBox::AComboBox( QWidget* parent, const char* name ):QComboBox( parent, name ) {
+}
+
+AComboBox::AComboBox(  bool rw, QWidget* parent, const char* name ):QComboBox( rw, parent, name ) {
+}
+
+AComboBox::~AComboBox(){
+}
+
+int
+AComboBox::count() const {
+       return QComboBox::count();
+}
+
+void
+AComboBox::insertStringList( const QStringList &list, int index ) {
+       QComboBox::insertStringList( list, index );
+};
+
+/*--void
+AComboBox::insertStrList( const Q3StrList &list, int index ){
+       QComboBox::insertStrList( list, index );
+};
+
+void
+AComboBox::insertStrList( const Q3StrList *list, int index ){
+       QComboBox::insertStrList( list, index );
+};
+
+void
+AComboBox::insertStrList( const char **str, int numStrings, int index){
+       QComboBox::insertStrList( str, numStrings, index );
+};*/
+
+void
+AComboBox::insertItem( const QString &text, int index ){
+       QComboBox::insertItem( text, index);
+};
+
+void
+AComboBox::insertItem( const QPixmap &pixmap, int index ){
+       QComboBox::insertItem( pixmap, index);
+};
+
+void
+AComboBox::insertItem( const QPixmap &pixmap, const QString &text, int index ){
+       QComboBox::insertItem(pixmap, text, index );
+};
+
+
+void
+AComboBox::removeItem( int index ){
+       QComboBox::removeItem( index );
+};
+
+
+int
+AComboBox::currentItem() {
+       return QComboBox::currentItem();
+};
+
+void
+AComboBox::setCurrentItem( int index ){
+       QComboBox::setCurrentItem( index );
+};
+
+
+QString
+AComboBox::currentText() const {
+       return QComboBox::currentText();
+};
+
+void
+AComboBox::setCurrentText( const QString& string){
+       QComboBox::setCurrentText( string );
+};
+
+
+QString
+AComboBox::text( int index ) const {
+       return QComboBox::text( index );
+};
+
+const QPixmap
+AComboBox::pixmap( int index ) const {
+       return QComboBox::pixmap( index );
+};
+
+void
+AComboBox::changeItem( const QString &text, int index ){
+       QComboBox::changeItem( text, index );
+};
+
+void
+AComboBox::changeItem( const QPixmap &pixmap, int index ){
+       QComboBox::changeItem( pixmap, index );
+};
+
+void
+AComboBox::changeItem( const QPixmap &pixmap, const QString &text, int index ){
+       QComboBox::changeItem( pixmap, text, index );
+};
+
+
+/*--bool
+AComboBox::autoResize() const {
+       return QComboBox::autoResize();
+};
+
+void
+AComboBox::setAutoResize( bool val){
+       QComboBox::setAutoResize( val );
+};*/
+
+QSize
+AComboBox::sizeHint() const {
+       return QComboBox::sizeHint();
+};
+
+void
+AComboBox::setPalette( const QPalette &pal ){
+       QComboBox::setPalette( pal );
+};
+
+void
+AComboBox::setFont( const QFont & font) {
+       QComboBox::setFont( font );
+};
+
+void
+AComboBox::setEnabled( bool val){
+       QComboBox::setEnabled( val);
+};
+
+
+/*--void
+AComboBox::setSizeLimit( int size ){
+       QComboBox::setSizeLimit( size );
+};
+
+int
+AComboBox::sizeLimit() const {
+       return QComboBox::sizeLimit();
+};*/
+
+void
+AComboBox::setMaxCount( int cnt ){
+       QComboBox::setMaxCount( cnt );
+}
+
+int
+AComboBox::maxCount() const {
+       return QComboBox::maxCount();
+}
+
+void
+AComboBox::setInsertionPolicy(QComboBox::Policy policy ){
+       QComboBox::setInsertionPolicy(policy );
+}
+
+QComboBox::Policy
+AComboBox::insertionPolicy() const{
+       return QComboBox::insertionPolicy() ;
+}
+
+
+void
+AComboBox::setValidator( const QValidator * v){
+       QComboBox::setValidator( v );
+}
+
+const QValidator *
+AComboBox::validator() const{
+       return QComboBox::validator();
+}
+
+/*--void
+AComboBox::setListBox( Q3ListBox * lb){
+       QComboBox::setListBox( lb );
+}
+
+Q3ListBox *
+AComboBox::listBox() const {
+       return QComboBox::listBox();
+}*/
+
+void
+AComboBox::setLineEdit( QLineEdit *edit ){
+       QComboBox::setLineEdit( edit );
+}
+
+QLineEdit*
+AComboBox::lineEdit() const{
+       return QComboBox::lineEdit();
+}
+
+
+void
+AComboBox::setAutoCompletion( bool val ){
+       QComboBox::setAutoCompletion( val );
+}
+
+bool
+AComboBox::autoCompletion() const{
+       return QComboBox::autoCompletion();
+}
+
+bool
+AComboBox::eventFilter( QObject *object, QEvent *event ){
+       return QComboBox::eventFilter( object, event );
+}
+
+void
+AComboBox::setDuplicatesEnabled( bool enable ){
+       QComboBox::setDuplicatesEnabled( enable );
+}
+
+bool
+AComboBox::duplicatesEnabled() const{
+       return QComboBox::duplicatesEnabled();
+}
+
+bool
+AComboBox::editable() const{
+       return QComboBox::editable();
+}
+
+void
+AComboBox::setEditable( bool val ){
+       QComboBox::setEditable( val );
+}
+
+void
+AComboBox::popup(){
+       QComboBox::popup();
+}
+
+
+void
+AComboBox::hide(){
+       QComboBox::hide();
+}
+
+
diff --git a/src/plugins/combobox/acombobox.h b/src/plugins/combobox/acombobox.h
new file mode 100644 (file)
index 0000000..62c3860
--- /dev/null
@@ -0,0 +1,140 @@
+/****************************************************************************
+** $Id: acombobox.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of the field plugin of Ananas
+** Designer and Engine applications
+**
+** Copyright (C) 2006 Andrey Paskal
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef ACOMBOBOX_H
+#define ACOMBOBOX_H
+
+
+#include <qwidgetplugin.h>
+#include "qcombobox.h"
+//Added by qt3to4:
+#include <QPixmap>
+#include <Q3StrList>
+#include <QEvent>
+#include <Q3ListBox>
+
+
+/*!
+ * \en
+ *     \brief QComboBox wrapper for AnanasScript access.
+ * \_en
+ * \ru
+ *     \brief Плагин -- виджет обеспечивает доступ из Ананас.Скрипта ко всем публичным методам QComboBox, являясь врапером
+ *     последнего.
+ *     Наследует QComboBox.
+ *
+ *     Смотрите документацию на QComboBox, поставляемую вместе с библиотекой QT компании TrollTech или на сайте
+ *     http://trolltech.com
+ *
+ *     Все публичные методы QComboBox доступны как публичные слоты AComboBox.
+ *
+ *     \code
+ *     var myBox=Widget("aComboBox1"); // Предполагается наличие в экранной форме комбобокса с именем aComboBox1
+ *     myBox.clear();
+ *     myBox.insertItem("Первый пункт");
+ *     myBox.insertItem("Второй пункт");
+ *     myBox.insertItem("Третий пункт");
+ *     myBox.setCurrentItem(1); // Порядковые номера наченаются с нуля, так что текущим делаем второй пункт.
+ *     \endcode
+ *
+ * \_ru
+ */
+class QT_WIDGET_PLUGIN_EXPORT AComboBox : public QComboBox
+{
+       Q_OBJECT
+       public:
+               AComboBox( QWidget* parent=0, const char* name=0 );
+               AComboBox( bool rw, QWidget* parent=0, const char* name=0 );
+               ~AComboBox();
+public slots:
+
+    int                count() const;
+
+    void       insertStringList( const QStringList &, int index=-1 );
+    //--void   insertStrList( const Q3StrList &, int index=-1 );
+    //--void   insertStrList( const Q3StrList *, int index=-1 );
+    //--void   insertStrList( const char **, int numStrings=-1, int index=-1);
+
+    void       insertItem( const QString &text, int index=-1 );
+    void       insertItem( const QPixmap &pixmap, int index=-1 );
+    void       insertItem( const QPixmap &pixmap, const QString &text, int index=-1 );
+
+    void       removeItem( int index );
+
+    int                currentItem();
+    virtual void setCurrentItem( int index );
+
+    QString    currentText() const;
+    virtual void setCurrentText( const QString& );
+
+    QString    text( int index ) const;
+    const QPixmap pixmap( int index ) const;
+
+    void       changeItem( const QString &text, int index );
+    void       changeItem( const QPixmap &pixmap, int index );
+    void       changeItem( const QPixmap &pixmap, const QString &text, int index );
+
+    //--bool   autoResize()    const;
+    //--virtual void setAutoResize( bool );
+    QSize      sizeHint() const;
+
+    void       setPalette( const QPalette & );
+    void       setFont( const QFont & );
+    void       setEnabled( bool );
+
+    //--virtual void setSizeLimit( int );
+    //--int            sizeLimit() const;
+
+
+    virtual void setMaxCount( int );
+    int                maxCount() const;
+
+    virtual void setInsertionPolicy( Policy policy );
+    QComboBox::Policy  insertionPolicy() const;
+
+    virtual void setValidator( const QValidator * );
+    const QValidator * validator() const;
+
+    //--virtual void setListBox( Q3ListBox * );
+    //--Q3ListBox *    listBox() const;
+
+    virtual void setLineEdit( QLineEdit *edit );
+    QLineEdit* lineEdit() const;
+
+    virtual void setAutoCompletion( bool );
+    bool       autoCompletion() const;
+
+    bool       eventFilter( QObject *object, QEvent *event );
+
+    void       setDuplicatesEnabled( bool enable );
+    bool       duplicatesEnabled() const;
+
+    bool       editable() const;
+    void       setEditable( bool );
+
+    virtual void popup();
+
+    void       hide();
+
+};
+
+
+#endif
diff --git a/src/plugins/combobox/acombobox_plugin.cpp b/src/plugins/combobox/acombobox_plugin.cpp
new file mode 100644 (file)
index 0000000..4cec34d
--- /dev/null
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "acombobox_plugin.h"
+
+#include <QtPlugin>
+
+#include "acombobox.h"
+
+
+AComboBoxPlugin::AComboBoxPlugin(QObject *parent)
+    : QObject(parent), m_initialized(false)
+{
+    m_initialized = false;
+}
+
+bool AComboBoxPlugin::isContainer() const
+{
+    return false;
+}
+
+bool AComboBoxPlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void AComboBoxPlugin::initialize(QDesignerFormEditorInterface *core)
+{
+    if (m_initialized)
+        return;
+    Q_UNUSED(core);
+    m_initialized = true;
+}
+
+QWidget *AComboBoxPlugin::createWidget(QWidget *parent)
+{
+    AComboBox *w = new AComboBox(parent, 0);
+    return w;
+}
+
+QString AComboBoxPlugin::name() const
+{
+    return QLatin1String("AComboBox");
+}
+
+QString AComboBoxPlugin::group() const
+{
+    return QLatin1String("Ananas");
+}
+
+QString AComboBoxPlugin::toolTip() const
+{
+    return QString("Ananas for QT custom combobox");
+}
+
+QString AComboBoxPlugin::whatsThis() const
+{
+    return QString("");
+}
+
+QString AComboBoxPlugin::includeFile() const
+{
+    return QLatin1String("acombobox.h");
+}
+
+QIcon AComboBoxPlugin::icon() const
+{
+    //return QIcon();
+    return QIcon(":/images/acombobox.png");
+}
+
+QString AComboBoxPlugin::domXml() const
+{
+    return "<widget class=\"AComboBox\" name=\"AComboBox_1\">\n</widget>\n";
+}
diff --git a/src/plugins/combobox/acombobox_plugin.h b/src/plugins/combobox/acombobox_plugin.h
new file mode 100644 (file)
index 0000000..2f43ce1
--- /dev/null
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef ACOMBOBOX_PLUGIN_H
+#define ACOMBOBOX_PLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+#include <qwidgetplugin.h>
+
+
+class QT_WIDGET_PLUGIN_EXPORT AComboBoxPlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+    AComboBoxPlugin(QObject *parent=0);
+
+    bool isContainer() const;
+    bool isInitialized() const;
+    void initialize(QDesignerFormEditorInterface *core);
+    QWidget *createWidget(QWidget *parent);
+
+    QString name() const;
+    QString group() const;
+    QString toolTip() const;
+    QString whatsThis() const;
+    QString includeFile() const;
+    QIcon icon() const;
+    QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+#endif // ACOMBOBOX_PLUGIN_H
diff --git a/src/plugins/combobox/combobox.pri b/src/plugins/combobox/combobox.pri
new file mode 100644 (file)
index 0000000..3051470
--- /dev/null
@@ -0,0 +1,7 @@
+HEADERS += \
+    combobox/acombobox.h \
+    combobox/acombobox_plugin.h 
+
+SOURCES += \
+    combobox/acombobox.cpp \
+    combobox/acombobox_plugin.cpp 
diff --git a/src/plugins/dbfield/dbfield.pri b/src/plugins/dbfield/dbfield.pri
new file mode 100644 (file)
index 0000000..7599d16
--- /dev/null
@@ -0,0 +1,15 @@
+HEADERS += \
+    dbfield/edbfield.h \
+    dbfield/wdbfield.h \
+    dbfield/wdbfield_plugin.h \
+    dbfield/wdbfield_taskmenu.h 
+
+SOURCES += \
+    dbfield/edbfield.cpp \
+    dbfield/wdbfield.cpp \
+    dbfield/wdbfield_plugin.cpp \
+    dbfield/wdbfield_taskmenu.cpp \
+        
+FORMS += \
+    dbfield/edbfield.ui
+    
\ No newline at end of file
diff --git a/src/plugins/dbfield/edbfield.cpp b/src/plugins/dbfield/edbfield.cpp
new file mode 100644 (file)
index 0000000..dd81233
--- /dev/null
@@ -0,0 +1,137 @@
+#include "edbfield.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "acfg.h"
+#include "wdbfield.h"
+
+/*
+ *  Constructs a eDBField as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+eDBField::eDBField(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+eDBField::~eDBField()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void eDBField::languageChange()
+{
+    retranslateUi(this);
+}
+
+
+void eDBField::init()
+{
+       eName->clear();
+       onames.clear();
+       oids.clear();
+}
+
+
+
+void eDBField::setData( QWidget *o, aCfg *md )
+{
+//    const QObject *o = sender();
+    if ( o ) {
+       if ( o->className() != QString("wDBField") || !md ) {
+           reject();
+           return;
+       }
+    }
+    else {
+       reject();
+       return;
+    }
+    int w=0, d=0, idx=0;
+    unsigned int i;
+    long oid, widgetId, fieldId;
+    QString pn;
+    aWidget *widget;
+    wDBField *field = (wDBField*)o;
+    QWidget *pWidget = field->parentWidget();
+
+    while ( pWidget ) {
+       pn = "";
+       pn = pWidget->className();
+       if ( pn == QString("wCatalogue") || pn == QString("wDocument") ) break;
+       pWidget = pWidget->parentWidget();
+    }
+    if ( pn == QString("wCatalogue") ) widget = (wCatalogue*)pWidget; else
+    if ( pn == QString("wDocument") ) widget = (wDocument*)pWidget; else
+    return;
+
+    widgetId = widget->getId();
+    //fieldId = field->getId();
+    if ( widgetId ) widget->setMDObject( md->find( widgetId ) );
+
+//    printf( "parent widget id = %i\n", widgetId );
+//    printf( "field id = %i\n", fieldId );
+//    printf( "metadata id = %i\n", md->id( *widget->getMDObject() ) );
+
+    QStringList tlist = md->types( md_field, widget->getMDObject() );
+    otypes.clear();
+    eType->clear();
+    for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
+       otypes.append( (*it).section( "\t", 0, 0 ) );
+       eName->insertItem( (*it).section("\t", 1, 1 ), idx++ );
+    }
+    for ( i = 0 ; i < otypes.count(); i++ ) {
+       oid = 0;
+       if( otypes[i][0] == 'O' ) {
+           sscanf( (const char *)otypes[ i ], "O %d", &oid );
+           if ( oid == fieldId ) {
+               eName->setCurrentItem( i );
+               break;
+           }
+       }
+    }
+}
+
+
+void eDBField::getData( QWidget *o )
+{
+//    const QObject *o = sender();
+    if ( !o ) return;
+    if ( o->className() != QString("wDBField") ) return;
+    wDBField *f = ( wDBField*) o;
+
+    int idx=eName->currentItem();
+    long oid = 0;
+    if (f) {
+       if( otypes[idx][0] == 'O' ) {
+           sscanf( (const char *)otypes[ idx ], "O %d", &oid );
+          // f->setId( oid );
+       }
+    }
+}
+
+
+void eDBField::namechanged( const QString &s )
+{
+    int idx=eName->currentItem();
+//     printf("new str=%s\n", (const char *) s.utf8());
+    selotype=otypes[idx];
+    seloid=oids[idx];
+    eType->setText(onames[idx]);
+}
+
diff --git a/src/plugins/dbfield/edbfield.h b/src/plugins/dbfield/edbfield.h
new file mode 100644 (file)
index 0000000..6830c99
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef EDBFIELD_H
+#define EDBFIELD_H
+
+#include "ui_edbfield.h"
+
+
+class eDBField : public QDialog, public Ui::eDBField
+{
+    Q_OBJECT
+
+public:
+    eDBField(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~eDBField();
+
+    QStringList oids;
+    QString selotype;
+    QStringList otypes;
+    QString seloid;
+
+public slots:
+    virtual void setData( QWidget * o, aCfg * md );
+    virtual void getData( QWidget * o );
+    virtual void namechanged( const QString & s );
+
+protected:
+    QStringList onames;
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    void init();
+
+};
+
+#endif // EDBFIELD_H
diff --git a/src/plugins/dbfield/edbfield.ui b/src/plugins/dbfield/edbfield.ui
new file mode 100644 (file)
index 0000000..18d158d
--- /dev/null
@@ -0,0 +1,134 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>eDBField</class>\r
+  <widget class="QDialog" name="eDBField" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>356</width>\r
+        <height>161</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Database field</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item row="1" column="0" >\r
+        <widget class="QLabel" name="textLabel2" >\r
+          <property name="text" >\r
+            <string>Field type</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="0" column="0" >\r
+        <widget class="QLabel" name="textLabel1" >\r
+          <property name="text" >\r
+            <string>Field name</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item rowspan="1" row="1" column="1" colspan="2" >\r
+        <widget class="QLabel" name="eType" >\r
+          <property name="frameShape" >\r
+            <enum>QFrame::Box</enum>\r
+          </property>\r
+          <property name="text" >\r
+            <string/>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item rowspan="1" row="0" column="1" colspan="2" >\r
+        <widget class="QComboBox" name="eName" />\r
+      </item>\r
+      <item row="3" column="0" >\r
+        <widget class="QPushButton" name="pushButton1" >\r
+          <property name="text" >\r
+            <string>OK</string>\r
+          </property>\r
+          <property name="default" >\r
+            <bool>true</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="3" column="2" >\r
+        <spacer name="spacer5" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>101</width>\r
+              <height>31</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Horizontal</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+      <item row="3" column="1" >\r
+        <widget class="QPushButton" name="pushButton2" >\r
+          <property name="text" >\r
+            <string>Cancel</string>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="2" column="1" >\r
+        <spacer name="spacer7" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>21</width>\r
+              <height>21</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Vertical</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="6" margin="11" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >ananas.h</include>\r
+    <include location="local" >wfield.h</include>\r
+    <include location="local" >wcatalogue.h</include>\r
+    <include location="local" >wdocument.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>pushButton1</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eDBField</receiver>\r
+      <slot>accept()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>pushButton2</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eDBField</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eName</sender>\r
+      <signal>activated(QString)</signal>\r
+      <receiver>eDBField</receiver>\r
+      <slot>namechanged(QString)</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/dbfield/wdbfield.cpp b/src/plugins/dbfield/wdbfield.cpp
new file mode 100644 (file)
index 0000000..7fba231
--- /dev/null
@@ -0,0 +1,423 @@
+/****************************************************************************
+** $Id: wdbfield.cpp,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Code file of the field plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <stdlib.h>
+#include <q3listbox.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+
+#include "ananas.h"
+#include "wfield.h"
+#include "edbfield.h"
+#include "wdbfield.h"
+#include "addfdialog.h"
+//--#include "mainform.h"
+
+
+
+/*!
+ * \en Constructor without name. \_en
+ * \ru         Создает конструктор без указания имени виджета. \_ru
+ */
+wDBField::wDBField( QWidget *parent, Qt::WFlags fl )
+    : wField( parent, "wDBField", fl)
+{
+       init();
+}
+
+
+
+/*!
+ * \en Constructor. \_en
+ * \ru Конструктор. \_ru
+ */
+wDBField::wDBField( QWidget *parent, const char *name, Qt::WFlags fl )
+    : wField( parent, name, fl)
+{
+       init();
+}
+
+
+
+/*!
+ * \en Destructor. \_en
+ * \ru Деструктор. \_ru
+ */
+wDBField::~wDBField()
+{
+
+}
+
+
+/*!
+ * \en Creates property editor dialog window. \_en
+ * \ru         Создает окно диалога редактора свойств.\_ru
+ *     \param parent - \en parent \_en \ru родитель \_ru
+ */
+QDialog*
+wDBField::createEditor( QWidget *parent )
+{
+       return new addfdialog( parent );
+}
+
+
+/*!
+ * \en Opens property editor dialog form. \_en
+ * \ru Открывает окно диалога редактора свойств. \_ru
+ */
+void wDBField::openEditor()
+{
+/*
+       QString s;
+  QValueList<Q_ULLONG> bindList = getBindList();
+  addfdialog e(this->topLevelWidget());
+  getFields();
+  e.setData( defDisplayFields, defFields,defId);
+  e.ListBox->setCurrentItem(e.ListBox->findItem(getFieldName()));
+       if ( e.exec()==QDialog::Accepted )
+       {
+               s = e.getData(true);
+               if(s.isEmpty()) return;
+               setFieldName(s);
+               s = e.getData(false);
+               if(s=="0") return;
+               // if select binding field
+               if(bindList.find(s.toULongLong()) != bindList.end())
+               {
+                       cfg_message(0, tr("field already binding, please select another field."));
+                       return;
+               }
+               setId(s.toInt());
+               setEditorType();
+               updateProp();
+    }
+    */
+}
+
+
+
+
+
+
+
+/*!
+ * \en         Sets property value `fieldName'. \_en
+ * \ru Устанавливает значение свойства `fieldName'. \_ru
+ */
+void
+wDBField::setFieldName( QString n )
+{
+    FieldName=n;
+}
+
+
+/*!
+ * \en         Gets field name in metadata. \_en
+ * \ru Получение имени поля в метаданных, на которое настроен виджет. \_ru
+ * return - \en Field name. \_en \ru Имя поля в метаданных.\_ru
+ */
+/*
+QString
+wDBField::getMdFieldName() const
+{
+       aCfgItem o = md->find(getId());
+       if(!o.isNull())
+       {
+               return md->attr(o,mda_name);
+       }
+       else
+       {
+               return getFieldName();
+       }
+}
+*/
+/*!
+ * \en Inits widget. Gets copy of metadata from designer window. \_en
+ * \ru Инициализирунт виджет.
+ *     Получает метаданные из окна дизайнера. \_ru
+ */
+void
+wDBField::init()
+{
+       qulonglong id;
+       id=0;
+       //get copy of metadata
+       md = getMd();
+       if(md)
+       {
+               // get id of container object - catalogue or document
+               id = aWidget::parentContainer(this)->getId();
+               head = md->find(id);
+       }
+}
+
+
+
+/*!
+ * \en Gets list of fields and id for Document.Header or Catalogue.Element and
+ *     Catalogue.Group \_en
+ * \ru Возвращает список полей, определенных в метаданных, для шапки документа
+ *     или элемента и группы каталога.
+ *     К имени уже забинденного поля добавляет впереди звездочку.
+ *     Для групп и элементов каталога добавляет в конце (element) или (group) \_ru
+ *     \return \en List of field name \_en \ru Список имен полей \_ru
+ */
+QStringList
+wDBField::getFields()
+{
+  QStringList lst, dlst;
+  QString str;
+  int res,i;
+  Q3ValueList<qulonglong> bindList = getBindList();
+  aCfgItem o, o_head;
+  defId.clear();
+  defFields.clear();
+  defDisplayFields.clear();
+  if(!head.isNull())
+  {
+       if(md->objClass(head) == md_catalogue)
+       {
+//             printf("getting fields from metadata\n");
+               o = md->findChild(head,md_element); //object element
+               res = md->countChild(o,md_field);
+//             printf("find elements\n");
+               for( i = 0; i < res; i++ )
+               {
+//                     printf("find %d elem\n",i);
+                       o_head = md->findChild(o,md_field,i);
+                       if(md->attr(o_head,mda_type).at(0)!=' ')
+                       {
+//                             printf("mda_type = %s\n",md->attr(o_head,mda_type).ascii());
+                               lst << md->attr(o_head,mda_name);
+                               dlst << md->attr(o_head,mda_name) + " (element)";
+                               defId << md->attr(o_head,mda_id);
+                       }
+                       else
+                       {
+//                             printf("calculated field not allowed here\n");
+                       }
+               }
+               o = md->findChild(head,md_group); // object group
+               res = md->countChild(o,md_field);
+//             printf("find groups\n");
+               for( i = 0; i < res; i++ )
+               {
+//                     printf("find %d group\n",i);
+                       o_head = md->findChild(o,md_field,i);
+                       //--if(md->attr(o,mda_type).left(1)!=' ')
+                       if(md->attr(o,mda_type).at(0)!=' ')
+                       {
+                               lst << md->attr(o_head,mda_name);
+                               dlst << md->attr(o_head,mda_name) + " (group)";
+                               defId << md->attr(o_head,mda_id);
+                       }
+               }
+       }
+       else
+       {
+               o = md->findChild(head,md_header); // object header
+               res = md->countChild(o,md_field);
+               for( i = 0; i < res; i++ )
+               {
+                       o_head = md->findChild(o,md_field,i);
+                       dlst << md->attr(o_head,mda_name);
+                       lst << md->attr(o_head,mda_name);
+                       defId << md->attr(o_head,mda_id);
+               }
+       }
+       res = lst.count();
+       for(int i=0; i<res; i++)
+       {
+               if(bindList.find(defId[i].toULongLong())!=bindList.end())
+                       str ="* ";
+               else
+                       str ="";
+               dlst[i] = str + dlst[i]; // addes available for binding fields name
+       //      printf("defField[%d]=%s\n",i,defFields[i].ascii());
+       }
+  }
+//<<<<<<< wdbfield.cpp
+       defDisplayFields = dlst;
+//     defDisplayFields = s;
+               defFields = lst;
+//=======
+//>>>>>>> 1.37.2.4
+return defFields;
+}
+
+
+
+//<<<<<<< wdbfield.cpp
+/*
+ * \en Updates object. \_en
+ * \ru         Записывает значение объекта в базу. \_ru
+*/
+/*
+int
+wDBField::Update()
+{
+       if(dbobj)
+       {
+               return dbobj->Update();
+       }
+       else
+       {
+               return err_abstractobj;
+       }
+}
+*/
+
+
+/*
+ * \en Inits object. \_en
+ * \ru         Инициализирует объект. \_ru
+*/
+/*
+aObject *
+wDBField::createDBObject(aCfgItem o, aDatabase *adb )
+{
+//  wField::initObject( adb );
+ // aCfgItem o;
+ / o = md->find( getId() );
+  aObject* obj = new aObject(o,adb);
+  aCfgItem g = md->parent( o );//, e = md->find( obj, md_element );
+  obj->tableInsert( aDatabase::tableDbName( *md, g ), g );
+  debug_message("table inserted\n");
+  return obj;
+}
+*/
+void
+wDBField::initObject(aDatabase *adb )
+{
+  wField::initObject( adb );
+  //aCfgItem o;
+  //o = md->find( getId() );
+  //aObject* obj = new aObject(o,adb);
+  //tableInsert( aDatabase::tableDbName( *md, o ), o );
+//  debug_message("init dbfield  \n");
+}
+
+//=======
+//>>>>>>> 1.37.2.4
+/*!
+ * \en Set widget type, use property `Id'. \_en
+ * \ru         Устанавливает тип виджета, используя свойство `Id'. \_ru
+ */
+void
+wDBField::setEditorType ()
+{
+    aCfgItem o_head,o;
+    QString str, type;
+    int id;
+       if(!head.isNull())
+       {
+               id = property("Id").toInt();
+               o_head = md->find(id);
+               if(!o_head.isNull())
+               {
+                       type = md->attr(o_head,mda_type);
+                       setFieldType(type);
+                       str = type.section(' ',0,0);
+                       // gets type of editor
+                       if(str=="N") wField::setEditorType(Numberic);
+                       if(str=="C") wField::setEditorType(String);
+                       if(str=="D") wField::setEditorType(Date);
+                       if(str=="B") wField::setEditorType(Boolean);
+                       if(str=="O")
+                       {
+                       //editor type is Object .
+                       //May be Catalog or Document.
+                               qulonglong tid;
+                               //gets object id.
+                               str = type.section(' ',1,1);
+                               tid = atol(str);
+                               o = md->find(tid);
+                               if(!o.isNull())
+                               {
+                                       //gets object class
+                                       str = md->objClass(o);
+                                       if(str == md_catalogue)
+                                               // and set editor
+                                               wField::setEditorType(Catalogue);
+                                       if(str == md_document)
+                                               wField::setEditorType(Document);
+
+                               }
+
+                       }
+
+               }
+
+       }
+
+}
+
+
+/*!
+ * \en Gets list of binding fields id. \_en
+ * \ru Получает список id забинденых полей. Корректно работает с удаленными
+ *     виджетами. \_ru
+ *     \return \en List of binding fields id. \_en
+ *             \ru Список id забинденых полей. \_ru
+ */
+Q3ValueList<qulonglong>
+wDBField::getBindList()
+{
+aCfgItem obj;
+QObjectList wList;
+int id;
+Q3ValueList<qulonglong> listBindings;
+wDBField* wfield;
+QObject* wd = aWidget::parentContainer (this);
+       listBindings.clear();
+       wList = wd->queryList( "wDBField" );
+       QListIterator<QObject*> it( wList ); // iterate over the wDBTable
+       while ( it.hasNext() )
+       {
+               wfield = qobject_cast<wDBField*>( it.next() );
+
+               if(strcmp(wfield->name(),this->name())) // don't added current id
+               {
+               //don.t added deleted widgets
+                  if(strncmp("qt_dead_widget_",wfield->name(),strlen("qt_dead_widget_")))
+                  {
+                       id = wfield->property("Id").toULongLong();
+       //              if(id>=0) // don't added negativ id (table while not selected)
+       //              {
+                               listBindings << id;
+//                             printf(">>>added id = `%d'\n",id);
+       //              }
+                  }
+               }
+       }
+       //--delete wList;
+return listBindings;
+}
+
diff --git a/src/plugins/dbfield/wdbfield.h b/src/plugins/dbfield/wdbfield.h
new file mode 100644 (file)
index 0000000..2eea7a9
--- /dev/null
@@ -0,0 +1,98 @@
+/****************************************************************************
+** $Id: wdbfield.h,v 1.1 2008/11/05 21:16:29 leader Exp $
+**
+** Header file of the field plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QADBFIELD_H
+#define QADBFIELD_H
+
+#include <qwidget.h>
+#include <qwidgetplugin.h>
+#include <qlabel.h>
+#include <qobject.h>
+#include <qlayout.h>
+#include <q3socket.h>
+#include <qeventloop.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include "adatabase.h"
+#include "acfg.h"
+#include "wfield.h"
+//#include "addfdialog.h"
+
+/*!
+ * \en
+ *     \brief Ananas DBField. widget.
+ * \_en
+ * \ru
+ *     \brief Универсальный Плагин -- виджет, предназначен для редактирования атрибутов бизнес объектов Ананаса.
+ *     Наследует wField.
+ *
+ *     Основным полезным свойством этого визуального класса является возможность его привязки к атрибуту persistence бизнес объекта
+ *     Ананаса. Как только привязка задана - логика заполнения объекта значением соответствующего атрибута бизнес объекта, логика
+ *     сохранения заданного пользователем значения в соответствующем атрибуте бизнес объекта выполняется автоматически runtime
+ *     подсистемой Ананаса. То есть мы используем прием, который имеет общепринятое название data bindings.
+ *
+ * \_ru
+ */
+class QT_WIDGET_PLUGIN_EXPORT wDBField : public wField
+{
+       Q_OBJECT
+
+       Q_PROPERTY( bool openEditor READ getOpenEditor WRITE setOpenEditor STORED false)
+       Q_PROPERTY( QString FieldName READ getFieldName WRITE setFieldName )
+
+friend class addfdialog;
+
+
+public:
+
+       wDBField( QWidget *parent, Qt::WFlags fl );
+       wDBField( QWidget *parent, const char *name, Qt::WFlags fl );
+       ~wDBField();
+
+       virtual QDialog* createEditor( QWidget *parent );
+       virtual void initObject( aDatabase *adb );
+       void            openEditor();
+       bool            getOpenEditor() const   { return false;         };
+       virtual QString getFieldName()  const   { return FieldName;     };
+       void            setOpenEditor(bool b)   { if(b) openEditor();   };
+       void            setFieldName(QString n);
+protected:
+       QStringList     getFields();
+       void            init();
+       Q3ValueList<qulonglong> getBindList();
+       void            setEditorType(void);
+
+       QString         FieldName;
+       QStringList     defDisplayFields,defFields,defId;
+
+private:
+       aCfgItem head;
+};
+#endif
diff --git a/src/plugins/dbfield/wdbfield_plugin.cpp b/src/plugins/dbfield/wdbfield_plugin.cpp
new file mode 100644 (file)
index 0000000..edba874
--- /dev/null
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "wdbfield_plugin.h"
+
+#include <QtPlugin>
+#include <QDesignerFormEditorInterface>
+#include <QExtensionManager>
+
+#include "wdbfield_taskmenu.h"
+#include "wdbfield.h"
+
+
+wDBFieldPlugin::wDBFieldPlugin(QObject *parent)
+    : QObject(parent), m_initialized(false)
+{
+    m_initialized = false;
+}
+
+bool wDBFieldPlugin::isContainer() const
+{
+    return false;
+}
+
+bool wDBFieldPlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void wDBFieldPlugin::initialize(QDesignerFormEditorInterface *core)
+{
+    if (m_initialized)
+        return;
+    Q_UNUSED(core);
+
+    QExtensionManager *manager = core->extensionManager();
+    Q_ASSERT(manager != 0);
+    manager->registerExtensions(new wDBFieldTaskMenuFactory(manager),
+                                Q_TYPEID(QDesignerTaskMenuExtension));
+
+    m_initialized = true;
+    printf("dbfield inited\n");
+}
+
+QWidget *wDBFieldPlugin::createWidget(QWidget *parent)
+{
+    wDBField *w = new wDBField(parent, 0);
+    return w;
+}
+
+QString wDBFieldPlugin::name() const
+{
+    return QLatin1String("wDBField");
+}
+
+QString wDBFieldPlugin::group() const
+{
+    return QLatin1String("Ananas");
+}
+
+QString wDBFieldPlugin::toolTip() const
+{
+    return QString("Ananas for QT Database Field Edit Widget");
+}
+
+QString wDBFieldPlugin::whatsThis() const
+{
+    return QString("Entry to modify field value of Ananas's object");
+}
+
+QString wDBFieldPlugin::includeFile() const
+{
+    return QLatin1String("wdbfield.h");
+}
+
+QIcon wDBFieldPlugin::icon() const
+{
+    //return QIcon();
+//QIcon i = QIcon(":/images/wdbfield.png");
+//if (i.isNull()) printf("FIELD ICON is NULL\n");
+//else printf("field icon OK\n");
+    return QIcon(":/images/wdbfield.png");
+}
+
+QString wDBFieldPlugin::domXml() const
+{
+    return "<widget class=\"wDBField\" name=\"wDBField_1\">\n</widget>\n";
+}
diff --git a/src/plugins/dbfield/wdbfield_plugin.h b/src/plugins/dbfield/wdbfield_plugin.h
new file mode 100644 (file)
index 0000000..7d91c11
--- /dev/null
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef WDBFIELD_PLUGIN_H
+#define WDBFIELD_PLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+#include "qwidgetplugin.h"
+
+
+class QT_WIDGET_PLUGIN_EXPORT wDBFieldPlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+    wDBFieldPlugin(QObject *parent=0);
+
+    bool isContainer() const;
+    bool isInitialized() const;
+    void initialize(QDesignerFormEditorInterface *core);
+    QWidget *createWidget(QWidget *parent);
+
+    QString name() const;
+    QString group() const;
+    QString toolTip() const;
+    QString whatsThis() const;
+    QString includeFile() const;
+    QIcon icon() const;
+    QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+#endif // WDBFIELD_PLUGIN_H
diff --git a/src/plugins/dbfield/wdbfield_taskmenu.cpp b/src/plugins/dbfield/wdbfield_taskmenu.cpp
new file mode 100644 (file)
index 0000000..aec82e0
--- /dev/null
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include <QDesignerFormEditorInterface>
+
+#include <QAction>
+
+#include "wdbfield_taskmenu.h"
+#include "wdbfield.h"
+#include "addfdialog.h"
+
+
+wDBFieldTaskMenu::wDBFieldTaskMenu(wDBField *widget, QObject *parent)
+    : QObject(parent)
+{
+    m_widget = widget;
+
+    m_editAction = new QAction(tr("Edit ..."), this);
+    connect(m_editAction, SIGNAL(triggered()), this, SLOT(edit()));
+}
+
+void wDBFieldTaskMenu::edit()
+{
+    /*addfdialog e;
+
+       e.setData(m_widget);
+       if (e.exec() == QDialog::Accepted)
+       {
+               e.getData(m_widget);
+       }*/
+       m_widget->widgetEditor();
+}
+
+QAction *wDBFieldTaskMenu::preferredEditAction() const
+{
+    return m_editAction;
+}
+
+QList<QAction *> wDBFieldTaskMenu::taskActions() const
+{
+    QList<QAction *> list;
+    list.append(m_editAction);
+    return list;
+}
+
+wDBFieldTaskMenuFactory::wDBFieldTaskMenuFactory(QExtensionManager *parent)
+    : QExtensionFactory(parent)
+{
+}
+
+QObject *wDBFieldTaskMenuFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
+{
+    if (iid != Q_TYPEID(QDesignerTaskMenuExtension))
+        return 0;
+
+    if (wDBField *df = qobject_cast<wDBField*>(object))
+        return new wDBFieldTaskMenu(df, parent);
+
+    return 0;
+}
diff --git a/src/plugins/dbfield/wdbfield_taskmenu.h b/src/plugins/dbfield/wdbfield_taskmenu.h
new file mode 100644 (file)
index 0000000..9ae82dd
--- /dev/null
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef WDBFIELD_TASKMENU_H
+#define WDBFIELD_TASKMENU_H
+
+#include <QDesignerTaskMenuExtension>
+#include <QExtensionFactory>
+
+
+class QExtensionManager;
+class QAction;
+class wDBField;
+
+class wDBFieldTaskMenu: public QObject, public QDesignerTaskMenuExtension
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerTaskMenuExtension)
+public:
+    wDBFieldTaskMenu(wDBField *widget, QObject *parent);
+
+    QAction *preferredEditAction() const;
+    QList<QAction *> taskActions() const;
+
+private slots:
+    void edit();
+
+private:
+    QAction *m_editAction;
+    wDBField *m_widget;
+};
+
+class wDBFieldTaskMenuFactory: public QExtensionFactory
+{
+    Q_OBJECT
+public:
+    wDBFieldTaskMenuFactory(QExtensionManager *parent = 0);
+
+protected:
+    QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
+};
+
+#endif // WDBFIELD_TASKMENU_H
diff --git a/src/plugins/dbtable/dbtable.pri b/src/plugins/dbtable/dbtable.pri
new file mode 100644 (file)
index 0000000..5e2a3cb
--- /dev/null
@@ -0,0 +1,15 @@
+HEADERS += \
+    dbtable/edbtable.h \
+    dbtable/wdbtable.h \
+    dbtable/wdbtable_plugin.h \
+    dbtable/wdbtable_taskmenu.h 
+
+SOURCES += \
+    dbtable/edbtable.cpp \
+    dbtable/wdbtable.cpp \
+    dbtable/wdbtable_plugin.cpp \
+    dbtable/wdbtable_taskmenu.cpp 
+        
+FORMS += \
+    dbtable/edbtable.ui 
+    
diff --git a/src/plugins/dbtable/edbtable.cpp b/src/plugins/dbtable/edbtable.cpp
new file mode 100644 (file)
index 0000000..2477cda
--- /dev/null
@@ -0,0 +1,521 @@
+#include "edbtable.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include <stdlib.h>
+#include "wdbtable.h"
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3SqlFieldInfo>
+
+/*
+ *  Constructs a eDBTable as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+eDBTable::eDBTable(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+eDBTable::~eDBTable()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void eDBTable::languageChange()
+{
+    retranslateUi(this);
+}
+
+void eDBTable::init()
+{
+}
+
+
+void
+eDBTable::destroy()
+{
+//     tablerow_free( r );
+}
+
+
+/*
+void eDBTable::insertColumn(const char *Header, const char *Name,
+int idxt, int cw, int tw, int td)
+{
+
+tablefield *f;
+char s[30];
+
+sprintf(s, "%s %i %i", (const char *)otypes[idxt], tw, td);
+
+f = tablefield_newsys(Name, s, "");
+tablefield_setheader(f, Header);
+f->sizex = cw;
+f->flen = tw;
+f->decimals = td;
+f->ftypeindex = idxt;
+tablerow_insertcolumn(r, f, -1);
+
+//     blockSignals( true );
+ListCol->insertItem(trUtf8(Header));
+//     eColHeader->setText( trUtf8(Header));
+//     eColName->setText(trUtf8(Name));
+//     eColWidth->setValue(cw);
+//     eColTWidth->setValue(tw);
+//     eColTDec->setValue(td);
+//     blockSignals( false );
+if (ListCol->count()) ListCol->setCurrentItem(ListCol->count()-1);
+
+}
+*/
+
+
+
+void eDBTable::ColumnDel()
+{
+
+int idx;
+QString str;
+idx = ListCol->currentItem();
+if (idx != -1 && ListCol->count()>0)
+{
+       str = fname[idx];
+       table->removeColumn(idx);
+       deletedFields.append(str);
+       deletedFieldsId.append(idlist[idx]);
+       idlist.remove(idlist.at(idx));
+       fname.remove(fname.at(idx));
+       cwidth.remove(cwidth.at(idx));
+       ListCol->removeItem(idx);
+//     table->removeColumn(idx);
+}
+}
+
+void eDBTable::ColumnL()
+{
+ int idx;
+ QString str;
+ QStringList::Iterator it;
+       idx = ListCol->currentItem();
+       if(idx>0)
+       {
+               str = fname[idx];
+               //--it = fname.at(idx);
+               //--fname.remove(it);
+               fname.removeAt(idx);
+               //--it = fname.at(idx-1);
+               //--fname.insert(it,str);
+               fname.insert(idx-1,str);
+
+               str = idlist[idx];
+               //--it = idlist.at(idx);
+               //--idlist.remove(it);
+               idlist.removeAt(idx);
+               //--it = idlist.at(idx-1);
+               //--idlist.insert(it,str);
+               idlist.insert(idx-1,str);
+
+               str = cwidth[idx];
+               //--it = cwidth.at(idx);
+               //--cwidth.remove(it);
+               cwidth.removeAt(idx);
+               //--it = cwidth.at(idx-1);
+               //--cwidth.insert(it,str);
+               cwidth.insert(idx-1,str);
+
+               str = ListCol->currentText();
+               ListCol->removeItem(idx);
+               ListCol->insertItem(str,idx-1);
+               ListCol->setSelected(idx-1,true);
+       }
+}
+
+
+void eDBTable::ColumnR()
+{
+ uint idx;
+ QString str;
+ QStringList::Iterator it;
+       idx = ListCol->currentItem();
+       if(idx<ListCol->count()-1)
+       {
+               str = fname[idx];
+               //--it = fname.at(idx);
+               //--fname.remove(it);
+               fname.removeAt(idx);
+               //--it = fname.at(idx+1);
+               //--fname.insert(it,str);
+               fname.insert(idx+1,str);
+
+               str = idlist[idx];
+               //--it = idlist.at(idx);
+               //--idlist.remove(it);
+               idlist.removeAt(idx);
+               //--it = idlist.at(idx+1);
+               //--idlist.insert(it,str);
+               idlist.insert(idx+1,str);
+
+               str = cwidth[idx];
+               //--it = cwidth.at(idx);
+               //--cwidth.remove(it);
+               cwidth.removeAt(idx);
+               //--it = cwidth.at(idx+1);
+               //--cwidth.insert(it,str);
+               cwidth.insert(idx+1,str);
+
+               str = ListCol->currentText();
+               ListCol->removeItem(idx);
+               ListCol->insertItem(str,idx+1);
+               ListCol->setSelected(idx+1,true);
+       }
+
+}
+void eDBTable::ColumnSel(int col)
+{
+QString str,s;
+int ind = 0;
+QStringList lst;
+       eColHeader->blockSignals(true);
+       eColWidth->blockSignals(true);
+       eType->clear();
+       eColTWidth->setValue(0);
+       eColTDec->setValue(0);
+       eColHeader->setText("");
+       eColWidth->setValue(0);
+       eColName->setText("");
+//     str = table->getFieldType((const char*) ComboBoxTable->currentText().utf8(),(const char*)ListCol->currentText().utf8());
+       //if(eColHeader->text="")
+//     ListCol->blockSignals( TRUE );
+       //ListCol->changeItem(s, ListCol->currentItem());
+
+//     printf(">>>read property DefHeaders in %s\n", table->name());
+//     lst = table->property("DefHeaders").toStringList();
+//     printf(">>>ok!\n");
+//     ListCol->clear();
+//     printf(">>>insert str list\n");
+//     ListCol->insertStringList(lst);
+//     ListCol->setCurrentItem(col);
+//     ListCol->blockSignals( FALSE );
+       if(col==-1 || ListCol->count()==0) return;
+//     printf(">>>set text in eColHeader\n");
+       eColHeader->setText(ListCol->currentText());
+       eColHeader->blockSignals(false);
+       ind = ListCol->currentItem();
+       str = cwidth[ind];
+       eColWidth->setValue(atoi(str));
+       eColWidth->blockSignals(false);
+       str = fname[ind];
+       eColName->setText(str);
+//     eType->clear();
+//     printf(">>>get fields type\n");
+//     str = eColName->text();
+
+       str = table->getFieldType(idlist[ind].toInt());
+//     parse string with type, num, numdec
+       if(!str.isEmpty())
+       {
+               eType->setText(str.left(1));
+               str.remove(0,2);
+               if(!str.isEmpty())
+               {
+//                     printf(">>>%s\n",str.ascii());
+                       eColTWidth->setValue(atoi(str));
+               }
+               ind = str.find(" ");
+               if(ind)// poisk decimal chasti
+               {
+                       s = str.remove(0,str.find(" "));
+               }
+               else
+               {
+                       str="0";
+               }
+//             printf(">>>%s\n",str.ascii());
+               eColTDec->setValue(atoi(str));
+       }
+       else
+       {
+//             printf(">>>unknown field\n");
+       }
+       /*
+       tablefield *f;
+
+       if (col >= 0 && col < tablerow_columns( r )) {
+               f = tablerow_column( r, col );
+               blockSignals( true );
+               eColHeader->setText(trUtf8(tablefield_header( f )));
+               eColWidth->setValue(f->sizex);
+               eType->setCurrentItem(f->ftypeindex);
+               eColName->setText(trUtf8(f->name));
+               eColTWidth->setValue(f->flen);
+               eColTDec->setValue(f->decimals);
+               blockSignals( false );
+       }
+*/
+}
+
+
+void eDBTable::ColumnUpd()
+{
+QStringList lst;
+int id;
+Q3ValueList<int> listTableId;
+       id = table->getTableId(ComboBoxTable->currentItem()-1);
+       listTableId = table->getBindList();
+       if(listTableId.find(id)!=listTableId.end())
+       {
+               cfg_message(0,tr("table in use, please select another table"));
+       //      ComboBoxTable->setCurrentItem(table->getTableInd(table->property("TableInd").toInt()));
+               ListCol->clear();
+               ListCol->insertItem("table in use!");
+               ListCol->setEnabled(false);
+               bOK->setEnabled(false);
+               ColumnSel(-1); // clear all line edit and labels
+               return;
+       }
+       if(!ListCol->isEnabled()) ListCol->setEnabled(true);
+       if(!bOK->isEnabled()) bOK->setEnabled(true);
+       lst = table->getFields(id);
+       ListCol->clear();
+       fname = lst;
+       idlist = table->getFields(id,true);
+       ListCol->insertStringList(lst,0);
+       cwidth.clear();
+       for(uint i=0; i<lst.count();i++)
+       {
+               cwidth << table->property("DefaultColWidth").toString();
+       }
+       //fname = table->fname;
+       findDeletedFields(id,idlist);
+
+}
+
+
+void eDBTable::getData( wDBTable *t )
+{
+QStringList lst;
+QString str, str2;
+int i;
+const Q3SqlFieldInfo *f;
+       if(ComboBoxTable->count())
+       {
+       //      t->setProperty("TableInd", tables[ComboBoxTable->currentItem()].section("\t",0,0).toInt())
+               t->setProperty("TableInd",t->getTableId(ComboBoxTable->currentItem()-1));
+               i=0;
+               while(i<t->numCols())
+               {
+                       t->removeColumn(0);
+                       ++i;
+               }
+               t->cur->clear();
+               for(uint j=0; j<ListCol->count(); j++)
+               {
+                       ListCol->setCurrentItem(j);
+                       str = ListCol->currentText();
+                       lst << str;
+                       f = new Q3SqlFieldInfo(fname[j]);
+                       t->cur->append(*f);
+                       t->setSqlCursor(t->cur);
+                       t->addColumn(f->name(),str,atoi(cwidth[j].ascii()));
+                       t->refresh(Q3DataTable::RefreshColumns);
+               }
+               t->setProperty("DefHeaders",lst);
+               t->setProperty("DefFields",fname);
+               t->setProperty("DefIdList",idlist);
+               t->setProperty("ColWidth", cwidth);
+       }
+       else
+       {
+               t->setProperty("TableInd",-1);
+       }
+}
+
+
+void eDBTable::setData( wDBTable * t, aCfg *md )
+
+{
+QStringList sl;
+QString ft,h,n;
+int idTable;
+bool ok;
+QStringList lst,lst_full;
+aCfgItem own;
+aWidget *wo;
+         table = t;
+//        md->print();
+//             own =
+       //      wo = aWidget::parentContainer( t );
+       //      if ( !wo ) return;
+       //      tables = md->objTables( wo->getId() );
+       //      QString wotype = wo->className();
+//             if ( wotype == "wDocument" ) tables.remove( tables[0] );
+//             if ( wotype == "wCatalogue" ) tables.remove( tables[1] );
+//             printf("tables=\n%s\n", ( const char *) tables.join("\n") );
+//             for ( unsigned int i=0; i < tables.count(); i++ ) {
+//                 ComboBoxTable->insertItem( tables[ i ].section("\t", 1 ) );
+//             }
+//     ComboBoxTable->insertItem("None");
+       ComboBoxTable->insertStringList(table->list_available_tables, 1);
+       idTable = table->property("TableInd").toInt(&ok);
+        //    printf("table ind = %i, id table =%i\n", t->getTableInd(idTable), idTable );
+
+               ComboBoxTable->setCurrentItem(1+t->getTableInd(idTable));
+       if(ok && idTable>-1)
+       {
+        //     v = new  QVariant(lst);
+        //     }
+        //     else
+        //     {
+       //              table->setFields(t->getTableId(0));
+               //      v = new  QVariant(lst);
+                       //table->setProperty("DefFields",*v);
+        //     }
+  //           v = new  QVariant(lst);
+//             table->setProperty("DefHeaders",*v);
+       //      table->setProperty("ColWidth",*v);
+       //ComboBoxTable->setFocus();
+//             tmp_table = *t;
+               lst = table->property("DefHeaders").toStringList();
+               ListCol->insertStringList(lst,0);
+               cwidth = table->property("ColWidth").toStringList();
+               fname = table->property("DefFields").toStringList();
+               idlist = table->property("DefIdList").toStringList();
+               findDeletedFields(idTable,idlist);
+       }
+       else
+       {
+               ColumnUpd();
+       }
+       ListCol->setFocus();
+       /*      if(!ListCol->isEmpty())
+               {
+                       ColumnSel(0);
+               }
+       */
+       /*
+               if (!t->getDefineCols().isEmpty()) {
+                       sl = QStringList::split("\n",t->getDefineCols());
+                       for (i = 0; i < sl.count(); i++) {
+                               sscanf((const char *)sl[i].section("|",3,3),"%s %d %d", st, &l, &d);
+                               if (st[0]=='O') ft.sprintf("O %d",l);
+                               else ft=st;
+                               w = sl[i].section("|",2,2).toInt();
+                               h = sl[i].section("|",5,5);
+                               n = sl[i].section("|",4,4);
+                               for (idxt = otypes.count()-1; idxt>0; idxt--) {
+                                       if (ft[0]=='O' && otypes[idxt]==ft) break;
+                                       else if (otypes[idxt][0]==ft[0]) break;
+                               }
+                               printf("set data %i = %s %s %i %i %i\n", i,
+                               (const char *)h, (const char *)n, idxt, w, l);
+                               insertColumn(h,n,idxt,w,l,d);
+                       }
+               }
+       */
+
+
+}
+
+
+void eDBTable::ColumnTextUpd( const QString &s )
+{
+CHECK_POINT
+
+       int idx;
+       idx = ListCol->currentItem();
+       if (idx == -1) return;
+       ListCol->blockSignals( TRUE );
+       ListCol->changeItem(s, ListCol->currentItem());
+       ListCol->blockSignals( FALSE );
+
+}
+
+
+void eDBTable::doOK()
+{
+       getData(table);
+       accept();
+}
+
+
+void eDBTable::ColumnAdd()
+{
+QString s;
+QString idx;
+QStringList::Iterator it;
+       addfdialog e( this->topLevelWidget());
+       e.setData(deletedFields,deletedFields,deletedFieldsId);
+       if ( e.exec()==QDialog::Accepted )
+       {
+               idx = e.getData(false);
+//             printf(">>>idx = %s\n",idx.ascii());
+               if(idx=="0") return;
+               s = table->getFieldName(idx.toInt());
+               idlist << idx;
+//             printf(">>> add field = '%s'\n",s.ascii());
+               ListCol->insertItem(s,ListCol->count());
+               fname << s;
+               cwidth << table->property("DefaultColWidth").toString();
+               it = deletedFields.find(s);
+               deletedFields.remove(it);
+               it = deletedFieldsId.find(idx);
+               deletedFieldsId.remove(it);
+//             table->addColumn(s,s,100);
+       }
+}
+
+
+void eDBTable::ColWidthChange( int value )
+{
+       int ind;
+       QString num;
+       ind = ListCol->currentItem();
+       if(ind!=-1)
+       {
+               cwidth[ind] = num.setNum(value);
+       }
+
+}
+
+
+QStringList
+eDBTable::findDeletedFields( int t_num ,QStringList idls)
+{
+       QStringList lst_full;
+       deletedFields.clear();
+       //formiruem list udalennix poley
+       lst_full = table->getFields(t_num,true);
+       for(unsigned int i=0;i<lst_full.count();i++)
+       {
+//             printf(">>>field '%s'\n",lst_full[i].ascii());
+               if(idls.find(lst_full[i])==idls.end())
+               {
+                       deletedFieldsId << lst_full[i];
+                       deletedFields << table->getFieldName(lst_full[i].toInt());
+               }
+       }
+return deletedFields;
+}
+
+
+void eDBTable::doCancel()
+{
+}
+
diff --git a/src/plugins/dbtable/edbtable.h b/src/plugins/dbtable/edbtable.h
new file mode 100644 (file)
index 0000000..3e59031
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef EDBTABLE_H
+#define EDBTABLE_H
+
+#include "ui_edbtable.h"
+
+
+class eDBTable : public QDialog, public Ui::eDBTable
+{
+    Q_OBJECT
+
+public:
+    eDBTable(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~eDBTable();
+
+    QStringList deletedFields, deletedFieldsId;
+    wDBTable *table;
+
+    virtual QStringList findDeletedFields( int t_num, QStringList idls );
+
+public slots:
+    virtual void ColumnDel();
+    virtual void ColumnL();
+    virtual void ColumnR();
+    virtual void ColumnSel( int col );
+    virtual void ColumnUpd();
+    virtual void getData( wDBTable * t );
+    virtual void setData( wDBTable * t, aCfg * md );
+    virtual void ColumnTextUpd( const QString & s );
+    virtual void doOK();
+    virtual void ColumnAdd();
+    virtual void ColWidthChange( int value );
+    virtual void doCancel();
+
+signals:
+    void closeEvent();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    QStringList otypes, fname, cwidth,idlist, tables;
+
+    virtual void init();
+    virtual void destroy();
+
+};
+
+#endif // EDBTABLE_H
diff --git a/src/plugins/dbtable/edbtable.ui b/src/plugins/dbtable/edbtable.ui
new file mode 100644 (file)
index 0000000..760b73b
--- /dev/null
@@ -0,0 +1,448 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>eDBTable</class>\r
+  <widget class="QDialog" name="eDBTable" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>479</width>\r
+        <height>348</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>aDBTable</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item rowspan="1" row="0" column="0" colspan="2" >\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QLabel" name="textLabel3" >\r
+              <property name="enabled" >\r
+                <bool>true</bool>\r
+              </property>\r
+              <property name="sizePolicy" >\r
+                <sizepolicy>\r
+                  <hsizetype>0</hsizetype>\r
+                  <vsizetype>0</vsizetype>\r
+                  <horstretch>0</horstretch>\r
+                  <verstretch>0</verstretch>\r
+                </sizepolicy>\r
+              </property>\r
+              <property name="frameShape" >\r
+                <enum>QFrame::NoFrame</enum>\r
+              </property>\r
+              <property name="frameShadow" >\r
+                <enum>QFrame::Plain</enum>\r
+              </property>\r
+              <property name="text" >\r
+                <string>Table name</string>\r
+              </property>\r
+              <property name="wordWrap" >\r
+                <bool>false</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QComboBox" name="ComboBoxTable" >\r
+              <item>\r
+                <property name="text" >\r
+                  <string/>\r
+                </property>\r
+              </item>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item rowspan="1" row="2" column="0" colspan="2" >\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QPushButton" name="bOK" >\r
+              <property name="text" >\r
+                <string>OK</string>\r
+              </property>\r
+              <property name="default" >\r
+                <bool>true</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="bCancel" >\r
+              <property name="text" >\r
+                <string>Cancel</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <spacer name="spacer1" >\r
+              <property name="sizeHint" >\r
+                <size>\r
+                  <width>301</width>\r
+                  <height>21</height>\r
+                </size>\r
+              </property>\r
+              <property name="sizeType" >\r
+                <enum>Expanding</enum>\r
+              </property>\r
+              <property name="orientation" >\r
+                <enum>Horizontal</enum>\r
+              </property>\r
+            </spacer>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item row="1" column="0" >\r
+        <widget class="Q3GroupBox" name="groupBox2" >\r
+          <property name="title" >\r
+            <string>Column list</string>\r
+          </property>\r
+          <layout class="QGridLayout" >\r
+            <item row="0" column="0" >\r
+              <widget class="Q3ListBox" name="ListCol" >\r
+                <property name="lineWidth" >\r
+                  <number>1</number>\r
+                </property>\r
+                <property name="margin" >\r
+                  <number>0</number>\r
+                </property>\r
+                <property name="midLineWidth" >\r
+                  <number>1</number>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+          </layout>\r
+        </widget>\r
+      </item>\r
+      <item row="1" column="1" >\r
+        <widget class="Q3GroupBox" name="groupBox1" >\r
+          <property name="title" >\r
+            <string>Column</string>\r
+          </property>\r
+          <layout class="QGridLayout" >\r
+            <item rowspan="1" row="0" column="0" colspan="2" >\r
+              <layout class="QHBoxLayout" >\r
+                <item>\r
+                  <widget class="QLabel" name="textLabel2" >\r
+                    <property name="sizePolicy" >\r
+                      <sizepolicy>\r
+                        <hsizetype>0</hsizetype>\r
+                        <vsizetype>5</vsizetype>\r
+                        <horstretch>0</horstretch>\r
+                        <verstretch>0</verstretch>\r
+                      </sizepolicy>\r
+                    </property>\r
+                    <property name="minimumSize" >\r
+                      <size>\r
+                        <width>120</width>\r
+                        <height>0</height>\r
+                      </size>\r
+                    </property>\r
+                    <property name="text" >\r
+                      <string>Header</string>\r
+                    </property>\r
+                    <property name="wordWrap" >\r
+                      <bool>false</bool>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item>\r
+                  <widget class="QLineEdit" name="eColHeader" >\r
+                    <property name="maxLength" >\r
+                      <number>100</number>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+              </layout>\r
+            </item>\r
+            <item rowspan="1" row="1" column="0" colspan="2" >\r
+              <layout class="QHBoxLayout" >\r
+                <item>\r
+                  <widget class="QLabel" name="textLabel1_2" >\r
+                    <property name="sizePolicy" >\r
+                      <sizepolicy>\r
+                        <hsizetype>0</hsizetype>\r
+                        <vsizetype>5</vsizetype>\r
+                        <horstretch>0</horstretch>\r
+                        <verstretch>0</verstretch>\r
+                      </sizepolicy>\r
+                    </property>\r
+                    <property name="minimumSize" >\r
+                      <size>\r
+                        <width>120</width>\r
+                        <height>0</height>\r
+                      </size>\r
+                    </property>\r
+                    <property name="text" >\r
+                      <string>Column width</string>\r
+                    </property>\r
+                    <property name="wordWrap" >\r
+                      <bool>false</bool>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item>\r
+                  <widget class="QSpinBox" name="eColWidth" >\r
+                    <property name="maximum" >\r
+                      <number>9999</number>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+              </layout>\r
+            </item>\r
+            <item row="4" column="0" >\r
+              <layout class="QHBoxLayout" >\r
+                <item>\r
+                  <widget class="QLabel" name="textLabel2_2" >\r
+                    <property name="text" >\r
+                      <string>Width</string>\r
+                    </property>\r
+                    <property name="wordWrap" >\r
+                      <bool>false</bool>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item>\r
+                  <widget class="QSpinBox" name="eColTWidth" >\r
+                    <property name="enabled" >\r
+                      <bool>false</bool>\r
+                    </property>\r
+                    <property name="maximum" >\r
+                      <number>255</number>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+              </layout>\r
+            </item>\r
+            <item rowspan="1" row="5" column="0" colspan="2" >\r
+              <layout class="QGridLayout" >\r
+                <item row="1" column="1" >\r
+                  <widget class="QPushButton" name="bColDel" >\r
+                    <property name="text" >\r
+                      <string>Delete</string>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item row="0" column="0" >\r
+                  <widget class="QPushButton" name="bColL" >\r
+                    <property name="text" >\r
+                      <string>Up</string>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item row="1" column="0" >\r
+                  <widget class="QPushButton" name="bColR" >\r
+                    <property name="text" >\r
+                      <string>Down</string>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item row="0" column="1" >\r
+                  <widget class="QPushButton" name="bColAdd" >\r
+                    <property name="text" >\r
+                      <string>Add</string>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+              </layout>\r
+            </item>\r
+            <item rowspan="1" row="2" column="0" colspan="2" >\r
+              <layout class="QHBoxLayout" >\r
+                <item>\r
+                  <widget class="QLabel" name="textLabel2_3" >\r
+                    <property name="sizePolicy" >\r
+                      <sizepolicy>\r
+                        <hsizetype>0</hsizetype>\r
+                        <vsizetype>5</vsizetype>\r
+                        <horstretch>0</horstretch>\r
+                        <verstretch>0</verstretch>\r
+                      </sizepolicy>\r
+                    </property>\r
+                    <property name="minimumSize" >\r
+                      <size>\r
+                        <width>120</width>\r
+                        <height>0</height>\r
+                      </size>\r
+                    </property>\r
+                    <property name="text" >\r
+                      <string>Field name</string>\r
+                    </property>\r
+                    <property name="wordWrap" >\r
+                      <bool>false</bool>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item>\r
+                  <widget class="QLineEdit" name="eColName" >\r
+                    <property name="maxLength" >\r
+                      <number>300</number>\r
+                    </property>\r
+                    <property name="readOnly" >\r
+                      <bool>true</bool>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+              </layout>\r
+            </item>\r
+            <item rowspan="1" row="3" column="0" colspan="2" >\r
+              <layout class="QHBoxLayout" >\r
+                <item>\r
+                  <widget class="QLabel" name="textLabel1" >\r
+                    <property name="sizePolicy" >\r
+                      <sizepolicy>\r
+                        <hsizetype>0</hsizetype>\r
+                        <vsizetype>0</vsizetype>\r
+                        <horstretch>0</horstretch>\r
+                        <verstretch>0</verstretch>\r
+                      </sizepolicy>\r
+                    </property>\r
+                    <property name="minimumSize" >\r
+                      <size>\r
+                        <width>120</width>\r
+                        <height>0</height>\r
+                      </size>\r
+                    </property>\r
+                    <property name="text" >\r
+                      <string>Field type</string>\r
+                    </property>\r
+                    <property name="wordWrap" >\r
+                      <bool>false</bool>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item>\r
+                  <widget class="QLabel" name="eType" >\r
+                    <property name="text" >\r
+                      <string/>\r
+                    </property>\r
+                    <property name="wordWrap" >\r
+                      <bool>false</bool>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+              </layout>\r
+            </item>\r
+            <item row="4" column="1" >\r
+              <layout class="QHBoxLayout" >\r
+                <item>\r
+                  <widget class="QLabel" name="textLabel3_2" >\r
+                    <property name="text" >\r
+                      <string>decimal</string>\r
+                    </property>\r
+                    <property name="wordWrap" >\r
+                      <bool>false</bool>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+                <item>\r
+                  <widget class="QSpinBox" name="eColTDec" >\r
+                    <property name="enabled" >\r
+                      <bool>false</bool>\r
+                    </property>\r
+                    <property name="maximum" >\r
+                      <number>9</number>\r
+                    </property>\r
+                  </widget>\r
+                </item>\r
+              </layout>\r
+            </item>\r
+          </layout>\r
+        </widget>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="5" margin="5" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >wdbtable.h</include>\r
+    <include location="local" >ananas.h</include>\r
+    <include location="local" >addfdialog.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>bOK</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>accept()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bColAdd</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>ColumnAdd()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bColDel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>ColumnDel()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bColL</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>ColumnL()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bColR</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>ColumnR()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>ListCol</sender>\r
+      <signal>highlighted(int)</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>ColumnSel(int)</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>ComboBoxTable</sender>\r
+      <signal>activated(QString)</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>ColumnUpd()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eColHeader</sender>\r
+      <signal>textChanged(QString)</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>ColumnTextUpd(QString)</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eColWidth</sender>\r
+      <signal>valueChanged(int)</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>ColWidthChange(int)</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>ComboBoxTable</sender>\r
+      <signal>activated(QString)</signal>\r
+      <receiver>ListCol</receiver>\r
+      <slot>setFocus()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>doCancel()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eDBTable</sender>\r
+      <signal>closeEvent()</signal>\r
+      <receiver>eDBTable</receiver>\r
+      <slot>doCancel()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bColAdd</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>ListCol</receiver>\r
+      <slot>setFocus()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/dbtable/wdbtable.cpp b/src/plugins/dbtable/wdbtable.cpp
new file mode 100644 (file)
index 0000000..26195b4
--- /dev/null
@@ -0,0 +1,1901 @@
+/****************************************************************************
+** $Id: wdbtable.cpp,v 1.2 2008/11/08 20:16:36 leader Exp $
+**
+** Code file of the database table plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2006 Grigory Panov, <gr1313 at mail.ru>, Yoshkar-Ola.
+** Copyright (C) 2003-2004 Andrey Paskal <app at lrn dot ru>, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+//--#include <qfocusdata.h>
+#include <stdlib.h>
+#include <qpainter.h>
+#include <qmessagebox.h>
+//Added by qt3to4:
+#include <QContextMenuEvent>
+#include <Q3HBoxLayout>
+#include <QKeyEvent>
+#include <Q3SqlPropertyMap>
+#include <Q3ValueList>
+#include <Q3SqlCursor>
+#include <QPixmap>
+#include <Q3Frame>
+#include <q3mimefactory.h>
+#include <Q3PopupMenu>
+#include <QEvent>
+#include <Q3SqlFieldInfo>
+#include <QPointer>
+//--#include "propertyeditor.h"
+//--#include "command.h"
+//--#include "formwindow.h"
+//--#include "mainwindow.h"
+//--#include "mainform.h"
+#include "adocjournal.h"
+#include "alog.h"
+
+#include "wdbtable.h"
+#include "edbtable.h"
+
+
+/*!
+ * \en Constructor. \_en
+ * \ru Конструктор.
+ *     Задает значение ширины по умолчанию для столбца = 100. \_ru
+ */
+wDBTable::wDBTable( QString objtype,  QWidget *parent, const char *name )
+    : Q3DataTable( parent, name )
+{
+//     vId = 0;
+//     verticalHeader()->hide();
+       setLeftMargin(0);
+       setNullText("");
+       objtype = "";
+       defColWidth = 100; //default column width
+       tableInd = -1;
+       inEditMode = false;
+       searchWidget = 0;
+       searchMode = false;
+       searchString = "";
+       connect( this, SIGNAL(cursorChanged ( QSql::Op ) ), this, SLOT(lineUpdate( QSql::Op ) ) );
+       connect( this, SIGNAL(currentChanged ( int, int ) ), this, SLOT(lineChange( int, int ) ) );
+       connect( this, SIGNAL(beforeInsert ( QSqlRecord* ) ), this, SLOT(lineInsert( QSqlRecord* ) ) );
+       connect( this, SIGNAL(valueChanged ( int, int )  ), this, SLOT(updateTableCellHandler(int, int ) ) );
+       connect( this, SIGNAL(doubleClicked ( int, int, int, const QPoint&) ), this, SLOT(doubleClickEventHandler(int,int,int, const QPoint&)));
+       init();
+
+
+       aLog::print(aLog::Debug, tr("wDBTable init ok"));
+//     printf("ok init wdbtable\n");
+
+}
+
+
+
+/*!
+ * \en Opens property editor. \_en
+ * \ru Открывает окно редактора свойсв, если fn == true \_ru
+ */
+void
+wDBTable::setOpenEditor( bool fn )
+{
+       if(fn)  OpenEditor();
+}
+
+
+/*!
+ *     \~english
+ *     Gets list of defined fields.
+ *     \~russian
+ *     Получение списка заданных полей.
+ *     \~
+ */
+QStringList
+wDBTable::getDefFields() const
+{
+       return fname;
+}
+
+
+/*!
+ *     \~english
+ *     Gets list of defined headers.
+ *     \~russian
+ *     Получение списка заданных заголовков.
+ *     \~
+ */
+QStringList
+wDBTable::getDefHeaders() const
+{
+       return hname;
+}
+
+
+/*!
+ *     \~english
+ *     Gets list of defined column width.
+ *     \~russian
+ *     Получение списка заданных размеров столбцов.
+ *     \~
+ */
+QStringList
+wDBTable::getColWidth() const
+{
+       return colWidth;
+}
+
+
+/*!
+ *     \~english
+ *     Gets list of defined column id.
+ *     \~russian
+ *     Получение списка заданных идентификаторов столбцов.
+ *     \~
+ */
+QStringList
+wDBTable::getDefIdList() const
+{
+       return idList;
+}
+
+/*!
+ *     \~english
+ *     Gets metadata document id.
+ *     \~russian
+ *     Получение идентификатора документа метаданных, которому принадлежит виджет.
+ *     \~
+ */
+qulonglong
+wDBTable::getId() const
+{
+       return doc_id;
+}
+
+/*!
+ *     \~english
+ *     Gets current table id.
+ *     \~russian
+ *     Получение идентификатора текущей таблицы.
+ *     \~
+ */
+int
+wDBTable::getTblInd() const
+{
+       return tableInd;
+}
+
+/*!
+ *     \~english
+ *     Olways return false.
+ *     \~russian
+ *     Всегда возвращает false.
+ *     \~
+ *     \return false
+ */
+bool
+wDBTable::getOpenEditor() const
+{
+       return false;
+}
+
+/*!
+ *     \~english
+ *     Gets default column width.
+ *     \~russian
+ *     Получение размера столбца по умолчанию.
+ *     \~
+ */
+int
+wDBTable::getDefColWidth() const
+{
+       return defColWidth;
+}
+
+/*!
+ *     \~english
+ *     Sets list of field names.
+ *     \~russian
+ *     Установка списка имен полей.
+ *     \~
+ */
+void
+wDBTable::setDefFields(QStringList lst)
+{
+       fname = lst;
+}
+
+/*!
+ *     \~english
+ *     Sets list of field headers.
+ *     \~russian
+ *     Установка списка заголовков полей.
+ *     \~
+ */
+void
+wDBTable::setDefHeaders(QStringList lst)
+{
+       hname = lst;
+}
+
+/*!
+ *     \~english
+ *     Sets list of columns width.
+ *     \~russian
+ *     Установка списка размеров столбцов.
+ *     \~
+ */
+void
+wDBTable::setColWidth(QStringList lst)
+{
+       colWidth = lst;
+}
+
+/*!
+ *     \~english
+ *     Gets list of column id.
+ *     \~russian
+ *     Установка списка идентификаторов столбцов.
+ *     \~
+ */
+void
+wDBTable::setDefIdList(QStringList lst)
+{
+       idList = lst;
+}
+
+/*!
+ *     \~english
+ *     Sets metadata document id.
+ *     \~russian
+ *     Установка идентификатора документа метаданных, которому принадлежит виджет.
+ *     \~
+ */
+void
+wDBTable::setId( qulonglong fn )
+{
+       doc_id = fn;
+}
+
+
+/*!
+ *     \~english
+ *     Gets current table id.
+ *     \~russian
+ *     Установка идентификатора текущей таблицы.
+ *     \~
+ */
+void
+wDBTable::setTblInd( int ind )
+{
+       tableInd = ind;
+}
+
+
+/*!
+ *     \~english
+ *     Sets default columns width.
+ *     \~russian
+ *     Установка размера столбцов по умолчанию.
+ *     \~
+ */
+void
+wDBTable::setDefColWidth( int fn )
+{
+       defColWidth = fn;
+}
+
+
+
+/*!
+ * \en Creates property editor dialog window. \_en
+ * \ru Создает диалоговое окно редактора свойств. \_ru
+ */
+void
+wDBTable::OpenEditor()
+{
+       //getBindList();
+       setAvailableTables();
+       eDBTable e( this->topLevelWidget());
+       checkFields();
+       e.setData(this,md);
+       if ( e.exec()==QDialog::Accepted )
+       {
+               e.getData(this);
+               //updateProp();
+       }
+}
+
+
+
+/*!
+ *     \~endlish
+ *     Destructor.
+ *     \~russian
+ *     Деструктор.
+ *     \~
+ */
+wDBTable::~wDBTable()
+{
+       delete cur;
+       cur=0;
+}
+
+
+
+/*!
+ *     \~english
+ *     Function init. Sets metadata object and tables object.
+ *     \~russian
+ *     Функция инициализации. Устанавливает объект метаданных и объект таблицы,
+ *     к которому идет обращение для поиска полей или (в случае документа) таблиц
+ *     \~
+ */
+void
+wDBTable::init()// aDatabase *adb )
+{
+       int id=0;
+       aCfgItem o, o_table;
+       aCfgItem mditem, docitem;
+
+       // set up pixmap for calculated fields
+
+       cur = new Q3SqlCursor("cur",false);
+       md = aWidget::parentContainer(this)->getMd();
+       if ( md )
+       {
+               id = aWidget::parentContainer(this)->getId();
+               o = md->find(id);
+               QString objClass = md->objClass(o);
+               if(objClass==md_document)
+               {
+                       o = md->findChild(o,md_tables); // object tables
+                       tables = o;
+               }
+               if(objClass==md_journal){
+                       o = md->findChild(o, md_columns);
+                       tables = o;
+               }
+               if(objClass==md_catalogue)
+               {
+//                     verticalHeader()->hide();
+                       o = md->findChild(o,md_element);
+                       tables = o;
+               }
+       }
+       else
+       {
+//             verticalHeader()->hide();
+//             printf("name engin\n");
+       }
+
+}
+
+
+
+/*!
+ * \en Sets available tables, using object tables. \_en
+ * \ru         Заполняет внутренний список доступных таблиц, используя в качестве
+ *     источника информации объект tables.
+ *     Добавляет к имени уже забинденой таблицы звездочку(*). \_ru
+ */
+void
+wDBTable::setAvailableTables()
+{
+aCfgItem o_table, o = tables;
+QString str;
+QStringList listIdTable;
+int res;
+Q3ValueList<int> vList = getBindList();
+
+       if(o.isNull()) return;
+       QString objClass = md->objClass(o);
+       //printf("obj class `%s'\n",objClass.ascii());
+       list_available_tables.clear();
+       if(objClass==md_tables)
+       {
+               res = md->countChild(o,md_table); // ind kol_vo tables in obj tables
+               for(int i=0; i<res; i++)
+               {
+                       o_table = md->findChild(o,md_table,i);
+                       listIdTable << QString("%1").arg(md->id(o_table));
+                       //printf("id = %li\n", md->id(o_table));
+               }
+       }
+       if(objClass==md_columns)
+       {
+       //      listIdTable << QString("%1").arg(md->id(o));
+               list_available_tables << tr("Available columns");
+       }
+       if(objClass==md_element)
+       {
+               list_available_tables << md_element;
+
+       //      listIdTable << QString("%1").arg(md->id(o));
+       }
+
+       //res = md->countChild(o,md_table); // ind kol_vo tables in obj tables
+       res = listIdTable.count();
+       for(int i=0; i<res; i++)
+       {
+               //o_table = md->findChild(o,md_table,i);
+
+               if(vList.find(listIdTable[i].toInt())!=vList.end())
+                       str ="* ";
+               else
+                       str ="";
+               list_available_tables << str + md->attr(md->find(listIdTable[i].toInt()),mda_name); // add tables name in  combo box
+       }
+}
+
+
+
+
+/*!
+ * \en         Handler line current change signal. \_en
+ * \ru Обработчик сигнала изменения строки. Генерирует сигналы
+ * deleteLine и saveLine. \_ru
+ */
+void
+wDBTable::lineUpdate( QSql::Op mode)
+{
+QSqlRecord *rec = sqlCursor()->editBuffer();//currentRecord();
+       switch(mode)
+       {
+               case QSql::Update:
+       //      rec =  currentRecord();
+               break;
+               case QSql::Insert:
+               break;
+               case QSql::Delete:
+               //printf("emit del line\n");
+               emit(deleteLine(rec));
+               return;
+               default:
+               break;
+       }
+       //if(!rec) return;
+       //printf(" emit saveLine\n");
+       emit(saveLine(rec));
+}
+
+
+
+/*!
+ *     \~english
+ *     Function paint field in table.
+ *     \~russian
+ *     Переопределенная функция рисования поля таблицы.
+ *     В типе DateTime не отображает время.
+ *     Поддерживает вычисляемые поля.
+ *     \~
+ */
+void
+wDBTable::paintField ( QPainter * p, const QSqlField * field, const QRect & cr, bool selected )
+{
+       if(field->name().left(5)=="text_") return;
+        if ( sqlCursor()->isCalculated( field->name() ) ){
+               if ( field->name()=="system_icon" )
+                       p->drawPixmap( QRect( 0, 0, cr.width(), cr.height() ), systemIcon() );
+                return;
+        }
+        if ( sqlCursor()->contains( "text_"+field->name() ) ) {
+               QSqlField f(*field);
+               f.setValue(((aDataTable*)sqlCursor())->sysValue("text_"+f.name()));
+                Q3DataTable::paintField( p, &f, cr, selected );
+                return;
+       //      f = * sqlCursor()->field( "text_"+f.name() );
+        }
+       if(field->type() == QVariant::DateTime)
+       {
+               QSqlField f(*field);
+               f.setValue(field->value().toDate());// don't show time
+               Q3DataTable::paintField( p, &f, cr, selected );
+               return;
+       }
+       Q3DataTable::paintField( p, field, cr, selected );
+}
+
+
+
+/*!
+ *     \~english
+ *     Return system icon for display object record state.
+ *     \russian
+ *     Возвращает иконку для отображения состояния строки.
+ *     \~
+ */
+QPixmap
+wDBTable::systemIcon()
+{
+        aWidget *container = aWidget::parentContainer( this );
+        QString ctype="";
+        QPixmap pm;
+        Q3SqlCursor *r = sqlCursor();
+        int df=0, cf=0, mf=0;
+
+        if ( container ) ctype = container->className();
+        if ( r )
+       {
+                if ( r->contains("df") ) df = r->field("df").value().toInt();
+                if ( r->contains("cf") ) cf = r->field("cf").value().toInt();
+               else
+               {
+                       if(ctype=="wJournal")
+                       {
+
+                               aDocJournal* sysObj = new aDocJournal(db);
+                               if(sysObj)
+                               {
+//for(int i=0; i<r->count(); i++)
+//     printf("f[%d]=%s, %s\n",i, r->fieldName(i).ascii(), r->field(i)->value().toString().ascii());
+                                       if(sysObj->findDocument(r->field("id").value().toULongLong()))
+                                       {
+                                               aDocument *doc = sysObj->CurrentDocument();
+                                               cf = doc->IsConducted();
+                                               delete doc;
+                                       }
+                                       else
+                                       {
+                                               printf(">>doc select failed!\n");
+                                       }
+                                       //doc = 0;
+                                       //cf = sysObj->sysValue("cf").toInt();
+                               }
+
+                               delete sysObj;
+
+
+                       }
+//>>>>>>> 1.71.2.13
+               }
+                if ( r->contains("mf") ) mf = r->field("mf").value().toInt();
+               if(ctype=="wJournal")
+               {
+                        pm = t_doc;
+                        if ( df ) pm = t_doc_d;
+                        if ( cf && !df ) pm = t_doc_t;
+                        if ( mf && !df ) pm = t_doc_m;
+                        if ( cf && mf && !df ) pm = t_doc_tm;
+                }
+               else
+                       if(ctype=="wCatalogue")
+                       {
+                               pm = t_cat_e;
+                               if ( df ) pm = t_cat_ed;
+                       }
+                       else
+                               if(ctype=="wCatGroupe")
+                               {
+                                       pm = t_cat_g;
+                                       if ( df ) pm = t_cat_gd;
+                               }
+        }
+        return pm;
+}
+
+
+
+/*!
+ * \~english
+ *     Sets property `DefFields', `DefHeaders', `ColWidth', `DefIdList' to
+ *     values from metadata.
+ * \~russian
+ *     Устанавливает свойства `DefFields', `DefHeaders', `ColWidth', `DefIdList'
+ *     в значения, определенные в метаданных. Старые значения не сохраняются.
+ *     Для документа используется idTable.
+ *     \~
+ *     \param idTable (in) -   \~english table id
+ *                             \~russian id таблицы документа.  Не используется для каталогов и журналов.
+ *     \~
+ */
+void
+wDBTable::setFields(int idTable)
+{
+CHECK_POINT
+       int field_count,j;
+       int i; //,tableCount;
+       //QSqlCursor *cur;
+       const Q3SqlFieldInfo *field;
+       QString str;
+       QStringList Cwidth, list_fields,list_id;
+       aCfgItem o, o_table, o_field;
+       QString mdtag=QString(md_field);
+
+       list_fields.clear();
+       o = tables; // object tables
+       QString objClass = md->objClass(o);
+       //printf("table parent obj class '%s'\n", (const char*)objClass);
+       if(objClass==md_tables)
+       {
+               o_table = md->find(idTable);
+       }
+       else
+       if(objClass==md_columns)
+       {
+               o_table = o;
+               mdtag=QString(md_column);
+       }
+       else
+       if(objClass==md_element)
+       {
+               o_table = o;
+       }
+       colWidth.clear();
+       i=0;
+       while(i<numCols())
+       {
+               removeColumn(0);
+       }
+       cur->clear();
+       if(!o_table.isNull())
+       {
+               field_count = md->countChild(o_table,mdtag);
+               //printf("table name '%s'\n",(const char*)md->attr(o_table,mda_name));
+               //printf("table id '%s'\n",(const char*)md->attr(o_table,mda_id));
+               for (j=0; j<field_count; j++)
+               {
+                       o_field = md->findChild(o_table,mdtag,j);
+                       //printf("field %i name '%s'\n",j,(const char*)md->attr(o_field,mda_name));
+                       //printf("field %i id '%s'\n",j,(const char*)md->attr ( o_field, mda_id ));
+                       list_fields << md->attr(o_field,mda_name);
+                       list_id << md->attr(o_field,mda_id);
+                       str.setNum(j);
+                       field = new Q3SqlFieldInfo(md->attr(o_field,"name"));
+                       cur->append(*field);
+                       setSqlCursor(cur);
+                       addColumn(field->name(),field->name(),property("DefaultColWidth").toInt());
+                       refresh(RefreshColumns);
+                       Cwidth << property("DefaultColWidth").toString();
+               }
+       }
+       setProperty("DefFields",list_fields);
+       setProperty("DefHeaders",list_fields);
+       setProperty("ColWidth",Cwidth);
+       setProperty("DefIdList",list_id);
+}
+
+
+
+/*!
+ * \en Gets table id at position table. \_en
+ * \ru Получение id таблицы по ее позиции в метаданных.
+ *     Эта позиция совпадает с индексом таблицы в комбобоксе редактора свойств
+ *     таблицы. \_ru
+ *     \param numTable (in) -  \en Position table in metadata \_en
+ *                             \ru Положение таблицы в метаданных.
+ *                             Не используется в каталоге и журнале. \_ru
+ *     \return \en table id \_en \ru id таблицы \_ru
+ */
+int
+wDBTable::getTableId(int numTable)
+{
+       int res = -1;
+       aCfgItem o, o_table;
+       if ( numTable == -1 ) return res;
+       o = tables; // object tables
+       QString objClass = md->objClass(o);
+       if(objClass==md_tables)
+       {
+               o_table = md->findChild(o,md_table,numTable);
+               res = md->id(o_table);
+       }
+       if(objClass==md_columns)
+       {
+               res = md->id(o);
+               //printf("parent name %s\n", (const char*)md->attr(md->parent(o),mda_name));
+       }
+       if(objClass==md_element)
+       {
+               res = md->id(o);
+       }
+       //printf("get table id=%i\n", res);
+       return res;
+}
+
+
+
+/*!
+ * \en Gets table position at id table. \_en
+ * \ru Получение позиции таблицы в метаданных по ее id.
+ *     Эта позиция совпадает с индексом таблицы в комбобоксе редактора свойств
+ *     таблицы. \_ru
+ *     \param id (in) -        \en Id table \_en
+ *                             \ru id таблицы.
+ *                             Не используется в каталоге и журнале. \_ru
+ *     \return \en table position for documet or 0 for catalogue and journal\_en
+ *             \ru Для документа возвращает позицию таблицы, для каталога и
+ *             журнала документов возвращает 0 \_ru
+ */
+int
+wDBTable::getTableInd(int id)
+{
+int j,tableCount;
+aCfgItem o, o_table;
+       o = tables; // object tables
+       QString objClass = md->objClass(o);
+       if(objClass==md_columns || objClass==md_element)
+       {
+               //printf("TableInd=%i\n",tableInd);
+               return tableInd;
+       }
+       tableCount = md->count(o,md_table);
+       for(j=tableCount-1; j>=0; j--)
+       {
+               o_table = md->findChild(o,md_table,j);
+               if(md->id(o_table)==id) break;
+       }
+return j;
+}
+
+
+
+/*!
+ * \en         Gets list of id fields or list of name fields. \_en
+ * \ru         Получение списка id или имен полей таблицы.
+ *     Возвращаемое значение зависит от параметра GetId. \_ru
+ *     \param idTable (in) -   \en id of table \_en
+ *                             \ru id таблицы документа. Для каталога и журнала
+ *                             не используется. \_ru
+ *     \param GetId (ib) -     \en if GetId == true returns list of id, else
+ *                             returns list of names. \_en
+ *                             \ru если параметр равен true, возвращается
+ *                             список id полей таблицы, иначе возвращается
+ *                             список имен полей таблицы. \_ru
+ *     \return \en list of id fields or list of name fields. \_en
+ *             \ru Список id или имен полей таблицы. \_ru
+ */
+QStringList
+wDBTable::getFields(int idTable, bool GetId)
+{
+       QStringList lst;
+       if (idTable==-1) {
+               return lst;
+       }
+
+       int items_count,j;//,tableCount;
+       aCfgItem o, o_table, o_item;
+       QString mdtag=md_field;
+
+
+//aWidget *wo = aWidget::parentContainer( this );
+//     if ( !wo ) return lst;
+//     o_table = md->objTable( wo->getId(), idTable );
+
+       o = tables; // object tables
+       QString objClass = md->objClass(o);
+       if(objClass==md_tables)
+       {
+               o_table = md->find(idTable);
+       }
+       else
+       if(objClass==md_columns)
+       {
+               o_table = o;
+               mdtag = md_column;
+       }
+       else
+       if(objClass==md_element)
+       {
+               o_table = o;
+       }
+       if(!o_table.isNull())
+       {
+               items_count = md->countChild(o_table,mdtag);
+               for (j=0; j<items_count; j++)
+               {
+                       o_item = md->findChild(o_table,mdtag,j);
+                       if(GetId)
+                         lst << md->attr(o_item,mda_id);
+                       else
+                         lst << md->attr(o_item,mda_name);
+               }
+       }
+       else {
+               debug_message("Table not found!\n");
+       }
+return lst;
+}
+
+
+
+/*!
+ *     \~english
+ *     Gets field type.
+ *     \~russian
+ *     Получение типа поля.
+ *     \~
+ *     \param id - \~english field id \~russian идентификатор поля \~
+ *     \return \~english field type \~russian тип поля \~
+ */
+QString
+wDBTable::getFieldType(long id)
+{
+       aCfgItem o;
+       QString str="";
+
+       QString objClass = md->objClass(tables);
+       if(objClass==md_columns) {
+               id= journalFieldId(id);
+       }
+       o = md->find(id);
+       if(!o.isNull())
+       {
+               str = md->attr(o,mda_type);
+       }
+return str;
+}
+
+
+
+/*!
+ *     \~english
+ *     Gets field name.
+ *     \~russian
+ *     Получение имени поля.
+ *     \~
+ *     \param id - \~english field id \~russian идентификатор поля \~
+ *     \return \~english field name \~russian имя поля \~
+ */
+QString
+wDBTable::getFieldName(long id)
+{
+       aCfgItem o;
+       QString str="";
+       o = md->find(id);
+       if(!o.isNull())
+       {
+               str = md->attr(o,mda_name);
+       }
+return str;
+}
+
+
+
+/*!
+ *\~english
+ *     function check property name, id, header and width.
+ *     If have incorrect field name or id, then print message and all.
+ *     If have less or more items in DefHeaders or ColWidth, then set them normal.
+ *\~russian
+ *     Функция проверяет свойства name, id, DefHeaders и ColWidth.
+ *     Если находит ошибки в свойствах name или id, она выводит сообщение об этом, но не исправляет ошибки.
+ *     Если находит ошибки в свойствах DefHeaders или ColWidth, то исправляет.
+ *\~
+ */
+void
+wDBTable::checkFields()
+{
+       QStringList fl,hl,cl,il;
+       unsigned int i;
+       QString str;
+
+       //t = getFields(property("tableInd").toInt(),true); //get list fields id
+       fl = property("DefFields").toStringList();
+       il = property("DefIdList").toStringList();
+       cl = property("ColWidth").toStringList();
+       hl = property("DefHeaders").toStringList();
+//     proverka na nalichie field in metadata
+       for(i=0; i<il.count(); i++)
+       {
+               str = getFieldName(il[i].toInt());
+               if(i<fl.count())
+               {
+                       if(str!=fl[i])
+                       {
+                               aLog::print(aLog::Debug, QString("wDBTable unknown field name `%1' or (and) id `%1'\n").arg(str).arg(il[i]));
+                       }
+               }
+               else il.remove(il.at(i--));
+               if(i>=hl.count()) hl << str;
+               if(i>=cl.count()) cl << property("DefaultColWidth").toString();
+       }
+       while(i<hl.count())
+       {
+               hl.remove(hl.at(i));
+       }
+       while(i<cl.count())
+       {
+               cl.remove(cl.at(i));
+       }
+       setProperty("DefFields", fl );
+       setProperty("DefHeaders", hl );
+       setProperty("ColWidth", cl );
+       setProperty("DefIdList", il );
+}
+
+
+
+
+
+
+
+
+
+/*!
+ *\~english
+ *     Initialisation the widget on form loaded in engine.
+ *\~russian
+ *     Инициализация виджета при загрузке в форму инжина.
+ *\~
+ */
+void
+wDBTable::init(aDatabase *adb, aEngine *e )
+{
+
+       aLog::print(aLog::Debug, tr("wDBTable init in engine "));
+//     printf("begin init wdbtable\n");
+       unsigned int countField,i;
+       aCfgItem o, own;
+       QString str, ctype;
+       QStringList lst,lstHead,lstWidth;
+       int tid;
+       aWidget *container = NULL;
+
+       t_doc = rcIcon( "t_doc.png" );
+        t_doc_d = rcIcon( "t_doc_d.png" );
+        t_doc_t = rcIcon( "t_doc_t.png" );
+        t_doc_m = rcIcon( "t_doc_m.png" );
+        t_doc_tm = rcIcon( "t_doc_tm.png" );
+       t_cat_e = rcIcon( "t_cat_e.png" );
+        t_cat_ed = rcIcon( "t_cat_ed.png" );
+       t_cat_g = rcIcon( "t_cat_g.png" );
+       t_cat_gd = rcIcon( "t_cat_gd.png" );
+
+       engine = e;
+       setConfirmDelete(true);
+       db = adb;
+       md = &adb->cfg;
+       tid = property("TableInd").toInt();
+       container = aWidget::parentContainer( this );
+       if ( !container )
+       {
+               aLog::print(aLog::Error, tr("wDBTable not in Ananas object container "));
+               return; //printf("!no wDBTable parent container\n");
+       }
+       else
+       {
+               o = md->objTable( container->getId(), tid );
+               if ( o.isNull() )
+               {
+                       //debug_message("Table not found\n");
+                       aLog::print(aLog::Error, tr("wDBTable init meta object not found "));
+               }
+               ctype = container->className();
+               aLog::print(aLog::Info, tr("wDBTable container type is %1 ").arg(ctype));
+
+               setContainerType(ctype);
+       }
+
+       //o  = md->find(property("TableInd").toInt());
+       if ( o.isNull() )
+       {
+               aLog::print(aLog::Error, tr("wDBTable init meta object not found "));
+               return;
+       }
+       countField = numCols();
+       for(i=0; i<countField;i++)
+       {
+               removeColumn(0);
+       }
+       aSQLTable *tbl = NULL;
+       //printf("ctype = %s\n",( const char *) ctype );
+       if ( containerType() == "wDocument" )
+       {
+               QString flt;
+               flt = QString("idd=%1").arg(container->uid());
+               aLog::print(aLog::Info, tr("wDBTable filter is %1 ").arg(flt));
+               setFilter(flt);
+               //TODO: fix memory leak
+               tbl = new aSQLTable( o, adb );
+//             printf("new table ok\n");
+       //      tbl->first();
+
+       }
+       if ( containerType() == "wCatalogue" ) {
+                tbl = container->table(); //new aSQLTable( o, adb );
+               setFilter(QString("idg=0"));
+               newDataId(0);
+               tbl->append( Q3SqlFieldInfo("system_icon") );
+//             tbl->setGenerated( "system_icon", false );
+               tbl->setCalculated("system_icon", true );
+          }
+       if ( containerType() == "wJournal" ) {
+               tbl = container->table(); //new aSQLTable( o, adb );
+               tbl->setMode( 0 );
+               tbl->append( Q3SqlFieldInfo( "system_icon" ) );
+//             tbl->setGenerated( "system_icon", false );
+               tbl->setCalculated( "system_icon", true );
+//             tbl->append( QSqlFieldInfo( "t1" ) );
+//             tbl->setGenerated( "t1", false );
+//             tbl->setCalculated("t1", true );
+        }
+       refresh();
+       cur->clear();
+       setSqlCursor(tbl,true);
+       refresh(RefreshColumns);
+       countField = numCols();
+       lst = property("DefIdList").toStringList();
+       lstHead = property("DefHeaders").toStringList();
+       lstWidth = property("ColWidth").toStringList();
+       for ( i = 0; i < countField; i++ )
+       {
+               //remove all columns in wDBTable, not in sql cursor
+               removeColumn( 0 );
+               QString s = sqlCursor()->fieldName(i);
+//             printf(">>>>s = %s\n",s.ascii());
+//             if(sqlCursor()->isCalculated(s))
+//             {
+//                     if((s.left(7)=="text_uf" && lst.findIndex(s.mid(7))!=-1) || s == "system_icon")
+//                     {
+//                             continue;
+//                     }
+                       // not calculate field, if is not contents in wDBTable
+//                     sqlCursor()->setCalculated(sqlCursor()->fieldName(i),false);
+//             }
+       }
+       if ( containerType() == "wJournal" ) {
+               addColumn( "system_icon", "", 20 );
+               setColumnReadOnly( 0, true );
+               if (md->objClass(*(container->getMDObject()))==md_journal && !((aDocJournal*) container->dataObject())->type() ) {
+                       // we have common journal
+                       // Insert journal system columns.
+                       addColumn( "ddate", tr("Date"), 100 );
+                       addColumn( "pnum", tr("Prefix"), 200 );
+                       addColumn( "num", tr("Number"), 100 );
+               }
+       }
+       if ( containerType() == "wCatalogue" ) {
+               addColumn( "system_icon", "", 20 );
+       //      printf("set column ro\n");
+               setColumnReadOnly( 0, true );
+       }
+
+       if ( containerType() == "wDocument" || containerType() == "wCatalogue" ) {
+
+       // Задаем сортировку по индентификатору в обратном порядке для
+       // табличной части документа
+       // чтобы при добавлении новых позиций в список строки не скакали
+           QSqlIndex pk = sqlCursor()->primaryIndex();
+           pk.setDescending( 0, false);
+           setSort( pk );
+           sqlCursor()->select();
+           sqlCursor()->first();
+           refresh();
+       }
+
+
+       //refresh(RefreshColumns);
+       if (md->objClass(*(container->getMDObject()))!=md_journal || ((aDocJournal*) container->dataObject())->type() ) {
+               // we have not common journal
+               for(i=0; i<lst.count();i++)
+               {
+                       // assemble sql table field names
+                       if ( containerType() == "wJournal" )
+                       {
+//                             str = journalFieldName(lst[i].toLong());
+
+                               str = "uf"+QString::number(journalFieldId(lst[i].toLong()));
+                               //printf(">>>>>>ss=%s\n",str.ascii());
+                       }
+                       else
+                       {
+                               str = "uf"+lst[i];
+                       }
+                       // add defined fields
+                       addColumn(str,lstHead[i],lstWidth[i].toInt());
+               }
+       }
+       refresh(RefreshAll);
+       setWFieldEditor();
+       aLog::print(aLog::Debug, tr("wDBTable init in engine ok"));
+}
+
+
+
+/*!
+ *
+ */
+/*!
+ *     \~english
+ *     Set custom field editor (wField) used property `value'.
+ *     \~russian
+ *     Устанавливает свой редактор ячейки таблицы (wField).
+ *     \~
+ */
+void
+wDBTable::setWFieldEditor()
+{
+        aEditorFactory * f = new  aEditorFactory(this,"");
+        f->setMd(md);
+        Q3SqlPropertyMap * m = new Q3SqlPropertyMap();
+        m->insert("wField", "value");
+        installPropertyMap(m);
+        installEditorFactory(f);
+}
+
+
+
+/*!
+ *     \~english
+ *     Construct cell editor. Creates new wField object and inited it.
+ *     \~russian
+ *     Конструктор редактора ячейки. Создает новый экземпляр объекта wField и инициализирует его.
+ *     \~
+ */
+QWidget*
+aEditorFactory::createEditor(QWidget * parent, const QSqlField * field)
+{
+//--WFlags fl=0;
+wField * tmp;
+wDBTable *t=0;
+QString str,stmp;
+wField::tEditorType type = wField::Unknown;
+       if(md)
+       {
+               t = (wDBTable*)parent->parent()->parent();
+
+               tmp  = new wField((QWidget*)(parent->parent()),""/*--,fl*/);
+               if(t)
+               {
+                       str = field->name();
+                       str = str.remove(0,2);
+                       tmp->setFieldType(t->getFieldType(str.toInt()));
+                       str = t->getFieldType(str.toInt());
+                       stmp = str.section(' ',0,0);
+//                     printf("type is %s\n",stmp.ascii());
+                       if(stmp=="C") type = wField::String;
+                       if(stmp=="N") type = wField::Numberic;
+                       if(stmp=="D") type = wField::Date;
+                       if(stmp=="B") type = wField::Boolean;
+                       if(stmp=="O")
+                       {
+                               int tid;
+                               //gets object id.
+                               //stmp = str.section(' ',1,1);
+                               tid = atoi(str.section(' ',1,1).ascii());
+//                             printf("tid =%d\n",tid);
+                               aCfgItem o = md->find(tid);
+                               if(!o.isNull())
+                               {
+                                       //gets object class
+                                       str = md->objClass(o);
+//                                     printf("otupe = %s\n",str.ascii());
+                                       if(str == md_catalogue)
+                                               // and set editor
+                                               type = wField::Catalogue;
+                                       if(str == md_document)
+                                               type = wField::Document;
+
+                               }
+                               else
+                               {
+                                       aLog::print(aLog::Error,tr("aEditorFactory field metaobject not found"));
+                               }
+                       }
+                       tmp->setEditorType(type);
+                       tmp->initObject( t->db );
+                       tmp->engine = t->engine;
+               }
+       }
+       else
+       {
+               aLog::print(aLog::Error,tr("aEditorFactory metadata in null"));
+       }
+       if(parent && parent->parent() && parent->parent()->parent()) // setted right tabOrder
+       // parent->parent()->parent() - pointer to wDBTable;
+       QWidget::setTabOrder((QWidget*)parent->parent()->parent(),tmp);
+        return tmp;
+
+}
+void
+aEditorFactory::setMd(aCfg * cfg)
+{
+       md = cfg;
+}
+
+
+/*!
+ *     \~english
+ *     Gets list of id binding table.
+ *     \~russian
+ *     Получение списка уже присутствующих в форме таблиц. Необходимо для того, чтобы одну таблицу не добавили два раза.
+ *     \~
+ *     \return \~english list of id binding table. \~russian список таблиц \~
+ */
+Q3ValueList<int>
+wDBTable::getBindList()
+{
+aCfgItem obj;
+QObjectList wList;
+int id;
+wDBTable* wtable;
+QObject* wd = aWidget::parentContainer( this );
+       listBindings.clear();
+       wList = wd->queryList( "wDBTable" );
+       QListIterator<QObject*> it( wList ); // iterate over the wDBTable
+       while ( it.hasNext() )
+       {
+               wtable = qobject_cast<wDBTable*>( it.next() );
+
+               if(strcmp(wtable->name(),this->name())) // don't added current id
+               {
+               //don.t added deleted widgets
+                  if(strncmp("qt_dead_widget_",wtable->name(),strlen("qt_dead_widget_")))
+                  {
+                       id = wtable->property("TableInd").toInt();
+                       if(id>=0) // don't added negativ id (table while not selected)
+                       {
+                               listBindings << id;
+                       }
+                  }
+               }
+       }
+       //--delete wList;
+return listBindings;
+}
+
+
+
+/*!
+ *     \~english
+ *     Get field value slot. Don't implemented.
+ *     \~russian
+ *     Получение значения поля. Не реализовано.
+ *     \~
+ */
+QVariant
+wDBTable::Value( const QString &colname )
+{
+       aLog::print(aLog::Error, tr("wDBTable: function Value() call"));
+       return QVariant("");
+}
+
+
+
+/*!
+ *\~english
+ *     Emit signal on select record.
+ *     Signal give information about selected record database id.
+ *\~russian
+ *     Выдает сигнал при выборе записи.
+ *     Сигнал содержит информацию об id, выбранного объекта в базе данных.
+ *\param -\~english Not use, only for signal compatibility.\~russian
+ *     Не используются, заданы только для совместимости с сигналом таблицы.\~
+ *\~
+ */
+void
+wDBTable::lineChange(int, int)
+{
+       QSqlRecord * rec = currentRecord();
+       if ( !rec ) return;
+       qulonglong id = 0;
+       if(rec->contains("id")) id = rec->value("id").toLongLong();
+       //if (containerType() == "wJournal")
+       //{
+               //if(rec->contains("idd")) id = rec->value("idd").toLongLong();
+       //}
+       aLog::print(aLog::Info, tr("wDBTable: select document %1").arg(id));
+       emit( selectRecord( id ) );
+}
+
+
+/*!
+ *\ru
+ *     Устанавливает значение системного поля idd во вновь добавляемую запись табличной части документа.
+ *\_ru
+ */
+void
+wDBTable::lineInsert(QSqlRecord* rec){
+
+       if (containerType() == "wDocument")
+       {
+               if(rec->contains("idd")) rec->setValue("idd",QVariant(doc_id));
+               if(rec->contains("ln")) rec->setValue("ln",numRows()-1);
+       }
+       if(containerType() == "wCatalogue")
+       {
+               if(rec->contains("idg")) rec->setValue("idg",QVariant(cat_group_id));
+       }
+}
+
+
+/*!
+ *     \~english
+ *     Delete line function
+ *     \~russian
+ *     Функция удаления строки.
+ *     \~
+ *     \return \~english true, if no error \~russian true, если ошибок не было \~
+ */
+bool
+wDBTable::deleteCurrent()
+{
+       bool res;
+       res = Q3DataTable::deleteCurrent();
+       emit(updateCurr(currentRow(),currentColumn()));
+       return res;
+
+}
+
+
+/*!
+ *     \~english
+ *     Key press handler.
+ *     \~russian
+ *     Обрабатывает события при нажатии кнопок клавиатуры.
+ *     \~
+ */
+void
+wDBTable::keyPressEvent ( QKeyEvent *e )
+{
+       qulonglong id;
+
+       aWidget *container = NULL;
+       if ( searchMode == FALSE && e->text().at( 0 ).isPrint() )
+       {
+               searchOpen( e->text() );
+       }
+       else
+       {
+               searchClose();
+       }
+
+       if(containerType() =="wJournal")
+       {
+               e->ignore();
+       }
+       if(containerType() =="wCatalogue")
+       {
+               switch ( e->key() )
+               {
+               case Qt::Key_Escape:
+                       e->ignore();
+                       break;
+               case Qt::Key_Return:
+                       if(currentRecord())
+                       {
+                               id = currentRecord()->value(0).toLongLong();
+                               if ( e->state() == Qt::ShiftModifier )
+                               {
+                                       //printf("Shift+Return pressed %Ld\n", id);
+                                       EditElement();
+                               } else
+                               {
+                                       //printf("Return pressed %Ld\n", id );
+                                       emit( selected( id ) );
+                               }
+                               e->accept();
+                       }
+                       else
+                       {
+                               aLog::print(aLog::Info, tr("wDBTable: current record not setted"));
+                       }
+                       break;
+               default:
+                       e->ignore();
+                       break;
+               }
+       }
+       Q3DataTable::keyPressEvent( e );
+}
+
+
+
+/*!
+ *\ru
+ *     Слот обрабатывает ситуацию смены/установки идентификатора документа, устанавливая новый фильтр.
+ *     Кроме переустановки фильта следует вызывать слот newDataId, для смены/установки
+ *     значения идентификатора документа. Для журнала этого можно не делать.
+ *     \param flt - строка вида "idd=999", задающая условия отбора записей в таблицу по значению поля idd.
+ *\_ru
+ */
+void
+wDBTable::newFilter(const QString & flt)
+{
+       setFilter(flt);
+       refresh();
+}
+
+/*!
+ *\ru
+ *     Слот обрабатывает ситуацию смены/установки идентификатора документа, запоминая новое значение.
+ *     Для смены фильта следует вызывать слот newFilter.
+ *     \param id - идентификатор документа, который следует запомнить.
+ *\_ru
+ */
+void
+wDBTable::newDataId(const qulonglong id)
+{
+       if(containerType() == "wDocument")
+       {
+               setId(id);
+       }
+       if(containerType() == "wCatalogue")
+       {
+               cat_group_id = id;
+       }
+}
+
+
+/*!
+ *     \~english
+ *     Opens form for edit catalogue element.
+ *     \~russian
+ *     Открывает форму по умолчанию для объекта контейнера и настраивает ее на работу с текущей строкой таблицы. Используется только в настраиваемом редакторе каталога.
+ *     \~
+ */
+void
+wDBTable::EditElement()
+{
+
+       ANANAS_UID id = 0;
+//     wGroupTreeItem * item = ( wGroupTreeItem * ) tree->currentItem();
+       aForm * f = 0;
+
+//CHECK_POINT
+       id = currentRecord()->value(0).toLongLong();
+       if ( id ) {
+               if ( engine ) {
+                       f = engine->openForm( aWidget::parentContainer( this )->getId(), 0, md_action_edit, md_form_elem, id, ( aWidget *) this );
+                       if ( f ) {
+                               connect(f, SIGNAL( update( ANANAS_UID )), this, SLOT(updateItem( ANANAS_UID )));
+//                             connect(f, SIGNAL(selected( Q_ULLONG )), this, SLOT(on_selected( Q_ULLONG )));
+//                             f->closeAfterSelect = true;
+                       }
+               }
+       }
+}
+
+
+long
+wDBTable::journalFieldId(long columnId){
+       aCfgItem item;
+
+       item= md->find(md->find(columnId),md_fieldid);
+       return md->text(item).toLong();
+
+}
+
+QString
+wDBTable::journalFieldName(long columnId)
+{
+       aCfgItem item;
+       item= md->find(md->find(columnId),md_fieldid);
+       item = md->find(md->text(item).toLong());
+       if(!item.isNull())
+       {
+               QString s = md->attr(item,mda_type);
+               QChar ch = s[0];
+               if(ch.upper()=='O')
+               {
+                       return QString("text_uf%1").arg(md->attr(item,mda_id));
+               }
+               else
+               {
+                       return QString("uf%1").arg(md->attr(item,mda_id));
+               }
+       }
+       return "uf0";
+
+}
+
+/*!
+ *     \~english
+ *     Hanler table cell end edit.
+ *     \~russian
+ *     Обрабатывает окончание редактирования ячейки таблицы.
+ *     \~
+ */
+//bool
+void
+wDBTable::updateTableCellHandler(int r, int c)
+{
+//     printf(">>>>update curr row %d  col %d!\n",r,c);
+       lastEditedRow= r;
+       lastEditedCol= c;
+}
+
+/*!
+ *     \~english
+ *     Reimplemented QDataTable function.
+ *     \~russian
+ *     Переопределяет функцию QDataTable. Испускает сигнал updateCurr().
+ *     \~
+ */
+bool
+wDBTable::updateCurrent()
+{
+       bool res = Q3DataTable::updateCurrent();
+       if(res)
+       {
+//             printf(">>>>real update curr row %d  col %d!\n",lastEditedRow, lastEditedCol);
+               emit(updateCurr(lastEditedRow,lastEditedCol));
+       }
+return res;
+}
+
+
+/*!
+ *     \~english
+ *     Reimplemented QDataTable function.
+ *     \~russian
+ *     Переопределяет функцию QDataTable. Отрабатывет после нажатия Enter в редактируемой ячейке.
+ *     Перемещает фокус ввода на следующую ячейку.
+ *     \~
+ */
+void
+wDBTable::activateNextCell()
+{
+       //int r = currentRow(), c = currentColumn();
+       //if(r<0) r=0;
+       //if(c<0) c=0;
+       //tCurrentCell(r,c+1);
+}
+
+
+
+
+/*!
+ *     \~english
+ *     Reimplemented QDataTable function.
+ *     \~russian
+ *     Переопределяет функцию QDataTable. Выделяет текст в ячейке.
+ *     \~
+ */
+//>>>>>>> 1.71.2.13
+QWidget *
+wDBTable::beginUpdate ( int row, int col, bool replace )
+{
+       wField  *wd;
+       wd = (wField*)Q3DataTable::beginUpdate(row,col,replace);
+       if(wd)
+       {
+               //inEditMode = true;
+               wd->selectAll();
+       }
+       return wd;
+}
+
+
+void
+wDBTable::doubleClickEventHandler(int /*rol*/, int /*col*/, int /*button*/, const QPoint &/*mousePos*/)
+{
+       if(containerType() =="wCatalogue" || containerType() == "wJournal")
+       {
+               if(currentRecord())
+               {
+                       qulonglong id = currentRecord()->value(0).toLongLong();
+                       emit( selected( id ) );
+               }
+       }
+
+}
+
+/**
+ * \ru
+ *             \brief Переопределяем метод базового класса, вызывающий диалог подтверждения.
+ *             Переопределен только диалог подтверждения удаления.
+ * \_ru
+ */
+
+QSql::Confirm
+wDBTable::confirmEdit( QSql::Op m ) {
+       if ( m == QSql::Delete ) {
+               if ( 0 == QMessageBox::question(
+            this,
+            tr("Remove record?"),
+            tr("You are going to remove record <br>"
+                "Are you sure?"),
+            tr("&Yes, remove"), tr("&No"),
+            QString::null, 0, 1 ) ) {
+               return QSql::Yes;
+        } else {
+               return QSql::No;
+        }
+       } else {
+               return Q3DataTable::confirmEdit( m );
+       }
+}
+
+/**
+ * \ru
+ *             \brief Переопределяем метод базового класса, осуществляющий вставку новой строки в таблицу.
+ *             Наш метод будет всегда помещать новую строку в начале таблицы.
+ * \_ru
+ */
+
+bool
+wDBTable::beginInsert() {
+       if ( !sqlCursor() || isReadOnly() || !numCols() )
+               return FALSE;
+    if ( !sqlCursor()->canInsert() )
+               return FALSE;
+
+       bool result = Q3DataTable::beginInsert();
+       endEdit( currentRow(), currentColumn(), false, false);
+       setCurrentCell( numRows(), 0 );
+       return result;
+
+}
+
+
+/*!
+ *     \~english
+ *     Reimplemented QDataTable function.
+ *     \~russian
+ *     Переопределяет функцию QDataTable. Если контейнер wJournal, может испускаеть сигналы insertRequest(), updateRequest(), deleteRequest(), viewRequest()
+ *     \~
+ */
+void
+wDBTable::contentsContextMenuEvent ( QContextMenuEvent * e )
+{
+       Q3Table::contentsContextMenuEvent( e );
+       QString str, ctype;
+
+       if ( containerType() == "wDocument" || containerType() == "wCatalogue" ) {
+       // Переопределяем всплывающее по правой кнопке мыши меню для табличной части документа
+       // Во-первых, для его локализации
+       // Во-вторых, чтобы добавляемая в табличную часть строка всегда вставлялась самой последней.
+               enum {
+               IdInsert=0,
+                       IdUpdate,
+               IdDelete,
+               };
+
+               QPointer<Q3PopupMenu> popupForDoc = new Q3PopupMenu( this );
+               int id[ 3 ];
+               id[ IdInsert ]  = popupForDoc->insertItem( tr( "New" ) );
+               id[ IdUpdate ]  = popupForDoc->insertItem( tr( "Edit" ) );
+               id[ IdDelete ]  = popupForDoc->insertItem( tr( "Delete" ) );
+
+               if ( !sqlCursor() || isReadOnly() || !numCols() ) {
+                       popupForDoc->setItemEnabled(id[ IdInsert ], false );
+                       popupForDoc->setItemEnabled(id[ IdUpdate ], false );
+                       popupForDoc->setItemEnabled(id[ IdDelete ], false );
+               }
+
+               int r = popupForDoc->exec( e->globalPos() );
+               delete (Q3PopupMenu*) popupForDoc;
+               if(r==id[IdInsert]) {
+                       beginInsert();
+               } else if(r==id[IdUpdate]) {
+                       keyPressEvent( new QKeyEvent( QEvent::KeyPress, Qt::Key_F2, 0, Qt::NoButton));
+               } else if(r==id[IdDelete]) {
+                       Q3DataTable::deleteCurrent();
+               }
+       }
+
+
+       if ( containerType() == "wJournal" )
+       {
+               //id = currentRecord()->value(0).toLongLong();
+                       enum {
+                       IdInsert=0,
+                       IdUpdate,
+                       IdDelete,
+                       IdView,
+                       IdRefresh };
+               QPointer<Q3PopupMenu> popup = new Q3PopupMenu( this );
+               int id[ 5 ];
+               id[ IdInsert ] = popup->insertItem( tr( "New" ) );
+               id[ IdUpdate ] = popup->insertItem( tr( "Edit" ) );
+               id[ IdDelete ] = popup->insertItem( tr( "Delete" ) );
+               id[ IdView ] = popup->insertItem( tr( "View" ) );
+               id[ IdRefresh ] = popup->insertItem( tr( "Refresh" ) );
+               int r = popup->exec( e->globalPos() );
+               delete (Q3PopupMenu*) popup;
+               if(r==id[IdInsert])
+                       emit(insertRequest());
+               else
+                       if(r==id[IdUpdate])
+                               emit(updateRequest());
+                       else
+                               if(r==id[IdDelete])
+                                       emit(deleteRequest());
+                               else
+                                       if(r==id[IdView])
+                                               emit(viewRequest());
+                                               if(r==id[IdRefresh])
+                                                       {
+                                                               //recalculate();
+                                                               refresh();
+                                                       }
+       }
+       e->accept();
+
+}
+
+
+void
+wDBTable::updateItem( ANANAS_UID db_uid )
+{
+       refresh();
+       emit currentChanged( currentRecord() );
+}
+
+
+int
+wDBTable::Select( ANANAS_UID db_uid )
+{
+       aSQLTable *t = ( aSQLTable *) sqlCursor();
+
+//     printf("id = %Li\n",db_uid);
+       ANANAS_UID cur_id = 0;
+       uint curr = currentRow(), curc=currentColumn(), row = 0;
+       bool found = FALSE;
+
+       while ( t->seek( row ) ){
+               cur_id = t->sysValue( "id" ).toULongLong();
+               if ( cur_id == db_uid ) {
+                       found = TRUE;
+                       break;
+               }
+               row++;
+       }
+       if ( found ) {
+               setCurrentCell( row, curc );
+       } else setCurrentCell( curr, curc );
+       return 0;
+}
+
+
+bool
+wDBTable::searchColumn( const QString & text, bool FromCurrent, bool Forward )
+{
+
+       QString s;
+       uint curr = currentRow(), curc=currentColumn(), row = 0, idx;
+       bool found = FALSE;
+       aSQLTable *t = ( aSQLTable *) sqlCursor();
+
+       if ( FromCurrent ) row = curr;
+       if ( Forward ) row++; else row--;
+       idx = indexOf( curc );
+
+       while ( t->seek( row ) ){
+               s = t->value( idx ).toString();
+               if ( s.left( text.length() ) == text ) {
+                       found = TRUE;
+                       break;
+               }
+               if ( Forward ) row++; else row--;
+       }
+       if ( found ) {
+               setCurrentCell( row, curc );
+       };
+       return found;
+}
+
+
+
+void
+wDBTable::searchOpen( const QString & text )
+{
+       searchWidget = new aSearchWidget( aWidget::parentContainer( this ), this );
+       searchMode = TRUE;
+       searchWidget->setFocus();
+       searchWidget->search( text );
+}
+
+
+void
+wDBTable::searchClose()
+{
+       if ( searchWidget ) {
+               setFocus();
+               searchWidget->deleteLater();
+               searchMode = FALSE;
+               searchWidget = 0;
+       }
+}
+
+
+/*!
+ *\~english
+ *
+ *
+ *\~russian
+ *     Осуществляет интерактивный поиск по первым буквам
+ *     текстового значения текущего столбца таблицы.
+ *     Пока не реализован поиск для столбцов типа "Объект".
+ *     Up      - предыдущее значение.
+ *     Down    - следующее значение.
+ *     ESC,Enter - конец поиска.
+ *\~
+ */
+aSearchWidget::aSearchWidget( QWidget *parent, wDBTable *table )
+: Q3Frame( parent )
+{
+       t = table;
+       ftext = "";
+       setFrameStyle( Q3Frame::PopupPanel | Q3Frame::Raised );
+       setFocusPolicy( Qt::StrongFocus );
+       new Q3HBoxLayout( this, 0, 0 );
+       l = new QLineEdit( this );
+        l->installEventFilter( this );
+       setFocusProxy( l );
+       layout()->add( l );
+//     move (0,0);
+       move( 3+t->x()+t->columnPos( t->currentColumn()), t->y()+1/*+t->height()*/);
+       resize( t->columnWidth( t->currentColumn() )-2, 25 );
+       connect( l, SIGNAL( textChanged( const QString & ) ), this, SLOT( setText( const QString & ) ) );
+}
+
+
+aSearchWidget::~aSearchWidget()
+{
+}
+
+
+void
+aSearchWidget::search( const QString &t )
+{
+       show();
+       l->setText( t );
+}
+
+
+void
+aSearchWidget::setText( const QString &text )
+{
+       if ( t->searchColumn( text ) ) ftext = text;
+       else l->setText( ftext );
+}
+
+
+bool
+aSearchWidget::eventFilter( QObject *obj, QEvent *ev )
+{
+       if ( obj == l ) {
+               if ( ev->type() == QEvent::FocusOut ) {
+                       t->searchClose();
+                       return TRUE;
+               }
+               if ( ev->type() == QEvent::KeyPress ) {
+               QKeyEvent *e = ( QKeyEvent *) ev;
+                       switch ( e->key() ){
+                       case Qt::Key_Return:
+                       case Qt::Key_Escape:
+                               //printf("OK\n");
+                               t->searchClose();
+                               break;
+                       case Qt::Key_Up:
+                               t->searchColumn( ftext, TRUE, FALSE );
+                               break;
+                       case Qt::Key_Down:
+                               t->searchColumn( ftext, TRUE, TRUE );
+                               break;
+                       default:
+                               return FALSE;
+                               break;
+                       }
+                return TRUE;
+            } else {
+                return FALSE;
+            }
+        } else {
+            // pass the event on to the parent class
+            return Q3Frame::eventFilter( obj, ev );
+        }
+}
diff --git a/src/plugins/dbtable/wdbtable.h b/src/plugins/dbtable/wdbtable.h
new file mode 100644 (file)
index 0000000..2041a98
--- /dev/null
@@ -0,0 +1,323 @@
+/****************************************************************************
+** $Id: wdbtable.h,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Header file of the database table plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef WDBTABLE_H
+#define WDBTABLE_H
+
+#include <q3sqlpropertymap.h>
+#include <q3datatable.h>
+//Added by qt3to4:
+#include <Q3SqlEditorFactory>
+#include <QContextMenuEvent>
+#include <Q3Frame>
+#include <Q3ValueList>
+#include <QPixmap>
+#include <Q3SqlCursor>
+#include <QKeyEvent>
+#include <QEvent>
+#include "acfg.h"
+#include "aobject.h"
+#include "awidget.h"
+#include "wfield.h"
+
+class aDatabase;
+class wDBTable;
+class Q3DataTable;
+
+class aSearchWidget : public Q3Frame
+{
+Q_OBJECT
+public:
+       aSearchWidget( QWidget *parent, wDBTable *table );
+       ~aSearchWidget();
+       void search( const QString &t ="");
+public slots:
+       void setText( const QString &t );
+protected:
+//     virtual void keyPressEvent ( QKeyEvent *e );
+        bool eventFilter( QObject *obj, QEvent *ev );
+private:
+       QString ftext;
+       QLineEdit *l;
+       wDBTable *t;
+};
+
+
+
+/*!
+ * \en Class for editing documents tables. \_en
+ * \ru
+ *     \brief Визуальный класс для редактирования табличных частей документа.
+ *     Наследует QDataTable.
+ *
+ *     Поддерживает редактирование журнала документов
+ *     и таблицы элементов каталога.
+ * \_ru
+ *
+ */
+class QT_WIDGET_PLUGIN_EXPORT wDBTable : public Q3DataTable
+{
+       friend class aForm;
+
+       Q_OBJECT
+       Q_PROPERTY( qulonglong  Id READ getId WRITE setId DESIGNABLE true )
+       Q_PROPERTY( int         DefaultColWidth READ getDefColWidth WRITE setDefColWidth DESIGNABLE true )
+       Q_PROPERTY( int         TableInd READ getTblInd WRITE setTblInd DESIGNABLE true )
+       Q_PROPERTY( QStringList DefFields READ getDefFields WRITE setDefFields DESIGNABLE true )
+       Q_PROPERTY( QStringList DefHeaders READ getDefHeaders WRITE setDefHeaders DESIGNABLE true )
+       Q_PROPERTY( QStringList ColWidth READ getColWidth WRITE setColWidth DESIGNABLE true )
+       Q_PROPERTY( QStringList DefIdList READ getDefIdList WRITE setDefIdList DESIGNABLE true )
+//     Q_PROPERTY( bool        openEditor READ getOpenEditor WRITE setOpenEditor STORED true )
+       Q_PROPERTY( QString     editFormName READ getEditFormName WRITE setEditFormName DESIGNABLE true )
+public:
+       aCfg*           md;
+       aDatabase*      db;
+       aEngine*        engine;
+       //char vLoaded;
+       QStringList     list_available_tables;
+       QStringList     fname, hname, colWidth,idList;
+       int             defColWidth;
+       int             tableInd;
+       aCfgItem        tables;
+       Q3SqlCursor*    cur;
+       bool            searchMode;
+       QString         searchString;
+       aSearchWidget   *searchWidget;
+
+       wDBTable( QString objtype, QWidget *parent = 0, const char *name = 0);
+       virtual ~wDBTable();
+       void            checkFields();
+       void            setFields(int numTable); //set propertis default value for table with num=numTable
+       QStringList     getFields(int numTable, bool GetId=false); // return list field names or id's, defined in metadata
+       QString         getFieldName(long idField); // return attribute `name' value
+       QString         getFieldType(long idField); // return attribute `type' value
+       int             getTableInd(int id);
+       int             getTableId(int ind);
+
+       //      void    init( aDatabase *adb );
+       void            init();
+       void            init(aDatabase *adb, aEngine *e = 0 ); // call in ananas engine
+       void            OpenEditor();
+       //QWidget*      createEditor();
+
+       //int   getDefaultWidth() const {return defColWidth;};
+
+       QStringList     getDefFields()  const;
+       QStringList     getDefHeaders() const;
+       QStringList     getColWidth()   const;
+       QStringList     getDefIdList()  const;
+       qulonglong      getId()         const;
+       int             getTblInd()     const;
+       bool            getOpenEditor() const;
+       int             getDefColWidth() const;
+
+       void    setDefFields(QStringList lst);
+       void    setDefHeaders(QStringList lst);
+       void    setColWidth(QStringList lst);
+       void    setDefIdList(QStringList lst);
+       void    setId( qulonglong fn );
+       void    setTblInd( int ind );
+       void    setOpenEditor( bool fn );
+       void    setDefColWidth( int fn );
+
+       QString getEditFormName() const { return vEditFormName;};
+       void    setEditFormName( QString name)  { vEditFormName = name; };
+
+       QString containerType() const { return container_type;};
+       void    setContainerType( QString name) { container_type = name; };
+       QPixmap systemIcon();
+       virtual int Select( ANANAS_UID db_uid );
+public slots:
+       Q3ValueList<int> getBindList();
+       void    setWFieldEditor();
+       void    setAvailableTables();
+       void    lineUpdate(QSql::Op mode);
+       void    newFilter(const QString & );
+       void    newDataId(const qulonglong );
+       QVariant Value( const QString &colname );
+
+       bool searchColumn( const QString &text, bool FromCurrent = FALSE, bool Forward = TRUE );
+       void searchOpen( const QString &text = "" );
+       void searchClose();
+
+protected slots:
+       void doubleClickEventHandler(int , int , int, const QPoint& ); //parametrs not used
+       virtual void updateTableCellHandler(int, int);
+signals:
+
+/*!
+ *     \~english
+ *     Signal emitted after table line update.
+ *     \~russian
+ *     Сигнал испускается после обновлении строки таблицы.
+ *     \~
+ */
+       void saveLine(QSqlRecord *rec);
+
+/*!
+ *     \~english
+ *     Signal emitted after table line delete.
+ *     \~russian
+ *     Сигнал испускается после удаления строки таблицы.
+ *     \~
+ */
+       void deleteLine(QSqlRecord *rec);
+/*!
+ *     \~english
+ *     Signal emitted after select another document.
+ *     \~russian
+ *     Сигнал испускается после выбора документа.
+ *     \~
+ */
+       void selected( qulonglong uid );
+/*!
+ *     \~english
+ *     Signal emitted after change line.
+ *     \~russian
+ *     Сигнал испускается после изменения строки.
+ *     \~
+ */
+       void selectRecord ( qulonglong );
+/*!
+ *     \~english
+ *     Signal emitted after update cell.
+ *     \~russian
+ *     Сигнал испускается после обновления ячейки с номером \a row, \a col.
+ *     \~
+ */
+       void updateCurr(int row, int col);
+//<<<<<<< wdbtable.h
+
+       //signals from context menu for connecting to wJournal
+       //if container has another type, then do QDataTable context menu
+       //and this signal no emitted
+//=======
+
+/*!
+ *     \~english
+ *     signals from context menu for connecting to wJournal
+ *     if container has another type, then do QDataTable context menu
+ *     and this signal no emitted
+ *     \~russian
+ *     Сигналы от контекстного меню для присоединения к wJournal
+ *     Если контейнер другого типа, то вызывается стандартное меню,
+ *     и эти сигналы не испускаются.
+ *     \~
+ *     \see updateRequest(); deleteRequest(); viewRequest();
+ *
+*/
+//>>>>>>> 1.45.2.4
+       void insertRequest();
+/*!
+ *     \see insertRequest();
+*/
+       void updateRequest();
+/*!
+ *     \see insertRequest();
+*/
+       void deleteRequest();
+/*!
+ *     \see insertRequest();
+*/
+       void viewRequest();
+       // end
+
+private slots:
+       //void select( Q_ULLONG group );
+       void lineChange(int, int);
+       void lineInsert(QSqlRecord*);
+       void updateItem( ANANAS_UID db_uid );
+
+protected:
+       virtual void paintField ( QPainter * p, const QSqlField * field, const QRect & cr, bool selected );
+       QWidget * beginUpdate ( int row, int col, bool replace );
+       virtual bool updateCurrent();
+       void  contentsContextMenuEvent ( QContextMenuEvent * e );
+//     void propertyUpdate(const QString &propName);
+       virtual bool deleteCurrent();
+       //virtual QSql::Confirm confirmEdit ( QSql::Op m );
+       virtual void keyPressEvent ( QKeyEvent *e );
+       void EditElement();
+       virtual void activateNextCell();
+       virtual bool beginInsert ();
+       virtual QSql::Confirm confirmEdit( QSql::Op m );
+
+private:
+
+       QPixmap t_doc;
+       QPixmap t_doc_d;
+       QPixmap t_doc_t;
+       QPixmap t_doc_m;
+       QPixmap t_doc_tm;
+       QPixmap t_cat_e;
+       QPixmap t_cat_ed;
+       QPixmap t_cat_g;
+       QPixmap t_cat_gd;
+
+       int lastEditedRow;
+       int lastEditedCol;
+
+       QString container_type;
+       qulonglong      doc_id;
+       qulonglong      cat_group_id;
+       long journalFieldId(long);
+       QString journalFieldName(long);
+       bool inEditMode;
+       //aDBTablePrivate impl;
+//     void updateProp(void);
+       Q3ValueList<int> listBindings;
+       aCfgItem obj;
+        QString vName, vEditFormName;
+       QString vDefineCols;
+       qulonglong oid;
+};
+
+
+/*!
+ * \en Class for support custom editor in wDBTable. \_en
+ * \ru
+ *     \brief Класс для поддержки собственного редактора поля в wDBTable.
+ *     Наследует QSqlEditorFactory.
+ * \_ru
+ */
+class aEditorFactory: public Q3SqlEditorFactory
+{
+public:
+/*!
+ * \~english   Constructor
+ * \~russian   Конструктор \~
+ */
+       aEditorFactory(QObject * parent = 0, const char * name = 0):Q3SqlEditorFactory(parent/*--,name*/) {};
+       QWidget * createEditor (QWidget * parent, const QSqlField * field);
+       void setMd(aCfg *md);
+private:
+       aCfg * md;
+};
+#endif
diff --git a/src/plugins/dbtable/wdbtable_plugin.cpp b/src/plugins/dbtable/wdbtable_plugin.cpp
new file mode 100644 (file)
index 0000000..b13124e
--- /dev/null
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "wdbtable_plugin.h"
+
+#include <QtPlugin>
+#include <QDesignerFormEditorInterface>
+#include <QExtensionManager>
+
+#include "wdbtable_taskmenu.h"
+#include "wdbtable.h"
+
+
+wDBTablePlugin::wDBTablePlugin(QObject *parent)
+    : QObject(parent), m_initialized(false)
+{
+    m_initialized = false;
+}
+
+bool wDBTablePlugin::isContainer() const
+{
+    return false;
+}
+
+bool wDBTablePlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void wDBTablePlugin::initialize(QDesignerFormEditorInterface *core)
+{
+    if (m_initialized)
+        return;
+    Q_UNUSED(core);
+
+    QExtensionManager *manager = core->extensionManager();
+    Q_ASSERT(manager != 0);
+    manager->registerExtensions(new wDBTableTaskMenuFactory(manager),
+                                Q_TYPEID(QDesignerTaskMenuExtension));
+
+    m_initialized = true;
+}
+
+QWidget *wDBTablePlugin::createWidget(QWidget *parent)
+{
+    wDBTable *w = new wDBTable("", parent, 0);
+    return w;
+}
+
+QString wDBTablePlugin::name() const
+{
+    return QLatin1String("wDBTable");
+}
+
+QString wDBTablePlugin::group() const
+{
+    return QLatin1String("Ananas");
+}
+
+QString wDBTablePlugin::toolTip() const
+{
+    return QString("Ananas for QT database Table Widget");
+}
+
+QString wDBTablePlugin::whatsThis() const
+{
+    return QString("Entry to modify database tables values of Ananas's object");
+}
+
+QString wDBTablePlugin::includeFile() const
+{
+    return QLatin1String("wdbtable.h");
+}
+
+QIcon wDBTablePlugin::icon() const
+{
+    //return QIcon();
+    return QIcon(":/images/wdbtable.png");
+}
+
+QString wDBTablePlugin::domXml() const
+{
+    return "<widget class=\"wDBTable\" name=\"wDBTable_1\">\n</widget>\n";
+}
diff --git a/src/plugins/dbtable/wdbtable_plugin.h b/src/plugins/dbtable/wdbtable_plugin.h
new file mode 100644 (file)
index 0000000..1610911
--- /dev/null
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef WDBTABLE_PLUGIN_H
+#define WDBTABLE_PLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+#include "qwidgetplugin.h"
+
+
+class QT_WIDGET_PLUGIN_EXPORT wDBTablePlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+    wDBTablePlugin(QObject *parent=0);
+
+    bool isContainer() const;
+    bool isInitialized() const;
+    void initialize(QDesignerFormEditorInterface *core);
+    QWidget *createWidget(QWidget *parent);
+
+    QString name() const;
+    QString group() const;
+    QString toolTip() const;
+    QString whatsThis() const;
+    QString includeFile() const;
+    QIcon icon() const;
+    QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+#endif // WDBTABLE_PLUGIN_H
diff --git a/src/plugins/dbtable/wdbtable_taskmenu.cpp b/src/plugins/dbtable/wdbtable_taskmenu.cpp
new file mode 100644 (file)
index 0000000..599047a
--- /dev/null
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include <QDesignerFormEditorInterface>
+
+#include <QAction>
+
+#include "wdbtable_taskmenu.h"
+#include "wdbtable.h"
+#include "edbtable.h"
+
+
+wDBTableTaskMenu::wDBTableTaskMenu(wDBTable *widget, QObject *parent)
+    : QObject(parent)
+{
+    m_widget = widget;
+
+    m_editAction = new QAction(tr("Edit ..."), this);
+    connect(m_editAction, SIGNAL(triggered()), this, SLOT(edit()));
+}
+
+void wDBTableTaskMenu::edit()
+{
+    /*eDBTable e;
+
+    m_widget->setAvailableTables();
+    m_widget->checkFields();
+       e.setData(m_widget);
+       if (e.exec() == QDialog::Accepted)
+       {
+               e.getData(m_widget);
+       }*/
+       m_widget->OpenEditor();
+}
+
+QAction *wDBTableTaskMenu::preferredEditAction() const
+{
+    return m_editAction;
+}
+
+QList<QAction *> wDBTableTaskMenu::taskActions() const
+{
+    QList<QAction *> list;
+    list.append(m_editAction);
+    return list;
+}
+
+wDBTableTaskMenuFactory::wDBTableTaskMenuFactory(QExtensionManager *parent)
+    : QExtensionFactory(parent)
+{
+}
+
+QObject *wDBTableTaskMenuFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
+{
+    if (iid != Q_TYPEID(QDesignerTaskMenuExtension))
+        return 0;
+
+    if (wDBTable *dt = qobject_cast<wDBTable*>(object))
+        return new wDBTableTaskMenu(dt, parent);
+
+    return 0;
+}
diff --git a/src/plugins/dbtable/wdbtable_taskmenu.h b/src/plugins/dbtable/wdbtable_taskmenu.h
new file mode 100644 (file)
index 0000000..a08fed9
--- /dev/null
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef WDBTABLE_TASKMENU_H
+#define WDBTABLE_TASKMENU_H
+
+#include <QDesignerTaskMenuExtension>
+#include <QExtensionFactory>
+
+
+class QExtensionManager;
+class QAction;
+class wDBTable;
+
+class wDBTableTaskMenu: public QObject, public QDesignerTaskMenuExtension
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerTaskMenuExtension)
+public:
+    wDBTableTaskMenu(wDBTable *widget, QObject *parent);
+
+    QAction *preferredEditAction() const;
+    QList<QAction *> taskActions() const;
+
+private slots:
+    void edit();
+
+private:
+    QAction *m_editAction;
+    wDBTable *m_widget;
+};
+
+class wDBTableTaskMenuFactory: public QExtensionFactory
+{
+    Q_OBJECT
+public:
+    wDBTableTaskMenuFactory(QExtensionManager *parent = 0);
+
+protected:
+    QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
+};
+
+#endif // WDBTABLE_TASKMENU_H
diff --git a/src/plugins/document/document.pri b/src/plugins/document/document.pri
new file mode 100644 (file)
index 0000000..3bf42d3
--- /dev/null
@@ -0,0 +1,19 @@
+HEADERS += \
+    document/edocument.h \
+    document/eselectdoctype.h \
+    document/wdocument.h \
+    document/wdocument_plugin.h \
+    document/wdocument_taskmenu.h
+
+SOURCES += \
+    document/edocument.cpp \
+    document/eselectdoctype.cpp \
+    document/wdocument.cpp \
+    document/wdocument_plugin.cpp \
+    document/wdocument_taskmenu.cpp 
+        
+FORMS += \
+    document/edocument.ui \
+    document/eselectdoctype.ui
+     
+    
\ No newline at end of file
diff --git a/src/plugins/document/edocument.cpp b/src/plugins/document/edocument.cpp
new file mode 100644 (file)
index 0000000..8092766
--- /dev/null
@@ -0,0 +1,153 @@
+#include "edocument.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "acfg.h"
+
+/*
+ *  Constructs a eDocument as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+eDocument::eDocument(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+eDocument::~eDocument()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void eDocument::languageChange()
+{
+    retranslateUi(this);
+}
+
+void eDocument::init()
+{
+/*
+       int oc, i, f, idx=0;
+       char *id, *name, *ot;
+       cfg_objptr o;
+       char otype[100];
+       QString named;
+
+       otypes.clear();
+       eType->clear();
+       otypes.append("D");
+       eType->insertItem(trUtf8("Дата"), idx++);
+       otypes.append("T");
+       eType->insertItem(trUtf8("Время"), idx++);
+       otypes.append("N %d %d");
+       eType->insertItem(trUtf8("Число"), idx++);
+       otypes.append("C %d");
+       eType->insertItem(trUtf8("Строка"), idx++);
+
+       oc=cfgobj_count(NULL, NULL);
+       for (i=1;i<=oc;i++) {
+               id=cfgobj_idn(NULL, NULL, i, &o);
+               ot=(char *)o->name;
+               name=cfgobj_attr(o, "name");
+               named="";
+               f=0;
+               if (strcmp((char *)ot, aot_doc)==0) {
+                       named=trUtf8("Документ.");
+                       f=1;
+               }
+               if (strcmp((char *)ot, aot_cat)==0) {
+                       named=trUtf8("Справочник.");
+                       f=1;
+               }
+               if (f) {
+                       named=named+trUtf8(name);
+                       sprintf(otype, "O %s", id);
+                       otypes.append(otype);
+                       eType->insertItem(named, idx++);
+               }
+       }
+*/
+}
+
+
+
+void eDocument::setData( QWidget *o, aCfg *md )
+{
+//     const QObject *o = sender();
+       if ( o ) {
+           if ( o->className() != QString("wDocument") || !md ) {
+               reject();
+               return;
+           }
+       }
+       else {
+               reject();
+               return;
+       }
+       wDocument *f = ( wDocument*) o;
+                       int w=0, d=0, idx=0;
+                       unsigned int i;
+                       long oid , id;
+
+                       id = f->getId();
+
+                       otypes.clear();
+                       eType->clear();
+
+                       QStringList tlist = md->types( md_document );
+                       otypes.clear();
+                       eType->clear();
+                       for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
+                               otypes.append( (*it).section( "\t", 0, 0 ) );
+                               eType->insertItem( (*it).section("\t", 1, 1 ), idx++ );
+                       }
+                       for ( i = 0 ; i < otypes.count(); i++ ) {
+                               oid = 0;
+                               if( otypes[i][0] == 'O' ) {
+                                       sscanf( (const char *)otypes[ i ], "O %d", &oid );
+                                       if ( oid == id ) {
+                                               eType->setCurrentItem( i );
+                                               break;
+                                       }
+                               }
+                       }
+}
+
+
+void eDocument::getData( QWidget *o )
+//aDocument *f )
+{
+       QVariant v;
+//     const QObject *o = sender();
+            if ( !o ) return;
+       if ( o->className() != QString("wDocument") ) return;
+       wDocument *f = ( wDocument*) o;
+
+       int idx=eType->currentItem();
+       int oid = 0;
+
+       if (f) {
+               if( otypes[idx][0] == 'O' ) {
+                       sscanf( (const char *)otypes[ idx ], "O %d", &oid );
+//                     v = oid;
+                       f->setProperty("Id", QVariant( oid ) );
+//                     f->setId( oid );
+               }
+       }
+
+}
+
diff --git a/src/plugins/document/edocument.h b/src/plugins/document/edocument.h
new file mode 100644 (file)
index 0000000..e60042a
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef EDOCUMENT_H
+#define EDOCUMENT_H
+
+#include "ui_edocument.h"
+
+
+class eDocument : public QDialog, public Ui::eDocument
+{
+    Q_OBJECT
+
+public:
+    eDocument(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~eDocument();
+
+    QStringList otypes;
+
+public slots:
+    virtual void init();
+    virtual void setData( QWidget * o, aCfg * md );
+    virtual void getData( QWidget * o );
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // EDOCUMENT_H
diff --git a/src/plugins/document/edocument.ui b/src/plugins/document/edocument.ui
new file mode 100644 (file)
index 0000000..c3becf3
--- /dev/null
@@ -0,0 +1,116 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>eDocument</class>\r
+  <widget class="QDialog" name="eDocument" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>348</width>\r
+        <height>110</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Document</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item rowspan="1" row="3" column="0" colspan="4" >\r
+        <layout class="QHBoxLayout" />\r
+      </item>\r
+      <item rowspan="1" row="1" column="1" colspan="3" >\r
+        <widget class="QComboBox" name="eType" />\r
+      </item>\r
+      <item row="1" column="0" >\r
+        <widget class="QLabel" name="textLabel2" >\r
+          <property name="maximumSize" >\r
+            <size>\r
+              <width>100</width>\r
+              <height>32767</height>\r
+            </size>\r
+          </property>\r
+          <property name="text" >\r
+            <string>Type</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="4" column="0" >\r
+        <spacer name="spacer4" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>31</width>\r
+              <height>16</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Vertical</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+      <item rowspan="1" row="5" column="0" colspan="2" >\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QPushButton" name="bOK" >\r
+              <property name="text" >\r
+                <string>OK</string>\r
+              </property>\r
+              <property name="default" >\r
+                <bool>true</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="bCancel" >\r
+              <property name="text" >\r
+                <string>Cancel</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item rowspan="1" row="5" column="2" colspan="2" >\r
+        <spacer name="spacer2" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>91</width>\r
+              <height>31</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Horizontal</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="6" margin="11" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >ananas.h</include>\r
+    <include location="local" >wdocument.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>bOK</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eDocument</receiver>\r
+      <slot>accept()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eDocument</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/document/eselectdoctype.cpp b/src/plugins/document/eselectdoctype.cpp
new file mode 100644 (file)
index 0000000..82f16eb
--- /dev/null
@@ -0,0 +1,77 @@
+#include "eselectdoctype.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a eSelectDocType as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+eSelectDocType::eSelectDocType(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+eSelectDocType::~eSelectDocType()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void eSelectDocType::languageChange()
+{
+    retranslateUi(this);
+}
+
+void eSelectDocType::init()
+{
+    listDocs->header()->hide();
+    listDocs->setColumnWidth( 0, 1000 );
+    listDocs->setFocus();
+}
+
+
+void eSelectDocType::setJournal( aCfg *md, int id )
+{
+    aCfgItem obj, dobj;
+    int i, cnt, t, did;
+    QString name;
+
+    listDocs->clear();
+    dlist.clear();
+    obj = md->find( id );
+    if ( !obj.isNull() ) {
+       dlist = md->getJournalDocuments( obj );
+//     printf("docs=%s\n", ( const char *) dlist.join("\n") );
+       for (i=0;i< dlist.count();i++) {
+           did = dlist[i].toInt();
+           dobj = md->find( did );
+           if ( !dobj.isNull() ) {
+               name = md->attr( dobj, mda_name );
+               new Q3ListViewItem( listDocs, name, dlist[i] );
+           }
+       }
+       listDocs->setSelected( listDocs->firstChild(), true );
+    }
+}
+
+
+void eSelectDocType::accepted()
+{
+    docId = listDocs->selectedItem()->text(1).toInt();
+  //  printf("docId=%i\n", docId );
+    accept();
+}
diff --git a/src/plugins/document/eselectdoctype.h b/src/plugins/document/eselectdoctype.h
new file mode 100644 (file)
index 0000000..936ab86
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef ESELECTDOCTYPE_H
+#define ESELECTDOCTYPE_H
+
+#include "ui_eselectdoctype.h"
+
+
+class eSelectDocType : public QDialog, public Ui::eSelectDocType
+{
+    Q_OBJECT
+
+public:
+    eSelectDocType(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~eSelectDocType();
+
+    QStringList dlist;
+    int docId;
+
+public slots:
+    virtual void init();
+    virtual void setJournal( aCfg * md, int id );
+    virtual void accepted();
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // ESELECTDOCTYPE_H
diff --git a/src/plugins/document/eselectdoctype.ui b/src/plugins/document/eselectdoctype.ui
new file mode 100644 (file)
index 0000000..662f149
--- /dev/null
@@ -0,0 +1,102 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>eSelectDocType</class>\r
+  <widget class="QDialog" name="eSelectDocType" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>304</width>\r
+        <height>272</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Select document type</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item row="1" column="1" >\r
+        <widget class="QPushButton" name="bCancel" >\r
+          <property name="text" >\r
+            <string>Cancel</string>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="0" column="1" >\r
+        <widget class="QPushButton" name="bOK" >\r
+          <property name="text" >\r
+            <string>OK</string>\r
+          </property>\r
+          <property name="default" >\r
+            <bool>true</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item rowspan="3" row="0" column="0" colspan="1" >\r
+        <widget class="Q3ListView" name="listDocs" >\r
+          <property name="hScrollBarMode" >\r
+            <enum>Q3ScrollView::AlwaysOff</enum>\r
+          </property>\r
+          <column>\r
+            <property name="text" >\r
+              <string>Document type</string>\r
+            </property>\r
+            <property name="clickable" >\r
+              <bool>true</bool>\r
+            </property>\r
+            <property name="resizable" >\r
+              <bool>true</bool>\r
+            </property>\r
+          </column>\r
+          <column>\r
+            <property name="text" >\r
+              <string>ID</string>\r
+            </property>\r
+            <property name="clickable" >\r
+              <bool>true</bool>\r
+            </property>\r
+            <property name="resizable" >\r
+              <bool>true</bool>\r
+            </property>\r
+          </column>\r
+        </widget>\r
+      </item>\r
+      <item row="2" column="1" >\r
+        <spacer name="spacer1" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>21</width>\r
+              <height>171</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Vertical</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="5" margin="5" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >ananas.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>bOK</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eSelectDocType</receiver>\r
+      <slot>accepted()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eSelectDocType</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/document/wdocument.cpp b/src/plugins/document/wdocument.cpp
new file mode 100644 (file)
index 0000000..a3f82c9
--- /dev/null
@@ -0,0 +1,420 @@
+/****************************************************************************
+** $Id: wdocument.cpp,v 1.2 2008/11/08 20:16:36 leader Exp $
+**
+** Code file of the document plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qobject.h>
+//--#include <qfocusdata.h>
+#include "adatabase.h"
+#include "adocument.h"
+#include "asqltable.h"
+#include "wdocument.h"
+#include "edocument.h"
+#include "wdbfield.h"
+#include "wdbtable.h"
+#include "wactionbutton.h"
+#include "alog.h"
+
+
+/*!
+ *\~english
+ *     Create wDocument object.
+ *\~russian
+ *     Создает объект wDocument.
+ *\~
+ *\param - \~english \~russian \~
+ *\param - \~english \~russian \~
+ */
+wDocument::wDocument( QWidget *parent, Qt::WFlags fl )
+:aWidget( parent, "wDocument", fl )
+{
+       setInited( false );
+}
+
+
+
+/*!
+ *\~english
+ *     Destructor for object.
+ *\~russian
+ *     Деструктор.
+ *\~
+ */
+wDocument::~wDocument()
+{
+
+}
+
+
+
+/*!
+ *\~english
+ *     Create aDocument database object.
+ *\~russian
+ *     Создает объект aDocument для работы с базой.
+ *\~
+ *\param - \~english \~russian \~
+ *\param - \~english \~russian \~
+ *\return \~english \~russian \~
+ */
+aObject *
+wDocument::createDBObject(  aCfgItem obj, aDatabase *adb )
+{
+       return new aDocument( obj, adb );
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ *\param - \~english \~russian \~
+ */
+void
+wDocument::initObject( aDatabase *adb )
+{
+       aWidget::initObject( adb );
+       QObject *obj;
+       QObjectList lb = this->queryList( "wDBField" );
+       QListIterator<QObject*> itb( lb ); // iterate over the buttons
+       while ( itb.hasNext() )
+       {
+               obj = itb.next();
+//             if ( (wActionButtton*) obj )->isActionUpdate() )
+               connect( (wDBField *)obj, SIGNAL(valueChanged( const QVariant & )),
+                               this, SLOT(valueChanged( const QVariant & )) );
+       }
+       //--delete lb; // delete the list, not the objects
+       lb = this->queryList( "wDBTable" );
+       QListIterator<QObject*> itb1( lb ); // iterate over the buttons
+       while ( itb1.hasNext() )
+       {
+               obj = itb1.next();
+//             if ( (wActionButtton*) obj )->isActionUpdate() )
+               connect( this, SIGNAL(changeObj(const QString &)),
+                        (wDBTable *)obj, SLOT(newFilter(const QString &)));
+               connect( this, SIGNAL(changeObjId(const qulonglong)),
+                        (wDBTable *)obj, SLOT(newDataId(const qulonglong)));
+       }
+       //--delete lb; // delete the list, not the objects
+       //--focusData()->next()->setFocus();
+       focusNextChild();
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ *\return \~english \~russian \~
+ */
+bool
+wDocument::checkStructure()
+{
+       return false;
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ *\param - \~english \~russian \~
+ *\return \~english \~russian \~
+ */
+QDialog*
+wDocument::createEditor( QWidget *parent )
+{
+       return new eDocument( parent );
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ *\param - \~english \~russian \~
+ *\return \~english \~russian \~
+ */
+int
+wDocument::select( qulonglong id )
+{
+       id=id;
+       return 0;
+}
+
+
+
+/*!
+ *\~english
+ *     Select object in database.
+ *\~russian
+ *     Выбирает объект в базе данных.
+ *\~
+ *\param id -\~english database record id.\~russian id объекта в базе данных.\~
+ *\return id -\~english error code.\~russian код ошибки.\~
+ */
+ERR_Code
+wDocument::Select( qulonglong id )
+{
+       ERR_Code err = aWidget::Select ( id );
+/*     if ( err )
+       {
+               printf( "select document error %i\n", err );
+               return err;
+       }
+*/     NewValues();
+       emit( changeObj(QString("idd=%1").arg(id)));
+       emit( changeObjId(id));
+       return err_noerror;
+}
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ *\param - \~english \~russian \~
+ *\return \~english \~russian \~
+ */
+qulonglong
+wDocument::Insert()
+{
+       return 0;
+}
+
+
+
+/*!
+ *\~english
+ *     Update values in database.
+ *     Udate values in current document header.
+ *\~russian
+ *     Обновляет значения в базе данных.
+ *     Обновляет значения в текущей шапке документа.
+ *\~
+ *\return \~english error code.\~russian код ошибки.\~
+ */
+int
+wDocument::Update()
+{
+       if ( dbobj ) {
+               return dbobj->Update();
+               NewValues();
+       }
+       else return err_abstractobj;
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ *\param - \~english \~russian \~
+ *\return \~english \~russian \~
+ */
+int
+wDocument::MarkDelete()
+{
+       return 0;
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ *\return \~english \~russian \~
+ */
+QString
+wDocument::displayString()
+{
+       return"";
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ *\return \~english \~russian \~
+ */
+bool
+wDocument::isContainer()
+{
+       return true;
+}
+
+
+
+/*!
+ *\~english
+ *\~russian
+ *\~
+ *\return \~english \~russian \~
+ */
+int
+wDocument::New()
+{
+       ERR_Code err = aWidget::New();
+       qulonglong idd;
+       if ( err ) return  err;
+       NewValues();
+       idd = uid();
+//     printf("<<<<<<<<<<<<<<<NEW id=%llu\n",idd);
+       aLog::print(aLog::Info, tr("wDocument new ok"));
+       emit( changeObj(QString("idd=%1").arg(idd)));
+       emit( changeObjId(idd));
+
+       return err_noerror;
+}
+
+
+
+/*!
+ *\~english
+ *     Conduct current docment.
+ *\~russian
+ *     Проводит текущий документ.
+ *\~
+ *\return \~english error code.\~russian код ошибки.\~
+ */
+int
+wDocument::TurnOn()
+{
+       if (!dbobj) return err_abstractobj;
+       else return dbobj->Conduct();
+}
+/*!
+ *\~english
+ *     UnConduct current docment.
+ *\~russian
+ *     Распроводит текущий документ.
+ *\~
+ *\return \~english error code.\~russian код ошибки.\~
+ */
+int
+wDocument::TurnOff()
+{
+       if (!dbobj) return err_abstractobj;
+       else return dbobj->UnConduct();
+}
+
+
+
+/*!
+ *\~english
+ *     Set fields values from database.
+ *     Used for insert values into fields when create or open document.
+ *\~russian
+ *     Устанавливает значения виджетов (кроме таблиц).
+ *     Устанавливает значения виджетов (полей экранной формы таких как поля шапки документа)
+ *     равными значениям из базы данных.
+ *     Используется для при открытии формы, смене документа, обновлении значений виджетов документа.
+ *\~
+ */
+void
+wDocument::NewValues()
+{
+       QString fname;
+       QObjectList l = this->queryList( "wDBField" );
+       QListIterator<QObject*> it( l );
+       QObject *obj;
+       while ( it.hasNext() )
+       {
+               obj = it.next();
+               fname=((wDBField *)obj)->getFieldName();
+               ((wDBField *)obj)->setValue(dbobj->Value(fname).toString());
+               aLog::print(aLog::Debug, tr("wDocument set new value %1 for field %2 ").arg(dbobj->Value(fname).toString()).arg(fname));
+       }
+       //--delete l; // delete the list, not the objects
+}
+
+
+
+/*!
+ *\~english
+ *     Processed field value changed.
+ *     Conected on signal valueChanged( const QVariant & ) for all
+ *     wDBField insert in the widget.
+ *     Decode field name and set new field value in database object.
+ *     Emit signal value change with field name and value.
+ *     Signal connectaed on aform slot, for future work.
+ *\~russian
+ *     Обрабатывает изменение значения поля
+ *     Присоединяется к сигналу valueChanged( const QVariant & ),
+ *     всех полей типа wDBField, вставленных в виджет.
+ *     Декодирует имя поля и сохраняет его новое значение в объекте для
+ *     работы с базой.
+ *     Посылает сигнал об изменении значения, который содержит имя поля
+ *     и его новое значение.
+ *     Сигнал присоединяется к слоту формы для последующей обработки.
+ *\~
+ *\param value - \~english new field value. \~russian новое значение поля. \~
+ */
+void
+wDocument::valueChanged( const QVariant & value )
+{
+       if ( sender()->className() != QString("wDBField") ) return;
+       wDBField * fld = ( wDBField * ) sender();
+       QString fname=fld->getFieldName();
+//     printf( "field name %s\n",(const char*)fname );
+       if ( dbobj ) dbobj->SetValue( fname, value );
+       emit aWidget::valueChanged( fname, value );
+}
+
+/*void
+wDocument::on_abuttonclick()
+{
+       wActionButton *b = ( wActionButton *) sender();
+       if ( !b ) return;
+       if ( !b->isAction() ) return;
+       if ( b->isActionUpdate() )
+       {
+               QString fname;
+               QObjectList *l = this->queryList( "wDBField" );
+               QObjectListIt it( *l );
+               QObject *obj;
+               uint i = 0;
+               while ( (obj = it.current()) != 0 )
+               {
+                       ++it;
+                       fname=((wDBField *)obj)->getFieldName();
+                       dbobj->SetValue(fname,((wDBField *)obj)->value());
+               }
+                update();
+       }
+       if ( b->isActionTurnOn() ) Conduct();
+}*/
+
diff --git a/src/plugins/document/wdocument.h b/src/plugins/document/wdocument.h
new file mode 100644 (file)
index 0000000..06920e9
--- /dev/null
@@ -0,0 +1,83 @@
+/****************************************************************************
+** $Id: wdocument.h,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Header file of the document plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef WDOCUMENT_H
+#define WDOCUMENT_H
+#include <qwidgetplugin.h>
+#include <qwidget.h>
+#include "awidget.h"
+
+class aDatabase;
+
+
+
+/*!
+ *\~english
+ *      Visual object for work with documents.
+ *\~russian
+ *     \brief Визуальный объект - контейнер для работы с документами.
+ *     Наследует aWidget.
+ */
+class QT_WIDGET_PLUGIN_EXPORT wDocument : public aWidget
+{
+       Q_OBJECT
+public:
+       wDocument( QWidget *parent = 0, Qt::WFlags fl = 0 );
+       virtual ~wDocument();
+       bool checkStructure();
+       virtual void initObject( aDatabase *adb );
+       virtual QDialog* createEditor( QWidget *parent );
+       virtual QString displayString();
+       virtual bool isContainer();
+       virtual aObject *createDBObject(  aCfgItem obj, aDatabase *adb );
+
+       virtual ERR_Code New();
+       virtual ERR_Code Select( qulonglong id );
+
+public slots:
+       int             select( qulonglong id );
+       qulonglong      Insert();
+       virtual int     Update();
+       virtual int     TurnOn();
+       virtual int     TurnOff();
+       int             MarkDelete();
+//     void on_abuttonclick();
+
+//signals:
+//     void valueChanged( const QString &, const QVariant & );
+
+private slots:
+       virtual void valueChanged( const QVariant & );
+
+private:
+       void NewValues();
+};
+
+
+#endif // WDOCUMENT_H
diff --git a/src/plugins/document/wdocument_plugin.cpp b/src/plugins/document/wdocument_plugin.cpp
new file mode 100644 (file)
index 0000000..ecec7e4
--- /dev/null
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "wdocument_plugin.h"
+
+#include <QtPlugin>
+#include <QDesignerFormEditorInterface>
+#include <QExtensionManager>
+
+#include "wdocument_taskmenu.h"
+#include "wdocument.h"
+
+
+wDocumentPlugin::wDocumentPlugin(QObject *parent)
+    : QObject(parent), m_initialized(false)
+{
+    m_initialized = false;
+}
+
+bool wDocumentPlugin::isContainer() const
+{
+    return true;
+}
+
+bool wDocumentPlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void wDocumentPlugin::initialize(QDesignerFormEditorInterface *core)
+{
+    if (m_initialized)
+        return;
+    Q_UNUSED(core);
+
+    QExtensionManager *manager = core->extensionManager();
+    Q_ASSERT(manager != 0);
+    manager->registerExtensions(new wDocumentTaskMenuFactory(manager),
+                                Q_TYPEID(QDesignerTaskMenuExtension));
+
+    m_initialized = true;
+}
+
+QWidget *wDocumentPlugin::createWidget(QWidget *parent)
+{
+    wDocument *w = new wDocument(parent, 0);
+    return w;
+}
+
+QString wDocumentPlugin::name() const
+{
+    return QLatin1String("wDocument");
+}
+
+QString wDocumentPlugin::group() const
+{
+    return QLatin1String("Ananas");
+}
+
+QString wDocumentPlugin::toolTip() const
+{
+    return QString();
+}
+
+QString wDocumentPlugin::whatsThis() const
+{
+    return QString();
+}
+
+QString wDocumentPlugin::includeFile() const
+{
+    return QLatin1String("wdocument.h");
+}
+
+QIcon wDocumentPlugin::icon() const
+{
+    //return QIcon();
+    return QIcon(":/images/wdocument.png");
+}
+
+QString wDocumentPlugin::domXml() const
+{
+    return "<widget class=\"wDocument\" name=\"wDocument_1\">\n</widget>\n";
+}
diff --git a/src/plugins/document/wdocument_plugin.h b/src/plugins/document/wdocument_plugin.h
new file mode 100644 (file)
index 0000000..2028630
--- /dev/null
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef WDOCUMENT_PLUGIN_H
+#define WDOCUMENT_PLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+#include "qwidgetplugin.h"
+
+
+class QT_WIDGET_PLUGIN_EXPORT wDocumentPlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+    wDocumentPlugin(QObject *parent=0);
+
+    bool isContainer() const;
+    bool isInitialized() const;
+    void initialize(QDesignerFormEditorInterface *core);
+    QWidget *createWidget(QWidget *parent);
+
+    QString name() const;
+    QString group() const;
+    QString toolTip() const;
+    QString whatsThis() const;
+    QString includeFile() const;
+    QIcon icon() const;
+    QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+#endif // WDOCUMENT_PLUGIN_H
diff --git a/src/plugins/document/wdocument_taskmenu.cpp b/src/plugins/document/wdocument_taskmenu.cpp
new file mode 100644 (file)
index 0000000..6856cef
--- /dev/null
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include <QDesignerFormEditorInterface>
+
+#include <QAction>
+
+#include "wdocument_taskmenu.h"
+#include "wdocument.h"
+#include "edocument.h"
+
+
+wDocumentTaskMenu::wDocumentTaskMenu(wDocument *widget, QObject *parent)
+    : QObject(parent)
+{
+    m_widget = widget;
+
+    m_editAction = new QAction(tr("Edit ..."), this);
+    connect(m_editAction, SIGNAL(triggered()), this, SLOT(edit()));
+}
+
+void wDocumentTaskMenu::edit()
+{
+    /*eDocument e;
+
+       e.setData(m_widget);
+       if (e.exec() == QDialog::Accepted)
+       {
+               e.getData(m_widget);
+       }*/
+       m_widget->widgetEditor();
+}
+
+QAction *wDocumentTaskMenu::preferredEditAction() const
+{
+    return m_editAction;
+}
+
+QList<QAction *> wDocumentTaskMenu::taskActions() const
+{
+    QList<QAction *> list;
+    list.append(m_editAction);
+    return list;
+}
+
+wDocumentTaskMenuFactory::wDocumentTaskMenuFactory(QExtensionManager *parent)
+    : QExtensionFactory(parent)
+{
+}
+
+QObject *wDocumentTaskMenuFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
+{
+    if (iid != Q_TYPEID(QDesignerTaskMenuExtension))
+        return 0;
+
+    if (wDocument *dt = qobject_cast<wDocument*>(object))
+        return new wDocumentTaskMenu(dt, parent);
+
+    return 0;
+}
diff --git a/src/plugins/document/wdocument_taskmenu.h b/src/plugins/document/wdocument_taskmenu.h
new file mode 100644 (file)
index 0000000..44c190c
--- /dev/null
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef WDOCUMENT_TASKMENU_H
+#define WDOCUMENT_TASKMENU_H
+
+#include <QDesignerTaskMenuExtension>
+#include <QExtensionFactory>
+
+
+class QExtensionManager;
+class QAction;
+class wDocument;
+
+class wDocumentTaskMenu: public QObject, public QDesignerTaskMenuExtension
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerTaskMenuExtension)
+public:
+    wDocumentTaskMenu(wDocument *widget, QObject *parent);
+
+    QAction *preferredEditAction() const;
+    QList<QAction *> taskActions() const;
+
+private slots:
+    void edit();
+
+private:
+    QAction *m_editAction;
+    wDocument *m_widget;
+};
+
+class wDocumentTaskMenuFactory: public QExtensionFactory
+{
+    Q_OBJECT
+public:
+    wDocumentTaskMenuFactory(QExtensionManager *parent = 0);
+
+protected:
+    QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
+};
+
+#endif // WDOCUMENT_TASKMENU_H
diff --git a/src/plugins/eaddobj.cpp b/src/plugins/eaddobj.cpp
new file mode 100644 (file)
index 0000000..76f7a9d
--- /dev/null
@@ -0,0 +1,48 @@
+#include "eaddobj.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+/*
+ *  Constructs a eAddObj as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ */
+eAddObj::eAddObj(QWidget* parent, const char* name, Qt::WindowFlags fl)
+    : Q3MainWindow(parent, name, fl)
+{
+    setupUi(this);
+
+    (void)statusBar();
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+eAddObj::~eAddObj()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void eAddObj::languageChange()
+{
+    retranslateUi(this);
+}
+
+void
+eAddObj::init()
+{
+}
+
+void
+eAddObj::destroy()
+{
+}
+
diff --git a/src/plugins/eaddobj.h b/src/plugins/eaddobj.h
new file mode 100644 (file)
index 0000000..b38556e
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef EADDOBJ_H
+#define EADDOBJ_H
+
+#include "ui_eaddobj.h"
+
+
+class eAddObj : public Q3MainWindow, public Ui::eAddObj
+{
+    Q_OBJECT
+
+public:
+    eAddObj(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
+    ~eAddObj();
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    void init();
+    void destroy();
+
+};
+
+#endif // EADDOBJ_H
diff --git a/src/plugins/eaddobj.ui b/src/plugins/eaddobj.ui
new file mode 100644 (file)
index 0000000..22e890a
--- /dev/null
@@ -0,0 +1,39 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>eAddObj</class>\r
+  <widget class="Q3MainWindow" name="eAddObj" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>417</width>\r
+        <height>297</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Form1</string>\r
+    </property>\r
+    <widget class="QWidget" >\r
+      <layout class="QGridLayout" >\r
+        <item row="0" column="0" >\r
+          <widget class="Q3Table" name="table1" >\r
+            <property name="numRows" >\r
+              <number>0</number>\r
+            </property>\r
+            <property name="numCols" >\r
+              <number>0</number>\r
+            </property>\r
+          </widget>\r
+        </item>\r
+      </layout>\r
+    </widget>\r
+  </widget>\r
+  <layoutdefault spacing="5" margin="5" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >adocument.h</include>\r
+    <include location="local" >acatalogue.h</include>\r
+  </includes>\r
+</ui>\r
diff --git a/src/plugins/engine.cpp b/src/plugins/engine.cpp
new file mode 100644 (file)
index 0000000..2c163f9
--- /dev/null
@@ -0,0 +1,874 @@
+/****************************************************************************
+** $Id: engine.cpp,v 1.4 2008/12/10 21:04:56 leader Exp $
+**
+** Code file of the Ananas Engine of Ananas
+** Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include <qsinterpreter.h>
+#include <qsinputdialogfactory.h>
+#include <qobject.h>
+#include <q3valuelist.h>
+#include <qstringlist.h>
+#include <qstring.h>
+#include <stdlib.h>
+#include <qfile.h>
+#include <qsproject.h>
+#include <qsscript.h>
+#include <qdialog.h>
+//--#include <qwidgetfactory.h>
+#include <qobject.h>
+#include <qsutilfactory.h>
+#include <qsinputdialogfactory.h>
+#include <qapplication.h>
+//Added by qt3to4:
+#include <QTimerEvent>
+#include <Q3PopupMenu>
+
+#include "ananas.h"
+#include "wcatalogeditor.h"
+#include "adatafield.h"
+#include "alog.h"
+#include "acombobox.h"
+
+/*!
+ *     \~english
+ *     Constructor
+ *     \~russian
+ *     Конструктор. Регистрирует следующие типу объектов для использования их в Ананас.Скрипте
+ *     \arg \c PopupMenu всплывающее меню
+ *     \arg \c Document документ
+ *     \arg \c Catalogue каталог
+ *     \arg \c CatalogueEditor редактор каталога
+ *     \arg \c Report отчет
+ *     \arg \c ARegister накопительный регистр
+ *     \arg \c DataField поле (не работает)
+ *     \arg \c Journal журнал
+ *     \arg \c ATime объект для работы со временем
+ *     \~
+ */
+aObjectsFactory::aObjectsFactory( aEngine *e )
+{
+       engine = e;
+        if ( ! engine ) return;
+        db = e->db;
+        if ( ! db ) return;
+
+
+       registerClass("MetaObject",&AMetaObject::staticMetaObject);
+       registerClass("MetaObjectGroup",&AMetaObjectGroup::staticMetaObject);
+       registerClass("DocumentsGroup",&ADocumentsGroup::staticMetaObject);
+       registerClass("CataloguesGroup",&ACataloguesGroup::staticMetaObject);
+       registerClass("MetaDataInfo",&AMetaDataInfo::staticMetaObject);
+       registerClass("MetaDataGlobal",&AMetaDataGlobal::staticMetaObject);
+
+
+       registerClass("PopupMenu",&Q3PopupMenu::staticMetaObject);
+//     registerClass("PopupMenu","QApopupmenu");
+       registerClass("Document",&aDocument::staticMetaObject);
+       registerClass("Catalogue",&aCatalogue::staticMetaObject);
+       registerClass("CatalogEditor",&wCatalogEditor::staticMetaObject);
+       registerClass("Report",&aReport::staticMetaObject);
+       registerClass("ARegister",&aARegister::staticMetaObject);
+       registerClass("IRegister",&aIRegister::staticMetaObject);
+       registerClass("ATime",&aTime::staticMetaObject);
+       registerClass("DataField",&aDataField::staticMetaObject);
+//     registerClass("reg","QAreg");
+       registerClass("Journal",&aDocJournal::staticMetaObject);
+       registerClass("ComboBox",&AComboBox::staticMetaObject);
+//registerClass("djournalview","QAjournview");
+//     registerClass("djournalview","QAdocjournal");
+//     registerClass("form","AForms");
+//     registerClass("report","QAreport");
+//     registerClass("table","QAnanasTable");
+
+//Register extensions classes
+       QStringList extlist = AExtensionFactory::keys();
+       for ( int i=0; i<extlist.count(); i++){
+           registerClass(extlist[i], AExtensionFactory::metaObject( extlist[i] ));
+       }
+}
+
+
+
+
+/*!
+ *     \~english
+ *     Creates script object. Mapping Script name to real name.
+ *     \~russian
+ *     Создает объект. Отображает имена из скрипта в имена объектов библиотеки.
+ *     \param className - \~english scripn object name \~russian имя объекта в скрипте \~
+ *     \param arguments - \~english sarguments to constructor \~russian аргументы для конструктора \~
+ *     \param context - \~english running context \~russian контекст, в котором выполняется скрипт \~
+ *     \~
+ */
+QObject *
+aObjectsFactory::create( const QString &className,
+                     const QVariantList &arguments, QObject *context )
+{
+       QObject * res = 0;
+//     context=context;
+       if (className=="PopupMenu") {
+//                     return new QApopupmenu();
+                       res = new Q3PopupMenu();
+       }else if (className=="Document") {
+               if (arguments.size()>0) {
+                       res = new aDocument(arguments[0].toString(), db );
+               }
+       }else if (className=="Catalogue") {
+               if (arguments.size()>0) {
+                       res = new aCatalogue( arguments[0].toString(), db );
+               }
+       }else if ( className=="Report" ) {
+               if ( arguments.size()>0 )
+               {
+                       if(arguments.size()==2) {
+                               res = new aReport( arguments[0].toString(),(aReport::RT_type)arguments[1].toInt(), engine );
+                       }else{
+                               res = new aReport( arguments[0].toString(),aReport::RT_text, engine );
+                       }
+               }
+       }else if (className =="CatalogEditor") {
+               if (arguments.size()>0) {
+                       aCfgItem it;
+                       it = db->cfg.find(QString("Catalogue.%1").arg(arguments[0].toString()));
+                       if(!it.isNull()) {
+                               wCatalogEditor * w = new wCatalogEditor(engine->ws,db->cfg.id(it));
+                               w->initCat(db);
+                               res = w;
+                       }
+               }
+       }else if (className == "ARegister") {
+               if (arguments.size() > 0) {
+                       res = new aARegister(arguments[0].toString(), db);
+               }
+
+       }else if (className == "IRegister") {
+               if (arguments.size() > 0) {
+                       res = new aIRegister(arguments[0].toString(), db);
+               }
+
+       } else if (className == "Journal") {
+               if (arguments.size() > 0) {
+                       res = new aDocJournal(arguments[0].toString(), db);
+               }
+
+       } else if (className == "ATime") {
+                 res = new aTime();
+       } else if (className == "DataField") {
+                 res = new aDataField();
+       } else if ( AExtensionFactory::keys().contains( className )) {
+//             printf("create extension object %s\n",(const char*) className);
+               AExtension *obj = AExtensionFactory::create( className );
+               // Insert check existence signal in future!!!!
+               QObject::connect( obj, SIGNAL(event(const QString&)),
+                        engine, SLOT( on_event(const QString&)));
+               obj->init(db);
+               res = obj;
+       } else if ( className == "ComboBox" ) {
+               if (arguments.size() == 1) {
+                       res = new AComboBox( 0, arguments[0].toString());
+               } else {
+                       res = new AComboBox();
+               }
+       }
+       if(!res) aLog::print(aLog::Error,QObject::tr("Unknown classname '%1' or metaobject '%2'").arg(className).arg(arguments[0].toString()));
+       return res;
+}
+
+
+
+/*!
+ *\en
+ *     Constructor.
+ *\_en
+ *\ru
+ *     Конструктор. Создает новый объект с именем "sys". Доступ к функциям этого объекта из Ананас.Скрипта возможен примерно так:
+ *     \code
+ *     sys.Date(); // текущая дата
+ *     sys.OpenForm("DocJournal.Системный журнал.Form.Список документов"); // открывает форму "Список Документов" журнала "Системный журнал"
+ *     \endcode
+ *\_ru
+ */
+aEngine::aEngine():QObject(0,"sys")
+{
+       md = 0;
+       next_obj_id = 1;
+       db = aDatabase::database();
+}
+
+
+
+/*!
+ *\en
+ *     Destructor
+ *\_en \ru
+ *     Деструктор.
+ *\_ru
+ */
+aEngine::~aEngine()
+{
+       values.clear();
+//     delete project;
+}
+
+
+
+/*!
+ * \~english
+ * Init engine.
+ * Init script subsystem, load global module.
+ * \~russian
+ *     Инициализирует объект. Инициализирует скриптовую систему, добавляет несколько глобальных функций.
+ * \~
+ */
+bool
+aEngine::init( const QString &rcfile )
+{
+//     QString mGlobal;
+       aCfgItem gobj, obj, obj0;
+       QString sysf =
+//     "function Message( t, msg ){ sys.Message( t, msg );}"
+//     "function StatusMessage( msg ){ sys.StatusMessage( msg );}"
+//     "function Date(){ return sys.Date();}"
+//     "function Time(){ return sys.Time();}"
+//     "function Exit(){ return sys.Exit();}"
+       "";
+
+       bool ok = false;
+       if ( db->init( rcfile ) ) {
+               md = &db->cfg;
+               code = project.interpreter();
+//             code->setErrorMode(QSInterpreter::Notify);
+               code->setErrorMode(QSInterpreter::Nothing);
+               connect(code, SIGNAL( error ( const QString &, QObject *, const QString &, int )),
+                       this, SLOT  ( error ( const QString &, QObject *, const QString &, int )));
+               code->addObjectFactory( new QSInputDialogFactory );
+               code->addObjectFactory( new aObjectsFactory( this ) );
+               code->addObjectFactory( new QSUtilFactory );
+               project.addObject( this );
+               project.addObject( md );
+               project.addObject( AMetaData::metadata() );
+               mGlobal = md->sText( md->find( md->find( mdc_metadata ), md_globals, 0 ), md_sourcecode );
+               if ( ! mGlobal.isEmpty() ) {
+//                     project.createScript("global", mGlobal);
+//                     project.createScript(this, mGlobal );
+//                     project.createScript( "globalmodule", sysf );
+//                     project.createScript( this, sourcePreprocessor(mGlobal));
+                       project.createScript( "globalmodule", sysf+sourcePreprocessor(mGlobal));
+//                     code->evaluate(sourcePreprocessor(mGlobal));
+               } else {
+//                        printf("Global module is empty\n");
+                }
+       } else return false;
+       return true;
+}
+
+
+
+/*!
+ *\en
+ *\_en \ru
+ *     Заглушка.
+ *\_ru
+ */
+void
+aEngine::done()
+{
+
+}
+
+
+
+/*!
+ *\en
+ *     Called on system start.
+ *\_en \ru
+ *     Автоматически вызывается при старте системы. Если в глобальном модуле определа функция on_systemstart()
+ *     то она будет автоматически вызвана.
+ *     Это можно использовать для открытия документов или журналов при старте системы, или каких-либо других действий.
+ *     \see on_systemstop()
+ *\_ru
+ */
+int
+aEngine::on_systemstart(){
+
+       if (project.interpreter()->functions().findIndex("on_systemstart")!=-1) {
+               project.interpreter()->call("on_systemstart",QVariantList());
+       }
+       return 0;
+}
+
+
+void
+aEngine::on_event( const QString &data )
+{
+       Q3ValueList<QVariant> lst;
+       lst <<  sender()->name();
+       lst << data;
+       if (project.interpreter()->functions().findIndex("on_event")!=-1) {
+               project.interpreter()->call("on_event", QVariantList(lst));
+       }
+       emit event( sender()->name(), data );
+}
+
+
+
+/*!
+ *\en
+ *     Called on system stop.
+ *\_en \ru
+ *     Автоматически вызывается при остановке системы.
+ *     Если в глобальном модуле определа функция on_systemstop()
+ *     то она будет автоматически вызвана.
+ *     \see on_systemstart()
+ *\_ru
+ */
+int
+aEngine::on_systemstop(){
+       if (project.interpreter()->functions().findIndex("on_systemstop")!=-1) {
+               project.interpreter()->call("on_systemstop",QVariantList());
+       }
+       return 0;
+}
+
+
+
+/*!
+ *\en
+ *     Stub.
+ *\_en \ru
+ *     Заглушка.
+ *\_ru
+ */
+void
+aEngine::timerEvent(QTimerEvent *e)
+{
+       e=e; //
+//     project->interpreter()->evaluate(pr_timer, this);
+}
+
+
+
+/*!
+ *\en
+ *     Stub.
+ *\_en \ru
+ *     Заглушка. Возвращает всегда строку "???"
+ *     В будущем возможно будет возвращать имя конфигурации.
+ *\_ru
+ */
+QString
+aEngine::cfgname() {
+       return "???"; //cfg_info("name");
+}
+
+
+
+/*!
+ *\en
+ *\_en \ru
+ *     Возвращает строковое представление текущего времени в формате "hh:mm:ss"
+ *\_ru
+ */
+QString
+aEngine::Time() {
+       return QTime::currentTime().toString("hh:mm:ss");
+}
+
+
+
+/*!
+ *\en
+ *\_en \ru
+ *     Возвращает строковое представление текущей даты в формате "dd.MM.yy"
+ *\_ru
+ */
+QString
+aEngine::Date() {
+       return QDate::currentDate().toString("dd.MM.yy");
+}
+
+
+void
+aEngine::Exit() {
+       qApp->quit();
+}
+
+/*!
+ *     \~english
+ *     Outputs messages.
+ *     \~russian
+ *     Вывод сообщений.
+ *     \param n - тип сообщения. 0 - уведомление, 1 - предупреждение, 2 - ошибка.
+ *     \param msg - текст сообщения.
+ *     \~
+ *     \see cfg_message(int msgtype, const char *msgfmt,...)
+ */
+void
+aEngine::Message(int n, const QString &msg)
+{
+       cfg_message(n, (const char *) msg.utf8());
+}
+
+
+
+/*!
+ *\en
+ *     Outputs status messages.
+ *\_en \ru
+ *     Вывод сообщений в строке состояния.
+ *     \param msg - текст сообщения.
+ *\_ru
+ */
+void
+aEngine::StatusMessage( const QString &msg )
+{
+        emit statusMessage( msg );
+}
+
+
+
+/*!
+ *\en
+ *\_en \ru
+ *\_ru
+ */
+void
+aEngine::settimer(int sec, QString proc){
+    // TODO Need id timer - get from startTimer
+       //--killTimers();
+       if (sec) {
+               pr_timer=proc;
+               startTimer(sec*1000);
+       } else {
+               pr_timer="";
+       }
+}
+
+
+
+/*!
+ *\en
+ *\_en \ru
+ *     Запускает действие
+ *     \param id - идентификатор действия в метаданных.
+ *\_ru
+ */
+void
+aEngine::on_MenuBar( int id )
+{
+       aCfgItem obj, act;
+       int actions, i;
+
+//     printf("menu %i selected\n", id);
+       if ( id>0 ) {
+               obj = md->find( id );
+               if ( !obj.isNull() ) {
+                       actions = md->count( obj, md_comaction );
+//                     printf("obj found %i actions\n", actions);
+                       for ( i=0; i<actions; i++) {
+                               act = md->findChild( obj, md_comaction, i );
+                               act = md->find( md->text( act ).toLong() );
+                               execAction( act );
+                       }
+               }
+       }
+}
+
+
+
+/*!
+ *\en
+ *\_en \ru
+ *     Вспомогательный метод.
+ *     Запускает действие в указанном контексте. Правильная работа не гарантируется (где-то там ошибки есть).
+ *     \param act - ссылка на объект метаданных, описывающий действие
+ *     \param context - контекст выполнения действия.
+ *\_ru
+ */
+void aEngine::execAction( aCfgItem &act, QObject *context )
+{
+       QString aModule, arg;
+       int atype, satype;
+       long oid, foid;
+       //aForm *form;
+       aCfgItem gobj, obj;
+
+       if ( ! act.isNull() ) {
+               atype = md->attr( act, mda_type ).toInt();
+//             printf("atype=%i\n",atype);
+               switch ( atype ){
+               case 0:
+                       satype = md->sText( act, md_actiontype ).toInt();
+                       oid = md->sText( act, md_objectid ).toLong();
+                       foid = md->sText( act, md_formid ).toLong();
+                       arg = md->sText( act, md_argument );
+//                     printf("satype=%d, oid=%d,foid=%d,arg=%s",satype,oid,foid,arg.ascii());
+                       gobj =  md->find( oid );
+                       if ( foid == 0 )
+                       {
+                               foid = md->getDefaultFormId( gobj, satype );
+                               break;
+                       }
+                       if ( foid == 1 )
+                       {
+                               openEmbedCatalogueEditor(oid, NULL, false); //open to edit
+                               break;
+                       }
+
+                       openForm(oid, foid, satype, 0, 0, 0 );
+                       break;
+/*                     if ( !arg.isEmpty() ) {
+                               obj = md->findName( md->find( gobj, md_forms ), md_form, arg );
+                               foid = md->id( obj );
+//                             if ( !obj.isNull() ) printf("form found\n");
+//                             else printf("! not found %s\n", (const char *) arg );
+                       }*/
+                       /*
+                       if ( wl->find( foid ) )
+                       {
+                               printf("form already exist,set focus \n");
+                               wl->get( foid )->setFocus();
+                       }
+                       else
+                       {
+                               printf("execute action\n");
+                       if ( oid )
+                               switch ( satype )
+                               {
+                               case md_action_new://create new
+                                       printf("create new\n");
+                                       form = new aForm( ws, this, foid );
+//                                     form->init();
+                                       form->New();
+                                       form->show();
+                                       break;
+                               case md_action_view://view
+                                       printf("view\n");
+                                       form = new aForm( ws, this, foid );
+                                                                               //form->init();
+                                       form->show();
+                                       break;
+                               }
+                       }
+                       break;
+                       */
+               case 1:
+                       aModule = md->sText( act, md_sourcecode );
+                       if ( !aModule.isEmpty() ) {
+                               code->evaluate( sourcePreprocessor(aModule), context, md->attr( act, mda_name ) );
+                       }
+                       break;
+               case 2:
+                       break;
+               }
+//             printf("executed %s\n", ( const char *) md->attr( act, mda_name ).local8Bit() );
+       }
+}
+
+
+
+/*!
+ *\~english
+ *     Create and open new form.
+ *\~russian
+ *     Создает и открывает новую форму.
+ *     Форма создается с учетом её id в конфигураци и действия,
+ *     режима работы (просмотр, редактирование, создание нового объекта).
+ *     Форма должна поддерживать тот режим, для которого она открывается.
+ *     Если форма открыта для просмотра она открывается в режиме отлько чтение.
+ *     Если id формы равно 0, делается попытка найти первую форму с
+ *     требуемым режимом.
+ *\~
+ *\param oid - \~english form owner md id,\~russian id владельца формы в конфигурации,\~
+ *\param fid - \~english form md id, \~russian id формы в конфигурации\~
+ *\param mode - \~english form use mode, \~russian режим работы формы\~
+ *\param ido - \~english database id of opening object\~russian идентификатор объекта в базе данных, для которого открывается форма.\~
+ *\return \~english link on new form or 0 if form not created.
+                       \~russian ссылку на новую форму или 0, если форма не создана.\~
+ */
+aForm*
+aEngine::OpenForm(QString fname, int mode, aObject* selecter)//Q_ULLONG ido)
+{
+       aCfgItem object, form;
+
+       form = md->find(fname);
+       if(!form.isNull())
+       {
+               object = md->parent(md->parent(form));
+               if(object.isNull()) return 0;
+               qulonglong ido =0;
+               if(selecter) ido = selecter->sysValue("id").toULongLong();
+               return openForm(atoi(md->attr(object,mda_id)), atoi(md->attr(form,mda_id)), mode, mode, ido);
+       }
+       else
+       {
+               return 0;
+       }
+}
+
+
+
+/*!
+ *\~english
+ *     Create and open new form.
+ *\~russian
+ *     Создает и открывает новую форму.
+ *     Форма создается с учетом её id в конфигураци и действия,
+ *     режима работы (просмотр, редактирование, создание нового объекта).
+ *     Форма должна поддерживать тот режим, для которого она открывается.
+ *     Если форма открыта для просмотра она открывается в режиме отлько чтение.
+ *     Если id формы равно 0, делается попытка найти первую форму с
+ *     требуемым режимом.
+ *     При необходимости поля формы заполняются в соответствии с параметром  \a id
+ *\~
+ *\param oid - \~english form owner md id,\~russian id владельца формы в конфигурации,\~
+ *\param fid - \~english form md id, \~russian id формы в конфигурации,\~
+ *\param defaultfor - \~english form use mode, \~russian режим работы формы,\~
+ *\param mode - \~english not use yet\~russian пока не используется,\~
+ *\param id - \~english database id of opening object\~russian идентификатор объекта в базе данных, для которого открывается форма. Используется только в режиме просмотра или редактирования.\~
+ *\param caller - \~english caller widget\~russian Вызывающий данную функцию объект. Он будет обновлен автоматически при закрытии формы. \~
+ *\return \~english link on new form or 0 if form not created.
+                       \~russian ссылку на новую форму или 0, если форма не создана.\~
+ */
+aForm *
+aEngine::openForm(int oid, int fid, int defaultfor, int mode, ANANAS_UID id, aWidget* caller )
+{
+       aForm *form = 0;
+       if ( fid == 0 )
+       {
+               fid = md->getDefaultFormId( md->find( oid ), defaultfor, mode );
+       }
+       //printf("engine:try found %d %llu in wl\n", fid, id);
+       if ( wl->find( fid, id ) )
+       {
+               //printf("foubd!, set focus\n");
+               wl->get( fid, id )->setFocus();
+       }
+       else {
+               //printf("not found!\n");
+               aLog::print(aLog::Info,tr("aEngine open form %1 in mode %2, select %3").arg(fid).arg(mode).arg(id));
+               if ( oid ) {
+                       switch ( defaultfor ) {
+                       case md_action_new://create new
+                               form = new aForm( ws, this, fid, caller );
+                               if(form)
+                               {
+                                       form->setMode(0);
+                                       form->New();
+                               }
+                               else
+                               {
+                                       aLog::print(aLog::Error,tr("aEngine form create error"));
+                               }
+                               //printf("open new form\n");
+                               break;
+                       case md_action_view://view
+                               form = new aForm( ws, this, fid, caller );
+                               if(form)
+                               {
+                                       form->setMode(1);
+                                       form->SetReadOnly(true);
+                                       form->Select( id );
+                               }
+                               else
+                               {
+                                       aLog::print(aLog::Error,tr("aEngine form create error"));
+                               }
+                               //printf(" open form for view %llu\n",id);
+                               break;
+                       case md_action_edit:
+                               form = new aForm( ws, this, fid, caller );
+                               if(form)
+                               {
+                                       form->setMode(2);
+                                       form->Select( id );
+                               }
+                               else
+                               {
+                                       aLog::print(aLog::Error,tr("aEngine form create error"));
+                               }
+                               //printf("open form for edit %llu\n ",id);
+                               break;
+                       default:
+                               aLog::print(aLog::Error, tr("aEngine open form mode %1 not supported").arg(defaultfor));
+                       }
+                       connect( this, SIGNAL( event(const QString &, const QString&)),
+                                form, SLOT( on_event(const QString &, const QString&)));
+               }
+       }
+       if(form && caller)
+       {
+               connect(form,SIGNAL(changedData()),caller,SLOT(Refresh()));
+       }
+//     printf("before clear\n");
+//     this->project.interpreter()->clear();
+       if ( form ) form->show();
+//     printf("end open form\n");
+       return form;
+}
+
+
+
+/*!
+ *\~english
+ *     Create and open new embedded catalog editor form.
+ *\~russian
+ *     Создает и открывает новую форму встроенного редактора каталога.
+ *\~
+ *\param oid - \~english catalogue md id,\~russian id каталога конфигурации,\~
+ *\param parent - \~english parent wField object, \~russian родительский объект wField\~
+ *\param toSelect - \~english Mode. true - for select, false - for edit\~russian Режим. true - выбор, false - редактирование\~
+ */
+void
+aEngine::openEmbedCatalogueEditor(int oid, QWidget* parent,const bool toSelect)
+{
+       wCatalogEditor * w = new wCatalogEditor(ws,oid);
+       if( parent )
+       {
+               connect(w,              SIGNAL(selected( qulonglong )),
+                       (wField*)parent,SLOT(on_selected( qulonglong )));
+               connect(w,              SIGNAL(destroyed_form()),
+                       (wField*)parent,SLOT(setFocus()));
+       }
+
+       w->initCat(db);
+       if(toSelect)
+       {
+               w->select();
+       }
+       else
+       {
+               w->edit();
+       }
+}
+
+
+
+/*!
+ *\en
+ *\_en \ru
+ *     Печатает сообщение об ощибке.
+ *\_ru
+ */
+void
+aEngine::error ( const QString & message, QObject * context, const QString & scriptName, int lineNumber )
+{
+       Message( 2, tr("Line:%1 Message:%2 Stack:(%3)").arg(lineNumber).arg(message).arg(code->stackTraceString()) );
+}
+
+
+
+/*!
+ *\en
+ *\_en \ru
+ * Функция препроцессора исходного текста скрипта.
+ * Для разработчиков:
+ * В первую очередь может быть использована для замены коротких
+ * имен из локального контекста на квалифицированные имена
+ * глобальных функций и объектов, например Message() в контексте
+ * формы может заменяться на global.Message() перед выполнением скрипта
+ * и выполняться корректно из любого места.
+ * В противном случае приходится дублировать глобальные
+ * встроенные функции во всех контекстах.
+ *\_ru
+ */
+QString
+aEngine::sourcePreprocessor( const QString &src )
+{
+       QString psrc = src;
+       // Global functions preprocessing
+//     psrc.replace( "Message(", "global.Message(");
+//     psrc.replace( "Statusglobal.Message(", "global.StatusMessage(");
+//     psrc.replace( "Date(", "global.Date(");
+//     psrc.replace( "Time(", "global.Time(");
+       // Russian key words
+//     psrc.replace( QString::fromUtf8("функция"), "function");
+//     psrc.replace( QString::fromUtf8("если"), "if");
+//     psrc.replace( QString::fromUtf8("то"), "then");
+//     psrc.replace( QString::fromUtf8("иначе"), "else");
+//     psrc.replace( QString::fromUtf8("начало"), "{");
+//     psrc.replace( QString::fromUtf8("конец"), "}");
+       return psrc;
+}
+
+
+
+/*!
+ *\en
+ *\_en \ru
+ * Получение значения глобальной переменной.
+ *\_ru
+ */
+QVariant
+aEngine::value( const QString &name )
+{
+       QVariant v, *pv;
+       pv = values.find( name );
+       if ( pv ) return *pv;
+       return v;
+}
+
+
+
+/*!
+ *\en
+ *\_en \ru
+ * Установка значения глобальной переменной.
+ *\_ru
+ */
+void
+aEngine::setValue( const QString &name, QVariant value )
+{
+    values.remove( name );
+    if ( !value.isValid() ) values.insert( name, new QVariant( value ) );
+}
+
+
+
+/*!
+ *\en
+ *\_en \ru
+ * Установка значения глобальной переменной.
+ *\_ru
+ */
+aDataField*
+aEngine::enterValue( const QString &FieldType, const QString &title )
+{
+       aDataField *f = new aDataField( "", FieldType );
+       QDialog *d = new QDialog( ws, title, true );
+       wField *wf = new wField( d, "" );
+       QPushButton *b_ok = new QPushButton( d, tr("OK") );
+       QPushButton *b_cancel =new QPushButton( d, tr("Cancel") );
+       connect( b_ok, SIGNAL( pressed() ), d, SLOT( accept() ) );
+       connect( b_cancel, SIGNAL( pressed() ), d, SLOT( reject() ) );
+       if ( d->exec() == QDialog::Accepted ) {
+//             printf("accepted\n");
+       }
+       delete d;
+       return f;
+}
+
diff --git a/src/plugins/engine.h b/src/plugins/engine.h
new file mode 100644 (file)
index 0000000..2e0e46d
--- /dev/null
@@ -0,0 +1,198 @@
+/****************************************************************************
+** $Id: engine.h,v 1.2 2008/12/10 21:04:56 leader Exp $
+**
+** Header file of the Ananas Engine of Ananas
+** Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Library of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/****************************************************************************
+****************************************************************************/
+#ifndef ENGINE_H
+#define ENGINE_H
+#include <qobject.h>
+#include <q3popupmenu.h>
+#include <qsobjectfactory.h>
+#include <qsproject.h>
+#include <qsinterpreter.h>
+//Added by qt3to4:
+#include <QTimerEvent>
+#include <qwidgetplugin.h>
+
+#include "adatabase.h"
+#include "acfg.h"
+#include "awindowslist.h"
+#include <q3mainwindow.h>
+#include "adatafield.h"
+#include "aobject.h"
+
+
+
+class aEngine;
+class aWidget;
+class QSInterpreter;
+
+/*!
+ * \~english
+ *     Register Ananas-engine objects into script engine.
+ * \~russian
+ *     \brief Метод aObjectsFactory::create регистрирует С++ классы Ананаса в интерпретаторе скриптов,
+ *     делая доступным работу с объектами зарегистрированного класса из Ананас.Скрипта.
+ *     Наследует QSObjectFactory.
+ * \~
+ */
+class QT_WIDGET_PLUGIN_EXPORT aObjectsFactory : public QSObjectFactory
+{
+public:
+        aEngine   *engine;
+       aDatabase *db;
+        aObjectsFactory( aEngine *e );
+        QObject *create( const QString &className,
+                     const QVariantList &arguments,
+                     QObject *context );
+};
+
+
+class aForm;
+
+/*!
+ *     \~english
+ *     Ananas-engine object.
+ *     \~russian
+ *     \brief Определяет программный интерфейс Runtime системы, который используется Ананас скриптом.
+ *     Наследует QObject.
+ *
+ *     Класс, реализующий обработку и выполнение скриптов, открытие экранных форм,
+ *     предварительную обработку скрипта перед выполнением (для последующего использования русских управляющих инструкций),
+ *     системные функции получения даты и времени, печати сообщений об ошибках и т.д
+ *     \~
+ */
+class  QT_WIDGET_PLUGIN_EXPORT aEngine : public QObject
+{
+       Q_OBJECT
+public:
+/*!
+ *     \~english
+ *     database connection.
+ *     \~russian
+ *     Соединение с базой данных.
+ *     \~
+*/
+       aDatabase       *db;
+/*!
+ *     \~english
+ *     link to metadata.
+ *     \~russian
+ *     ссылка на метаданные.
+ *     \~
+*/
+       aCfg*           md;
+/*!
+ *     \~english
+ *     link to workspace.
+ *     \~russian
+ *     ссылка на рабочее пространство.
+ *     \~
+*/
+       QWidget*        ws;
+/*!
+ *     \~english
+ *     link to windowlist.
+ *     \~russian
+ *     ссылка на список окон.
+ *     \~
+*/
+       aWindowsList*   wl;
+/*!
+ *     \~english
+ *     link to script interpreter.
+ *     \~russian
+ *     ссылка на интерпретатор скрипта.
+ *     \~
+*/
+       QSInterpreter*  code;
+/*!
+ *     \~english
+ *     link to script project.
+ *     \~russian
+ *     ссылка на проект.
+ *     \~
+*/
+    QSProject  project;
+/*!
+ *     \~english
+ *     number to form
+ *     \~russian
+ *     номер для обеспечения уникальных имен при открытии форм.
+ *     \~
+*/
+       int             next_obj_id;
+
+       aEngine();
+        virtual        ~aEngine();
+       virtual bool init( const QString &rcfile );
+       virtual void done();
+       void openEmbedCatalogueEditor(int oid, QWidget *parent=NULL, const bool toSelect=true);
+
+       QString sourcePreprocessor( const QString &src );
+
+       void timerEvent(QTimerEvent *e);
+       int on_systemstart();
+       int on_systemstop();
+       aForm *openForm( int oid, int fid = 0 , int defaultfor = 1,
+               int mode = 0, ANANAS_UID id = 0, aWidget* caller = 0 );
+
+public slots:
+       QString cfgname();
+       QString Time();
+       QString Date();
+       void Exit();
+       void Message(int n, const QString &msg );
+       void StatusMessage( const QString &msg );
+       void settimer(int sec, QString proc);
+       aForm * OpenForm(QString fname, int mode=0, aObject * selecter=0);//Q_ULLONG ido=0);
+       QVariant value( const QString &name );
+       void setValue( const QString &name, QVariant value = QVariant::Invalid );
+
+       void on_MenuBar( int id );
+       void execAction( aCfgItem &act, QObject *context = 0 );
+
+       aDataField *enterValue( const QString &FieldType, const QString &title = "" );
+
+private slots:
+       void error (    const QString & message, QObject * context,
+                       const QString & scriptName, int lineNumber );
+       void on_event( const QString &data );
+signals:
+        void statusMessage( const QString &msg );
+       void event( const QString &source, const QString &data );
+
+private:
+       QString pr_timer;
+       QString mGlobal;
+       Q3Dict <QVariant> values;
+
+};
+
+#endif // ENGINE_H
diff --git a/src/plugins/field/addfdialog.cpp b/src/plugins/field/addfdialog.cpp
new file mode 100644 (file)
index 0000000..c4dc979
--- /dev/null
@@ -0,0 +1,126 @@
+#include "addfdialog.h"
+
+#include <qvariant.h>
+#include "wdbfield.h"
+
+#include <Q3ValueList>
+/*
+ *  Constructs a addfdialog as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+addfdialog::addfdialog(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+addfdialog::~addfdialog()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void addfdialog::languageChange()
+{
+    retranslateUi(this);
+}
+
+/*!
+ * Sets current field name and field id for return with function getData()
+ */
+
+void addfdialog::doOk()
+{
+       int idx;
+       idx = ListBox->currentItem();
+       if(idx>=0)
+       {
+               id = idlist[idx];
+               field = list[idx];
+       }
+       else id="0";
+       accept();
+}
+
+
+void addfdialog::init()
+{
+       id="0";
+       field="";
+}
+
+
+void addfdialog::destroy()
+{
+
+}
+
+
+/*!
+ * Function return field name (if param name == true) or field id otherwise
+ * \return field name or field id
+ */
+const QString addfdialog::getData(bool name)
+{
+       if(name) return field;
+       else return id;
+}
+
+/*!
+ * Sets list of field name and list of field id.
+ * \param flst (in) - list of field name
+ * \param ilst (in) - list of field id
+ */
+void addfdialog::setData( QStringList displst, QStringList flst, QStringList ilds)
+{
+       list = flst;
+       ListBox->insertStringList(displst);
+       idlist = ilds;
+}
+
+
+
+
+void addfdialog::setData( QWidget *o, aCfg *md )
+{
+
+       wDBField *w = (wDBField *)o;
+       w->getFields();
+       setData( w->defDisplayFields, w->defFields,w->defId);
+       ListBox->setCurrentItem(ListBox->findItem(w->getFieldName()));
+}
+
+
+void addfdialog::getData( QWidget *o )
+{
+       QString s;
+       wDBField *w = (wDBField *)o;
+       Q3ValueList<qulonglong> bindList = w->getBindList();
+               s = getData(true);
+               if(s.isEmpty()) return;
+               w->setFieldName(s);
+               s = getData(false);
+               if(s=="0") return;
+               // if select binding field
+               if(bindList.find(s.toULongLong()) != bindList.end())
+               {
+                       cfg_message(0, tr("field already binding, please select another field."));
+                       return;
+               }
+               w->setId(s.toInt());
+               w->setEditorType();
+               //w->updateProp();
+
+}
diff --git a/src/plugins/field/addfdialog.h b/src/plugins/field/addfdialog.h
new file mode 100644 (file)
index 0000000..2aeb81b
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef ADDFDIALOG_H
+#define ADDFDIALOG_H
+
+#include "ui_addfdialog.h"
+
+
+class addfdialog : public QDialog, public Ui::addfdialog
+{
+    Q_OBJECT
+
+public:
+    addfdialog(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~addfdialog();
+
+    QStringList list,idlist;
+
+    virtual void init();
+    virtual void destroy();
+    virtual const QString getData( bool name );
+
+public slots:
+    virtual void doOk();
+    virtual void setData( QStringList displst, QStringList flst, QStringList ilds );
+    virtual void setData(QWidget *o, aCfg *md);
+    virtual void getData(QWidget *o);
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    QString field;
+    QString id;
+
+};
+
+#endif // ADDFDIALOG_H
diff --git a/src/plugins/field/addfdialog.ui b/src/plugins/field/addfdialog.ui
new file mode 100644 (file)
index 0000000..bda881c
--- /dev/null
@@ -0,0 +1,83 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>addfdialog</class>\r
+  <widget class="QDialog" name="addfdialog" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>363</width>\r
+        <height>224</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>select field</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item row="0" column="1" >\r
+        <layout class="QVBoxLayout" >\r
+          <item>\r
+            <widget class="QPushButton" name="OkButton" >\r
+              <property name="text" >\r
+                <string>OK</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="CButton" >\r
+              <property name="text" >\r
+                <string>Cancel</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <spacer name="spacer3" >\r
+              <property name="sizeHint" >\r
+                <size>\r
+                  <width>20</width>\r
+                  <height>120</height>\r
+                </size>\r
+              </property>\r
+              <property name="sizeType" >\r
+                <enum>Expanding</enum>\r
+              </property>\r
+              <property name="orientation" >\r
+                <enum>Vertical</enum>\r
+              </property>\r
+            </spacer>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item row="0" column="0" >\r
+        <widget class="Q3ListBox" name="ListBox" />\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="6" margin="11" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >wdbtable.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>OkButton</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>addfdialog</receiver>\r
+      <slot>doOk()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>CButton</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>addfdialog</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>ListBox</sender>\r
+      <signal>doubleClicked(Q3ListBoxItem*)</signal>\r
+      <receiver>addfdialog</receiver>\r
+      <slot>doOk()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/field/efield.cpp b/src/plugins/field/efield.cpp
new file mode 100644 (file)
index 0000000..acf687f
--- /dev/null
@@ -0,0 +1,168 @@
+#include "efield.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "acfg.h"
+#include <stdlib.h>
+
+/*
+ *  Constructs a eField as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+eField::eField(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+eField::~eField()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void eField::languageChange()
+{
+    retranslateUi(this);
+}
+
+void eField::init()
+{
+
+
+
+}
+
+
+
+void eField::setData( QWidget *o, aCfg *cfg )
+{
+       md = cfg;
+       if(!o)
+       {
+               reject();
+               return;
+       }
+       if ( o->className() != QString("wField") || !md ) {
+           reject();
+           return;
+       }
+    wField *f = ( wField*) o;
+    QString ts = f->getFieldType();
+//    printf(">>> fieldType = %s;\n", ts.ascii() );
+    char t=' ';
+    int w=0, d=0, oid, idx=0;
+    unsigned int i;
+
+//    eName->setText(f->getName());
+    otypes.clear();
+    eType->clear();
+
+    QStringList tlist = md->types();
+    otypes.clear();
+    eType->clear();
+    for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
+       otypes.append( (*it).section( "\t", 0, 0 ) );
+       eType->insertItem( (*it).section("\t", 1, 1 ), idx++ );
+    }
+    if ( !ts.isEmpty() ) {
+       sscanf( ts, "%c %d %d", &t, &w, &d );
+    } else {
+       t = 'N';
+       w = 10;
+    }
+    if ( t=='O' ) {
+       for( i = 0 ; i < otypes.count(); i++ ) {
+           if( otypes[i][0] == 'O' ) {
+               sscanf( (const char *)otypes[ i ], "O %d", &oid );
+               if ( oid == w ) {
+                   eType->setCurrentItem( i );
+                   break;
+               }
+           }
+       }
+    } else {
+       eWidth->setValue( w );
+       eDec->setValue( d );
+       if ( t == ' ' ) eType->setCurrentItem( 0 );
+       if ( t == 'N' ) eType->setCurrentItem( 1 );
+       if ( t == 'C' ) eType->setCurrentItem( 2 );
+       if ( t == 'D' ) eType->setCurrentItem( 3 );
+       if ( t == 'B' ) eType->setCurrentItem( 4 );
+    }
+    typeSelect( eType->currentItem() );
+}
+
+
+void eField::getData( QWidget *o )
+{
+//    const QObject *o = sender();
+    if ( !o ) return;
+    if ( o->className() != QString("wField") ) return;
+    wField *f = ( wField*) o;
+    wField::tEditorType type;
+    char ntype[40]="";
+    int idx=eType->currentItem();
+
+    if (f) {
+       //f->setName(eName->text());
+       sprintf(ntype, (const char *) otypes[idx], eWidth->value(), eDec->value());
+       f->setFieldType(ntype);
+       if(otypes[idx][0]==' ') type = wField::Unknown;
+       if(otypes[idx][0]=='N') type = wField::Numberic;
+       if(otypes[idx][0]=='C') type = wField::String;
+       if(otypes[idx][0]=='D') type = wField::Date;
+       if(otypes[idx][0]=='B') type = wField::Boolean;
+       if(otypes[idx][0]=='O')
+       {
+               QString tmp = otypes[idx].section(' ',1,1);
+               long tid = atol(tmp);
+               aCfgItem item = md->find(tid);
+               if(!item.isNull())
+               {
+                       //gets object class
+                       tmp = md->objClass(item);
+                       if(tmp == md_catalogue)
+                               type = wField::Catalogue;
+                       if(tmp == md_document)
+                               type = wField::Document;
+               }
+       }
+       f->setEditorType(type);
+    }
+}
+
+void eField::typechanged(const QString &s )
+{
+}
+
+void eField::typeSelect( int idx )
+{
+    bool w = false, d = false;
+    if ( otypes[ idx ][0] == 'N' ){
+       w = true;
+       d = true;
+
+    } else
+       if ( otypes[ idx ][0] == 'C' ){
+       w = true;
+
+    }
+    eWidth->setShown( w );
+    tWidth->setShown( w );
+    eDec->setShown( d );
+    tDec->setShown( d );
+}
diff --git a/src/plugins/field/efield.h b/src/plugins/field/efield.h
new file mode 100644 (file)
index 0000000..e4cc313
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef EFIELD_H
+#define EFIELD_H
+
+#include "ui_efield.h"
+
+
+class eField : public QDialog, public Ui::eField
+{
+    Q_OBJECT
+
+public:
+    eField(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~eField();
+
+    QStringList otypes;
+
+public slots:
+    virtual void init();
+    virtual void setData( QWidget * o, aCfg * cfg );
+    virtual void getData( QWidget * o );
+    virtual void typechanged( const QString & s );
+    virtual void typeSelect( int idx );
+
+protected:
+    aCfg * md;
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // EFIELD_H
diff --git a/src/plugins/field/efield.ui b/src/plugins/field/efield.ui
new file mode 100644 (file)
index 0000000..a08baa7
--- /dev/null
@@ -0,0 +1,212 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>eField</class>\r
+  <widget class="QDialog" name="eField" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>313</width>\r
+        <height>186</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Input field</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item rowspan="1" row="3" column="0" colspan="4" >\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QCheckBox" name="ePositive" >\r
+              <property name="text" >\r
+                <string>Positive</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QCheckBox" name="eNotNull" >\r
+              <property name="text" >\r
+                <string>Required</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item rowspan="1" row="1" column="1" colspan="3" >\r
+        <widget class="QComboBox" name="eType" />\r
+      </item>\r
+      <item row="1" column="0" >\r
+        <widget class="QLabel" name="textLabel2" >\r
+          <property name="maximumSize" >\r
+            <size>\r
+              <width>100</width>\r
+              <height>32767</height>\r
+            </size>\r
+          </property>\r
+          <property name="text" >\r
+            <string>Type</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item rowspan="1" row="0" column="1" colspan="3" >\r
+        <widget class="QLineEdit" name="eName" />\r
+      </item>\r
+      <item row="0" column="0" >\r
+        <widget class="QLabel" name="textLabel1" >\r
+          <property name="maximumSize" >\r
+            <size>\r
+              <width>100</width>\r
+              <height>32767</height>\r
+            </size>\r
+          </property>\r
+          <property name="text" >\r
+            <string>Name</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="4" column="0" >\r
+        <spacer name="spacer4" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>31</width>\r
+              <height>16</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Vertical</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+      <item rowspan="1" row="5" column="0" colspan="2" >\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QPushButton" name="pushButton1" >\r
+              <property name="text" >\r
+                <string>OK</string>\r
+              </property>\r
+              <property name="default" >\r
+                <bool>true</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="pushButton2" >\r
+              <property name="text" >\r
+                <string>Cancel</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item rowspan="1" row="5" column="2" colspan="2" >\r
+        <spacer name="spacer2" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>91</width>\r
+              <height>31</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Horizontal</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+      <item row="2" column="0" >\r
+        <widget class="QLabel" name="tWidth" >\r
+          <property name="maximumSize" >\r
+            <size>\r
+              <width>100</width>\r
+              <height>32767</height>\r
+            </size>\r
+          </property>\r
+          <property name="text" >\r
+            <string>Width</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="2" column="1" >\r
+        <widget class="QSpinBox" name="eWidth" >\r
+          <property name="maximum" >\r
+            <number>254</number>\r
+          </property>\r
+          <property name="minimum" >\r
+            <number>1</number>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="2" column="2" >\r
+        <widget class="QLabel" name="tDec" >\r
+          <property name="maximumSize" >\r
+            <size>\r
+              <width>100</width>\r
+              <height>32767</height>\r
+            </size>\r
+          </property>\r
+          <property name="text" >\r
+            <string>Decimals</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="2" column="3" >\r
+        <widget class="QSpinBox" name="eDec" >\r
+          <property name="maximum" >\r
+            <number>9</number>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="6" margin="11" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >ananas.h</include>\r
+    <include location="local" >acfg.h</include>\r
+    <include location="local" >wfield.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>pushButton1</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eField</receiver>\r
+      <slot>accept()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>pushButton2</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eField</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eType</sender>\r
+      <signal>activated(QString)</signal>\r
+      <receiver>eField</receiver>\r
+      <slot>typechanged(QString)</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eType</sender>\r
+      <signal>activated(int)</signal>\r
+      <receiver>eField</receiver>\r
+      <slot>typeSelect(int)</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/field/field.pri b/src/plugins/field/field.pri
new file mode 100644 (file)
index 0000000..efef031
--- /dev/null
@@ -0,0 +1,22 @@
+HEADERS += \
+    field/efield.h \
+    field/addfdialog.h \
+    field/wfield.h \
+    field/wdateedit.h \
+    field/wcatalogeditor.h \
+    field/wfield_plugin.h \
+    field/wfield_taskmenu.h
+
+SOURCES += \
+    field/efield.cpp \
+    field/addfdialog.cpp \
+    field/wfield.cpp \
+    field/wdateedit.cpp \
+    field/wcatalogeditor.cpp \
+    field/wfield_plugin.cpp \
+    field/wfield_taskmenu.cpp
+        
+FORMS += \
+    field/efield.ui \
+    field/addfdialog.ui
+    
\ No newline at end of file
diff --git a/src/plugins/field/wcatalogeditor.cpp b/src/plugins/field/wcatalogeditor.cpp
new file mode 100644 (file)
index 0000000..6fa468b
--- /dev/null
@@ -0,0 +1,411 @@
+/****************************************************************************
+** $Id: wcatalogeditor.cpp,v 1.2 2008/11/08 20:16:36 leader Exp $
+**
+** Code file of the field plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qlineedit.h>
+#include <qlayout.h>
+#include <qvalidator.h>
+#include <qlabel.h>
+#include <q3listview.h>
+#include <qsizepolicy.h>
+//Added by qt3to4:
+#include <Q3Frame>
+#include <QPixmap>
+#include "ananas.h"
+#include "wcatalogeditor.h"
+#include "wfield.h"
+#include "wdbtable.h"
+#include "catalogform.h"
+#include "alog.h"
+#include "../ananas/mainform.h"
+
+
+/*!
+ * \en         Creates catalog editor widget. \_en
+ * \ru         Создает виджет для редактирования каталога.
+ *     В принципе он не предусмотрен использоваться ни как иначе, кроме как часть
+ *     объекта wField, т.е его родительский объект должен быть wField
+ *     или его наследник для обеспечения корректной инициализации.
+ *     При создании объекта runtime не предусмотрено, за исключением случая,
+ *     когда виджет используется в составе wField в объекте wDBTable.
+ *     \param parent - \en parent object. \_en \ru родительский объект. \_ru
+ *     \param name - \en name \_en \ru имя \_ru
+ *     \param catname \en not used \_en \ru не используется \_ru
+ */
+wCatalogEditor::wCatalogEditor(        wField *parent,
+                               const char *name,
+                               const char *catname) : QWidget(parent, name)
+{
+  QWidget* w =0;
+  md = NULL;
+  QString str;
+  label = new QLabel(parent, name);
+       label->setFrameShape(Q3Frame::Box);
+       w =(QWidget*) parent->parent()->parent();
+       str = parent->getFieldType();
+       catId = atoi(str.remove(0,2));// gets catalog id.
+       if(w)
+       {
+               if(strcmp(w->className(),"wDBTable")==0) // wField is element wDBTable
+               {
+                       initCat(((wDBTable*)w)->db);
+               }
+   }
+}
+
+wCatalogEditor::wCatalogEditor(QWidget* parent,int cat) : QWidget()
+{
+       catId = cat;
+       label = 0;
+       ws = parent;
+}
+
+
+/*!
+ * \en Destructor catalog editor. \_en
+ */
+wCatalogEditor::~wCatalogEditor()
+{
+       delete label;
+       label = 0;
+}
+
+
+
+/*!
+ * \en Initialisation catalog editor. \_en
+ * \ru Инициализация редактора каталога.
+ *     Инициализирует внутренние объекты метаданных и базы банных. \_ru
+ */
+void
+wCatalogEditor::initCat(aDatabase * adb)
+{
+       md = &adb->cfg;
+       db = adb;
+}
+
+
+/*!
+ * \en Handler signal click().
+ *     Creates and shows form for select catalog. \_en
+ * \ru Обработчик события нажатия кнопки,
+ *     которая является второй составной частью виджета.
+ *     Сигнал коннектится в объекте wField.
+ *     Создает и отображет в рабочем пространстве енжина форму для
+ *     редактирования каталога или выбора из каталога.
+ *     Производит заполнение дерева групп и элементов группами и формирует
+ *     данные для передачи в форму редактирования каталога.
+ *     Создает и отображет в рабочем пространстве енжина эту форму.\_ru
+ */
+void
+wCatalogEditor::select()
+{
+       openForm(true);
+}
+/*!
+ * \en Creates and shows form for edit  catalog. \_en
+ * \ru Обработчик события нажатия кнопки,
+ *     которая является второй составной частью виджета.
+ *     редактирования каталога.
+ *     Производит заполнение дерева групп и элементов группами и формирует
+ *     данные для передачи в форму редактирования каталога.
+ *     Создает и отображет в рабочем пространстве енжина эту форму.\_ru
+ */
+void
+wCatalogEditor::edit()
+{
+       openForm(false);
+}
+
+void
+wCatalogEditor::openForm(const bool toSelect)
+{
+
+
+       aLog::print(aLog::Debug, tr("wCatalog Editor open form for select=%1 ").arg((int)toSelect));
+       MainForm *mainform;
+       if(parent())
+       {
+               mainform = (MainForm*) topLevelWidget();
+               ws = mainform->ws;
+       }
+//  aWindowsList *wl = mainform->wl;
+       int objid = catId;
+/*     if ( wl->find( objid ) )
+       {
+//             wl->remove(objid);
+               wl->get( objid )->setFocus();
+               return;
+       }
+       else
+       {
+               CatalogForm* newform = new CatalogForm(ws,0, WDestructiveClose);
+               wl->insert( objid, newform );
+       }*/
+       CatalogForm* newform = new CatalogForm(ws,0, Qt::WDestructiveClose);
+
+       connect( newform,       SIGNAL(selected(qulonglong)),
+                this,          SLOT(on_selected( qulonglong )));
+       connect( newform,       SIGNAL(destroyed()),
+                this,          SLOT(on_destroyed_form()));
+
+       aCatalogue *cat = new aCatalogue(md->find(catId),db);
+       int count=0;
+       bool est=true;
+       QMap<qulonglong,Q3ListViewItem*> map, map_el;
+       aCfgItem tmp, tmp_f,tmp_el,tmp_group, o;
+       Q3ListViewItem * item;
+       Q3ListViewItem * p_item;
+       qulonglong idGrForm=0, idElForm=0;
+       QStringList listPos, listPosGroup;
+       newform->ListHint->hide();
+       QPixmap pixmap(newform->getGroupPixmap());
+       QPixmap pixmap_mark_deleted(newform->getMarkDeletedPixmap());
+       tmp = md->find(catId);
+       newform->setCaption(md->attr(tmp,mda_name));
+       o = md->findChild(tmp, md_forms); // get obj forms
+       if(!o.isNull())
+       {
+               count = md->count(o,md_form);
+               for(int i=0; i<count; i++)
+               {
+                       tmp_f = md->findChild(o,md_form,i);
+                       if(!tmp_f.isNull()
+                          && atoi(md->attr(tmp_f,mda_type).ascii())==md_form_elem)
+                       {
+                               aLog::print(aLog::Debug, tr("wCatalog Editor found element forms"));
+                               idElForm = md->id(tmp_f);
+//                              continue;
+                       }
+                       if(!tmp_f.isNull()
+                          && atoi(md->attr(tmp_f,mda_type).ascii())==md_form_group)
+                       {
+                               aLog::print(aLog::Debug, tr("wCatalog Editor found group forms"));
+                               idGrForm = md->id(tmp_f);
+                       }
+               }
+       }
+       else
+       {
+               aLog::print(aLog::Error, tr("wCatalog Editor meta object forms not found"));
+       }
+       tmp_el = md->findChild(tmp, md_element);
+       tmp_group = md->findChild(tmp,md_group);
+       tmp = md->findChild(tmp_el, md_field);
+       int count_fields = md->count(tmp_el,md_field);
+       listPosGroup = cat->getGroupUserFields();
+       int i,level = 0;
+       cat->Select();
+       while(est) // add group in tree on levels
+       {
+               est = false;
+               ++level;
+               cat->selectByLevel(level-1);
+
+               if(!cat->FirstInGroupTable()) break;
+               do
+               {
+                       if(cat->GroupSysValue("level").toInt()==level-1) //all groups, having this level
+                       {
+                               est = true;
+                               QString displayString;
+                               displayString= cat->GroupSysValue(listPosGroup[0]).toString();
+                               if(map.contains(cat->GroupSysValue("idp").toULongLong()))
+                               {
+                                       p_item = map[(cat->GroupSysValue("idp").toULongLong())];
+                                       item = new Q3ListViewItem(p_item);
+                               }
+                               else
+                               {
+                                       item = new Q3ListViewItem(newform->ListView);
+                                       newform->ListView->insertItem(item);
+                               }
+                               item->setText(0, displayString);
+                               if(cat->isGroupMarkDeleted())
+                                       item->setPixmap(0,pixmap_mark_deleted);
+                               else
+                                       item->setPixmap(0,pixmap);
+
+                               map.insert(cat->GroupSysValue("id").toULongLong(),item);
+                       //printf("%lu\n",cat->GroupSysValue("id").toULongLong());
+
+                       }
+
+
+               }while(cat->NextInGroupTable());
+
+       }
+       listPos = cat->getUserFields();
+       checkUserFields(listPos);
+       int fid;
+       //sets column name
+       for(uint i=0; i<listPos.count(); i++)
+       {
+               fid = atoi(listPos[i].remove("uf",false).ascii());
+               if(!fid)
+               {
+//                     printf("listPos[]=%s",listPos[i].remove("text_uf",false).ascii());
+                       fid = (listPos[i].remove("text_",false)).toInt();
+                       //tmp = md->find(fid);
+               }
+               if(fid)
+               {
+                       tmp = md->find(fid);
+                       newform->ListView->addColumn(md->attr(tmp,mda_name));
+               }
+       }
+
+       listPos.clear();
+       listPos = cat->getUserFields();
+       checkUserFields(listPos);
+       //Q_ULLONG res = 0;
+       // cat deleted in function catalogform::destroy();
+
+        newform->setData(      cat,
+                               map,
+                               listPos,
+                               cat->getGroupUserFields(),
+                               idElForm,
+                               idGrForm,
+                               toSelect);
+
+       newform->setId(value().toULongLong());
+       //--
+       if (ws)
+        ((QWorkspace*)ws)->addWindow(newform);
+       newform->show();
+       ((QWidget*)newform->parent())->move(0,0);
+}
+void
+wCatalogEditor::checkUserFields( QStringList &lst)
+{
+       aCfgItem item = md->find(catId);
+       int fid;
+       if(item.isNull()) return;
+       item = md->findChild(item,md_element);
+       for(int i=0; i< md->count(item,md_field); i++)
+       {
+               aCfgItem mdi = md->findChild(item,md_field,i);
+               int ind = lst.findIndex(QString("uf%1").arg(md->attr(mdi,mda_id)));
+               if(ind!=-1)
+               {
+                       //--lst.insert(lst.at(i),lst[ind]);
+                       lst.insert(i,lst[ind]);
+                       lst.remove(lst.at(ind+1));
+
+               }
+               else
+               {
+                       ind = lst.findIndex(QString("text_uf%1").arg(md->attr(mdi,mda_id)));
+                       if(ind!=-1)
+                       {
+                               //--lst.insert(lst.at(i),lst[ind]);
+                               lst.insert(i,lst[ind]);
+                               lst.remove(lst.at(ind+1));
+
+                       }
+               }
+       }
+
+}
+
+void
+wCatalogEditor::on_selected( qulonglong uid )
+{
+       emit( selected(uid) );
+}
+
+void
+wCatalogEditor::on_destroyed_form( )
+{
+       emit( destroyed_form() );
+}
+
+
+/*!
+ * \en         Gets catalog editor value. \_en
+ * \ru         Получение значения редактора каталога.
+ *     Т.е. то, что было выбрано или утановлено функцией setValue().
+ *     Сейчас возвращает стринг с id, но может быть
+ *     Для получения осмысленного значения используй функцию displayValue() \_ru
+ */
+QString
+wCatalogEditor::value() const
+{
+       return vValue;
+}
+
+
+/*!
+ * \en         Gets value for displaying. \_en
+ * \ru Получение осмысленного представления id.
+ *     Строка является представлением уникального id для элемента
+ *     или группы каталога. \_ru
+ *     \param id_element (in) -\en unique id element or group \_en
+ *                             \ru уникальный идентификатор элемента или группы \_ru
+ */
+QString
+wCatalogEditor::displayValue(qulonglong id_element) const
+{
+const QString no_select = "  ";
+       if(md)
+       {
+        /*     aCfgItem tmp,field;
+               QString res;
+               tmp = md->find(catId);
+               tmp = md->findChild(tmp, md_element);
+               field = md->findChild(tmp,md_field);
+               aSQLTable* te = new aSQLTable(tmp,db);
+               te->select(QString("id=%1").arg(id_element));
+               if(te->first())
+               {
+                       res = te->sysValue(QString("uf%1").arg(md->id(field))).toString();
+               }
+               else res = no_select;
+               delete te;*/
+               return QString("%1").arg(id_element);
+       }
+       else return no_select;
+}
+
+
+/*!
+ * \en         Sets id for displaying. \_en
+ * \ru Установка id для показа.
+ *     Хранится в стринге для совмесимости с wField. \_ru
+ */
+void
+wCatalogEditor::setValue(QString newvalue)
+{
+       if(vValue==newvalue) return;
+       vValue = newvalue;
+       if(label) label->setText(displayValue(newvalue.toULongLong()));
+       emit valueChanged(value());
+}
+
diff --git a/src/plugins/field/wcatalogeditor.h b/src/plugins/field/wcatalogeditor.h
new file mode 100644 (file)
index 0000000..a67c906
--- /dev/null
@@ -0,0 +1,93 @@
+/****************************************************************************
+** $Id: wcatalogeditor.h,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Header file of the field plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef WCATALOGEDITOR_H
+#define WCATALOGEDITOR_H
+
+#include "ananasglobal.h"
+
+#include <qwidget.h>
+#include <qwidgetplugin.h>
+#include <qlabel.h>
+#include <qworkspace.h>
+//#include <qobjectlist.h>
+//#include <qlayout.h>
+//#include <qsocket.h>
+//#include <qeventloop.h>
+//#include <qdatetimeedit.h>
+#include "wfield.h"
+#include "adatabase.h"
+#include "ananas.h"
+
+/*!
+ * \en
+ *     \brief Ananas catalogue type field editor.
+ * \_en
+ * \ru
+ *     \brief Класс предоставляет доступ к методам встроенного редактора справочников (каталогов)
+ *     Наследует QWidget.
+ * \_ru
+ */
+class QT_WIDGET_PLUGIN_EXPORT wCatalogEditor : public QWidget
+{
+       Q_OBJECT
+       Q_PROPERTY( QString value READ value WRITE setValue)
+public:
+       QLabel* label;
+       wCatalogEditor( wField* parent = 0, const char *name = 0, const char* catname=0);
+       wCatalogEditor( QWidget* w, int cat);
+       ~wCatalogEditor();
+       QString value() const;
+       void setValue(QString newvalue);
+       void initCat(aDatabase *adb);
+       QString displayValue(qulonglong id_element) const;
+private slots:
+       void on_selected( qulonglong );
+       void on_destroyed_form();
+
+protected slots:
+       void  openForm(const bool toSelect);
+public slots:
+       void  checkUserFields( QStringList &lst);
+       void    select();
+       void    edit();
+
+signals:
+       void valueChanged(const QString &);
+       void selected( qulonglong );
+       void destroyed_form();
+private:
+       QString vValue;
+       aCfg* md;
+       int catId;
+       QWidget *ws;
+       aDatabase* db;
+};
+#endif
diff --git a/src/plugins/field/wdateedit.cpp b/src/plugins/field/wdateedit.cpp
new file mode 100644 (file)
index 0000000..419eb33
--- /dev/null
@@ -0,0 +1,77 @@
+/****************************************************************************
+** $Id: wdateedit.cpp,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Code file of the field plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <q3datetimeedit.h>
+//Added by qt3to4:
+#include <QFocusEvent>
+#include "wdateedit.h"
+
+
+
+/*!
+ * \en Constructor. \_en
+ * \ru Конструктор. \_ru
+ */
+wDateEdit::wDateEdit(QWidget* parent, const char* name ):Q3DateEdit(parent,name)
+{}
+
+
+/*!
+ * \en Constructor with setting date. \_en
+ * \ru Конструктор с инициированием даты. \_ru
+ * \param date - \en date for set \_en \ru Дата для установки \_ru
+ */
+wDateEdit::wDateEdit(const QDate &date,
+                    QWidget* parent,
+                    const char* name) : Q3DateEdit(date,parent,name)
+{}
+
+
+
+/*!
+ * \en         Destructor \_en
+ */
+wDateEdit::~wDateEdit()
+{
+       //QDateEdit::~QDateEdit();
+}
+
+
+/*!
+ * \en         Focus out event handler. Emit signal lostFocus. \_en
+ * \ru         Обработчик сигнала выхода из фокуса. Испускает сигнал lostFocus. \_ru
+ */
+void
+wDateEdit::focusOutEvent ( QFocusEvent * e)
+{
+       emit(lostFocus());
+       QWidget::focusOutEvent(e);
+}
+
+
diff --git a/src/plugins/field/wdateedit.h b/src/plugins/field/wdateedit.h
new file mode 100644 (file)
index 0000000..b4b8570
--- /dev/null
@@ -0,0 +1,78 @@
+/****************************************************************************
+** $Id: wdateedit.h,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Header file of the field plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef WDATEEDIT_H
+#define WDATEEDIT_H
+
+#include <qlabel.h>
+#include <q3datetimeedit.h>
+//Added by qt3to4:
+#include <QFocusEvent>
+
+/*!
+ * \en Unknown field editor. \_en
+ * \ru
+ *     \brief Плагин-виджет для отображения в экранной форме поля типа Unknown.
+ *     Наследует QLabel.
+ * \_ru
+ */
+class wUnknownField : public QLabel
+{
+       Q_OBJECT
+public:
+    wUnknownField( QWidget *parent = 0, const char *name = 0):QLabel(parent, name){};
+
+};
+
+
+/*!
+ * \en DateEdit field editor. \_en
+ * \ru
+ *     \brief Плагин -- виджет используется в экранных формах в качестве поля ввода/редактирования
+ *     атрибута типа Дата бизнес объекта Ананаса.
+ *     Наследует QDateEdit.
+ *
+ * \_ru
+ */
+class wDateEdit : public Q3DateEdit
+{
+       Q_OBJECT
+public:
+       wDateEdit(QWidget* parent = 0, const char* name = 0);
+       wDateEdit(const QDate &date,
+                       QWidget* parent = 0,
+                       const char* name = 0 );
+       ~wDateEdit();
+protected:
+       void focusOutEvent ( QFocusEvent * );
+signals:
+       void lostFocus();
+};
+
+#endif
diff --git a/src/plugins/field/wfield.cpp b/src/plugins/field/wfield.cpp
new file mode 100644 (file)
index 0000000..1f18d09
--- /dev/null
@@ -0,0 +1,720 @@
+/****************************************************************************
+** $Id: wfield.cpp,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Code file of the field plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qlineedit.h>
+#include <qlayout.h>
+#include <qcombobox.h>
+#include <qmessagebox.h>
+#include <qdom.h>
+#include <qvalidator.h>
+#include <qlabel.h>
+#include <q3listbox.h>
+#include <qsizepolicy.h>
+#include <q3groupbox.h>
+#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3Frame>
+#include <QKeyEvent>
+
+//--#include "command.h"
+//--#include "mainwindow.h"
+//--#include "formwindow.h"
+
+#include "ananas.h"
+#include "wfield.h"
+#include "wdateedit.h"
+#include "wcatalogeditor.h"
+#include "efield.h"
+
+
+
+/*!
+ * \en Constructs object with parent=parent, name=name and flags=fl \_en
+ * \ru Создает объект с родителем parent, именем name и флагом fl. \_ru
+ */
+wField::wField( QWidget *parent, const char *name, Qt::WFlags fl )
+    : aWidget( parent, name, fl )
+{
+       loaded = 0;
+       md_oid = 0;
+       md_fid = 0;
+       setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );
+       setFocusPolicy(Qt::StrongFocus);
+       new Q3HBoxLayout( this, 0, 0 );
+       lineEdit = new QLineEdit(this);
+       lineEdit->hide();
+       dateEdit = new wDateEdit(this);
+       dateEdit->hide();
+       objButton = new wCatButton("...",this);
+       objButton->hide();
+       objLabel = new QLabel(this);
+       objLabel->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ));
+       objLabel->setFrameShape(Q3Frame::Box);
+       objLabel->setText("UnknownField");
+       objLabel->show();
+       checkBox = new wCheckBox(this);
+       checkBox->hide();
+       vEditorType = Unknown;
+}
+/*
+wField::wField( QWidget *parent, const char *name, WFlags fl, bool dbf )
+    : aWidget( parent, name, fl )
+{
+    setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );
+    //vValue = "";
+    //vFieldType="";
+    new QHBoxLayout( this, 0, 0 );
+    loaded = 0;
+    fieldEditor = NULL;
+    fieldSelector = NULL;
+    cfgobj_name = NULL;
+    cfgobj_type = NULL;
+    vEditorType = Unknown;
+    setMode( Mode0 );
+    if ( dbf ) widgetInit();
+}
+*/
+
+
+/*!
+ * \en         Destructor. \_en
+ */
+wField::~wField()
+{
+}
+
+
+/*!
+ * \en Sets widget visual type, depend of property fieldType.
+ *     This property must be set above call this function. \_en
+ * \ru Устанавливает визуальный тип виджета в зависимости от свойства
+ *     `fieldType'. Это свойсто должно быть установлено до вызова этой функции,
+ *     иначе тип виджета будет установлен в Unknown. \_ru
+ */
+void
+wField::widgetInit()
+{
+    QString str;
+    char s1[20];
+    int n1=0, n2=0;
+    lineEdit->hide();
+       disconnect( lineEdit, SIGNAL( textChanged( const QString & ) ),
+                               this, SLOT( setValue( const QString & ) ) );
+       disconnect( lineEdit, SIGNAL( lostFocus() ), this, SLOT( focusOutEvent()) );
+  //  lineEdit->disconnect();
+    lineEdit->setReadOnly(false);
+    layout()->remove(lineEdit);
+    dateEdit->hide();// = new QDateEdit(this);
+    disconnect(dateEdit, SIGNAL( valueChanged ( const QDate&) ),
+                               this, SLOT( setValue( const QDate & ) ) );
+    disconnect(dateEdit, SIGNAL( lostFocus() ),
+                               this, SLOT( focusOutEvent() ) );
+    layout()->remove(dateEdit);
+    objLabel->hide();// = new QLabel(this);
+    objLabel->disconnect();
+    layout()->remove(objLabel);
+    objButton->hide();// = new wCatButton("...",this);
+       disconnect( objButton,  SIGNAL( clicked() ),
+                        this, SLOT( fieldSelect() ) );
+//    objButton->disconnect();
+    layout()->remove(objButton);
+    checkBox->hide();
+       disconnect( checkBox, SIGNAL( valueChanged ( const QString & ) ),
+                               this, SLOT( setValue( const QString & ) ) );
+
+       disconnect( checkBox, SIGNAL( toggled (bool) ), checkBox, SLOT( on_toggled() ) );
+//     checkBox->disconnect();
+    layout()->remove(checkBox);
+    //TODO: need rewrite
+    if (!vFieldType.isEmpty()) sscanf((const char *)vFieldType,"%s %i %i", s1, &n1, &n2);
+
+    switch (vEditorType)
+    {
+    case Numberic:
+               lineEdit->setText(vValue);
+               if(vFieldType.isEmpty())
+               {
+               // set validator for numeric type
+                       QString str = tr("^\\-{0,1}\\d{0,%1}\\.{1}\\d{0,%2}$").arg(3).arg(3);
+                       QRegExp rexp( str );
+                       lineEdit->setValidator(new QRegExpValidator(rexp,lineEdit));
+               }
+               else
+               {
+                       if(n2==0)
+                       {
+                          // set default validator for integer type
+                          QString str = tr("^\\-{0,1}\\d{0,%1}$").arg(n1);
+                          QRegExp rexp( str );
+                          lineEdit->setValidator(new QRegExpValidator(rexp,lineEdit));
+                       }
+                       else
+                       {
+                               // set default validator for float type
+                               QString str = tr("^\\-{0,1}\\d{0,%1}\\.{1}\\d{0,%2}$").arg(n1).arg(n2);
+                               QRegExp rexp( str );
+                               lineEdit->setValidator(new QRegExpValidator(rexp,lineEdit));
+                       }
+               }
+               connect( lineEdit, SIGNAL( textChanged( const QString & ) ),
+                               this, SLOT( setValue( const QString & ) ) );
+               connect( lineEdit, SIGNAL( lostFocus() ), this, SLOT( focusOutEvent()) );
+
+               setFocusProxy(lineEdit);
+               layout()->add( lineEdit );
+               lineEdit->show();
+               break;
+
+       case String:
+               if(vFieldType.isEmpty())
+               {
+                       // set default validator for string
+                       lineEdit->setMaxLength(20);
+               }
+               else
+               {
+                       // set validator for string
+                       lineEdit->setMaxLength(n1);
+               }
+               connect( lineEdit, SIGNAL( textChanged( const QString & ) ),
+                               this, SLOT( setValue( const QString & ) ) );
+               connect( lineEdit, SIGNAL( lostFocus() ), this, SLOT( focusOutEvent()) );
+
+               setFocusProxy(lineEdit);
+               layout()->add( lineEdit );
+               lineEdit->show();
+               break;
+
+       case Date:
+       case DateTime:
+       // used object wDateTime, inherits QDateTime
+               dateEdit->setSeparator(".");
+               dateEdit->setOrder( Q3DateEdit::DMY );
+               connect(dateEdit, SIGNAL( valueChanged ( const QDate&) ),
+                               this, SLOT( setValue( const QDate & ) ) );
+               connect(dateEdit, SIGNAL( lostFocus() ),
+                               this, SLOT( focusOutEvent() ) );
+
+               setFocusProxy( dateEdit );
+               layout()->add( dateEdit );
+               dateEdit->show();
+               break;
+
+       case Catalogue:
+               md_oid = n1;
+               objLabel->setFrameShape( Q3Frame::Box );
+               objLabel->setLineWidth( 1 );
+               objLabel->setFocusPolicy(Qt::NoFocus);
+               objButton->setMaximumWidth(25);
+               objButton->setFocusPolicy(Qt::StrongFocus);
+               connect( objButton,     SIGNAL( clicked() ),
+                        this, SLOT( fieldSelect() ) );
+
+               setFocusProxy(objButton);
+               layout()->add( objLabel );
+               layout()->add( objButton );
+               objLabel->show();
+               objButton->show();
+               break;
+
+       case Document:
+//>>>>>>> 1.49.2.4
+       // Field type = Document
+               md_oid = n1;
+               objLabel->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken );
+               objLabel->setLineWidth( 1 );
+               objLabel->setFocusPolicy(Qt::NoFocus);
+               objButton->setMaximumWidth(25);
+               objButton->setFocusPolicy(Qt::StrongFocus);
+               connect( objButton,     SIGNAL( clicked() ),
+                        this, SLOT( fieldSelect() ) );
+
+               setFocusProxy(objButton);
+               layout()->add( objLabel );
+               layout()->add( objButton );
+               objLabel->show();
+               objButton->show();
+               break;
+
+       case Boolean:
+//             connect( checkBox, SIGNAL( lostFocus() ), this, SLOT( focusOutEvent()) );
+               connect( checkBox, SIGNAL( valueChanged ( const QString & ) ),
+                               this, SLOT( setValue( const QString & ) ) );
+
+               connect( checkBox, SIGNAL( toggled (bool) ), checkBox, SLOT( on_toggled() ) );
+               setFocusProxy(checkBox);
+               layout()->add(checkBox);
+               checkBox->show();
+               break;
+
+    default:
+               objLabel->setText("UnknownField");
+               objLabel->setFrameShape(Q3Frame::Box);
+               setFocusPolicy(Qt::NoFocus);
+               layout()->add( objLabel );
+               objLabel->show();
+       break;
+    }
+       setValue(vValue);
+}
+
+
+
+/*!
+ * \en Sets property fieldType. \_en
+ * \ru         Устанавливает значение свойства `fieldType'.\_ru
+ */
+void
+wField::setFieldType( QString n )
+{
+    vFieldType=n;
+    if (!loaded)
+    {
+           loaded = true;
+    }
+    //widgetInit();
+}
+
+
+/*!
+ * \en Sets property editorType. \_en
+ * \ru         Устанавливает значение свойства `editorType'.\_ru
+ */
+void
+wField::setEditorType( tEditorType n )
+{
+    vEditorType=n;
+    widgetInit();
+}
+
+
+
+//<<<<<<< wfield.cpp
+
+/*
+void
+wField::load()
+{
+}
+
+*/
+
+/*!
+ * \en Creates property editor dialog window. \_en
+ * \ru         Создает окно диалога редактора свойств.\_ru
+ *     \param parent - \en parent \_en \ru родитель \_ru
+ */
+QDialog*
+wField::createEditor( QWidget *parent )
+{
+    return new eField( parent );
+}
+
+
+/*!
+ * \en Sets value type DateTime. \_en
+ * \ru Устанавливает значения типа DateTime.
+ *     Так как в базе хранится тип DateTime, значение дополняется
+ *     нулевым временем для корректной конвертации и хранении в базе.
+ *     Формат даты в базе данных должен быть ISO. \_ru
+ *     \param newDate (in) - \en date for set \_en \ru Дата для установки \_ru
+ */
+void
+wField::setValue(const QDate& newDate)
+{
+//CHECK_POINT
+       vValue = newDate.toString(Qt::ISODate);
+       vValue+="T00:00:00"; //for correct converting to date-time
+       emit valueChanged(vValue);
+       emit valueChanged(QVariant(vValue));
+}
+
+
+
+/*!
+ * \en         Sets value. \_en
+ * \ru Устанавливает значение виджета. \_ru
+ *     \param newvalue (in) - \en value for set \_en \ru значение для установки \_ru
+ */
+void
+wField::setValue(const QString &newvalue)
+{
+    int pos;
+    QString  str;
+    QDateTime dt;
+//<<<<<<< wfield.cpp
+//    if (!fieldEditor) return;
+//    emit valueChanged(newvalue);
+//    emit valueChanged(QVariant(newvalue));
+///=======
+//>>>>>>> 1.49.2.4
+    switch (vEditorType)
+    {
+    case Unknown:
+       break;
+    case Numberic:
+    case String:
+       vValue = newvalue;
+       pos = lineEdit->cursorPosition();
+       lineEdit->setText(vValue);
+       lineEdit->setCursorPosition(pos);
+       break;
+    case Date:
+    case DateTime:
+       // conventering date-time to date, and if new value is NULL set up current locale date.
+       // date must be stored in server in format ISO
+        str = newvalue;
+        if(newvalue.isEmpty())
+        {
+                str= QDateTime::currentDateTime(Qt::LocalTime).toString(Qt::ISODate);
+        }
+        dt = QDateTime::fromString(str,Qt::ISODate);
+        vValue = dt.toString(Qt::ISODate);
+        dateEdit->setDate(dt.date());
+        break;
+    case Catalogue:
+    case Document:
+       vValue = newvalue;
+       objLabel->setText( ananas_objectstr( db, vValue.toULongLong(), md_oid ) );
+       break;
+    case Boolean:
+       vValue = newvalue;
+       if(newvalue == "1")
+       {
+               checkBox->setChecked(true);
+       }
+       else
+       {
+               checkBox->setChecked(false);
+       }
+       break;
+       //emit valueChanged(QVariant(vValue));
+
+    }
+    emit valueChanged(vValue);
+    emit valueChanged(QVariant(vValue));
+}
+
+
+
+/*!
+ * \en Gets value. \_en
+ * \ru Возвращает значение виджета. \_ru
+ *     \return \en value \_en \ru значение виджета \_ru
+ */
+QString
+wField::value() const
+{
+   QString str = vValue;
+   return  str; //str.setUnicode(vValue.unicode(),vValue.length());
+}
+
+
+
+/*!
+ * \en Gets text value. \_en
+ * \ru Возвращает текстовое значение виджета. \_ru
+ *     \return \en value \_en \ru значение виджета \_ru
+ */
+QString
+wField::text() const
+{
+   QString str;
+       switch (vEditorType)
+       {
+       case Date:
+       case DateTime:
+               str = dateEdit->date().toString(Qt::ISODate);
+               break;
+       case String:
+       case Numberic:
+               str = lineEdit->text();
+               break;
+       case Catalogue:
+       case Document:
+               str = objLabel->text();
+               break;
+       case Boolean:
+               str = checkBox->isChecked()?"1":"0";
+               break;
+       default:
+               str = "";
+               break;
+       }
+       return  str; //str.setUnicode(vValue.unicode(),vValue.length());
+}
+
+/*!
+ * \en Calls handler onClick event for Catalogue or Document object. \_en
+ * \ru Вызывает обработчик события onClick для объектов Каталог или Документ. \_ru
+ */
+void
+wField::fieldSelect()
+{
+       aForm * f = 0;
+//    if (!fieldEditor) return;
+       switch (vEditorType)
+       {
+               case Catalogue:
+                       //printf("select catalogue\n");
+               if ( engine )
+               {
+                       int fid = md->getDefaultFormId( md->find( md_oid ), md_action_view);
+                       if ( !fid )
+                       {
+                               engine->openEmbedCatalogueEditor(md_oid,this,true);
+                               return;
+                       }
+                       f = engine->openForm( md_oid, 0, md_action_view, 0, false );
+                       if ( f )
+                       {
+                               connect(f, SIGNAL(selected( qulonglong )), this, SLOT(on_selected( qulonglong )));
+                               f->closeAfterSelect = true;
+                       }
+               }
+               else printf("No Engine\n");
+               break;
+               case Document:
+               if( engine )
+               {
+                       aCfgItem journ  = md->findJournal(1, md->find( md_oid ));
+                       if( journ.isNull() )
+                       {
+                               printf("special journal not found, find system journal\n");
+                               journ = md->findJournal(0, md->find( md_oid ));
+                       }
+                       else
+                       {
+                               printf("found special journal %s with class %s\n", (const char*) md->attr(journ,mda_name).local8Bit(),md->objClass(journ).ascii());
+                       }
+                       f =  engine->openForm( md->id(journ), 0, md_action_view, 0, false );
+                       if( f )
+                       {
+                               connect(f, SIGNAL(selected( qulonglong )), this, SLOT(on_selected( qulonglong )));
+                               f->closeAfterSelect = true;
+                       }
+
+               }
+               else printf("No engine\n");
+//             printf("select document!\n");
+               break;
+               default:
+               break;
+       }
+}
+
+
+
+
+/*!
+ * \en Handler signal lostFocus. \_en
+ * \ru Обработчик сигнала lostFocus. \ru
+ */
+void
+wField::focusInEvent()
+{
+       switch (vEditorType) {
+       case Catalogue:
+               objLabel->setLineWidth( 2 );
+               break;
+       case Document:
+               break;
+       default:
+               break;
+    }
+//emit(lostFocus());
+}
+
+
+/*!
+ * \en Handler signal lostFocus. \_en
+ * \ru Обработчик сигнала lostFocus. \ru
+ */
+void
+wField::focusOutEvent()
+{
+       switch (vEditorType) {
+       case Catalogue:
+               objLabel->setLineWidth( 1 );
+               break;
+       case Document:
+               break;
+       default:
+               break;
+    }
+//emit(lostFocus());
+}
+
+
+void
+wField::on_selected( qulonglong uid )
+{
+       setValue( QString::number( uid ) );
+       setFocus();
+}
+
+void
+wField::selectAll()
+{
+       switch (vEditorType) {
+       case Numberic:
+       case String:
+//             ((QLineEdit *) fieldEditor)->home( false );
+               lineEdit->selectAll();
+               break;
+       default:
+               break;
+    }
+}
+
+void
+wField::SetReadOnly(bool fl)
+{
+       switch (vEditorType) {
+       case Numberic:
+       case String:
+               lineEdit->setReadOnly(fl);
+               break;
+       case Date:
+       case DateTime:
+               dateEdit->setDisabled(fl);
+               break;
+       case Catalogue:
+               objButton->setDisabled( fl );
+               break;
+       case Document:
+               objButton->setDisabled( fl );
+               break;
+       case Boolean:
+               checkBox->setDisabled( fl );
+               break;
+       default:
+               break;
+    }
+
+}
+
+/*<<<<<<< wfield.cpp
+void
+wField::SetReadOnly(bool fl)
+{
+       switch (vEditorType) {
+       case Numberic:
+       case String:
+//             ((QLineEdit *) fieldEditor)->home( false );
+               ((QLineEdit *) fieldEditor)->setReadOnly(fl);
+               break;
+       case Date:
+               ((QDateEdit*)fieldEditor)->setDisabled(fl);
+               break;
+       case DateTime:
+               ((QDateTimeEdit*)fieldEditor)->setDisabled(fl);
+               break;
+       case Catalogue:
+//             ((QLabel *) fieldEditor)->setFrameShape( QFrame::NoFrame );
+               ((wCatButton *) fieldSelector)->setDisabled( fl );
+               break;
+       case Document:
+               break;
+       default:
+               break;
+    }
+
+}
+
+=======
+
+>>>>>>> 1.49.2.4
+*/
+/*!
+ *\~english
+ *     Proces value changed.
+ *     Proces value changed in fields diferent types.
+ *\~russian
+ *     Обрабатывает изменение значения.
+ *     Обрабатывает изменение значения в поле, вне зависимости от типа поля.
+ *\~
+ */
+
+wCatButton::wCatButton(const char * caption, QWidget *parent):QPushButton(caption,parent)
+{
+}
+
+wCatButton::~wCatButton()
+{
+}
+
+void
+wCatButton::keyPressEvent ( QKeyEvent * e )
+{
+       switch(e->key())
+       {
+               case Qt::Key_Left:
+               case Qt::Key_Up:
+               case Qt::Key_Right:
+               case Qt::Key_Down:
+                       e->accept();
+                       break;
+               case Qt::Key_Space:
+                       e->accept();
+                       emit( clicked() );
+                       break;
+               case Qt::Key_Tab:
+//                     printf("press tab\n");
+                       e->accept();
+//<<<<<<< wfield.cpp
+                       //new QKeyEvent( QEvent::KeyPress, Qt::Key_Return, 10, 0);
+                       //new QKeyEvent( QEvent::KeyRelease, Qt::Key_Return, 10, 0);
+//=======
+//>>>>>>> 1.49.2.4
+                       break;
+               default:
+                       e->ignore();
+                       break;
+
+       }
+}
+
+wCheckBox::wCheckBox(QWidget * parent, const char * name):QCheckBox(parent,name)
+{
+}
+
+wCheckBox::~wCheckBox()
+{
+}
+
+void
+wCheckBox::on_toggled()
+{
+//     printf("wCheckBox state is %d\n",this->state());
+       if(this->isChecked()) emit(valueChanged("1"));
+       else emit(valueChanged("0"));
+}
diff --git a/src/plugins/field/wfield.h b/src/plugins/field/wfield.h
new file mode 100644 (file)
index 0000000..3f8cc87
--- /dev/null
@@ -0,0 +1,149 @@
+/****************************************************************************
+** $Id: wfield.h,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Header file of the field plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QAFIELD_H
+#define QAFIELD_H
+
+#include <qwidget.h>
+#include <qwidgetplugin.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
+#include <q3datetimeedit.h>
+#include <qcheckbox.h>
+#include "qlineedit.h"
+//Added by qt3to4:
+#include <QKeyEvent>
+#include "wdateedit.h"
+#include "adatabase.h"
+#include "ananas.h"
+
+class wCatButton;
+class wCheckBox;
+
+/*!
+ * \en
+ *     \brief Ananas Field widget.
+ * \_en
+ * \ru
+ *     \brief Плагин -- виджет предназначенный для редактирования значений любых типов, определенных в бизнес схеме.
+ *     Наследует aWidget.
+ *
+ *     В отличие от wDBField класс wField не биндится к атрибутам persistent бизнес объектов. То есть время жизни
+ *     хранимых в нем значений равно времени жизни родительской экранной формы. Прикладной программист сам должен
+ *     решить вопрос обработки и хранения значений задаваемых пользователем.
+ * \_ru
+ */
+#include <QtDesigner/QDesignerExportWidget>
+
+//class QT_WIDGET_PLUGIN_EXPORT wField : public aWidget
+class QDESIGNER_WIDGET_EXPORT wField : public aWidget
+{
+       Q_OBJECT
+
+       Q_PROPERTY( QString value READ value WRITE setValue)
+       Q_PROPERTY( QString FieldType READ getFieldType WRITE setFieldType )
+       Q_PROPERTY( tEditorType EditorType READ getEditorType WRITE setEditorType )
+       Q_ENUMS(tEditorType)
+       Q_ENUMS(FieldMode)
+public:
+       enum tEditorType { Unknown, Numberic, String, Date, DateTime, Boolean, Catalogue=101, Document};
+
+       wField( QWidget *parent, const char *name, Qt::WFlags fl = 0 );
+//     wField( QWidget *parent, const char *name, WFlags fl, bool dbf = TRUE );
+       virtual ~wField();
+
+       virtual QDialog*        createEditor( QWidget *parent );
+
+signals:
+       void valueChanged( const QString & );
+       void valueChanged( const QVariant & );
+       void lostFocus();
+
+public slots:
+       bool                    getOpt() const { return false; };
+       void                    setOpt( bool fn ) { if(fn) widgetEditor(); };
+       virtual QString         value() const;
+       QString                 text() const;
+       virtual void            setValue( const QString &fn );
+       void                    setValue( const QDate& d);
+       virtual QString         textValue() {return text();};
+       void                    setFieldType( QString n );
+       QString                 getFieldType() const {return vFieldType;};
+       void                    setEditorType( tEditorType n );
+       tEditorType             getEditorType() const { return vEditorType; };
+       void                    fieldSelect();
+//     void                    propertyUpdate(QString propName);
+       virtual void            focusInEvent();
+       virtual void            focusOutEvent();
+       void                    selectAll();
+       virtual void            SetReadOnly(bool);
+
+private slots:
+       void on_selected( qulonglong uid );
+
+protected:
+       QLineEdit       *lineEdit;
+       wDateEdit       *dateEdit;
+       QLabel          *objLabel;
+       wCatButton      *objButton;
+       wCheckBox       *checkBox;
+       tEditorType     vEditorType;
+       QString         vFieldType;
+       QString         vValue;
+//     virtual         void updateProp();
+       void widgetInit();
+private:
+       int loaded;
+       int md_oid, md_fid;
+};
+
+class  wCatButton: public QPushButton
+{
+       Q_OBJECT
+       public:
+               wCatButton(const char * caption, QWidget *parent);
+               virtual ~wCatButton();
+       protected:
+               void keyPressEvent ( QKeyEvent * e );
+};
+class  wCheckBox: public QCheckBox
+{
+       Q_OBJECT
+       public:
+               wCheckBox(QWidget *parent, const char * name =0);
+               virtual ~wCheckBox();
+
+       public slots:
+               void on_toggled();
+       signals:
+               void valueChanged(const QString &);
+};
+
+#endif
diff --git a/src/plugins/field/wfield_plugin.cpp b/src/plugins/field/wfield_plugin.cpp
new file mode 100644 (file)
index 0000000..4114396
--- /dev/null
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "wfield_plugin.h"
+
+#include <QtPlugin>
+#include <QDesignerFormEditorInterface>
+#include <QExtensionManager>
+
+#include "wfield_taskmenu.h"
+#include "wfield.h"
+
+
+wFieldPlugin::wFieldPlugin(QObject *parent)
+    : QObject(parent), m_initialized(false)
+{
+    m_initialized = false;
+}
+
+bool wFieldPlugin::isContainer() const
+{
+    return false;
+}
+
+bool wFieldPlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void wFieldPlugin::initialize(QDesignerFormEditorInterface *core)
+{
+    if (m_initialized)
+        return;
+    Q_UNUSED(core);
+
+    QExtensionManager *manager = core->extensionManager();
+    Q_ASSERT(manager != 0);
+    manager->registerExtensions(new wFieldTaskMenuFactory(manager),
+                                Q_TYPEID(QDesignerTaskMenuExtension));
+
+    m_initialized = true;
+}
+
+QWidget *wFieldPlugin::createWidget(QWidget *parent)
+{
+    wField *w = new wField(parent, 0);
+    return w;
+}
+
+QString wFieldPlugin::name() const
+{
+    return QLatin1String("wField");
+}
+
+QString wFieldPlugin::group() const
+{
+    return QLatin1String("Ananas");
+}
+
+QString wFieldPlugin::toolTip() const
+{
+    return QString("Ananas for QT Field Edit Widget");
+}
+
+QString wFieldPlugin::whatsThis() const
+{
+    return QString("Entry to modify field value of Ananas's object");
+}
+
+QString wFieldPlugin::includeFile() const
+{
+    return QLatin1String("wfield.h");
+}
+
+QIcon wFieldPlugin::icon() const
+{
+//    return QIcon();
+    return QIcon( ":/images/wfield.png" );
+}
+
+QString wFieldPlugin::domXml() const
+{
+    return "<widget class=\"wField\" name=\"wField_1\">\n</widget>\n";
+}
+
diff --git a/src/plugins/field/wfield_plugin.h b/src/plugins/field/wfield_plugin.h
new file mode 100644 (file)
index 0000000..ddb61a0
--- /dev/null
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef WFIELD_PLUGIN_H
+#define WFIELD_PLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+#include "qwidgetplugin.h"
+
+
+class QT_WIDGET_PLUGIN_EXPORT wFieldPlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+    wFieldPlugin(QObject *parent=0);
+
+    bool isContainer() const;
+    bool isInitialized() const;
+    void initialize(QDesignerFormEditorInterface *core);
+    QWidget *createWidget(QWidget *parent);
+
+    QString name() const;
+    QString group() const;
+    QString toolTip() const;
+    QString whatsThis() const;
+    QString includeFile() const;
+    QIcon icon() const;
+    QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+#endif // WFIELD_PLUGIN_H
diff --git a/src/plugins/field/wfield_taskmenu.cpp b/src/plugins/field/wfield_taskmenu.cpp
new file mode 100644 (file)
index 0000000..f526022
--- /dev/null
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include <QDesignerFormEditorInterface>
+
+#include <QAction>
+
+#include "wfield_taskmenu.h"
+#include "wfield.h"
+#include "efield.h"
+
+
+wFieldTaskMenu::wFieldTaskMenu(wField *widget, QObject *parent)
+    : QObject(parent)
+{
+    m_widget = widget;
+
+    m_editAction = new QAction(tr("Edit ..."), this);
+    connect(m_editAction, SIGNAL(triggered()), this, SLOT(edit()));
+}
+
+void wFieldTaskMenu::edit()
+{
+    /*eField e;
+
+       e.setData(m_widget);
+       if (e.exec() == QDialog::Accepted)
+       {
+               e.getData(m_widget);
+       }*/
+       m_widget->widgetEditor();
+}
+
+QAction *wFieldTaskMenu::preferredEditAction() const
+{
+    return m_editAction;
+}
+
+QList<QAction *> wFieldTaskMenu::taskActions() const
+{
+    QList<QAction *> list;
+    list.append(m_editAction);
+    return list;
+}
+
+wFieldTaskMenuFactory::wFieldTaskMenuFactory(QExtensionManager *parent)
+    : QExtensionFactory(parent)
+{
+}
+
+QObject *wFieldTaskMenuFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
+{
+    if (iid != Q_TYPEID(QDesignerTaskMenuExtension))
+        return 0;
+
+    if (wField *ob = qobject_cast<wField*>(object))
+        return new wFieldTaskMenu(ob, parent);
+
+    return 0;
+}
diff --git a/src/plugins/field/wfield_taskmenu.h b/src/plugins/field/wfield_taskmenu.h
new file mode 100644 (file)
index 0000000..7ce4e45
--- /dev/null
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef WFIELD_TASKMENU_H
+#define WFIELD_TASKMENU_H
+
+#include <QDesignerTaskMenuExtension>
+#include <QExtensionFactory>
+
+
+class QExtensionManager;
+class QAction;
+class wField;
+
+class wFieldTaskMenu: public QObject, public QDesignerTaskMenuExtension
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerTaskMenuExtension)
+public:
+    wFieldTaskMenu(wField *widget, QObject *parent);
+
+    QAction *preferredEditAction() const;
+    QList<QAction *> taskActions() const;
+
+private slots:
+    void edit();
+
+private:
+    QAction *m_editAction;
+    wField *m_widget;
+};
+
+class wFieldTaskMenuFactory: public QExtensionFactory
+{
+    Q_OBJECT
+public:
+    wFieldTaskMenuFactory(QExtensionManager *parent = 0);
+
+protected:
+    QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
+};
+
+#endif // WFIELD_TASKMENU_H
diff --git a/src/plugins/grouptree/grouptree.pri b/src/plugins/grouptree/grouptree.pri
new file mode 100644 (file)
index 0000000..dde3799
--- /dev/null
@@ -0,0 +1,7 @@
+HEADERS += \
+    grouptree/wgrouptree.h \
+    grouptree/wgrouptree_plugin.h
+
+SOURCES += \
+    grouptree/wgrouptree.cpp \
+    grouptree/wgrouptree_plugin.cpp
diff --git a/src/plugins/grouptree/wgrouptree.cpp b/src/plugins/grouptree/wgrouptree.cpp
new file mode 100644 (file)
index 0000000..637c1f2
--- /dev/null
@@ -0,0 +1,416 @@
+/****************************************************************************
+** $Id: wgrouptree.cpp,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Header file of the document plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <q3header.h>
+#include <qlayout.h>
+#include <qaction.h>
+//Added by qt3to4:
+#include <q3mimefactory.h>
+#include <Q3GridLayout>
+#include <QKeyEvent>
+#include "wgrouptree.h"
+#include "awidget.h"
+
+wGroupTreeItem::wGroupTreeItem( Q3ListView *parent, const QString &name )
+    : Q3ListViewItem( parent, name )
+{
+       level = -1;
+       parent = 0;
+       id = 0;
+}
+
+
+wGroupTreeItem::wGroupTreeItem( wGroupTreeItem *parent, wGroupTreeItem *after, const QString &name, int newlevel, ANANAS_UID newid )
+    : Q3ListViewItem( parent, after, name )
+{
+       level = newlevel;
+       id = newid;
+}
+
+
+wGroupTreeItem::wGroupTreeItem( wGroupTreeItem *parent, wGroupTreeItem *after, aCatGroup *g )
+    : Q3ListViewItem( parent, after )
+{
+       level = g->Value( "Level" ).toInt();
+       id = g->getUid();
+//     setText( 0, g->Value("Name").toString()+" "+QString::number( level )+" ("+QString::number( id )+")" );
+       setText( 0, g->displayString() );
+}
+
+
+wGroupTreeItem::~wGroupTreeItem()
+{
+}
+
+
+
+wGroupTreeItem *
+wGroupTreeItem::parentItem()
+{
+       return ( wGroupTreeItem *) parent();
+}
+
+
+wGroupTree::wGroupTree( QWidget *parent, Qt::WFlags fl )
+    : aWidget( parent, "wGroupTree", fl )
+{
+       tree = new Q3ListView( this );
+       tree->addColumn( "" );
+       tree->header()->hide();
+       tree->setSorting( 0 );
+       tree->setSelectionMode( Q3ListView::Single );
+       root = new wGroupTreeItem( tree, "ROOT" );
+       root->setOpen( true );
+       root->setPixmap(0, rcIcon("wcatalogue.png"));
+
+       Q3GridLayout *l = new Q3GridLayout( this );
+       l->addWidget( tree, 0, 0 );
+       connect(tree, SIGNAL(selectionChanged(Q3ListViewItem*)),
+               this, SLOT( on_selectionChanged(Q3ListViewItem*)));
+}
+
+
+wGroupTree::~wGroupTree()
+{
+}
+
+
+void
+wGroupTree::initObject( aDatabase *adb )
+{
+       aWidget::initObject( adb );
+       findGroupTree();
+       //connectSlots();
+}
+
+
+QDialog*
+wGroupTree::createEditor( QWidget * )//parent )
+{
+    return 0; //new eCatalogue( parent );
+}
+
+
+
+/*!
+ * Create aDocument database object.
+ */
+aObject *
+wGroupTree::createDBObject(  aCfgItem obj, aDatabase *adb )
+{
+       return new aCatGroup( obj, adb );
+}
+
+
+void
+wGroupTree::buildGroupTree( aCfgItem obj, aCatGroup * cg1, wGroupTreeItem * wG )
+{
+       aCatGroup cg2 (obj, db);
+       QString t;
+       int err = 0;
+       wGroupTreeItem *item;
+       CHECK_POINT
+
+       err = cg2.SelectChild( cg1 );
+       if ( !err )
+       {
+//             CHECK_POINT
+//             QListViewItem * parent1 = new QListViewItem ( wG );
+//             wG = new wGroupTreeItem ( tree, parent1 );
+       do
+       {
+//                     CHECK_POINT
+                       t = cg2.Value("Name").toString();
+//                     CHECK_POINT
+                       item = new wGroupTreeItem ( wG, 0, &cg2 ); //cg2.Value("Level").toInt(), cg2.getUid() );
+                       item->setPixmap( 0, rcIcon( "t_cat_g.png" ));
+//                     buildGroupTree( obj, &cg2, wG );
+//                     CHECK_POINT
+                       buildGroupTree( obj, &cg2, item );
+//                     CHECK_POINT
+       }
+       while ( cg2.Next() );
+       } else {
+//             CHECK_POINT
+               printf("table %s err = %d\n", ( const char *)cg2.table()->name(), err);
+       }
+}
+
+
+
+void
+wGroupTree::findGroupTree()
+{
+       int oid = 0;
+       aCfgItem tab, cat;
+       if ( !db || !md ) return;
+       CHECK_POINT
+       aWidget *pc = parentContainer( this );
+       if ( !pc ) return;
+       CHECK_POINT
+       printf("inserted in %s\n", pc->className());
+       if ( pc->className() == QString("wCatalogue") ) {
+               cat = md->find( pc->getId() ); // md->find(mdc_metadata), md_catalogues, 0 ), md_catalogue, 0 );
+               root->setText( 0, md->attr( cat, mda_name ) );
+//             CHECK_POINT
+//             wGroupTreeItem *wG = new wGroupTreeItem ( tree, root, "root" );
+//             aCatGroup cg ( cat, db );
+
+//             CHECK_POINT
+               buildGroupTree( cat, 0, root );
+               CHECK_POINT
+       }
+}
+
+
+/*!
+ *\~english
+ *
+ *\~russian
+ * ������ ������������� �����.
+ *\~
+ */
+void
+wGroupTree::keyPressEvent ( QKeyEvent *e )
+{
+       ANANAS_UID id = 0;
+       wGroupTreeItem * item = ( wGroupTreeItem * ) tree->currentItem();
+       printf("key=%04x\n",e->key());
+       switch ( e->key() ){
+       case Qt::Key_Return:
+               id = item->id;
+               if ( e->state() == Qt::ShiftModifier ) {
+                       printf("Shift+Return pressed %Li\n", id);
+                       if ( id ) EditGroup();
+               } else {
+                       printf("Return pressed %Li\n", id );
+                       emit( selected( id ) );
+               }
+               e->accept();
+               break;
+       case Qt::Key_Escape:
+               break;
+       case Qt::Key_Delete:
+               id = item->id;
+               if ( id ) DeleteGroup();
+               break;
+       case Qt::Key_Insert:
+               NewGroup();
+               item = ( wGroupTreeItem * ) tree->currentItem();
+               id = item->id;
+               if ( id ) EditGroup();
+               break;
+
+       default:
+               e->ignore();
+               break;
+       }
+       aWidget::keyPressEvent( e );
+}
+
+
+
+void
+wGroupTree::NewGroup()
+{
+       wGroupTreeItem *item, *cur;
+       QString t = "Element";
+       int level;
+
+       cur = ( wGroupTreeItem *) tree->currentItem();
+       if ( !cur ) cur = root;
+       level = cur->level + 1;
+       ( ( aCatGroup *) dbobj )->New();
+       dbobj->SetValue("Name", t);
+       dbobj->setSysValue("level", level );
+       dbobj->setSysValue("idp", cur->id );
+       dbobj->Update();
+       item = new wGroupTreeItem ( cur, 0, ( aCatGroup *) dbobj ); //level, dbobj->getUid() );
+       item->id = dbobj->getUid();
+       cur->setOpen( true );
+       tree->setCurrentItem( item );
+
+}
+
+
+void
+wGroupTree::DeleteGroup()
+{
+CHECK_POINT
+       aCatGroup g( *getMDObject(), db);
+       wGroupTreeItem * item = ( wGroupTreeItem * ) tree->currentItem();
+       if(item!=root)
+       {
+               g.select( item->id );
+               g.Delete();
+               item->id=0;
+               item->setText(0,"X");
+       }
+}
+
+
+void
+wGroupTree::EditGroup()
+{
+       ANANAS_UID id = 0;
+       wGroupTreeItem * item = ( wGroupTreeItem * ) tree->currentItem();
+       if(item!=root)
+       {
+               aForm * f = 0;
+               if ( item ) id = item->id;
+CHECK_POINT
+               if ( id ) {
+                       if ( engine ) {
+                               f = engine->openForm( parentContainer( this )->getId(), 0, md_action_edit, md_form_group, id, this );
+                               if ( f ) {
+                                       f->SelectGroup(id);
+                                       connect(f, SIGNAL( update( ANANAS_UID )), this, SLOT(updateItem( ANANAS_UID )));
+//                             connect(f, SIGNAL(selected( Q_ULLONG )), this, SLOT(on_selected( Q_ULLONG )));
+//                             f->closeAfterSelect = true;
+                               }
+                       } else printf("No Engine\n");
+
+               }
+       }
+}
+
+
+//void
+//wGroupTree::UpdateItem( aCatGroup *g )
+//{
+//}
+
+
+/*!
+ * Show appropriated group after catalogue item selected.
+ */
+void
+wGroupTree::on_selected( ANANAS_UID element )
+{
+
+}
+
+
+/*!
+ * Update item after edit.
+ */
+void
+wGroupTree::updateItem( ANANAS_UID element )
+{
+       wGroupTreeItem *i = 0;
+       aCatGroup g( *getMDObject(), db);
+
+       printf("Need update text %Li\n", element);
+       i = findItem( element );
+       if ( i ) {
+               g.select( element );
+               printf("founded text %Li %s\n", element, (const char *) i->text(0));
+               i->setText( 0, g.displayString() );
+
+       }
+}
+
+
+wGroupTreeItem *
+wGroupTree::findItem( ANANAS_UID id )
+{
+       wGroupTreeItem *i = 0;
+
+       Q3ListViewItemIterator it( tree );
+       while ( i = ( wGroupTreeItem *) it.current() ) {
+               if ( i->id == id ) break;
+               ++it;
+       }
+       return i;
+}
+
+
+/*!
+ * Create toolbar for Journal.
+ */
+Q3ToolBar*
+wGroupTree::createToolBar( Q3MainWindow * owner )
+{
+       QAction *a;
+       Q3ToolBar *t = new Q3ToolBar( owner, "GroupTreeTools" );
+
+       a = new QAction(
+       rcIcon("doc_new.png"),
+       tr("New"),
+       QKeySequence(""),//Insert"),
+       t,
+       tr("New group")
+       );
+       a->setToolTip(tr("New group (Ins)"));
+       a->addTo( t );
+       connect( a, SIGNAL( activated() ), this, SLOT( NewGroup() ) );
+
+       a = new QAction(
+       rcIcon("doc_edit.png"),
+       tr("Edit"),
+       QKeySequence(""),//Return"),
+       t,
+       tr("Edit group")
+       );
+       a->setToolTip(tr("Edit group (Enter)"));
+       a->addTo( t );
+       connect( a, SIGNAL( activated() ), this, SLOT( EditGroup() ) );
+
+/*     a = new QAction(
+       QPixmap::fromMimeSource("doc_view.png"),
+       tr("View"),
+       QKeySequence("Shifh+Return"),
+       t,
+       tr("View element")
+       );
+       a->setToolTip(tr("View element (Shift+Enter)"));
+       a->addTo( t );
+       connect( a, SIGNAL( activated() ), this, SLOT( view() ) );
+*/
+       a = new QAction(
+       rcIcon("doc_delete.png"),
+       tr("Delete group"),
+       QKeySequence(""),//Delete"),
+       t,
+       tr("Delete group")
+       );
+       a->setToolTip(tr("Delete group (Delete)"));
+       a->addTo( t );
+       connect( a, SIGNAL( activated() ), this, SLOT( DeleteGroup() ) );
+
+
+       return 0;
+}
+
+void
+wGroupTree::on_selectionChanged( Q3ListViewItem * item)
+{
+       printf("wGroupTree id =%llu\n",((wGroupTreeItem*) item)->id);
+       emit(selectionChanged( ((wGroupTreeItem*) item)->id) );
+}
diff --git a/src/plugins/grouptree/wgrouptree.h b/src/plugins/grouptree/wgrouptree.h
new file mode 100644 (file)
index 0000000..296cc68
--- /dev/null
@@ -0,0 +1,95 @@
+/****************************************************************************
+** $Id: wgrouptree.h,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Header file of the document plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef WGROUPTREE_H
+#define WGROUPTREE_H
+
+#include <q3listview.h>
+#include <qwidgetplugin.h>
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include "awidget.h"
+
+class wGroupTreeItem;
+
+class QT_WIDGET_PLUGIN_EXPORT wGroupTree : public aWidget
+{
+    Q_OBJECT
+public:
+       Q3ListView *tree;
+       wGroupTreeItem *root;
+
+       wGroupTree( QWidget *parent = 0, Qt::WFlags fl = 0 );
+       virtual ~wGroupTree();
+
+       virtual void initObject( aDatabase *adb );
+       virtual QDialog* createEditor( QWidget *parent );
+       virtual Q3ToolBar*      createToolBar( Q3MainWindow *parent );
+       virtual aObject *createDBObject(  aCfgItem obj, aDatabase *adb );
+       void buildGroupTree( aCfgItem obj, aCatGroup * cg1, wGroupTreeItem * wG );
+       void findGroupTree();
+       wGroupTreeItem *findItem( ANANAS_UID id );
+public slots:
+       void NewGroup();
+       void DeleteGroup();
+       void EditGroup();
+//     void UpdateItem( aCatGroup *g );
+private slots:
+       void on_selected( ANANAS_UID element );
+//     void updateItem( ANANAS_UID element );
+       void updateItem( ANANAS_UID element );
+       void on_selectionChanged( Q3ListViewItem *);
+signals:
+    virtual void selected( ANANAS_UID group );
+    virtual void selectionChanged( const qulonglong );
+protected:
+       virtual void keyPressEvent ( QKeyEvent *e );
+private:
+};
+
+
+
+class wGroupTreeItem : public Q3ListViewItem
+{
+public:
+       ANANAS_UID id;
+       int level;
+    wGroupTreeItem( Q3ListView *parent, const QString &name = QString::null );
+    wGroupTreeItem( wGroupTreeItem *parent, wGroupTreeItem *after, const QString &name = QString::null, int newlevel = 0, ANANAS_UID newid = 0 );
+    wGroupTreeItem( wGroupTreeItem *parent, wGroupTreeItem *after, aCatGroup *g = 0 );
+    virtual ~wGroupTreeItem();
+    wGroupTreeItem *parentItem();
+private:
+};
+
+
+
+#endif // WGROUPTREE_H
+
diff --git a/src/plugins/grouptree/wgrouptree_plugin.cpp b/src/plugins/grouptree/wgrouptree_plugin.cpp
new file mode 100644 (file)
index 0000000..67be9bf
--- /dev/null
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "wgrouptree_plugin.h"
+
+#include <QtPlugin>
+
+#include "wgrouptree.h"
+
+
+wGroupTreePlugin::wGroupTreePlugin(QObject *parent)
+    : QObject(parent), m_initialized(false)
+{
+    m_initialized = false;
+}
+
+bool wGroupTreePlugin::isContainer() const
+{
+    return false;
+}
+
+bool wGroupTreePlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void wGroupTreePlugin::initialize(QDesignerFormEditorInterface *core)
+{
+    if (m_initialized)
+        return;
+    Q_UNUSED(core);
+    m_initialized = true;
+}
+
+QWidget *wGroupTreePlugin::createWidget(QWidget *parent)
+{
+    wGroupTree *w = new wGroupTree(parent);
+    return w;
+}
+
+QString wGroupTreePlugin::name() const
+{
+    return QLatin1String("wGroupTree");
+}
+
+QString wGroupTreePlugin::group() const
+{
+    return QLatin1String("Ananas");
+}
+
+QString wGroupTreePlugin::toolTip() const
+{
+    return QString("Ananas for QT Group Tree Widget");
+}
+
+QString wGroupTreePlugin::whatsThis() const
+{
+    return QString("Entry to select group of Ananas's object");
+}
+
+QString wGroupTreePlugin::includeFile() const
+{
+    return QLatin1String("wgrouptree.h");
+}
+
+QIcon wGroupTreePlugin::icon() const
+{
+    //return QIcon();
+    return QIcon(":/images/wgrouptree.png");
+}
+
+QString wGroupTreePlugin::domXml() const
+{
+    return "<widget class=\"wGroupTree\" name=\"wGroupTree_1\">\n</widget>\n";
+}
diff --git a/src/plugins/grouptree/wgrouptree_plugin.h b/src/plugins/grouptree/wgrouptree_plugin.h
new file mode 100644 (file)
index 0000000..d900af1
--- /dev/null
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef WGROUPTREE_PLUGIN_H
+#define WGROUPTREE_PLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+#include "qwidgetplugin.h"
+
+
+class QT_WIDGET_PLUGIN_EXPORT wGroupTreePlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+    wGroupTreePlugin(QObject *parent=0);
+
+    bool isContainer() const;
+    bool isInitialized() const;
+    void initialize(QDesignerFormEditorInterface *core);
+    QWidget *createWidget(QWidget *parent);
+
+    QString name() const;
+    QString group() const;
+    QString toolTip() const;
+    QString whatsThis() const;
+    QString includeFile() const;
+    QIcon icon() const;
+    QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+#endif // WGROUPTREE_PLUGIN_H
diff --git a/src/plugins/images/acombobox.png b/src/plugins/images/acombobox.png
new file mode 100644 (file)
index 0000000..7d4890a
Binary files /dev/null and b/src/plugins/images/acombobox.png differ
diff --git a/src/plugins/images/doc_copy.png b/src/plugins/images/doc_copy.png
new file mode 100644 (file)
index 0000000..4a7c257
Binary files /dev/null and b/src/plugins/images/doc_copy.png differ
diff --git a/src/plugins/images/doc_delete.png b/src/plugins/images/doc_delete.png
new file mode 100644 (file)
index 0000000..c79311f
Binary files /dev/null and b/src/plugins/images/doc_delete.png differ
diff --git a/src/plugins/images/doc_edit.png b/src/plugins/images/doc_edit.png
new file mode 100644 (file)
index 0000000..9e70eac
Binary files /dev/null and b/src/plugins/images/doc_edit.png differ
diff --git a/src/plugins/images/doc_new.png b/src/plugins/images/doc_new.png
new file mode 100644 (file)
index 0000000..6c8b94d
Binary files /dev/null and b/src/plugins/images/doc_new.png differ
diff --git a/src/plugins/images/doc_view.png b/src/plugins/images/doc_view.png
new file mode 100644 (file)
index 0000000..9b17518
Binary files /dev/null and b/src/plugins/images/doc_view.png differ
diff --git a/src/plugins/images/wactionbutton.png b/src/plugins/images/wactionbutton.png
new file mode 100644 (file)
index 0000000..a6a1e08
Binary files /dev/null and b/src/plugins/images/wactionbutton.png differ
diff --git a/src/plugins/images/wcatalogue.png b/src/plugins/images/wcatalogue.png
new file mode 100644 (file)
index 0000000..9b26a30
Binary files /dev/null and b/src/plugins/images/wcatalogue.png differ
diff --git a/src/plugins/images/wdbfield.png b/src/plugins/images/wdbfield.png
new file mode 100644 (file)
index 0000000..f8e8b77
Binary files /dev/null and b/src/plugins/images/wdbfield.png differ
diff --git a/src/plugins/images/wdbtable.png b/src/plugins/images/wdbtable.png
new file mode 100644 (file)
index 0000000..233b076
Binary files /dev/null and b/src/plugins/images/wdbtable.png differ
diff --git a/src/plugins/images/wdocument.png b/src/plugins/images/wdocument.png
new file mode 100644 (file)
index 0000000..61334f2
Binary files /dev/null and b/src/plugins/images/wdocument.png differ
diff --git a/src/plugins/images/wfield.png b/src/plugins/images/wfield.png
new file mode 100644 (file)
index 0000000..7a26951
Binary files /dev/null and b/src/plugins/images/wfield.png differ
diff --git a/src/plugins/images/wgrouptree.png b/src/plugins/images/wgrouptree.png
new file mode 100644 (file)
index 0000000..9b26a30
Binary files /dev/null and b/src/plugins/images/wgrouptree.png differ
diff --git a/src/plugins/images/wjournal.png b/src/plugins/images/wjournal.png
new file mode 100644 (file)
index 0000000..4d92109
Binary files /dev/null and b/src/plugins/images/wjournal.png differ
diff --git a/src/plugins/images/wreport.png b/src/plugins/images/wreport.png
new file mode 100644 (file)
index 0000000..0c4bb0c
Binary files /dev/null and b/src/plugins/images/wreport.png differ
diff --git a/src/plugins/images/wtable.png b/src/plugins/images/wtable.png
new file mode 100644 (file)
index 0000000..7198416
Binary files /dev/null and b/src/plugins/images/wtable.png differ
diff --git a/src/plugins/journal/ejournal.cpp b/src/plugins/journal/ejournal.cpp
new file mode 100644 (file)
index 0000000..b360bba
--- /dev/null
@@ -0,0 +1,201 @@
+#include "ejournal.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "acfg.h"
+
+/*
+ *  Constructs a eJournal as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+eJournal::eJournal(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+eJournal::~eJournal()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void eJournal::languageChange()
+{
+    retranslateUi(this);
+}
+
+void eJournal::init()
+{
+/*
+       int oc, i, f, idx=0;
+       char *id, *name, *ot;
+       cfg_objptr o;
+       char otype[100];
+       QString named;
+
+       otypes.clear();
+       eType->clear();
+       otypes.append("D");
+       eType->insertItem(trUtf8("Дата"), idx++);
+       otypes.append("T");
+       eType->insertItem(trUtf8("Время"), idx++);
+       otypes.append("N %d %d");
+       eType->insertItem(trUtf8("Число"), idx++);
+       otypes.append("C %d");
+       eType->insertItem(trUtf8("Строка"), idx++);
+
+       oc=cfgobj_count(NULL, NULL);
+       for (i=1;i<=oc;i++) {
+               id=cfgobj_idn(NULL, NULL, i, &o);
+               ot=(char *)o->name;
+               name=cfgobj_attr(o, "name");
+               named="";
+               f=0;
+               if (strcmp((char *)ot, aot_doc)==0) {
+                       named=trUtf8("Документ.");
+                       f=1;
+               }
+               if (strcmp((char *)ot, aot_cat)==0) {
+                       named=trUtf8("Справочник.");
+                       f=1;
+               }
+               if (f) {
+                       named=named+trUtf8(name);
+                       sprintf(otype, "O %s", id);
+                       otypes.append(otype);
+                       eType->insertItem(named, idx++);
+               }
+       }
+*/
+}
+
+
+
+/*void eJournal::setData( aCatalogue *f, QWidget *mw )
+{
+       aCfg *md = 0;
+       if ( !f ) return;
+//     printf("name = '%s'\n", (const char *) mw->name() );
+       if (mw->name() == QString("ananas-designer_mainwindow") ) {
+//             printf("running under ananas designer\n");
+               CfgForm *cf = ( ( MainForm *) mw )->cfgForm();
+               if ( cf ) {
+                       md = &cf->cfg;
+//                     QString ts = f->getFieldType();
+//                     char t=' ';
+                       int w=0, d=0, idx=0;
+                       unsigned int i;
+                       long oid , id;
+
+                       id = f->getId();
+
+                       otypes.clear();
+                       eType->clear();
+
+                       QStringList tlist = md->types( md_catalogue );
+                       otypes.clear();
+                       eType->clear();
+                       for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
+                               otypes.append( (*it).section( "\t", 0, 0 ) );
+                               eType->insertItem( (*it).section("\t", 1, 1 ), idx++ );
+                       }
+                       for ( i = 0 ; i < otypes.count(); i++ ) {
+                               oid = 0;
+                               if( otypes[i][0] == 'O' ) {
+                                       sscanf( (const char *)otypes[ i ], "O %d", &oid );
+                                       if ( oid == id ) {
+                                               eType->setCurrentItem( i );
+                                               break;
+                                       }
+                               }
+                       }
+               } else reject();
+       }
+
+}
+*/
+
+void
+eJournal::setData( QWidget *o, aCfg *md )
+{
+//    const QObject *o = sender();
+    if ( o ) {
+       if ( o->className() != QString("wJournal") || !md ) {
+           reject();
+           return;
+       }
+    }
+    else {
+       reject();
+       return;
+    }
+    wJournal *f = ( wJournal*) o;
+    int w=0, d=0, idx=0;
+    unsigned int i;
+    long oid , id;
+
+    id = f->getId();
+
+    QStringList tlist = md->types( md_journal );
+    otypes.clear();
+    eType->clear();
+    for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
+       otypes.append( (*it).section( "\t", 0, 0 ) );
+       eType->insertItem( (*it).section("\t", 1, 1 ), idx++ );
+    }
+    for ( i = 0 ; i < otypes.count(); i++ ) {
+       oid = 0;
+       if( otypes[i][0] == 'O' ) {
+           sscanf( (const char *)otypes[ i ], "O %d", &oid );
+           if ( oid == id ) {
+               eType->setCurrentItem( i );
+               break;
+           }
+       }
+    }
+}
+
+
+void eJournal::getData( QWidget * o )
+{
+
+/*     int idx=eType->currentItem();
+       long oid = 0;
+
+       if (f) {
+               if( otypes[idx][0] == 'O' ) {
+                       sscanf( (const char *)otypes[ idx ], "O %d", &oid );
+                       f->setId( oid );
+               }
+       }
+*/
+//    const QObject *o = sender();
+    if ( !o ) return;
+    if ( o->className() != QString("wJournal") ) return;
+    wJournal *f = ( wJournal*) o;
+
+    int idx=eType->currentItem();
+    long oid = 0;
+
+    if (f) {
+       if( otypes[idx][0] == 'O' ) {
+           sscanf( (const char *)otypes[ idx ], "O %d", &oid );
+           f->setId( oid );
+       }
+    }
+
+}
diff --git a/src/plugins/journal/ejournal.h b/src/plugins/journal/ejournal.h
new file mode 100644 (file)
index 0000000..fdeeccb
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef EJOURNAL_H
+#define EJOURNAL_H
+
+#include "ui_ejournal.h"
+
+
+class eJournal : public QDialog, public Ui::eJournal
+{
+    Q_OBJECT
+
+public:
+    eJournal(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~eJournal();
+
+    QStringList otypes;
+
+public slots:
+    virtual void init();
+    virtual void setData( QWidget * o, aCfg * md );
+    virtual void getData( QWidget * o );
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // EJOURNAL_H
diff --git a/src/plugins/journal/ejournal.ui b/src/plugins/journal/ejournal.ui
new file mode 100644 (file)
index 0000000..d96107a
--- /dev/null
@@ -0,0 +1,116 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>eJournal</class>\r
+  <widget class="QDialog" name="eJournal" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>348</width>\r
+        <height>109</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Journal</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item rowspan="1" row="3" column="0" colspan="4" >\r
+        <layout class="QHBoxLayout" />\r
+      </item>\r
+      <item rowspan="1" row="1" column="1" colspan="3" >\r
+        <widget class="QComboBox" name="eType" />\r
+      </item>\r
+      <item row="1" column="0" >\r
+        <widget class="QLabel" name="textLabel2" >\r
+          <property name="maximumSize" >\r
+            <size>\r
+              <width>100</width>\r
+              <height>32767</height>\r
+            </size>\r
+          </property>\r
+          <property name="text" >\r
+            <string>Type</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="4" column="0" >\r
+        <spacer name="spacer4" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>31</width>\r
+              <height>16</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Vertical</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+      <item rowspan="1" row="5" column="0" colspan="2" >\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QPushButton" name="bOK" >\r
+              <property name="text" >\r
+                <string>OK</string>\r
+              </property>\r
+              <property name="default" >\r
+                <bool>true</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="bCancel" >\r
+              <property name="text" >\r
+                <string>Cancel</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item rowspan="1" row="5" column="2" colspan="2" >\r
+        <spacer name="spacer2" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>91</width>\r
+              <height>31</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Horizontal</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="6" margin="11" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >ananas.h</include>\r
+    <include location="local" >wjournal.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>bOK</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eJournal</receiver>\r
+      <slot>accept()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eJournal</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/journal/journal.pri b/src/plugins/journal/journal.pri
new file mode 100644 (file)
index 0000000..61ed3fb
--- /dev/null
@@ -0,0 +1,15 @@
+HEADERS += \
+    journal/ejournal.h \
+    journal/wjournal.h \
+    journal/wjournal_plugin.h \
+    journal/wjournal_taskmenu.h
+
+SOURCES += \
+    journal/ejournal.cpp \
+    journal/wjournal.cpp \
+    journal/wjournal_plugin.cpp \
+    journal/wjournal_taskmenu.cpp
+        
+FORMS += \
+    journal/ejournal.ui 
+    
\ No newline at end of file
diff --git a/src/plugins/journal/wjournal.cpp b/src/plugins/journal/wjournal.cpp
new file mode 100644 (file)
index 0000000..5d51361
--- /dev/null
@@ -0,0 +1,351 @@
+/****************************************************************************
+** $Id: wjournal.cpp,v 1.2 2008/11/08 20:16:36 leader Exp $
+**
+** Code file of the journal plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qobject.h>
+#include <q3sqlcursor.h>
+#include <q3sqlpropertymap.h>
+#include <qmessagebox.h>
+#include <qaction.h>
+#include <q3datetimeedit.h>
+//Added by qt3to4:
+#include <q3mimefactory.h>
+#include "adatabase.h"
+#include "wjournal.h"
+#include "ejournal.h"
+#include "eselectdoctype.h"
+#include "adocjournal.h"
+#include "eselectdoctype.h"
+#include "wdbtable.h"
+#include "alog.h"
+
+
+
+wJournal::wJournal( QWidget *parent, Qt::WFlags fl )
+:aWidget( parent, "wJournal", fl )
+{
+       dSelectType = new eSelectDocType();
+       setInited( false );
+}
+
+
+wJournal::~wJournal()
+{
+       delete dSelectType;
+       dSelectType = 0;
+}
+
+
+
+void
+wJournal::initObject( aDatabase *adb )
+{
+       eSelectDocType *d = ( eSelectDocType *)dSelectType;
+       aWidget::initObject( adb );
+       d->setJournal( &adb->cfg, getId() );
+
+
+       if(((aDocJournal*)dbobj)->type()==0 && toolbar)
+       {
+               date_from = new Q3DateEdit(toolbar);
+               date_to = new Q3DateEdit(toolbar);
+               QDate current = QDate::currentDate();
+               date_to->setMinimumWidth(100);
+               date_from->setMinimumWidth(100);
+               date_to->setDate(current);
+               date_from->setDate(current.addMonths(-1));
+               connect(date_from, SIGNAL(valueChanged(const QDate &)), this, SLOT(setFilterByDate()));
+               connect(date_to, SIGNAL(valueChanged(const QDate &)), this, SLOT(setFilterByDate()));
+       }
+       else
+       {
+               date_from = date_to = 0;
+       }
+       setFilterByDate();
+       QObject *obj;
+       uint i = 0;
+       QObjectList lb = this->queryList( "wDBTable", 0, false, false );
+       QListIterator<QObject*> itb( lb ); // iterate over the buttons
+       i = 0;
+       while ( itb.hasNext() )
+       {
+               obj = itb.next();
+               //printf("wDBTable #%u found\n",++i);
+               aLog::print(aLog::Info, tr("wDBTable #%1 found ").arg(++i));
+               connect( (wDBTable *)obj, SIGNAL(selectRecord( qulonglong )),
+                        this, SLOT(select( qulonglong )) );
+               connect( (wDBTable *)obj, SIGNAL( insertRequest()),
+                        this, SLOT(insert()) );
+               connect( (wDBTable *)obj, SIGNAL(updateRequest()),
+                        this, SLOT(update()) );
+               connect( (wDBTable *)obj, SIGNAL(viewRequest()),
+                        this, SLOT(view()) );
+               connect( (wDBTable *)obj, SIGNAL(deleteRequest()),
+                        this, SLOT(markDelete()) );
+//<<<<<<< wjournal.cpp
+//             ((QWidget *)obj)->setFocus(); // set focus to wDBTable
+
+//=======
+               //((QWidget *)obj)->setFocus(); // set focus to wDBTable
+
+//>>>>>>> 1.15.2.6
+       }
+       //--delete lb; // delete the list, not the objects
+       //--lb=0;
+
+}
+
+
+bool
+wJournal::checkStructure()
+{
+
+       return false;
+}
+
+
+/*!
+ * Create toolbar for Journal.
+ */
+Q3ToolBar*
+wJournal::createToolBar( Q3MainWindow * owner )
+{
+       QAction *a,*b,*c,*d, *e;
+       toolbar = new Q3ToolBar( owner, "JournalTools" );
+       a = new QAction(
+       rcIcon("doc_new.png"),
+       tr("New"),
+       QKeySequence(QString("Insert")),
+       toolbar,
+       tr("New document")
+       );
+       a->setToolTip(tr("New document <Ins>"));
+       a->addTo( toolbar );
+       connect( a, SIGNAL( activated() ), this, SLOT( insert() ) );
+       b = new QAction(
+       rcIcon("doc_edit.png"),
+       tr("Edit"),
+       QKeySequence(Qt::Key_Return),
+       toolbar,
+       tr("Edit document")
+       );
+       b->setToolTip(tr("Edit document <Enter>"));
+       b->addTo( toolbar );
+       connect( b, SIGNAL( activated() ), this, SLOT( update() ) );
+       c = new QAction(
+       rcIcon("doc_view.png"),
+       tr("View"),
+       QKeySequence(Qt::SHIFT + Qt::Key_Return),
+       toolbar,
+       tr("View document")
+       );
+       c->setToolTip(tr("View document <Shift+Enter>"));
+       c->addTo( toolbar );
+       connect( c, SIGNAL( activated() ), this, SLOT( view() ) );
+       d = new QAction(
+       rcIcon("doc_delete.png"),
+       tr("Delete"),
+       QKeySequence(QString("Del")),
+       toolbar,
+       tr("Delete document")
+       );
+       d->setToolTip(tr("Delete document <Delete>"));
+       d->addTo( toolbar );
+       connect( d, SIGNAL( activated() ), this, SLOT( markDelete() ) );
+
+       e = new QAction(
+       rcIcon("doc_copy.png"),
+       tr("Copy"),
+       QKeySequence(Qt::CTRL+Qt::Key_D),
+       toolbar,
+       tr("Copy document")
+       );
+       e->setToolTip(tr("Duplicate document <Ctrl+D>"));
+       e->addTo( toolbar );
+       connect( e, SIGNAL( activated() ), this, SLOT( copy() ) );
+
+       return toolbar;
+}
+
+
+
+QDialog*
+wJournal::createEditor( QWidget *parent )
+{
+    return new eJournal( parent );
+}
+
+
+int
+wJournal::select( qulonglong id )
+{
+       if ( !dbobj ) return err_abstractobj;
+       docUid = dbobj->docId();
+//     docUid = 0;
+       docId = db->uidType(docUid);
+//     printf("selected record uid = %llu, doc uid = %llu doc md id %i\n", id, docUid, docId );
+    return 0;
+}
+
+
+
+qulonglong
+wJournal::insert()
+{
+       aForm * f = 0;
+       int md_id = 0;
+       eSelectDocType *d = ( eSelectDocType *)dSelectType;
+
+       if ( dSelectType->exec() == QDialog::Accepted ) {
+               md_id = d->docId;
+               if (  md_id > 0 ){
+                       if ( engine ) {
+                               f = engine->openForm( md_id, 0, md_action_new, 0, 0, (aWidget*)this );
+                               if ( f ) {
+//                                     connect(f, SIGNAL(selected( Q_ULLONG )), this, SLOT(on_selected( Q_ULLONG )));
+//                                     f->closeAfterSelect = true;
+                               }
+                       } else printf("engine = NULL\n");
+
+               }
+       }
+    return 0;
+}
+
+
+int
+wJournal::update()
+{
+       if ( !dbobj ) return err_abstractobj;
+       aDocument *doc = ((aDocJournal*)dbobj)->CurrentDocument();
+       //doc->select(docUid);
+       int res=0;
+       if(doc->IsConducted())
+       {
+               res = QMessageBox::question(this,
+                                               tr("Can not edit document"),
+                                               tr("To edit document you have to unconduct it. Or you can view it. Unconduct?"),
+                                               tr("&Unconduct"), tr("&View"),
+                                               QString::null, 0, 1 );
+       }
+       else
+       {
+               delete doc;
+               engine->openForm( docId, 0, md_action_edit, 0, docUid,  (aWidget*)this );
+               return 0;
+       }
+       if(res==0)
+       {
+               doc->UnConduct();
+               engine->openForm( docId, 0, md_action_edit, 0, docUid,  (aWidget*)this );
+       }
+       else
+       {
+               view();
+       }
+       delete doc;
+       return 0;
+}
+
+int
+wJournal::copy()
+{
+       aDocument *doc = ((aDocJournal*)dbobj)->CurrentDocument();
+       if(doc)
+       {
+               int res = doc->Copy();
+               Refresh();
+               return res;
+       }
+       return err_copyerror;
+}
+int
+wJournal::view()
+{
+//CHECK_POINT
+       engine->openForm( docId, 0, md_action_view, 0, docUid,  (aWidget*)this );
+    return 0;
+}
+
+
+
+int
+wJournal::markDelete()
+{
+       if ( !dbobj ) return err_abstractobj;
+       int res = QMessageBox::question(this,
+                                       tr("Confirm"),
+                                       tr("Do you really want to delete document?"),
+                                       tr("&Yes"), tr("&No"),
+                                       QString::null, 0, 1 );
+       if(res) return res;
+       aDocument *doc = ((aDocJournal*)dbobj)->CurrentDocument();
+       if(doc->IsConducted()) doc->UnConduct();
+       res = doc->Delete();
+       //invalidate selection
+       docId = docUid = 0;
+       Refresh();
+       delete doc;
+       doc = 0;
+       return res;
+}
+
+
+QString
+wJournal::displayString()
+{
+       return "***";
+}
+
+
+/*!
+ * Create aDocJournal database object.
+ */
+aObject *
+wJournal::createDBObject(  aCfgItem obj, aDatabase *adb )
+{
+       return new aDocJournal( obj, adb );
+}
+
+void
+wJournal::setFilterByDate()
+{
+       if(date_from && date_to)
+       {
+               QObject *obj;
+               QObjectList lb = this->queryList( "wDBTable" );
+               QListIterator<QObject*> itb( lb ); // iterate over the buttons
+               while ( itb.hasNext() )
+               {
+                       obj = itb.next();
+                       ((wDBTable *)obj)->setFilter(QString("ddate>='%1T00:00:00' AND ddate<='%2T23:59:59'").arg(date_from->date().toString(Qt::ISODate)).arg(date_to->date().toString(Qt::ISODate)));
+               }
+               //--delete lb; // delete the list, not the objects
+       }
+       Refresh();
+}
diff --git a/src/plugins/journal/wjournal.h b/src/plugins/journal/wjournal.h
new file mode 100644 (file)
index 0000000..6c26952
--- /dev/null
@@ -0,0 +1,92 @@
+/****************************************************************************
+** $Id: wjournal.h,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Header file of the catlogue plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef WJOURNAL_H
+#define WJOURNAL_H
+#include <qwidgetplugin.h>
+#include <q3datetimeedit.h>
+#include "awidget.h"
+
+class QWidget;
+/*!
+ *\en
+ *      Visual object for work with Journals of Documents.
+ *\_en
+ *\ru
+ *     \brief Визуальный объект - контейнер для работы с Журналами документов.
+ *     Наследует aWidget.
+ *
+ *     При создании диалогов - экранных форм журналов все элементы диалога
+ *     (в том числе wDBField, wDBTable) располагаются в этом контейнере.
+ *     В свойстве aObject *dbobj, унаследованном от aWidget, этого класса хранится объект доступа к данным
+ *     журнала в sql таблице базы данных, используемый элементами диалога для выборки и записи данных в базу данных.
+ *     Смотрите метод wJournal::dataObject().
+ *     В свойстве aCfgItem obj, унаследованном от aWidget, этого класса хранится элемент конфигурации (метаданные),
+ *     описывающий структуру объекта данных (как правило таблицу).
+ *     Смотрите метод wJournal::getMDObject().
+ *\_ru
+ */
+
+class QT_WIDGET_PLUGIN_EXPORT wJournal : public aWidget
+{
+       Q_OBJECT
+public:
+       wJournal( QWidget *parent = 0, Qt::WFlags fl = 0 );
+       virtual ~wJournal();
+       bool                    checkStructure();
+       virtual void            initObject( aDatabase *adb );
+       virtual Q3ToolBar*      createToolBar( Q3MainWindow *parent );
+       virtual QDialog*        createEditor( QWidget *parent );
+       virtual QString         displayString();
+       virtual bool            isContainer() { return true; };
+       virtual aObject*        createDBObject(  aCfgItem obj, aDatabase *adb );
+//     virtual ERR_Code Select( Q_ULLONG id );
+
+
+public slots:
+       int             select( qulonglong id );
+       qulonglong      insert();
+       int             update();
+       int             view();
+       int             markDelete();
+       int             copy();
+
+protected slots:
+       void            setFilterByDate();
+
+private:
+       QDialog *dSelectType;
+       Q3ToolBar *toolbar;
+       Q3DateEdit *date_from, *date_to;
+       qulonglong docUid;
+       int docId;
+};
+
+
+#endif // WJOURNAL_H
diff --git a/src/plugins/journal/wjournal_plugin.cpp b/src/plugins/journal/wjournal_plugin.cpp
new file mode 100644 (file)
index 0000000..e965f72
--- /dev/null
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "wjournal_plugin.h"
+
+#include <QtPlugin>
+#include <QDesignerFormEditorInterface>
+#include <QExtensionManager>
+
+#include "wjournal_taskmenu.h"
+#include "wjournal.h"
+
+
+wJournalPlugin::wJournalPlugin(QObject *parent)
+    : QObject(parent), m_initialized(false)
+{
+    m_initialized = false;
+}
+
+bool wJournalPlugin::isContainer() const
+{
+    return true;
+}
+
+bool wJournalPlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void wJournalPlugin::initialize(QDesignerFormEditorInterface *core)
+{
+    if (m_initialized)
+        return;
+    Q_UNUSED(core);
+
+    QExtensionManager *manager = core->extensionManager();
+    Q_ASSERT(manager != 0);
+    manager->registerExtensions(new wJournalTaskMenuFactory(manager),
+                                Q_TYPEID(QDesignerTaskMenuExtension));
+
+    m_initialized = true;
+}
+
+QWidget *wJournalPlugin::createWidget(QWidget *parent)
+{
+    wJournal *w = new wJournal(parent, 0);
+    return w;
+}
+
+QString wJournalPlugin::name() const
+{
+    return QLatin1String("wJournal");
+}
+
+QString wJournalPlugin::group() const
+{
+    return QLatin1String("Ananas");
+}
+
+QString wJournalPlugin::toolTip() const
+{
+    return QString();
+}
+
+QString wJournalPlugin::whatsThis() const
+{
+    return QString();
+}
+
+QString wJournalPlugin::includeFile() const
+{
+    return QLatin1String("wjournal.h");
+}
+
+QIcon wJournalPlugin::icon() const
+{
+    //return QIcon();
+    return QIcon(":/images/wjournal.png");
+}
+
+QString wJournalPlugin::domXml() const
+{
+    return "<widget class=\"wJournal\" name=\"wJournal_1\">\n</widget>\n";
+}
diff --git a/src/plugins/journal/wjournal_plugin.h b/src/plugins/journal/wjournal_plugin.h
new file mode 100644 (file)
index 0000000..38adaed
--- /dev/null
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef WJOURNAL_PLUGIN_H
+#define WJOURNAL_PLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+#include "qwidgetplugin.h"
+
+
+class QT_WIDGET_PLUGIN_EXPORT wJournalPlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+    wJournalPlugin(QObject *parent=0);
+
+    bool isContainer() const;
+    bool isInitialized() const;
+    void initialize(QDesignerFormEditorInterface *core);
+    QWidget *createWidget(QWidget *parent);
+
+    QString name() const;
+    QString group() const;
+    QString toolTip() const;
+    QString whatsThis() const;
+    QString includeFile() const;
+    QIcon icon() const;
+    QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+#endif // WJOURNAL_PLUGIN_H
diff --git a/src/plugins/journal/wjournal_taskmenu.cpp b/src/plugins/journal/wjournal_taskmenu.cpp
new file mode 100644 (file)
index 0000000..e30713f
--- /dev/null
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include <QDesignerFormEditorInterface>
+
+#include <QAction>
+
+#include "wjournal_taskmenu.h"
+#include "wjournal.h"
+#include "ejournal.h"
+
+
+wJournalTaskMenu::wJournalTaskMenu(wJournal *widget, QObject *parent)
+    : QObject(parent)
+{
+    m_widget = widget;
+
+    m_editAction = new QAction(tr("Edit ..."), this);
+    connect(m_editAction, SIGNAL(triggered()), this, SLOT(edit()));
+}
+
+void wJournalTaskMenu::edit()
+{
+    /*eJournal e;
+
+       e.setData(m_widget);
+       if (e.exec() == QDialog::Accepted)
+       {
+               e.getData(m_widget);
+       }*/
+       m_widget->widgetEditor();
+}
+
+QAction *wJournalTaskMenu::preferredEditAction() const
+{
+    return m_editAction;
+}
+
+QList<QAction *> wJournalTaskMenu::taskActions() const
+{
+    QList<QAction *> list;
+    list.append(m_editAction);
+    return list;
+}
+
+wJournalTaskMenuFactory::wJournalTaskMenuFactory(QExtensionManager *parent)
+    : QExtensionFactory(parent)
+{
+}
+
+QObject *wJournalTaskMenuFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
+{
+    if (iid != Q_TYPEID(QDesignerTaskMenuExtension))
+        return 0;
+
+    if (wJournal *ob = qobject_cast<wJournal*>(object))
+        return new wJournalTaskMenu(ob, parent);
+
+    return 0;
+}
diff --git a/src/plugins/journal/wjournal_taskmenu.h b/src/plugins/journal/wjournal_taskmenu.h
new file mode 100644 (file)
index 0000000..5d28257
--- /dev/null
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef WJOURNAL_TASKMENU_H
+#define WJOURNAL_TASKMENU_H
+
+#include <QDesignerTaskMenuExtension>
+#include <QExtensionFactory>
+
+
+class QExtensionManager;
+class QAction;
+class wJournal;
+
+class wJournalTaskMenu: public QObject, public QDesignerTaskMenuExtension
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerTaskMenuExtension)
+public:
+    wJournalTaskMenu(wJournal *widget, QObject *parent);
+
+    QAction *preferredEditAction() const;
+    QList<QAction *> taskActions() const;
+
+private slots:
+    void edit();
+
+private:
+    QAction *m_editAction;
+    wJournal *m_widget;
+};
+
+class wJournalTaskMenuFactory: public QExtensionFactory
+{
+    Q_OBJECT
+public:
+    wJournalTaskMenuFactory(QExtensionManager *parent = 0);
+
+protected:
+    QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
+};
+
+#endif // WJOURNAL_TASKMENU_H
diff --git a/src/plugins/plugins.pri b/src/plugins/plugins.pri
new file mode 100644 (file)
index 0000000..086eaf5
--- /dev/null
@@ -0,0 +1,12 @@
+INCLUDEPATH += \ 
+       ../plugins/actionbutton \
+       ../plugins/catalogue \
+       ../plugins/combobox \
+       ../plugins/dbfield \
+       ../plugins/dbtable \
+       ../plugins/document \
+       ../plugins/field \
+       ../plugins/grouptree \
+       ../plugins/journal \
+       ../plugins/report \
+       ../plugins/table
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
new file mode 100644 (file)
index 0000000..16b9581
--- /dev/null
@@ -0,0 +1,84 @@
+#!define TARGET first for correct temporray paths definitions
+TARGET = ananasplugin4
+
+include( plugins.pri )
+include( ../lib/lib.pri )
+include ( ../ananas.pri )
+load(qsa)
+
+TEMPLATE = lib
+shared:CONFIG += dll plugin
+
+DESTDIR = ../../lib/designer
+DLLDESTDIR = ../../bin
+
+INCLUDEPATH += ../plugins ../lib 
+LIBS += -L../../lib -lananas4 
+
+shared {
+    win32:DEFINES+= QT_PLUGIN # ANANAS_DLL
+} else {
+    win32:DEFINES   += ANANAS_NO_DLL
+}
+
+unix {
+    LIBS += -L/usr/X11R6/lib/
+}
+
+HEADERS = \
+    aform.h \
+    atoolbar.h \
+    awidgets_plugin.h \
+    eaddobj.h \
+    engine.h \
+    qwidgetplugin.h 
+
+SOURCES = \
+    aform.cpp \
+    atoolbar.cpp \
+    awidgets_plugin.cpp \
+    engine.cpp \
+    eaddobj.cpp 
+        
+FORMS = \
+    eaddobj.ui 
+
+RESOURCES += \
+    plugins.qrc
+    
+TRANSLATIONS = \
+    ../../translations/ananas-plugins-en.ts \
+    ../../translations/ananas-plugins-ru.ts 
+
+#SLASH = /
+unix {
+    lplugin.path = $(QTDIR)/plugins/designer
+    lplugin.files = libananasplugin4.so
+    lplugin.extra = cp -f libananasplugin4.so $(INSTALL_ROOT)$(LIBDIR) || true
+    lpluginheader.path = $(INCLUDEDIR)
+    lpluginheader.files = $$HEADERS
+}  
+
+win32 {
+    target.path = $(QTDIR)\plugins\designer
+    lplugin.path = $(QTDIR)\plugins\designer
+    lplugin.files = ananasplugin4.*
+    lplugin.extra = copy ananasplugin4.* $(QTDIR)\lib
+}  
+
+#INSTALLS += lplugin 
+unix{
+#    INSTALLS += lpluginheader
+}
+
+include ( actionbutton/actionbutton.pri )
+include ( catalogue/catalogue.pri )
+include ( combobox/combobox.pri )
+include ( dbfield/dbfield.pri )
+include ( dbtable/dbtable.pri )
+include ( document/document.pri )
+include ( field/field.pri )
+include ( grouptree/grouptree.pri )
+include ( journal/journal.pri )
+include ( report/report.pri )
+include ( table/table.pri )
diff --git a/src/plugins/plugins.qrc b/src/plugins/plugins.qrc
new file mode 100644 (file)
index 0000000..3d31bd5
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE RCC><RCC version="1.1">\r
+    <qresource prefix="/">\r
+        <file>images/acombobox.png</file>\r
+        <file>images/doc_copy.png</file>\r
+        <file>images/doc_delete.png</file>\r
+        <file>images/doc_edit.png</file>\r
+        <file>images/doc_new.png</file>\r
+        <file>images/doc_view.png</file>\r
+        <file>images/wactionbutton.png</file>\r
+        <file>images/wcatalogue.png</file>\r
+        <file>images/wdbfield.png</file>\r
+        <file>images/wdbtable.png</file>\r
+        <file>images/wdocument.png</file>\r
+        <file>images/wfield.png</file>\r
+        <file>images/wgrouptree.png</file>\r
+        <file>images/wjournal.png</file>\r
+        <file>images/wreport.png</file>\r
+        <file>images/wtable.png</file>\r
+    </qresource>\r
+</RCC>\r
diff --git a/src/plugins/qwidgetplugin.h b/src/plugins/qwidgetplugin.h
new file mode 100644 (file)
index 0000000..32204a3
--- /dev/null
@@ -0,0 +1,54 @@
+/****************************************************************************
+** $Id: qwidgetplugin.h,v 1.2 2008/11/27 20:20:55 leader Exp $
+**
+** Definition of QWidgetPlugin class
+**
+** Created : 010920
+**
+** Copyright (C) 2001-2005 Trolltech AS.  All rights reserved.
+**
+** This file is part of the widgets module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef QWIDGETPLUGIN_H
+#define QWIDGETPLUGIN_H
+
+#ifndef QT_NO_WIDGETPLUGIN
+
+#ifdef Q_WS_WIN
+#ifdef QT_PLUGIN
+#define QT_WIDGET_PLUGIN_EXPORT __declspec(dllexport)
+#else
+#define QT_WIDGET_PLUGIN_EXPORT __declspec(dllimport)
+#endif
+#else
+#define QT_WIDGET_PLUGIN_EXPORT
+#endif
+
+#endif // QT_NO_WIDGETPLUGIN
+#endif // QWIDGETPLUGIN_H
diff --git a/src/plugins/report/ereport.cpp b/src/plugins/report/ereport.cpp
new file mode 100644 (file)
index 0000000..a400818
--- /dev/null
@@ -0,0 +1,201 @@
+#include "ereport.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "acfg.h"
+
+/*
+ *  Constructs a eReport as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+eReport::eReport(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+eReport::~eReport()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void eReport::languageChange()
+{
+    retranslateUi(this);
+}
+
+void eReport::init()
+{
+/*
+       int oc, i, f, idx=0;
+       char *id, *name, *ot;
+       cfg_objptr o;
+       char otype[100];
+       QString named;
+
+       otypes.clear();
+       eType->clear();
+       otypes.append("D");
+       eType->insertItem(trUtf8("Дата"), idx++);
+       otypes.append("T");
+       eType->insertItem(trUtf8("Время"), idx++);
+       otypes.append("N %d %d");
+       eType->insertItem(trUtf8("Число"), idx++);
+       otypes.append("C %d");
+       eType->insertItem(trUtf8("Строка"), idx++);
+
+       oc=cfgobj_count(NULL, NULL);
+       for (i=1;i<=oc;i++) {
+               id=cfgobj_idn(NULL, NULL, i, &o);
+               ot=(char *)o->name;
+               name=cfgobj_attr(o, "name");
+               named="";
+               f=0;
+               if (strcmp((char *)ot, aot_doc)==0) {
+                       named=trUtf8("Документ.");
+                       f=1;
+               }
+               if (strcmp((char *)ot, aot_cat)==0) {
+                       named=trUtf8("Справочник.");
+                       f=1;
+               }
+               if (f) {
+                       named=named+trUtf8(name);
+                       sprintf(otype, "O %s", id);
+                       otypes.append(otype);
+                       eType->insertItem(named, idx++);
+               }
+       }
+*/
+}
+
+
+
+/*void eReport::setData( aCatalogue *f, QWidget *mw )
+{
+       aCfg *md = 0;
+       if ( !f ) return;
+//     printf("name = '%s'\n", (const char *) mw->name() );
+       if (mw->name() == QString("ananas-designer_mainwindow") ) {
+//             printf("running under ananas designer\n");
+               CfgForm *cf = ( ( MainForm *) mw )->cfgForm();
+               if ( cf ) {
+                       md = &cf->cfg;
+//                     QString ts = f->getFieldType();
+//                     char t=' ';
+                       int w=0, d=0, idx=0;
+                       unsigned int i;
+                       long oid , id;
+
+                       id = f->getId();
+
+                       otypes.clear();
+                       eType->clear();
+
+                       QStringList tlist = md->types( md_catalogue );
+                       otypes.clear();
+                       eType->clear();
+                       for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
+                               otypes.append( (*it).section( "\t", 0, 0 ) );
+                               eType->insertItem( (*it).section("\t", 1, 1 ), idx++ );
+                       }
+                       for ( i = 0 ; i < otypes.count(); i++ ) {
+                               oid = 0;
+                               if( otypes[i][0] == 'O' ) {
+                                       sscanf( (const char *)otypes[ i ], "O %d", &oid );
+                                       if ( oid == id ) {
+                                               eType->setCurrentItem( i );
+                                               break;
+                                       }
+                               }
+                       }
+               } else reject();
+       }
+
+}
+*/
+
+void
+eReport::setData( QWidget *o, aCfg *md )
+{
+//    const QObject *o = sender();
+    if ( o ) {
+       if ( o->className() != QString("wReport") || !md ) {
+           reject();
+           return;
+       }
+    }
+    else {
+       reject();
+       return;
+    }
+    wReport *f = ( wReport*) o;
+    int w=0, d=0, idx=0;
+    unsigned int i;
+    long oid , id;
+
+    id = f->getId();
+
+    QStringList tlist = md->types( md_journal );
+    otypes.clear();
+    eType->clear();
+    for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
+       otypes.append( (*it).section( "\t", 0, 0 ) );
+       eType->insertItem( (*it).section("\t", 1, 1 ), idx++ );
+    }
+    for ( i = 0 ; i < otypes.count(); i++ ) {
+       oid = 0;
+       if( otypes[i][0] == 'O' ) {
+           sscanf( (const char *)otypes[ i ], "O %d", &oid );
+           if ( oid == id ) {
+               eType->setCurrentItem( i );
+               break;
+           }
+       }
+    }
+}
+
+
+void eReport::getData( QWidget * o )
+{
+
+/*     int idx=eType->currentItem();
+       long oid = 0;
+
+       if (f) {
+               if( otypes[idx][0] == 'O' ) {
+                       sscanf( (const char *)otypes[ idx ], "O %d", &oid );
+                       f->setId( oid );
+               }
+       }
+*/
+//    const QObject *o = sender();
+    if ( !o ) return;
+    if ( o->className() != QString("wReport") ) return;
+    wReport *f = ( wReport*) o;
+
+    int idx=eType->currentItem();
+    long oid = 0;
+
+    if (f) {
+       if( otypes[idx][0] == 'O' ) {
+           sscanf( (const char *)otypes[ idx ], "O %d", &oid );
+           f->setId( oid );
+       }
+    }
+
+}
diff --git a/src/plugins/report/ereport.h b/src/plugins/report/ereport.h
new file mode 100644 (file)
index 0000000..00b7505
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef EREPORT_H
+#define EREPORT_H
+
+#include "ui_ereport.h"
+
+
+class eReport : public QDialog, public Ui::eReport
+{
+    Q_OBJECT
+
+public:
+    eReport(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~eReport();
+
+    QStringList otypes;
+
+public slots:
+    virtual void init();
+    virtual void setData( QWidget * o, aCfg * md );
+    virtual void getData( QWidget * o );
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // EREPORT_H
diff --git a/src/plugins/report/ereport.ui b/src/plugins/report/ereport.ui
new file mode 100644 (file)
index 0000000..0983f4b
--- /dev/null
@@ -0,0 +1,116 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>eReport</class>\r
+  <widget class="QDialog" name="eReport" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>348</width>\r
+        <height>106</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Catalogue</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item rowspan="1" row="3" column="0" colspan="4" >\r
+        <layout class="QHBoxLayout" />\r
+      </item>\r
+      <item rowspan="1" row="1" column="1" colspan="3" >\r
+        <widget class="QComboBox" name="eType" />\r
+      </item>\r
+      <item row="1" column="0" >\r
+        <widget class="QLabel" name="textLabel2" >\r
+          <property name="maximumSize" >\r
+            <size>\r
+              <width>100</width>\r
+              <height>32767</height>\r
+            </size>\r
+          </property>\r
+          <property name="text" >\r
+            <string>Type</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="4" column="0" >\r
+        <spacer name="spacer4" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>31</width>\r
+              <height>16</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Vertical</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+      <item rowspan="1" row="5" column="0" colspan="2" >\r
+        <layout class="QHBoxLayout" >\r
+          <item>\r
+            <widget class="QPushButton" name="bOK" >\r
+              <property name="text" >\r
+                <string>OK</string>\r
+              </property>\r
+              <property name="default" >\r
+                <bool>true</bool>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+          <item>\r
+            <widget class="QPushButton" name="bCancel" >\r
+              <property name="text" >\r
+                <string>Cancel</string>\r
+              </property>\r
+            </widget>\r
+          </item>\r
+        </layout>\r
+      </item>\r
+      <item rowspan="1" row="5" column="2" colspan="2" >\r
+        <spacer name="spacer2" >\r
+          <property name="sizeHint" >\r
+            <size>\r
+              <width>91</width>\r
+              <height>31</height>\r
+            </size>\r
+          </property>\r
+          <property name="sizeType" >\r
+            <enum>Expanding</enum>\r
+          </property>\r
+          <property name="orientation" >\r
+            <enum>Horizontal</enum>\r
+          </property>\r
+        </spacer>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="6" margin="11" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >ananas.h</include>\r
+    <include location="local" >wreport.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>bOK</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eReport</receiver>\r
+      <slot>accept()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eReport</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/report/report.pri b/src/plugins/report/report.pri
new file mode 100644 (file)
index 0000000..d64c02d
--- /dev/null
@@ -0,0 +1,14 @@
+HEADERS += \
+    report/ereport.h \
+    report/wreport.h \
+    report/wreport_plugin.h \
+    report/wreport_taskmenu.h 
+
+SOURCES += \
+    report/ereport.cpp \
+    report/wreport.cpp \
+    report/wreport_plugin.cpp \
+    report/wreport_taskmenu.cpp \
+        
+FORMS += \
+    report/ereport.ui 
diff --git a/src/plugins/report/wreport.cpp b/src/plugins/report/wreport.cpp
new file mode 100644 (file)
index 0000000..324677c
--- /dev/null
@@ -0,0 +1,145 @@
+/****************************************************************************
+** $Id: wreport.cpp,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Code file of the report plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qobject.h>
+#include <q3sqlcursor.h>
+#include <q3sqlpropertymap.h>
+//--#include <qfocusdata.h>
+#include <q3toolbar.h>
+#include "adatabase.h"
+#include "wreport.h"
+#include "ereport.h"
+
+//extern aCfg *plugins_aCfg;
+
+
+wReport::wReport( QWidget *parent, Qt::WFlags fl )
+:aWidget( parent, "wReport", fl )
+{
+       setInited( false );
+}
+
+
+wReport::~wReport()
+{
+}
+
+
+
+void
+wReport::initObject( aDatabase *adb )
+{
+       aWidget::initObject( adb );
+//     focusData()->next()->setFocus();
+
+//CHECK_POINT
+}
+
+
+bool
+wReport::checkStructure()
+{
+
+       return false;
+}
+
+
+
+QDialog*
+wReport::createEditor( QWidget *parent )
+{
+    return new eReport( parent );
+}
+
+
+int
+wReport::select( qulonglong id )
+{
+    return 0;
+}
+
+
+qulonglong
+wReport::insert()
+{
+    return 0;
+}
+
+
+int
+wReport::update()
+{
+    return 0;
+}
+
+
+int
+wReport::markDelete()
+{
+    return 0;
+}
+
+ERR_Code
+wReport::New()
+{
+       return err_abstractobj;
+}
+
+
+ERR_Code
+wReport::Update()
+{
+       return err_abstractobj;
+}
+
+
+ERR_Code
+wReport::TurnOn()
+{
+       return err_abstractobj;
+}
+
+
+ERR_Code
+wReport::Select( qulonglong id )
+{
+       return err_abstractobj;
+}
+
+QString
+wReport::displayString()
+{
+    return QString("");
+}
+
+qulonglong
+wReport::uid()
+{
+       return 0;
+}
diff --git a/src/plugins/report/wreport.h b/src/plugins/report/wreport.h
new file mode 100644 (file)
index 0000000..3bfe09f
--- /dev/null
@@ -0,0 +1,68 @@
+/****************************************************************************
+** $Id: wreport.h,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Header file of the report plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef WREPORT_H
+#define WREPORT_H
+#include <qwidgetplugin.h>
+#include "awidget.h"
+
+class QWidget;
+
+class QT_WIDGET_PLUGIN_EXPORT wReport : public aWidget
+{
+       Q_OBJECT
+public:
+       wReport( QWidget *parent = 0, Qt::WFlags fl = 0 );
+       virtual ~wReport();
+       bool checkStructure();
+       virtual void initObject( aDatabase *adb );
+       virtual QDialog* createEditor( QWidget *parent );
+       virtual QString displayString();
+       virtual bool isContainer() { return true; };
+
+       virtual qulonglong      uid();
+       virtual ERR_Code        New();
+       virtual ERR_Code        Update();
+       virtual ERR_Code        TurnOn();
+       virtual ERR_Code        Select( qulonglong id );
+
+public slots:
+//     QVariant value( const QString &name );
+//     void setValue( const QString &name, QVariant &value );
+       int select( qulonglong id );
+       qulonglong insert();
+       int update();
+       int markDelete();
+
+private:
+
+};
+
+
+#endif // WREPORT_H
diff --git a/src/plugins/report/wreport_plugin.cpp b/src/plugins/report/wreport_plugin.cpp
new file mode 100644 (file)
index 0000000..a459eb7
--- /dev/null
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "wreport_plugin.h"
+
+#include <QtPlugin>
+#include <QDesignerFormEditorInterface>
+#include <QExtensionManager>
+
+#include "wreport_taskmenu.h"
+#include "wreport.h"
+
+
+wReportPlugin::wReportPlugin(QObject *parent)
+    : QObject(parent), m_initialized(false)
+{
+    m_initialized = false;
+}
+
+bool wReportPlugin::isContainer() const
+{
+    return true;
+}
+
+bool wReportPlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void wReportPlugin::initialize(QDesignerFormEditorInterface *core)
+{
+    if (m_initialized)
+        return;
+    Q_UNUSED(core);
+
+    QExtensionManager *manager = core->extensionManager();
+    Q_ASSERT(manager != 0);
+    manager->registerExtensions(new wReportTaskMenuFactory(manager),
+                                Q_TYPEID(QDesignerTaskMenuExtension));
+
+    m_initialized = true;
+}
+
+QWidget *wReportPlugin::createWidget(QWidget *parent)
+{
+    wReport *w = new wReport(parent, 0);
+    return w;
+}
+
+QString wReportPlugin::name() const
+{
+    return QLatin1String("wReport");
+}
+
+QString wReportPlugin::group() const
+{
+    return QLatin1String("Ananas");
+}
+
+QString wReportPlugin::toolTip() const
+{
+    return QString();
+}
+
+QString wReportPlugin::whatsThis() const
+{
+    return QString();
+}
+
+QString wReportPlugin::includeFile() const
+{
+    return QLatin1String("wreport.h");
+}
+
+QIcon wReportPlugin::icon() const
+{
+    //return QIcon();
+    return QIcon(":/images/wreport.png");
+}
+
+QString wReportPlugin::domXml() const
+{
+    return "<widget class=\"wReport\" name=\"wReport_1\">\n</widget>\n";
+}
diff --git a/src/plugins/report/wreport_plugin.h b/src/plugins/report/wreport_plugin.h
new file mode 100644 (file)
index 0000000..dec2604
--- /dev/null
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef WREPORT_PLUGIN_H
+#define WREPORT_PLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+#include "qwidgetplugin.h"
+
+
+class QT_WIDGET_PLUGIN_EXPORT wReportPlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+    wReportPlugin(QObject *parent=0);
+
+    bool isContainer() const;
+    bool isInitialized() const;
+    void initialize(QDesignerFormEditorInterface *core);
+    QWidget *createWidget(QWidget *parent);
+
+    QString name() const;
+    QString group() const;
+    QString toolTip() const;
+    QString whatsThis() const;
+    QString includeFile() const;
+    QIcon icon() const;
+    QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+#endif // WREPORT_PLUGIN_H
diff --git a/src/plugins/report/wreport_taskmenu.cpp b/src/plugins/report/wreport_taskmenu.cpp
new file mode 100644 (file)
index 0000000..eda89d4
--- /dev/null
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#include <QDesignerFormEditorInterface>
+
+#include <QAction>
+
+#include "wreport_taskmenu.h"
+#include "wreport.h"
+#include "ereport.h"
+
+
+wReportTaskMenu::wReportTaskMenu(wReport *widget, QObject *parent)
+    : QObject(parent)
+{
+    m_widget = widget;
+
+    m_editAction = new QAction(tr("Edit ..."), this);
+    connect(m_editAction, SIGNAL(triggered()), this, SLOT(edit()));
+}
+
+void wReportTaskMenu::edit()
+{
+    /*eReport e;
+
+       e.setData(m_widget);
+       if (e.exec() == QDialog::Accepted)
+       {
+               e.getData(m_widget);
+       }*/
+       m_widget->widgetEditor();
+}
+
+QAction *wReportTaskMenu::preferredEditAction() const
+{
+    return m_editAction;
+}
+
+QList<QAction *> wReportTaskMenu::taskActions() const
+{
+    QList<QAction *> list;
+    list.append(m_editAction);
+    return list;
+}
+
+wReportTaskMenuFactory::wReportTaskMenuFactory(QExtensionManager *parent)
+    : QExtensionFactory(parent)
+{
+}
+
+QObject *wReportTaskMenuFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
+{
+    if (iid != Q_TYPEID(QDesignerTaskMenuExtension))
+        return 0;
+
+    if (wReport *ob = qobject_cast<wReport*>(object))
+        return new wReportTaskMenu(ob, parent);
+
+    return 0;
+}
diff --git a/src/plugins/report/wreport_taskmenu.h b/src/plugins/report/wreport_taskmenu.h
new file mode 100644 (file)
index 0000000..6f7f61d
--- /dev/null
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru> All rights reserved.
+**
+** This file is part of the widgets plugin of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef WREPORT_TASKMENU_H
+#define WREPORT_TASKMENU_H
+
+#include <QDesignerTaskMenuExtension>
+#include <QExtensionFactory>
+
+
+class QExtensionManager;
+class QAction;
+class wReport;
+
+class wReportTaskMenu: public QObject, public QDesignerTaskMenuExtension
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerTaskMenuExtension)
+public:
+    wReportTaskMenu(wReport *widget, QObject *parent);
+
+    QAction *preferredEditAction() const;
+    QList<QAction *> taskActions() const;
+
+private slots:
+    void edit();
+
+private:
+    QAction *m_editAction;
+    wReport *m_widget;
+};
+
+class wReportTaskMenuFactory: public QExtensionFactory
+{
+    Q_OBJECT
+public:
+    wReportTaskMenuFactory(QExtensionManager *parent = 0);
+
+protected:
+    QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
+};
+
+#endif // WREPORT_TASKMENU_H
diff --git a/src/plugins/table/etable.cpp b/src/plugins/table/etable.cpp
new file mode 100644 (file)
index 0000000..630aef7
--- /dev/null
@@ -0,0 +1,288 @@
+#include "etable.h"
+
+#include <qvariant.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "ananas.h"
+#include "wtable.h"
+
+/*
+ *  Constructs a eTable as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ *
+ *  The dialog will by default be modeless, unless you set 'modal' to
+ *  true to construct a modal dialog.
+ */
+eTable::eTable(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+    : QDialog(parent, name, modal, fl)
+{
+    setupUi(this);
+
+    init();
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+eTable::~eTable()
+{
+    destroy();
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void eTable::languageChange()
+{
+    retranslateUi(this);
+}
+
+void eTable::init()
+{
+/*
+       int oc, i, f, idx=0;
+       char *id, *name, *ot;
+       cfg_objptr o;
+       char otype[100];
+       QString named;
+
+       CHECK_POINT
+       r = tablerow_new(0);
+
+       otypes.clear();
+       eType->clear();
+       otypes.append("U");
+       eType->insertItem(trUtf8("Текстовая метка"), idx++);
+       otypes.append("D");
+       eType->insertItem(trUtf8("Дата"), idx++);
+       otypes.append("T");
+       eType->insertItem(trUtf8("Время"), idx++);
+       otypes.append("N %d %d");
+       eType->insertItem(trUtf8("Число"), idx++);
+       otypes.append("C %d");
+       eType->insertItem(trUtf8("Строка"), idx++);
+
+       oc=cfgobj_count(NULL, NULL);
+       for (i=1;i<=oc;i++) {
+               id=cfgobj_idn(NULL, NULL, i, &o);
+               ot=(char *)o->name;
+               name=cfgobj_attr(o, "name");
+               named="";
+               f=0;
+               if (strcmp((char *)ot, aot_doc)==0) {
+                       named=trUtf8("Документ.");
+                       f=1;
+               }
+               if (strcmp((char *)ot, aot_cat)==0) {
+                       named=trUtf8("Справочник.");
+                       f=1;
+               }
+               if (f) {
+                       named=named+trUtf8(name);
+                       sprintf(otype, "O %s", id);
+                       otypes.append(otype);
+                       eType->insertItem(named, idx++);
+               }
+       }
+       CHECK_POINT
+*/
+}
+
+
+void
+eTable::destroy()
+{
+//     tablerow_free( r );
+}
+
+
+
+void eTable::insertColumn(const char *Header, const char *Name,
+int idxt, int cw, int tw, int td)
+{
+/*
+       tablefield *f;
+       char s[30];
+
+       sprintf(s, "%s %i %i", (const char *)otypes[idxt], tw, td);
+
+       f = tablefield_newsys(Name, s, "");
+       tablefield_setheader(f, Header);
+       f->sizex = cw;
+       f->flen = tw;
+       f->decimals = td;
+       f->ftypeindex = idxt;
+       tablerow_insertcolumn(r, f, -1);
+
+//     blockSignals( true );
+       ListCol->insertItem(trUtf8(Header));
+//     eColHeader->setText( trUtf8(Header));
+//     eColName->setText(trUtf8(Name));
+//     eColWidth->setValue(cw);
+//     eColTWidth->setValue(tw);
+//     eColTDec->setValue(td);
+//     blockSignals( false );
+       if (ListCol->count()) ListCol->setCurrentItem(ListCol->count()-1);
+*/
+}
+
+
+
+void eTable::ColumnAdd()
+{
+//     insertColumn("Новый", "Новый", 0, 0, 0, 0);
+}
+
+
+void eTable::ColumnDel()
+{
+/*
+       int idx;
+       idx = ListCol->currentItem();
+       if (ListCol->count() && idx != -1) {
+               tablerow_removecolumn( r, idx );
+               ListCol->removeItem(idx);
+       }
+*/
+}
+
+
+void eTable::ColumnL()
+{
+
+}
+
+
+void eTable::ColumnR()
+{
+
+}
+
+
+void eTable::ColumnSel(int col)
+{
+/*
+       tablefield *f;
+
+       if (col >= 0 && col < tablerow_columns( r )) {
+               f = tablerow_column( r, col );
+               blockSignals( true );
+               eColHeader->setText(trUtf8(tablefield_header( f )));
+               eColWidth->setValue(f->sizex);
+               eType->setCurrentItem(f->ftypeindex);
+               eColName->setText(trUtf8(f->name));
+               eColTWidth->setValue(f->flen);
+               eColTDec->setValue(f->decimals);
+               blockSignals( false );
+       }
+*/
+}
+
+
+void eTable::ColumnUpd()
+{
+/*
+       tablefield *f;
+
+       if (signalsBlocked()) return;
+       int idx = ListCol->currentItem();
+
+       if ( idx >= 0 && idx < tablerow_columns( r )) {
+               f = tablerow_column( r, idx );
+               if (f->name) free(f->name);
+               f->name=strdup((const char *) eColName->text().utf8());
+               tablefield_setheader( f, (const char *) eColHeader->text().utf8());
+               f->sizex = eColWidth->value();
+               f->flen = eColTWidth->value();
+               f->decimals = eColTDec->value();
+               f->ftypeindex = eType->currentItem();
+
+               printf("set w=%i l=%i d=%i ti=%i\n", f->sizex, f->flen,
+               f->decimals, f->ftypeindex);
+               ListCol->blockSignals( TRUE );
+               ListCol->changeItem(eColHeader->text(), idx);
+               ListCol->blockSignals( FALSE );
+       }
+       CHECK_POINT
+*/
+}
+
+
+void eTable::setData( QWidget *o, aCfg *md )
+{
+
+       QStringList sl;
+       unsigned int i;
+       QString ft,h,n;
+       int w=0, l=0, d=0, idxt=0;
+       char st[20];
+
+       wTable *t = (wTable *) o;
+       //--eTabName->setText(t->getName());
+       eTabName->setText(t->objectName());
+/*
+       if (!t->getDefineCols().isEmpty()) {
+               sl = QStringList::split("\n",t->getDefineCols());
+               for (i = 0; i < sl.count(); i++) {
+                       sscanf((const char *)sl[i].section("|",3,3),"%s %d %d", st, &l, &d);
+                       if (st[0]=='O') ft.sprintf("O %d",l);
+                       else ft=st;
+                       w = sl[i].section("|",2,2).toInt();
+                       h = sl[i].section("|",5,5);
+                       n = sl[i].section("|",4,4);
+                       for (idxt = otypes.count()-1; idxt>0; idxt--) {
+                               if (ft[0]=='O' && otypes[idxt]==ft) break;
+                               else if (otypes[idxt][0]==ft[0]) break;
+                       }
+                       printf("set data %i = %s %s %i %i %i\n", i,
+                       (const char *)h, (const char *)n, idxt, w, l);
+                       insertColumn(h,n,idxt,w,l,d);
+               }
+       }
+*/
+}
+
+
+void eTable::getData( QWidget *o )
+{
+       wTable *t = (wTable *) o;
+/*
+       int i;
+       QStringList sl;
+       QString cdef, ft, s;
+       tablefield *f;
+
+       t->vTable->setNumCols(ListCol->count());
+       for (i=0;i<tablerow_columns( r ); i++) {
+               f = tablerow_column( r, i );
+               ft.sprintf(otypes[f->ftypeindex],f->flen,f->decimals);
+               cdef.sprintf("%i|%i|%i|%s|%s|%s",i,0, f->sizex,
+               (const char *) ft, f->name,
+               tablefield_header( f ));
+               s = s + cdef +"\n";
+       }
+//     t->vTable->setColumnLabels(sl);
+       t->setName(eTabName->text());
+       CHECK_POINT
+       printf("getData defs = %s\n",(const char *)s.utf8());
+       t->setDefineCols(s);
+*/
+       t->setName(eTabName->text());
+}
+
+
+void eTable::ColumnTextUpd( const QString &s )
+{
+/*
+       int idx;
+       idx = ListCol->currentItem();
+       if (idx == -1) return;
+       ListCol->blockSignals( TRUE );
+       ListCol->changeItem(s, ListCol->currentItem());
+       ListCol->blockSignals( FALSE );
+       CHECK_POINT
+*/
+}
diff --git a/src/plugins/table/etable.h b/src/plugins/table/etable.h
new file mode 100644 (file)
index 0000000..497046b
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef ETABLE_H
+#define ETABLE_H
+
+#include "ui_etable.h"
+
+
+class eTable : public QDialog, public Ui::eTable
+{
+    Q_OBJECT
+
+public:
+    eTable(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
+    ~eTable();
+
+public slots:
+    virtual void insertColumn( const char * Header, const char * Name, int idxt, int cw, int tw, int td );
+    virtual void ColumnAdd();
+    virtual void ColumnDel();
+    virtual void ColumnL();
+    virtual void ColumnR();
+    virtual void ColumnSel( int col );
+    virtual void ColumnUpd();
+    virtual void setData( QWidget * o, aCfg * md );
+    virtual void getData( QWidget * o );
+    virtual void ColumnTextUpd( const QString & s );
+
+protected slots:
+    virtual void languageChange();
+
+private:
+    QStringList otypes, ftype, fname, cwidth;
+
+    virtual void init();
+    virtual void destroy();
+
+};
+
+#endif // ETABLE_H
diff --git a/src/plugins/table/etable.ui b/src/plugins/table/etable.ui
new file mode 100644 (file)
index 0000000..fa779c4
--- /dev/null
@@ -0,0 +1,297 @@
+<ui version="4.0" stdsetdef="1" >\r
+  <author></author>\r
+  <comment></comment>\r
+  <exportmacro></exportmacro>\r
+  <class>eTable</class>\r
+  <widget class="QDialog" name="eTable" >\r
+    <property name="geometry" >\r
+      <rect>\r
+        <x>0</x>\r
+        <y>0</y>\r
+        <width>510</width>\r
+        <height>318</height>\r
+      </rect>\r
+    </property>\r
+    <property name="windowTitle" >\r
+      <string>Form table</string>\r
+    </property>\r
+    <layout class="QGridLayout" >\r
+      <item rowspan="1" row="1" column="0" colspan="2" >\r
+        <widget class="Q3GroupBox" name="groupBox2" >\r
+          <property name="title" >\r
+            <string>List of columns</string>\r
+          </property>\r
+          <layout class="QGridLayout" >\r
+            <item row="0" column="0" >\r
+              <widget class="Q3ListBox" name="ListCol" >\r
+                <property name="lineWidth" >\r
+                  <number>1</number>\r
+                </property>\r
+                <property name="margin" >\r
+                  <number>0</number>\r
+                </property>\r
+                <property name="midLineWidth" >\r
+                  <number>1</number>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+          </layout>\r
+        </widget>\r
+      </item>\r
+      <item row="0" column="0" >\r
+        <widget class="QLabel" name="textLabel3" >\r
+          <property name="text" >\r
+            <string>Table name</string>\r
+          </property>\r
+          <property name="wordWrap" >\r
+            <bool>false</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="2" column="0" >\r
+        <widget class="QPushButton" name="bOK" >\r
+          <property name="text" >\r
+            <string>OK</string>\r
+          </property>\r
+          <property name="default" >\r
+            <bool>true</bool>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item rowspan="1" row="0" column="1" colspan="2" >\r
+        <widget class="QLineEdit" name="eTabName" >\r
+          <property name="maxLength" >\r
+            <number>30</number>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+      <item row="1" column="2" >\r
+        <widget class="Q3GroupBox" name="groupBox1" >\r
+          <property name="title" >\r
+            <string>Table column</string>\r
+          </property>\r
+          <layout class="QGridLayout" >\r
+            <item row="0" column="0" >\r
+              <widget class="QLabel" name="textLabel2" >\r
+                <property name="text" >\r
+                  <string>Header</string>\r
+                </property>\r
+                <property name="wordWrap" >\r
+                  <bool>false</bool>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item row="4" column="0" >\r
+              <widget class="QLabel" name="textLabel2_2" >\r
+                <property name="text" >\r
+                  <string>Width</string>\r
+                </property>\r
+                <property name="wordWrap" >\r
+                  <bool>false</bool>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item row="3" column="0" >\r
+              <widget class="QLabel" name="textLabel1" >\r
+                <property name="text" >\r
+                  <string>Field type</string>\r
+                </property>\r
+                <property name="wordWrap" >\r
+                  <bool>false</bool>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item row="2" column="0" >\r
+              <widget class="QLabel" name="textLabel2_3" >\r
+                <property name="text" >\r
+                  <string>Field name</string>\r
+                </property>\r
+                <property name="wordWrap" >\r
+                  <bool>false</bool>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item rowspan="1" row="1" column="0" colspan="2" >\r
+              <widget class="QLabel" name="textLabel1_2" >\r
+                <property name="text" >\r
+                  <string>View width</string>\r
+                </property>\r
+                <property name="wordWrap" >\r
+                  <bool>false</bool>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item row="4" column="3" >\r
+              <widget class="QLabel" name="textLabel3_2" >\r
+                <property name="text" >\r
+                  <string>decimals</string>\r
+                </property>\r
+                <property name="wordWrap" >\r
+                  <bool>false</bool>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item rowspan="1" row="5" column="1" colspan="2" >\r
+              <widget class="QPushButton" name="bColAdd" >\r
+                <property name="text" >\r
+                  <string>Add</string>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item row="5" column="0" >\r
+              <widget class="QPushButton" name="bColL" >\r
+                <property name="text" >\r
+                  <string>Up</string>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item row="6" column="0" >\r
+              <widget class="QPushButton" name="bColR" >\r
+                <property name="text" >\r
+                  <string>Down</string>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item rowspan="1" row="6" column="1" colspan="2" >\r
+              <widget class="QPushButton" name="bColDel" >\r
+                <property name="text" >\r
+                  <string>Remove</string>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item row="1" column="2" >\r
+              <widget class="QSpinBox" name="eColWidth" >\r
+                <property name="maximum" >\r
+                  <number>9999</number>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item row="4" column="2" >\r
+              <widget class="QSpinBox" name="eColTWidth" >\r
+                <property name="maximum" >\r
+                  <number>255</number>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item row="4" column="4" >\r
+              <widget class="QSpinBox" name="eColTDec" >\r
+                <property name="maximum" >\r
+                  <number>9</number>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item rowspan="1" row="0" column="2" colspan="3" >\r
+              <widget class="QLineEdit" name="eColHeader" >\r
+                <property name="maxLength" >\r
+                  <number>100</number>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item rowspan="1" row="2" column="2" colspan="3" >\r
+              <widget class="QLineEdit" name="eColName" >\r
+                <property name="maxLength" >\r
+                  <number>300</number>\r
+                </property>\r
+              </widget>\r
+            </item>\r
+            <item rowspan="1" row="3" column="2" colspan="3" >\r
+              <widget class="QComboBox" name="eType" />\r
+            </item>\r
+          </layout>\r
+        </widget>\r
+      </item>\r
+      <item row="2" column="1" >\r
+        <widget class="QPushButton" name="bCancel" >\r
+          <property name="text" >\r
+            <string>Cancel</string>\r
+          </property>\r
+        </widget>\r
+      </item>\r
+    </layout>\r
+  </widget>\r
+  <layoutdefault spacing="5" margin="5" />\r
+  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>\r
+  <includes>\r
+    <include location="local" >ananas.h</include>\r
+  </includes>\r
+  <connections>\r
+    <connection>\r
+      <sender>bOK</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>accept()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bCancel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>reject()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bColAdd</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>ColumnAdd()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bColDel</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>ColumnDel()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bColL</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>ColumnL()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>bColR</sender>\r
+      <signal>clicked()</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>ColumnR()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>ListCol</sender>\r
+      <signal>highlighted(int)</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>ColumnSel(int)</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eColHeader</sender>\r
+      <signal>textChanged(QString)</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>ColumnUpd()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eType</sender>\r
+      <signal>activated(int)</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>ColumnUpd()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eColName</sender>\r
+      <signal>textChanged(QString)</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>ColumnUpd()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eColWidth</sender>\r
+      <signal>valueChanged(QString)</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>ColumnUpd()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eColTWidth</sender>\r
+      <signal>valueChanged(QString)</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>ColumnUpd()</slot>\r
+    </connection>\r
+    <connection>\r
+      <sender>eColTDec</sender>\r
+      <signal>valueChanged(QString)</signal>\r
+      <receiver>eTable</receiver>\r
+      <slot>ColumnUpd()</slot>\r
+    </connection>\r
+  </connections>\r
+</ui>\r
diff --git a/src/plugins/table/table.pri b/src/plugins/table/table.pri
new file mode 100644 (file)
index 0000000..ffedd6e
--- /dev/null
@@ -0,0 +1,13 @@
+HEADERS += \
+    table/etable.h \
+    table/wtable.h \
+    table/wtable_plugin.h
+
+SOURCES += \
+    table/etable.cpp \
+    table/wtable.cpp \
+    table/wtable_plugin.cpp
+        
+FORMS += \
+    table/etable.ui
+    
\ No newline at end of file
diff --git a/src/plugins/table/wtable.cpp b/src/plugins/table/wtable.cpp
new file mode 100644 (file)
index 0000000..6f52b42
--- /dev/null
@@ -0,0 +1,216 @@
+/****************************************************************************
+** $Id: wtable.cpp,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Code file of the table plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <q3table.h>
+#include <qlayout.h>
+#include <qstring.h>
+#include <q3header.h>
+#include <qvariant.h>
+#include <qobject.h>
+#include <qobject.h>
+
+#include "acfg.h"
+#include "aobject.h"
+#include "awidget.h"
+#include "wtable.h"
+
+
+
+wTable::wTable(QWidget *parent, const char * name):Q3Table(parent, name)
+{
+
+}
+
+wTable::~wTable()
+{
+}
+
+
+void
+wTable::setDocument(int row, aObject *object)
+{
+}
+
+void
+wTable::setText(int row, int col, const QString& text)
+{
+       return Q3Table::setText(row, col,text);
+}
+
+
+QString
+wTable::text(int col, int row)
+{
+       return Q3Table::text(col,row);
+}
+
+void
+wTable::setHeaderText(int col, const QString& text)
+{
+       Q3Table::horizontalHeader()->setLabel( col, text );
+}
+
+
+QString
+wTable::textHeader(int col)
+{
+       return Q3Table::horizontalHeader()->label(col);
+}
+
+void
+wTable::sortColumn ( int col, bool ascending, bool wholeRows )
+{
+       printf("do sort column\n");
+       Q3Table::sortColumn( col, ascending, true );
+}
+
+
+void
+wTable::setColumnWidth(int col, int width)
+{
+       Q3Table::setColumnWidth(col,width);
+}
+
+
+int
+wTable::columnWidth(int col)
+{
+       return Q3Table::columnWidth(col);
+}
+
+void
+wTable::setNumCols ( int r )
+{
+       Q3Table::setNumCols(r);
+}
+
+int
+wTable::numCols () const
+{
+       int res = Q3Table::numCols();// - 1;
+       return res;
+}
+void
+wTable::hideColumn ( int col )
+{
+       Q3Table::hideColumn ( col );
+}
+
+void
+wTable::showColumn ( int col )
+{
+       Q3Table::showColumn ( col );
+}
+/*
+bool
+wTable::isColumnHidden ( int col ) const
+{
+//     int i = -2;
+//     if(col>=0) i=col;
+       return QTable::isColumnHidden ( col );
+}
+*/
+void
+wTable::adjustColumn ( int col )
+{
+       return Q3Table::adjustColumn  ( col );
+}
+
+void
+wTable::setColumnStretchable ( int col, bool stretch )
+{
+       return Q3Table::setColumnStretchable ( col, stretch );
+}
+
+bool
+wTable::isColumnStretchable ( int col ) const
+{
+       return Q3Table::isColumnStretchable ( col );
+}
+
+
+void
+wTable::swapColumns ( int col1, int col2, bool swapHeader )
+{
+       Q3Table::swapColumns( col1, col2, swapHeader );
+
+}
+
+void
+wTable::swapCells ( int row1, int col1, int row2, int col2 )
+{
+       Q3Table::swapCells( row1, col1, row2, col2 );
+}
+
+void
+wTable::setCurrentCell ( int row, int col )
+{
+       Q3Table::setCurrentCell( row, col );
+}
+
+void
+wTable::setColumnReadOnly ( int col, bool ro )
+{
+       Q3Table::setColumnReadOnly( col, ro );
+}
+
+void
+wTable::insertColumns ( int col, int count )
+{
+       Q3Table::insertColumns( col, count );
+}
+
+void
+wTable::removeColumn ( int col )
+{
+       Q3Table::removeColumn( col );
+}
+
+void
+wTable::editCell ( int row, int col, bool replace )
+{
+       Q3Table::editCell( row, col, replace );
+}
+
+void
+wTable::columnClicked ( int col )
+{
+//     int i = -2;
+//     if(col>=0) i=col;
+       Q3Table::columnClicked ( col );//i-1 );
+}
+void
+wTable::swapRows ( int row1, int row2, bool swapHeader )
+{
+       Q3Table::swapRows (  row1, row2,swapHeader );
+}
+
+
+
diff --git a/src/plugins/table/wtable.h b/src/plugins/table/wtable.h
new file mode 100644 (file)
index 0000000..a550587
--- /dev/null
@@ -0,0 +1,115 @@
+/****************************************************************************
+** $Id: wtable.h,v 1.1 2008/11/05 21:16:30 leader Exp $
+**
+** Header file of the table plugin of Ananas
+** Designer and Engine applications
+**
+** Created : 20031201
+**
+** Copyright (C) 2003-2004 Leader InfoTech.  All rights reserved.
+** Copyright (C) 2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola.
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef WTABLE_H
+#define WTABLE_H
+
+#include <qwidget.h>
+#include <qwidgetplugin.h>
+#include <qobject.h>
+#include <q3scrollview.h>
+#include <q3table.h>
+#include <qlabel.h>
+#include <qevent.h>
+#include <q3datatable.h>
+#include "acfg.h"
+#include "aobject.h"
+#include "awidget.h"
+
+/*!
+ * \en
+ *     \brief Object for view and edit tabel in aTable object.
+ * \_en
+ * \ru
+ *     \brief Плагин - виджет для редактирования табличных данных, не хранящихся в бизнес объектах Ананаса.
+ *     Наследует QTable.
+ *
+ *     В отличие от wDBTable wTable не сохряняет редактируемые в нем данные автоматически
+ *     в persistent бизнес объектах Ананаса. Программист самостоятельно
+ *     должен закодировать на Ананас.Скрипте логику заполнения виджета данными и использования данных, вводимых
+ *     пользователем.
+ *
+ * \_ru
+ */
+
+
+class QT_WIDGET_PLUGIN_EXPORT wTable : public Q3Table
+{
+       Q_OBJECT
+
+public:
+
+       wTable(QWidget* parent, const char * name);
+       virtual ~wTable();
+public slots:
+       virtual void setDocument(int row, aObject *object);
+       void setText(int row, int col, const QString& text);
+       QString text(int col, int row);
+       void setHeaderText(int col, const QString& text);
+       QString textHeader(int col);
+       virtual void sortColumn ( int col, bool ascending = TRUE, bool wholeRows = TRUE );
+       virtual void setColumnWidth(int col, int width);
+       virtual int columnWidth(int col);
+       virtual void setNumCols ( int r );
+       virtual int numCols () const ;
+       virtual void hideColumn ( int col );
+       virtual void showColumn ( int col );
+//     bool isColumnHidden ( int col ) const;
+       virtual void adjustColumn ( int col );
+       virtual void setColumnStretchable ( int col, bool stretch );
+       bool isColumnStretchable ( int col ) const;
+       virtual void swapColumns ( int col1, int col2, bool swapHeader = FALSE );
+       virtual void swapCells ( int row1, int col1, int row2, int col2 );
+       virtual void setCurrentCell ( int row, int col );
+       virtual void setColumnReadOnly ( int col, bool ro );
+       virtual void insertColumns ( int col, int count = 1 );
+       virtual void removeColumn ( int col );
+       virtual void editCell ( int row, int col, bool replace = FALSE );
+       virtual void swapRows ( int row1, int row2, bool swapHeader = FALSE );
+signals:
+//     void pressed ( int row, int col, int button, const QPoint & mousePos );
+//     void currentChanged ( int row, int col );
+//     void clicked ( int row, int col, int button, const QPoint & mousePos );
+//     void valueChanged ( int row, int col );
+
+protected slots:
+       virtual void columnClicked ( int col );
+
+private slots:
+//     void on_pressed ( int row, int col, int button, const QPoint & mousePos );
+//     void on_currentChanged ( int row, int col );
+//     void on_clicked ( int row, int col, int button, const QPoint & mousePos );
+//     void on_valueChanged ( int row, int col );
+protected:
+       virtual void activateNextCell () {} ;
+
+};
+
+#endif
diff --git a/src/plugins/table/wtable_plugin.cpp b/src/plugins/table/wtable_plugin.cpp
new file mode 100644 (file)
index 0000000..cbc53bc
--- /dev/null
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Code file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#include "wtable_plugin.h"
+
+#include <QtPlugin>
+
+#include "wtable.h"
+
+
+wTablePlugin::wTablePlugin(QObject *parent)
+    : QObject(parent), m_initialized(false)
+{
+    m_initialized = false;
+}
+
+bool wTablePlugin::isContainer() const
+{
+    return false;
+}
+
+bool wTablePlugin::isInitialized() const
+{
+    return m_initialized;
+}
+
+void wTablePlugin::initialize(QDesignerFormEditorInterface *core)
+{
+    if (m_initialized)
+        return;
+    Q_UNUSED(core);
+    m_initialized = true;
+}
+
+QWidget *wTablePlugin::createWidget(QWidget *parent)
+{
+    wTable *w = new wTable(parent, 0);
+    return w;
+}
+
+QString wTablePlugin::name() const
+{
+    return QLatin1String("wTable");
+}
+
+QString wTablePlugin::group() const
+{
+    return QLatin1String("Ananas");
+}
+
+QString wTablePlugin::toolTip() const
+{
+    return QString("Ananas for QT Table Widget");
+}
+
+QString wTablePlugin::whatsThis() const
+{
+    return QString("Entry to modify tables values of Ananas's object");
+}
+
+QString wTablePlugin::includeFile() const
+{
+    return QLatin1String("wtable.h");
+}
+
+QIcon wTablePlugin::icon() const
+{
+    //return QIcon();
+    return QIcon(":/images/wtable.png");
+}
+
+QString wTablePlugin::domXml() const
+{
+    return "<widget class=\"wTable\" name=\"wTable_1\">\n</widget>\n";
+}
diff --git a/src/plugins/table/wtable_plugin.h b/src/plugins/table/wtable_plugin.h
new file mode 100644 (file)
index 0000000..b18a8c9
--- /dev/null
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Header file
+**
+** Copyright (C) 2006 Dmitriy Pavlyuk <dm-p@rambler.ru>
+**
+** This file is part of the Ananas Plugins of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**********************************************************************/
+
+#ifndef WTABLE_PLUGIN_H
+#define WTABLE_PLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+#include <qwidgetplugin.h>
+
+
+class QT_WIDGET_PLUGIN_EXPORT wTablePlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+    wTablePlugin(QObject *parent=0);
+
+    bool isContainer() const;
+    bool isInitialized() const;
+    void initialize(QDesignerFormEditorInterface *core);
+    QWidget *createWidget(QWidget *parent);
+
+    QString name() const;
+    QString group() const;
+    QString toolTip() const;
+    QString whatsThis() const;
+    QString includeFile() const;
+    QIcon icon() const;
+    QString domXml() const;
+
+private:
+    bool m_initialized;
+};
+
+#endif // WTABLE_PLUGIN_H
diff --git a/src/src.pro b/src/src.pro
new file mode 100644 (file)
index 0000000..e32d287
--- /dev/null
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+SUBDIRS  += lib plugins
+SUBDIRS += designer ananas admin
+SUBDIRS += extensions
+
+#TRANSLATIONS = \
+#    ../translations/ananas-en.ts \
+#    ../translations/ananas-ru.ts 
diff --git a/src/test/main.cpp b/src/test/main.cpp
new file mode 100644 (file)
index 0000000..24b0b78
--- /dev/null
@@ -0,0 +1,47 @@
+/****************************************************************************
+** $Id: main.cpp,v 1.3 2008/12/06 22:16:55 leader Exp $
+** 
+** Tool for automatic running Ananas tests
+**
+** Created : 20051024
+**
+** Copyright (C) 2008. Valery Grazhdankin <vg at leaderit.ru>, Moscow
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "ananas.h"
+#include <QApplication>
+#include <QtTest/QtTest>
+
+#include "testametadata.h"
+
+int main(int argc, char *argv[]) 
+{ 
+    QApplication app(argc, argv); 
+    int rc = 0;
+    
+//    TestQString test1;
+    TestAMetaData test2;
+    
+//    rc += QTest::qExec(&test1, argc, argv);
+    rc += QTest::qExec(&test2, argc, argv); 
+    printf("\nTotal fails: %i\n",rc);
+    return rc; 
+}
diff --git a/src/test/test.h b/src/test/test.h
new file mode 100644 (file)
index 0000000..952cbfa
--- /dev/null
@@ -0,0 +1,45 @@
+/****************************************************************************
+** $Id: test.h,v 1.1 2008/11/19 20:20:16 leader Exp $
+** 
+** Tool for automatic running Ananas tests
+**
+** Created : 20081119
+**
+** Copyright (C) 2008. Valery Grazhdankin <vg at leaderit.ru>, Moscow
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <math.h>
+#include <stdlib.h>
+
+double rnd(double m=1);
+
+
+double rnd(double m)
+{
+       double res;
+#ifdef _Windows
+       res = rand()*m;
+#else
+       res = random()*m;
+#endif
+       return res;
+       
+}
diff --git a/src/test/test.pro b/src/test/test.pro
new file mode 100644 (file)
index 0000000..fefd2e3
--- /dev/null
@@ -0,0 +1,20 @@
+TARGET = ananas4-test 
+include(../lib/lib.pri)
+include(../plugins/plugins.pri)
+include(../ananas.pri )
+
+SOURCES        += \
+           main.cpp \ 
+           testametadata.cpp
+
+HEADERS        +=  \
+           test.h \
+           testametadata.h
+TRANSLATES = 
+
+CONFIG +=qtestlib
+FORMS  = 
+TEMPLATE       =app
+INCLUDEPATH    += ../lib ../plugins
+LIBS   += -L$(QTDIR)/lib -lqsa -L../../lib -lananas4
+LIBS   += -L../../lib/designer -lananasplugin4 -lqt4-qdataschema
diff --git a/src/test/testametadata.cpp b/src/test/testametadata.cpp
new file mode 100644 (file)
index 0000000..29ee89c
--- /dev/null
@@ -0,0 +1,176 @@
+/****************************************************************************
+** $Id: testametadata.cpp,v 1.5 2008/12/15 22:22:48 leader Exp $
+** 
+** Tool for automatic running Ananas tests
+**
+** Created : 20081119
+**
+** Copyright (C) 2008. Valery Grazhdankin <vg at leaderit.ru>, Moscow
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "testametadata.h"
+#include "ametadataioxml.h"
+#include "ametafield.h"
+#include "ananas.h"
+#include <QtTest/QtTest>
+
+
+void TestAMetaData::initTestCase()
+{
+//    qDebug("TEST INIT");
+//    md = new AMetaData(QString("КлассОбъекта"), fromUtf8("ИмяОбъекта"),);
+//    mdo = new AMetaObject();
+}
+
+
+
+void TestAMetaData::cleanupTestCase()
+{
+//    qDebug("TEST DONE");
+//    delete md;
+//    delete mdo;
+}
+
+/*
+void TestAMetaData::toUpper_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+
+    QTest::newRow("all lower") << "hello" << "HELLO";
+    QTest::newRow("mixed")     << "Hello" << "HELLO";
+    QTest::newRow("all upper") << "HELLO" << "HELLO";
+}
+
+void TestAMetaData::toUpper()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+
+    QCOMPARE(string.toUpper(), result);
+}
+*/
+
+void TestAMetaData::testAMetaObject()
+{
+    QByteArray ba("1234567890АБВГД");
+    QString ts = QString::fromUtf8("Проверочный текст UTF8");
+
+    AMetaObject *o = new AMetaObject(QString::fromUtf8("КлассОбъекта"), 
+                                     QString::fromUtf8("ИмяОбъекта"), 0 );
+
+    o->setDescription( ts );
+    QCOMPARE( o->description(), ts );
+    
+    QCOMPARE( o->className(), QString::fromUtf8("КлассОбъекта"));
+    QCOMPARE( o->name(),      QString::fromUtf8("ИмяОбъекта"));
+
+    o->setId(123456);
+    QVERIFY( o->id()==123456);
+
+    o->setAttr("String","String");
+    o->setAttr("Int", 123456 );
+    o->setText("Text", QString::fromUtf8("Проверочный текст"));
+    o->setRawdata("RAW1", ba );
+    o->setRawdata("RAW2", ba );
+
+// Test attr functions
+    QVERIFY( o->attrCount() == 2 );
+    QVERIFY( o->attrExists("String") );
+    QVERIFY( o->attrExists("Int") );
+    QVERIFY( o->attrExists("IntX") == false );
+    QVERIFY( o->attr("String") == "String" );
+    QVERIFY( o->attr("Int") == 123456 );
+    QVERIFY( o->attr( 0 ) == "String" );
+    QVERIFY( o->attr( 1 ) == 123456 );
+    QVERIFY( o->attr( -1 ) == QVariant() );
+    QVERIFY( o->attr( 10 ) == QVariant() );
+// Test text functions
+    QVERIFY( o->textCount() == 1+1 );
+    QVERIFY( o->textExists("Text") );
+    QVERIFY( o->textExists("Text0") == false );
+    QVERIFY( o->text("Text") == QString::fromUtf8("Проверочный текст") );
+    QVERIFY( o->text( 1 ) == QString::fromUtf8("Проверочный текст") );
+    QVERIFY( o->text( -1 ) == QString::null );
+    QVERIFY( o->text( 10 ) == QString::null );
+// Test rawdata functions
+    QVERIFY( o->rawdataCount() == 2 );
+    QVERIFY( o->rawdataExists("RAW1") );
+    QVERIFY( o->rawdataExists("RAW2") );
+    QVERIFY( o->rawdataExists("RAW3") == false );
+    QVERIFY( o->rawdata("RAW1") == QString( ba.data() ) );
+    QVERIFY( o->rawdata("RAW2") == QString( ba.data() ) );
+    QVERIFY( o->rawdata( 0 ) == QString( ba.data() ) );
+    QVERIFY( o->rawdata( 1 ) == QString( ba.data() ) );
+    QVERIFY( o->rawdata( -1 ) == QByteArray() );
+    QVERIFY( o->rawdata( 10 ) == QByteArray() );
+    delete o;
+}
+
+
+
+void TestAMetaData::testAMetaObjectGroup()
+{
+    AMetaObjectGroup *o = new AMetaObjectGroup( QString::fromUtf8("ИмяОбъекта") );
+
+    QCOMPARE( o->name(),      QString::fromUtf8("ИмяОбъекта"));
+    delete o;
+}
+
+
+
+void TestAMetaData::testAMetaData()
+{
+    AMetaData *o = new AMetaData();
+    QCOMPARE( o->name(), QString("MetaData") );
+    delete o;
+}
+
+
+void TestAMetaData::testAMetaField()
+{
+    AMetaField *o = new AMetaField();
+    QCOMPARE( o->className(), QString("MetaField") );
+    QCOMPARE( o->description(), QString("") );
+    QCOMPARE( o->fieldType(), 0 );
+    QCOMPARE( o->fieldSubType(), 0 );
+    QCOMPARE( o->width(), 0 );
+    QCOMPARE( o->notNull(), false );
+    QCOMPARE( o->notNegative(), false );
+    QCOMPARE( o->calcSumm(), false );
+    delete o;
+}
+
+
+void TestAMetaData::testAMetaDataIOXML()
+{
+    AMetaDataIOXML *o = new AMetaDataIOXML();
+    QString xml;
+    
+    QCOMPARE( o->write("test.cfg"), 0 );
+    QCOMPARE( o->read("test1.cfg"), 0 );
+    xml = o->text();
+    QCOMPARE( o->write("test2.cfg"), 0 );
+    QCOMPARE( o->read("test2.cfg"), 0 );
+    QCOMPARE( xml, o->text() );
+    //QCOMPARE( o->name(), QString("ROOT") );
+    delete o;
+}
diff --git a/src/test/testametadata.h b/src/test/testametadata.h
new file mode 100644 (file)
index 0000000..939ca8e
--- /dev/null
@@ -0,0 +1,56 @@
+/****************************************************************************
+** $Id: testametadata.h,v 1.5 2008/12/15 22:22:48 leader Exp $
+** 
+** Tool for automatic running Ananas tests
+**
+** Created : 20081119
+**
+** Copyright (C) 2008. Valery Grazhdankin <vg at leaderit.ru>, Moscow
+**
+** This file is part of the Designer application of the Ananas
+** automation accounting system.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
+** See http://www.leaderit.ru/gpl/ for GPL licensing information.
+**
+** Contact org@leaderit.ru if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#ifndef TESTAMETADATA_H
+#define TESTAMETADATA_H
+#include "ametadata.h"
+#include <QObject>
+
+class TestAMetaData: public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void initTestCase();
+    void cleanupTestCase();
+    
+//    void toUpper_data();
+//    void toUpper();
+
+    void testAMetaObject();
+    void testAMetaObjectGroup();
+    void testAMetaData();
+    void testAMetaField();
+    void testAMetaDataIOXML();
+
+private:
+    AMetaObject *mdo;
+    AMetaData *md;
+};
+
+#endif
diff --git a/translations/ananas-designer-en.ts b/translations/ananas-designer-en.ts
new file mode 100644 (file)
index 0000000..8833822
--- /dev/null
@@ -0,0 +1,2061 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>CfgForm</name>
+    <message>
+        <source>CfgForm</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Metadata</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Actions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Rights</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Languages</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Tag</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Translation file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remove</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Clear dead aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Image collection</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;New</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+N</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Open</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Open...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+O</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Save</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Save</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+S</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Save As</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Save &amp;As...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Print</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Print...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+P</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Exit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&amp;xit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ActionGroup</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Action</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Open image dialog</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New language</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Deleting row</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete &apos;%1&apos;?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Yes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving changes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Save changes %1?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>messageswindow</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Clearing dead aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1 dead aliases killed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Role name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Clear dead roles</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New role</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Clearing dead roles</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1 dead roles killed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to write rc file.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>CfgForm readrc error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Business scheme: </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>CfgForm metadata root is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>CfgForm metadata lang is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>lang = %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>CfgForm %1 metadata lang is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>InterfaceTreeView</name>
+    <message>
+        <source>&amp;New Submenu</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New &amp;Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New &amp;Separator</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>MainForm</name>
+    <message>
+        <source>Ananas: Designer</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;File</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Object</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;New</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+N</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Open...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+O</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Save</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>actFileSave</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+S</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Save &amp;as...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Print</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+P</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&amp;xit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Undo</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+Z</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Redo</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+Y</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cut</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+X</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Copy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+C</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paste</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+V</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Find</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl+F</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Save</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ActionGroup</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New field</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Rename</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New table</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New in group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Move Up</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Move Down</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Action</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Submenu</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Separator</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Clear dead aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>new item</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Image Collection</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Help</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;About</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Cascade</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Tile</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Tile &amp;horizontal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Create new configuration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Open configuration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Tabs</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Вырезать</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Копировать</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Вставить</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Содержание</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>&amp;Содержание...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Индекс</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>&amp;Индекс...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>О программе</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>&amp;О программе</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Конфигурация</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Save configuration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Создать/обновить БД</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Новая кнопка</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Новый атрибут</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Новое поле</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add new role</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Clear dead roles</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit role</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Open</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Windows</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>About Ananas.Designer</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas.Designer %1&lt;/h4&gt; is a programm&lt;br&gt;for adjusting accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2006 Leader Infotech, Valery Grazdankin &lt;br&gt;Copyright 2003-2006 Project Ananas, Andrey Paskal, Grigory Panov, Andrey Strelnikov&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;&lt;br&gt;Avalable extensions:&lt;br&gt;%2</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>PixmapPreview</name>
+    <message>
+        <source>This is not a pixmap</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <source>default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Documents</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Init application</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Init forms designer</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Dialog forms designer</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalogues</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Reports</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Journals</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Information registers</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation registers</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Header</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Tables</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Forms</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Web forms</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Columns</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Resources</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Dimensions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Element</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New field</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New catalogue</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New journal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New information register</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New accumulation register</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New report</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New web form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Table</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>-------------------</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Popup menu</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New tool bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Submenu</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toolbars</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Main menu</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Popup menus</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Action Group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Action</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Actions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>header</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Column</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Elements list dialog</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Element dialog</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Group dialog</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>embedded editor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unknown</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Numberic</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source> Ananas List View Item %1 is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ananas List View Item swaping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>any files (*)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New &amp;Group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New &amp;Action</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aAliasEditor</name>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aMetadataTreeView</name>
+    <message>
+        <source>&amp;New</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aRoleEditor</name>
+    <message>
+        <source>Read</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Write</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Turn On</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Turn Off</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>ananasTreeView</name>
+    <message>
+        <source>&lt;font color=darkblue&gt;&lt;u&gt;&lt;b&gt;Context Menu&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Rename</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;MoveUp</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;MoveDown</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;SaveItem</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;LoadItem</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditAReg</name>
+    <message>
+        <source>Accumulating register</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation register:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditAction</name>
+    <message>
+        <source>Action</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>standart command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>user script</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled icon</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>X</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled icon</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Execute</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Object</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>new</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>view</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>execute</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Params</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Action_2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Action:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Open image dialog</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose an image</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>external script</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>File name</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditCat</name>
+    <message>
+        <source>Catalogue</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalogue:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Element string view</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Group string view</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Access</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Read</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Write</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditCfg</name>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Author</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Date</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base server user</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base password</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unknown</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>mysql</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>postgres</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base server address</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Work directory</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration file name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base server port</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Global module</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>MySQL</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Postgres</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base header</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Business scheme parameters</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Business scheme parameters: </source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditColumns</name>
+    <message>
+        <source>Columns</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Action</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Column:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditCommand</name>
+    <message>
+        <source>Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hot Key:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Alt</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Shift</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>3</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>4</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>5</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>6</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>7</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>8</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>9</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>0</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>A</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>B</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>D</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>F</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>G</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>H</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>I</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>J</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>K</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>L</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>M</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>N</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>O</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>P</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Q</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>R</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>T</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>U</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>V</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>W</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>X</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Y</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Z</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu text</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Actions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Command:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditDialog</name>
+    <message>
+        <source>Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Form file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Module file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Design</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>View</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Module</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Form:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Form mode:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use for:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Dialog</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selection</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Read only</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Designer</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Preview</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dEditDialog edit form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dEditDialog form file does not exists</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dEditDialog create form file from metadata</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dEditDialog create new form file from template</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dEditDialog open file %1 for write</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dEditDialog open file %1 for read from templates directory %2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dEditDialog file %1 not exists</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dEditDialog show formdesigner</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditDoc</name>
+    <message>
+        <source>Document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Module</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Document:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>String view</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Access</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Read</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Write</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditField</name>
+    <message>
+        <source>Field</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unknown</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Field:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Sum</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Width</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Decimals</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Flags</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Sort</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Positive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saldo source</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditIReg</name>
+    <message>
+        <source>Information register</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Information register:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Don&apos;t delete record in unconduct</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditJournal</name>
+    <message>
+        <source>Journal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Special</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Othes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Documents</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Action</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Action_2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Journal:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Access</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Read</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Write</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditLang</name>
+    <message>
+        <source>Language</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Tag:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Translation file:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Language:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditReport</name>
+    <message>
+        <source>Report</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Module</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Report:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditRole</name>
+    <message>
+        <source>Role</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Role:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditToolbar</name>
+    <message>
+        <source>Form1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hot Key:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ctrl</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Alt</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Shift</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>3</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>4</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>5</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>6</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>7</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>8</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>9</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>0</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>A</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>B</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>D</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>F</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>G</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>H</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>I</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>J</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>K</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>L</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>M</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>N</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>O</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>P</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Q</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>R</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>T</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>U</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>V</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>W</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>X</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Y</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Z</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Actions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Command:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditWebForm</name>
+    <message>
+        <source>Web Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Form editor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Client module</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Server module</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Web form:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+</TS>
diff --git a/translations/ananas-designer-ru.ts b/translations/ananas-designer-ru.ts
new file mode 100644 (file)
index 0000000..05a03d3
--- /dev/null
@@ -0,0 +1,2224 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>CfgForm</name>
+    <message>
+        <source>CfgForm</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>New</source>
+        <translation>Новый</translation>
+    </message>
+    <message>
+        <source>&amp;New</source>
+        <translation>&amp;Новый</translation>
+    </message>
+    <message>
+        <source>Ctrl+N</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Open</source>
+        <translation>Открыть</translation>
+    </message>
+    <message>
+        <source>&amp;Open...</source>
+        <translation>&amp;Открыть...</translation>
+    </message>
+    <message>
+        <source>Ctrl+O</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Save</source>
+        <translation>Сохранить</translation>
+    </message>
+    <message>
+        <source>&amp;Save</source>
+        <translation>&amp;Сохранить</translation>
+    </message>
+    <message>
+        <source>Ctrl+S</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Save As</source>
+        <translation>Сохранить как</translation>
+    </message>
+    <message>
+        <source>Save &amp;As...</source>
+        <translation>Сохранить &amp;как ...</translation>
+    </message>
+    <message>
+        <source>Print</source>
+        <translation>Печать</translation>
+    </message>
+    <message>
+        <source>&amp;Print...</source>
+        <translation>&amp;Печать ...</translation>
+    </message>
+    <message>
+        <source>Ctrl+P</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Exit</source>
+        <translation>Выход</translation>
+    </message>
+    <message>
+        <source>E&amp;xit</source>
+        <translation>В&amp;ыход</translation>
+    </message>
+    <message>
+        <source>ActionGroup</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Action</source>
+        <translation>Действие</translation>
+    </message>
+    <message>
+        <source>Configuration: </source>
+        <translation type="obsolete">Бизнес схема:</translation>
+    </message>
+    <message>
+        <source>Element</source>
+        <translation type="obsolete">Элемент</translation>
+    </message>
+    <message>
+        <source>Group</source>
+        <translation type="obsolete">Группа</translation>
+    </message>
+    <message>
+        <source>Saving changes</source>
+        <translation>Сохранение изменений</translation>
+    </message>
+    <message>
+        <source>Save changes %1?</source>
+        <translation>Сохранить изменения в &quot;%1&quot;?</translation>
+    </message>
+    <message>
+        <source>Yes</source>
+        <translation>Да</translation>
+    </message>
+    <message>
+        <source>No</source>
+        <translation>Нет</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+    <message>
+        <source>Configuration</source>
+        <translation type="obsolete">Конфигурация</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Object type</source>
+        <translation type="obsolete">Тип объекта</translation>
+    </message>
+    <message>
+        <source>Interface</source>
+        <translation>Интерфейс</translation>
+    </message>
+    <message>
+        <source>Command</source>
+        <translation type="obsolete">Команда</translation>
+    </message>
+    <message>
+        <source>Metadata</source>
+        <translation>Метаданные</translation>
+    </message>
+    <message>
+        <source>Actions</source>
+        <translation>Действия</translation>
+    </message>
+    <message>
+        <source>Rights</source>
+        <translation>Права</translation>
+    </message>
+    <message>
+        <source>Tag</source>
+        <translation>Метка</translation>
+    </message>
+    <message>
+        <source>Translation file</source>
+        <translation>Файл перевода</translation>
+    </message>
+    <message>
+        <source>Add</source>
+        <translation>Добавить</translation>
+    </message>
+    <message>
+        <source>Remove</source>
+        <translation>Удалить</translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation>Редактировать</translation>
+    </message>
+    <message>
+        <source>Clear dead aliases</source>
+        <translation>Очистить лишние алиасы</translation>
+    </message>
+    <message>
+        <source>Image collection</source>
+        <translation>Коллекция картинок</translation>
+    </message>
+    <message>
+        <source>Open image dialog</source>
+        <translation>Выбрать каринку</translation>
+    </message>
+    <message>
+        <source>New language</source>
+        <translation>Новый язык</translation>
+    </message>
+    <message>
+        <source>Deleting row</source>
+        <translation>Удаление строки</translation>
+    </message>
+    <message>
+        <source>Delete &apos;%1&apos;?</source>
+        <translation>Удалить %1&apos;?</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>messageswindow</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Languages</source>
+        <translation>Языки</translation>
+    </message>
+    <message>
+        <source>Clearing dead aliases</source>
+        <translation>Очистка неиспользуемых псевдонимов</translation>
+    </message>
+    <message>
+        <source>%1 dead aliases killed.</source>
+        <translation>%1 псевдоним удален.</translation>
+    </message>
+    <message>
+        <source>Role name</source>
+        <translation>Название роли</translation>
+    </message>
+    <message>
+        <source>Description</source>
+        <translation>Описание</translation>
+    </message>
+    <message>
+        <source>Clear dead roles</source>
+        <translation>Убрать неиспользуемые роли</translation>
+    </message>
+    <message>
+        <source>New role</source>
+        <translation>Новая роль</translation>
+    </message>
+    <message>
+        <source>Clearing dead roles</source>
+        <translation>Удаление неиспользуемых ролей</translation>
+    </message>
+    <message>
+        <source>%1 dead roles killed.</source>
+        <translation>%1 убрано.</translation>
+    </message>
+    <message>
+        <source>Unable to write rc file.</source>
+        <translation>Невозможно записать rc файл.</translation>
+    </message>
+    <message>
+        <source>CfgForm readrc error</source>
+        <translation>CfgForm - Ошибка readrc</translation>
+    </message>
+    <message>
+        <source>Business scheme: </source>
+        <translation>Бизнес схема:</translation>
+    </message>
+    <message>
+        <source>CfgForm metadata root is null</source>
+        <translation>CfgForm - пустой корень метаданных</translation>
+    </message>
+    <message>
+        <source>CfgForm metadata lang is null</source>
+        <translation>CfgForm - lang в метаданных равен null</translation>
+    </message>
+    <message>
+        <source>lang = %1</source>
+        <translation>lang = %1</translation>
+    </message>
+    <message>
+        <source>CfgForm %1 metadata lang is null</source>
+        <translation>CfgForm - %1 lang в метаданных равен null</translation>
+    </message>
+</context>
+<context>
+    <name>InterfaceTreeView</name>
+    <message>
+        <source>&amp;New Submenu</source>
+        <translation>Новое &amp;подменю</translation>
+    </message>
+    <message>
+        <source>New &amp;Command</source>
+        <translation>Новая &amp;команда</translation>
+    </message>
+    <message>
+        <source>New &amp;Separator</source>
+        <translation>Новый &amp;разделитель</translation>
+    </message>
+</context>
+<context>
+    <name>MainForm</name>
+    <message>
+        <source>Ctrl+N</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Ctrl+O</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>actFileSave</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Ctrl+S</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Ctrl+P</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Ctrl+Z</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Ctrl+Y</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Ctrl+X</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Ctrl+C</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Ctrl+V</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Ctrl+F</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>ActionGroup</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>new item</source>
+        <translation>новый элемент</translation>
+    </message>
+    <message>
+        <source>Ananas: Configurator</source>
+        <translation type="obsolete">Ананас: Конфигуратор</translation>
+    </message>
+    <message>
+        <source>Configuration</source>
+        <translation>Бизнес схема</translation>
+    </message>
+    <message>
+        <source>Object</source>
+        <translation>Объект</translation>
+    </message>
+    <message>
+        <source>New</source>
+        <translation>Новый</translation>
+    </message>
+    <message>
+        <source>Open</source>
+        <translation type="obsolete">Открыть</translation>
+    </message>
+    <message>
+        <source>Save</source>
+        <translation>Сохранить</translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation>Удалить</translation>
+    </message>
+    <message>
+        <source>Rename</source>
+        <translation>Переименовать</translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation>Редактировать</translation>
+    </message>
+    <message>
+        <source>About Ananas configuration program</source>
+        <translation type="obsolete">О программе настройки Ананаса</translation>
+    </message>
+    <message>
+        <source>Ananas: Designer</source>
+        <translation>Ананас.Дизайнер</translation>
+    </message>
+    <message>
+        <source>&amp;File</source>
+        <translation>&amp;Файл</translation>
+    </message>
+    <message>
+        <source>&amp;Edit</source>
+        <translation>&amp;Редактировать</translation>
+    </message>
+    <message>
+        <source>&amp;New</source>
+        <translation>&amp;Новый</translation>
+    </message>
+    <message>
+        <source>&amp;Open...</source>
+        <translation>&amp;Открыть...</translation>
+    </message>
+    <message>
+        <source>&amp;Save</source>
+        <translation>&amp;Сохранить</translation>
+    </message>
+    <message>
+        <source>Save &amp;as...</source>
+        <translation>Сохранить &amp;как ...</translation>
+    </message>
+    <message>
+        <source>&amp;Print</source>
+        <translation>&amp;Печать</translation>
+    </message>
+    <message>
+        <source>E&amp;xit</source>
+        <translation>В&amp;ыход</translation>
+    </message>
+    <message>
+        <source>Undo</source>
+        <translation>Отменить</translation>
+    </message>
+    <message>
+        <source>Redo</source>
+        <translation>Повторить</translation>
+    </message>
+    <message>
+        <source>Cut</source>
+        <translation>Вырезать</translation>
+    </message>
+    <message>
+        <source>Copy</source>
+        <translation>Скопировать</translation>
+    </message>
+    <message>
+        <source>Paste</source>
+        <translation>Вставить</translation>
+    </message>
+    <message>
+        <source>Find</source>
+        <translation>Найти</translation>
+    </message>
+    <message>
+        <source>New form</source>
+        <translation>Новая форма</translation>
+    </message>
+    <message>
+        <source>New field</source>
+        <translation>Новое поле</translation>
+    </message>
+    <message>
+        <source>New table</source>
+        <translation>Новая таблица</translation>
+    </message>
+    <message>
+        <source>New in group</source>
+        <translation>Новый в группе</translation>
+    </message>
+    <message>
+        <source>Image Collection</source>
+        <translation>Набор значков</translation>
+    </message>
+    <message>
+        <source>&amp;Windows</source>
+        <translation>&amp;Окна</translation>
+    </message>
+    <message>
+        <source>&amp;Help</source>
+        <translation>&amp;Помощь</translation>
+    </message>
+    <message>
+        <source>&amp;About</source>
+        <translation>&amp;О программе</translation>
+    </message>
+    <message>
+        <source>&amp;Cascade</source>
+        <translation>&amp;Каскадировать</translation>
+    </message>
+    <message>
+        <source>&amp;Tile</source>
+        <translation>В &amp;ряд</translation>
+    </message>
+    <message>
+        <source>Tile &amp;horizontal</source>
+        <translation>В ряд &amp;горизонтально</translation>
+    </message>
+    <message>
+        <source>Move Up</source>
+        <translation>Поднять</translation>
+    </message>
+    <message>
+        <source>Move Down</source>
+        <translation>Опустить</translation>
+    </message>
+    <message>
+        <source>New Group</source>
+        <translation>Новая Группа</translation>
+    </message>
+    <message>
+        <source>Action</source>
+        <translation>Действие</translation>
+    </message>
+    <message>
+        <source>New Submenu</source>
+        <translation>Новое подменю</translation>
+    </message>
+    <message>
+        <source>New Command</source>
+        <translation>Новая команда</translation>
+    </message>
+    <message>
+        <source>New Separator</source>
+        <translation>Новый разделитель</translation>
+    </message>
+    <message>
+        <source>Clear dead aliases</source>
+        <translation>Очистить лишние алиасы</translation>
+    </message>
+    <message>
+        <source>Add</source>
+        <translation>Добавить</translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas configurator&lt;/h4&gt; is a programm&lt;br&gt;for adjusting accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2004 Leader Infotech,&lt;br&gt;Valery Grazdankin, Andrey Paskal.&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.linux.ru.net&quot;&gt;http://ananas.linux.ru.net&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</source>
+        <translation type="obsolete">&lt;h4&gt;Ананас.Дизайнер&lt;/h4&gt; программа&lt;br&gt;для настройки бизнес схем учетной системы&lt;br&gt;&lt;br&gt;Copyright 2003-2005 Leader Infotech,&lt;br&gt;Валерий Гражданкин&lt;br&gt;Copyright 2003-2005, Проект Ананас, Андрей Паскаль.&lt;br&gt;Лицензия: GPL&lt;br&gt;&lt;br&gt;тех.поддержка:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Веб сайт:&lt;br&gt;&lt;a href=&quot;http://ananas.linux.ru.net&quot;&gt;http://ananas.linux.ru.net&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</translation>
+    </message>
+    <message>
+        <source>Index</source>
+        <translation type="obsolete">Индекс</translation>
+    </message>
+    <message>
+        <source>About</source>
+        <translation type="obsolete">О программе</translation>
+    </message>
+    <message>
+        <source>Create new configuration</source>
+        <translation>Создать новую схему</translation>
+    </message>
+    <message>
+        <source>Open configuration</source>
+        <translation>Открыть схему</translation>
+    </message>
+    <message>
+        <source>Save configuration changes</source>
+        <translation type="obsolete">Сохранить изменения</translation>
+    </message>
+    <message>
+        <source>Contents</source>
+        <translation type="obsolete">Содержание</translation>
+    </message>
+    <message>
+        <source>&amp;Contents...</source>
+        <translation type="obsolete">&amp;Содержание...</translation>
+    </message>
+    <message>
+        <source>&amp;Index...</source>
+        <translation type="obsolete">&amp;Индекс...</translation>
+    </message>
+    <message>
+        <source>Cteate/Update DB</source>
+        <translation type="obsolete">Создать/обновить БД</translation>
+    </message>
+    <message>
+        <source>New button</source>
+        <translation type="obsolete">Новая кнопка</translation>
+    </message>
+    <message>
+        <source>New attribute</source>
+        <translation type="obsolete">Новый атрибут</translation>
+    </message>
+    <message>
+        <source>New Field</source>
+        <translation type="obsolete">Новое поле</translation>
+    </message>
+    <message>
+        <source>Tabs</source>
+        <translation>Закладки</translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Вырезать</source>
+        <translation></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Копировать</source>
+        <translation></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Вставить</source>
+        <translation></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Содержание</source>
+        <translation></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>&amp;Содержание...</source>
+        <translation>&amp;Содержание...</translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Индекс</source>
+        <translation></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>&amp;Индекс...</source>
+        <translation>&amp;Индекс...</translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>О программе</source>
+        <translation></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>&amp;О программе</source>
+        <translation>&amp;О программе</translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Конфигурация</source>
+        <translation>Бизнес схема</translation>
+    </message>
+    <message>
+        <source>Save configuration</source>
+        <translation>Сохранить схему</translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Создать/обновить БД</source>
+        <translation></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Новая кнопка</source>
+        <translation></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Новый атрибут</source>
+        <translation></translation>
+    </message>
+    <message encoding="UTF-8">
+        <source>Новое поле</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Add new role</source>
+        <translation>Добавить новую роль</translation>
+    </message>
+    <message>
+        <source>Clear dead roles</source>
+        <translation>Убрать неиспользуемые роли</translation>
+    </message>
+    <message>
+        <source>Edit role</source>
+        <translation>Изменить роль</translation>
+    </message>
+    <message>
+        <source>&amp;Window</source>
+        <translation type="obsolete">&amp;Окно</translation>
+    </message>
+    <message>
+        <source>Windows</source>
+        <translation type="obsolete">Окна</translation>
+    </message>
+    <message>
+        <source>Goto</source>
+        <translation type="obsolete">Переход</translation>
+    </message>
+    <message>
+        <source>&amp;Open</source>
+        <translation>&amp;Открыть</translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas configurator&lt;/h4&gt; is a programm&lt;br&gt;for adjusting accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2004 Leader Infotech,&lt;br&gt;Valery Grazdankin, Andrey Paskal.&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</source>
+        <translation type="obsolete">&lt;h4&gt;Ананас.Дизайнер&lt;/h4&gt; это программа &lt;br&gt;для настройки бизнес схем.&lt;br&gt;&lt;br&gt;Copyright 2003-2004 Leader Infotech,&lt;br&gt;Валерий Гражданкин, Андрей Паскаль.&lt;br&gt;Лицензия: GPL&lt;br&gt;&lt;br&gt;техническая поддержка:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Веб сайты:&lt;br&gt;&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas configurator %1&lt;/h4&gt; is a programm&lt;br&gt;for adjusting accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2004 Leader Infotech,&lt;br&gt;Valery Grazdankin, Andrey Paskal.&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</source>
+        <translation type="obsolete">&lt;h4&gt;Ананас.Дизайнер  %1&lt;/h4&gt; это программа &lt;br&gt;для настройки бизнес схем.&lt;br&gt;&lt;br&gt;Copyright 2003-2006 Leader Infotech,&lt;br&gt;Валерий Гражданкин, Андрей Паскаль.&lt;br&gt;Лицензия: GPL&lt;br&gt;&lt;br&gt;техническая поддержка:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Веб сайты:&lt;br&gt;&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</translation>
+    </message>
+    <message>
+        <source>About Ananas.Designer</source>
+        <translation>О программе Ананас.Дизайнер</translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas.Designer %1&lt;/h4&gt; is a programm&lt;br&gt;for adjusting accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2006 Leader Infotech, Valery Grazdankin, Copyright 2003-2006 Project Ananas, Andrey Paskal, Grigory Panov, Andrey Strelnikov&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</source>
+        <translation type="obsolete">&lt;h4&gt;Ананас.Дизайнер %1&lt;/h4&gt; &lt;br&gt;
+Ананас.Дизайнер -  программа &lt;br&gt;
+для настройки бизнес схем.&lt;br&gt;
+Лицензия: GPL&lt;br&gt;
+Copyright 2003-2006 Лидер Инфотех, Валерий Гражданкин&lt;br&gt;
+Copyright 2003-2006 Проект Ананас, Андрей Паскаль, Григорий Панов, Андрей Стрельников&lt;br&gt;
+&lt;br&gt;
+&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;
+&lt;br&gt;Доступные расширения:&lt;br&gt;%2</translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas.Designer %1&lt;/h4&gt; is a programm&lt;br&gt;for adjusting accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2006 Leader Infotech, Valery Grazdankin &lt;br&gt;Copyright 2003-2006 Project Ananas, Andrey Paskal, Grigory Panov, Andrey Strelnikov&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;&lt;br&gt;Avalable extensions:&lt;br&gt;%2</source>
+        <translation>&lt;h4&gt;Ананас.Дизайнер %1&lt;/h4&gt; &lt;br&gt;
+Ананас.Дизайнер -  программа для настройки бизнес схем.&lt;br&gt;
+&lt;br&gt;
+Лицензия: GPL&lt;br&gt;
+Copyright 2003-2006 Лидер Инфотех, Валерий Гражданкин&lt;br&gt;
+Copyright 2003-2006 Проект Ананас, Андрей Паскаль, Григорий Панов, Андрей Стрельников&lt;br&gt;
+&lt;br&gt;
+Техподдержка:&lt;br&gt;
+lider-infotech@narod.ru&lt;br&gt;
+app@linux.ru.net&lt;br&gt;
+Сайты:&lt;br&gt;
+&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;
+&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;
+&lt;br&gt;
+Доступные расширения:&lt;br&gt;
+%2</translation>
+    </message>
+</context>
+<context>
+    <name>PixmapPreview</name>
+    <message>
+        <source>This is not a pixmap</source>
+        <translation>Это не картинка</translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <source>Dialog forms designer</source>
+        <translation>Редактор форм диалога</translation>
+    </message>
+    <message>
+        <source>Catalogues</source>
+        <translation>Справочники</translation>
+    </message>
+    <message>
+        <source>Documents</source>
+        <translation>Документы</translation>
+    </message>
+    <message>
+        <source>Reports</source>
+        <translation>Отчеты</translation>
+    </message>
+    <message>
+        <source>Journals</source>
+        <translation>Журналы</translation>
+    </message>
+    <message>
+        <source>Information registers</source>
+        <translation>Информационные регистры</translation>
+    </message>
+    <message>
+        <source>Accumulation registers</source>
+        <translation>Накопительные регистры</translation>
+    </message>
+    <message>
+        <source>Header</source>
+        <translation>Шапка</translation>
+    </message>
+    <message>
+        <source>Tables</source>
+        <translation>таблицы</translation>
+    </message>
+    <message>
+        <source>Forms</source>
+        <translation>Формы</translation>
+    </message>
+    <message>
+        <source>Web forms</source>
+        <translation>Веб-формы</translation>
+    </message>
+    <message>
+        <source>Columns</source>
+        <translation>Столбцы</translation>
+    </message>
+    <message>
+        <source>Resources</source>
+        <translation>Ресурсы</translation>
+    </message>
+    <message>
+        <source>Dimensions</source>
+        <translation>Измерения</translation>
+    </message>
+    <message>
+        <source>Information</source>
+        <translation>Информация</translation>
+    </message>
+    <message>
+        <source>Element</source>
+        <translation>Элемент</translation>
+    </message>
+    <message>
+        <source>Group</source>
+        <translation>Группа</translation>
+    </message>
+    <message>
+        <source>New field</source>
+        <translation>Новое поле</translation>
+    </message>
+    <message>
+        <source>New document</source>
+        <translation>Новый документ</translation>
+    </message>
+    <message>
+        <source>New catalogue</source>
+        <translation>Новый справочник</translation>
+    </message>
+    <message>
+        <source>New journal</source>
+        <translation>Новый журнал</translation>
+    </message>
+    <message>
+        <source>New information register</source>
+        <translation>Новый информационный регистр</translation>
+    </message>
+    <message>
+        <source>New accumulation register</source>
+        <translation>Новый накопительный регистр</translation>
+    </message>
+    <message>
+        <source>New report</source>
+        <translation>Новый отчет</translation>
+    </message>
+    <message>
+        <source>New form</source>
+        <translation>Новая форма</translation>
+    </message>
+    <message>
+        <source>New web form</source>
+        <translation>Новая веб-форма</translation>
+    </message>
+    <message>
+        <source>New Table</source>
+        <translation>Новая таблица</translation>
+    </message>
+    <message>
+        <source>New Command</source>
+        <translation>Новая команда</translation>
+    </message>
+    <message>
+        <source>New Submenu</source>
+        <translation>Новое подменю</translation>
+    </message>
+    <message>
+        <source>Interface</source>
+        <translation type="obsolete">Интерфейс</translation>
+    </message>
+    <message>
+        <source>New Action Group</source>
+        <translation>Новая группа действий</translation>
+    </message>
+    <message>
+        <source>New Action</source>
+        <translation>Новое действие</translation>
+    </message>
+    <message>
+        <source>Actions</source>
+        <translation>Действия</translation>
+    </message>
+    <message>
+        <source>selection</source>
+        <translation type="obsolete">выбор</translation>
+    </message>
+    <message>
+        <source>default</source>
+        <translation>предопределенный</translation>
+    </message>
+    <message>
+        <source>Init application</source>
+        <translation>Инициализация приложения</translation>
+    </message>
+    <message>
+        <source>Init forms designer</source>
+        <translation>Инициализация редактора форм</translation>
+    </message>
+    <message>
+        <source>-------------------</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>New Popup menu</source>
+        <translation>Новое всплывающее меню</translation>
+    </message>
+    <message>
+        <source>New tool bar</source>
+        <translation>Новая панель инструментов</translation>
+    </message>
+    <message>
+        <source>Toolbars</source>
+        <translation>Панели инструментов</translation>
+    </message>
+    <message>
+        <source>Main menu</source>
+        <translation>Главное меню</translation>
+    </message>
+    <message>
+        <source>Popup menus</source>
+        <translation>Всплывающие меню</translation>
+    </message>
+    <message>
+        <source>header</source>
+        <translation>заголовок</translation>
+    </message>
+    <message>
+        <source>New Column</source>
+        <translation>Новый столбец</translation>
+    </message>
+    <message>
+        <source>Elements list dialog</source>
+        <translation>Диалог списка элементов</translation>
+    </message>
+    <message>
+        <source>Element dialog</source>
+        <translation>Диалог элемента</translation>
+    </message>
+    <message>
+        <source>Group dialog</source>
+        <translation>Диалог Группы</translation>
+    </message>
+    <message>
+        <source>embedded editor</source>
+        <translation>Встроенный редактор</translation>
+    </message>
+    <message>
+        <source>&amp;Windows</source>
+        <translation type="obsolete">&amp;Окна</translation>
+    </message>
+    <message>
+        <source>Unknown</source>
+        <translation>Неизвестно</translation>
+    </message>
+    <message>
+        <source>Numberic</source>
+        <translation>Числовой</translation>
+    </message>
+    <message>
+        <source> Ananas List View Item %1 is null</source>
+        <translation>Элемент %1 списка равен null</translation>
+    </message>
+    <message>
+        <source>Ananas List View Item swaping</source>
+        <translation>Обмен пунктов списка</translation>
+    </message>
+    <message>
+        <source>any files (*)</source>
+        <translation>все файлы (*)</translation>
+    </message>
+    <message>
+        <source>New &amp;Group</source>
+        <translation>Новая &amp;Группа</translation>
+    </message>
+    <message>
+        <source>New &amp;Action</source>
+        <translation>Новое &amp;действие</translation>
+    </message>
+</context>
+<context>
+    <name>aAliasEditor</name>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+</context>
+<context>
+    <name>aMetadataTreeView</name>
+    <message>
+        <source>&amp;New</source>
+        <translation>&amp;Новый</translation>
+    </message>
+</context>
+<context>
+    <name>aRoleEditor</name>
+    <message>
+        <source>Read</source>
+        <translation>Прочитать</translation>
+    </message>
+    <message>
+        <source>Write</source>
+        <translation>Записать</translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation>Удалить</translation>
+    </message>
+    <message>
+        <source>Turn On</source>
+        <translation>Включить</translation>
+    </message>
+    <message>
+        <source>Turn Off</source>
+        <translation>Выключить</translation>
+    </message>
+</context>
+<context>
+    <name>ananasTreeView</name>
+    <message>
+        <source>&lt;font color=darkblue&gt;&lt;u&gt;&lt;b&gt;Context Menu&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;</source>
+        <translation>&lt;font color=darkblue&gt;&lt;u&gt;&lt;b&gt;Контекстное меню&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;</translation>
+    </message>
+    <message>
+        <source>&amp;Rename</source>
+        <translation>Пере&amp;именовать</translation>
+    </message>
+    <message>
+        <source>&amp;Edit</source>
+        <translation>&amp;Редактировать</translation>
+    </message>
+    <message>
+        <source>&amp;Delete</source>
+        <translation>&amp;Удалить</translation>
+    </message>
+    <message>
+        <source>&amp;MoveUp</source>
+        <translation>&amp;Поднять</translation>
+    </message>
+    <message>
+        <source>&amp;MoveDown</source>
+        <translation>&amp;Опустить</translation>
+    </message>
+    <message>
+        <source>&amp;SaveItem</source>
+        <translation>&amp;Сохранить элемент в файл</translation>
+    </message>
+    <message>
+        <source>&amp;LoadItem</source>
+        <translation>&amp;Загрузить элемент из файла</translation>
+    </message>
+</context>
+<context>
+    <name>dEditAReg</name>
+    <message>
+        <source>Accumulating register</source>
+        <translation>Накопительный регистр</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation>Имя:</translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation>Описание:</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation>Язык</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Accumulation register:</source>
+        <translation>Накопительный регистр:</translation>
+    </message>
+</context>
+<context>
+    <name>dEditAction</name>
+    <message>
+        <source>Action</source>
+        <translation>Действие</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation>Описание:</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation>Тип</translation>
+    </message>
+    <message>
+        <source>standart command</source>
+        <translation>стандартная команда</translation>
+    </message>
+    <message>
+        <source>user script</source>
+        <translation>скрипт</translation>
+    </message>
+    <message>
+        <source>Enabled icon</source>
+        <translation>Значек при доступности</translation>
+    </message>
+    <message>
+        <source>...</source>
+        <translation>...</translation>
+    </message>
+    <message>
+        <source>X</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Disabled icon</source>
+        <translation>Значек при недоступности</translation>
+    </message>
+    <message>
+        <source>Execute</source>
+        <translation>Выполнить</translation>
+    </message>
+    <message>
+        <source>Object</source>
+        <translation>Объект</translation>
+    </message>
+    <message>
+        <source>Params</source>
+        <translation>Параметры</translation>
+    </message>
+    <message>
+        <source>new</source>
+        <translation>новый</translation>
+    </message>
+    <message>
+        <source>edit</source>
+        <translation>редактировать</translation>
+    </message>
+    <message>
+        <source>execute</source>
+        <translation>выполнить</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation>Язык</translation>
+    </message>
+    <message>
+        <source>Action:</source>
+        <translation>Действие:</translation>
+    </message>
+    <message>
+        <source>Open image dialog</source>
+        <translation>Выбрать картинку</translation>
+    </message>
+    <message>
+        <source>Form</source>
+        <translation>Форма</translation>
+    </message>
+    <message>
+        <source>view</source>
+        <translation>просмотр</translation>
+    </message>
+    <message>
+        <source>Action_2</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Choose an image</source>
+        <translation>Выбрать изображение</translation>
+    </message>
+    <message>
+        <source>external script</source>
+        <translation>внешний скрипт</translation>
+    </message>
+    <message>
+        <source>File name</source>
+        <translation>Имя файла</translation>
+    </message>
+</context>
+<context>
+    <name>dEditCat</name>
+    <message>
+        <source>Catalogue</source>
+        <translation>Справочник</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation>Имя:</translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation>Описание:</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation>Язык</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Catalogue:</source>
+        <translation>Справочник:</translation>
+    </message>
+    <message>
+        <source>Element string view</source>
+        <translation>Текстовое представление элемента</translation>
+    </message>
+    <message>
+        <source>Group string view</source>
+        <translation>Текстовое представление группы</translation>
+    </message>
+    <message>
+        <source>Access</source>
+        <translation>Доступ</translation>
+    </message>
+    <message>
+        <source>Read</source>
+        <translation>Читать</translation>
+    </message>
+    <message>
+        <source>Write</source>
+        <translation>Изменять</translation>
+    </message>
+</context>
+<context>
+    <name>dEditCfg</name>
+    <message>
+        <source>mysql</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>postgres</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>MySQL</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Postgres</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Configuration parameters</source>
+        <translation type="obsolete">Параметры схемы</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Author</source>
+        <translation>Автор</translation>
+    </message>
+    <message>
+        <source>Date</source>
+        <translation>Дата</translation>
+    </message>
+    <message>
+        <source>Description</source>
+        <translation>Описание</translation>
+    </message>
+    <message>
+        <source>User</source>
+        <translation>Пользователь</translation>
+    </message>
+    <message>
+        <source>Data base server user</source>
+        <translation>Пользователь сервера баз данных</translation>
+    </message>
+    <message>
+        <source>Data base password</source>
+        <translation>Пароль сервера баз данных</translation>
+    </message>
+    <message>
+        <source>Data base type</source>
+        <translation>Тип базы данных</translation>
+    </message>
+    <message>
+        <source>Unknown</source>
+        <translation>Неизвестно</translation>
+    </message>
+    <message>
+        <source>Data base server address</source>
+        <translation>Адрес сервера баз данных</translation>
+    </message>
+    <message>
+        <source>Data base name</source>
+        <translation>Имя базы данных</translation>
+    </message>
+    <message>
+        <source>Work directory</source>
+        <translation>Рабочий каталог</translation>
+    </message>
+    <message>
+        <source>Configuration file name</source>
+        <translation>Имя файла метаданных</translation>
+    </message>
+    <message>
+        <source>Data base server port</source>
+        <translation>Порт сервера баз данных</translation>
+    </message>
+    <message>
+        <source>Global module</source>
+        <translation>Глобальный модуль</translation>
+    </message>
+    <message>
+        <source>Data base header</source>
+        <translation>Заголовок базы данных</translation>
+    </message>
+    <message>
+        <source>Configuration parameters: </source>
+        <translation type="obsolete">Параметры схемы:</translation>
+    </message>
+    <message>
+        <source>Business scheme parameters</source>
+        <translation>Параметры бизнес схемы</translation>
+    </message>
+    <message>
+        <source>Business scheme parameters: </source>
+        <translation>Параметры бизнес схемы:</translation>
+    </message>
+</context>
+<context>
+    <name>dEditColumns</name>
+    <message>
+        <source>Columns</source>
+        <translation>Столбцы</translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation>Имя:</translation>
+    </message>
+    <message>
+        <source>Action</source>
+        <translation>Действие</translation>
+    </message>
+    <message>
+        <source>Column:</source>
+        <translation>Столбец:</translation>
+    </message>
+</context>
+<context>
+    <name>dEditCommand</name>
+    <message>
+        <source>Command</source>
+        <translation>Команда</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation>Описание:</translation>
+    </message>
+    <message>
+        <source>Hot Key:</source>
+        <translation>Клавиатурная комбинация:</translation>
+    </message>
+    <message>
+        <source>Ctrl</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Alt</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Shift</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>1</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>2</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>3</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>4</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>5</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>6</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>7</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>8</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>9</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>0</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>A</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>B</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>C</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>D</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>E</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>F</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>G</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>H</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>I</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>J</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>K</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>L</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>M</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>N</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>O</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>P</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Q</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>R</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>S</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>T</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>U</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>V</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>W</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>X</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Y</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Z</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Type:</source>
+        <translation>Тип:</translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation>Имя:</translation>
+    </message>
+    <message>
+        <source>Actions</source>
+        <translation>Действия</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation>Язык</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Command:</source>
+        <translation>Команда:</translation>
+    </message>
+    <message>
+        <source>Menu text</source>
+        <translation>Текст меню</translation>
+    </message>
+</context>
+<context>
+    <name>dEditDialog</name>
+    <message>
+        <source>Form</source>
+        <translation>Форма</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Module file</source>
+        <translation>Файл модуля</translation>
+    </message>
+    <message>
+        <source>Form file</source>
+        <translation>Файл формы</translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation>Описание:</translation>
+    </message>
+    <message>
+        <source>Design</source>
+        <translation>Дизайн</translation>
+    </message>
+    <message>
+        <source>View</source>
+        <translation>Просмотр</translation>
+    </message>
+    <message>
+        <source>Module</source>
+        <translation>Модуль</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation>Язык</translation>
+    </message>
+    <message>
+        <source>Form:</source>
+        <translation>Форма:</translation>
+    </message>
+    <message>
+        <source>Default use for:</source>
+        <translation type="obsolete">По умолчанию используется для:</translation>
+    </message>
+    <message>
+        <source>no use</source>
+        <translation type="obsolete">не использовать</translation>
+    </message>
+    <message>
+        <source>create new</source>
+        <translation type="obsolete">создать новый</translation>
+    </message>
+    <message>
+        <source>view</source>
+        <translation type="obsolete">просмотр</translation>
+    </message>
+    <message>
+        <source>Form mode:</source>
+        <translation>Режим формы:</translation>
+    </message>
+    <message>
+        <source>Use for:</source>
+        <translation>Использовать для:</translation>
+    </message>
+    <message>
+        <source>Dialog</source>
+        <translation>Диалог</translation>
+    </message>
+    <message>
+        <source>New</source>
+        <translation>Новый</translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation>Редактировать</translation>
+    </message>
+    <message>
+        <source>Selection</source>
+        <translation>Выбор</translation>
+    </message>
+    <message>
+        <source>Read only</source>
+        <translation>Только чтение</translation>
+    </message>
+    <message>
+        <source>Designer</source>
+        <translation>Редактор диалогов</translation>
+    </message>
+    <message>
+        <source>Preview</source>
+        <translation>Просмотр</translation>
+    </message>
+    <message>
+        <source>dEditDialog edit form</source>
+        <translation>Форма редактирования dEditDialog</translation>
+    </message>
+    <message>
+        <source>dEditDialog form file does not exists</source>
+        <translation>Не найден файл dEditDialog</translation>
+    </message>
+    <message>
+        <source>dEditDialog create form file from metadata</source>
+        <translation>dEditDialog - файл формы из метаданных</translation>
+    </message>
+    <message>
+        <source>dEditDialog create new form file from template</source>
+        <translation>dEditDialog  - файл формы из шаблона</translation>
+    </message>
+    <message>
+        <source>dEditDialog open file %1 for write</source>
+        <translation>dEditDialog - редактируем файл %1 </translation>
+    </message>
+    <message>
+        <source>dEditDialog open file %1 for read from templates directory %2</source>
+        <translation>dEditDialog - Открываем для чтения файл %1 из каталога шаблонов </translation>
+    </message>
+    <message>
+        <source>dEditDialog file %1 not exists</source>
+        <translation>dEditDialog - Файл %1 не найден</translation>
+    </message>
+    <message>
+        <source>dEditDialog show formdesigner</source>
+        <translation>dEditDialog - Открываем редактор диалогов</translation>
+    </message>
+</context>
+<context>
+    <name>dEditDoc</name>
+    <message>
+        <source>Document</source>
+        <translation>Документ</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation>Описание:</translation>
+    </message>
+    <message>
+        <source>Module</source>
+        <translation>Модуль</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Document:</source>
+        <translation>Документ:</translation>
+    </message>
+    <message>
+        <source>String view</source>
+        <translation>Текстовое представление</translation>
+    </message>
+    <message>
+        <source>Access</source>
+        <translation>Доступ</translation>
+    </message>
+    <message>
+        <source>Read</source>
+        <translation>Читать</translation>
+    </message>
+    <message>
+        <source>Write</source>
+        <translation>Изменять</translation>
+    </message>
+</context>
+<context>
+    <name>dEditField</name>
+    <message>
+        <source>Field</source>
+        <translation>Поле</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Description</source>
+        <translation>Описание</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation>Язык</translation>
+    </message>
+    <message>
+        <source>Unknown</source>
+        <translation>Неизвестно</translation>
+    </message>
+    <message>
+        <source>Field:</source>
+        <translation>Поле:</translation>
+    </message>
+    <message>
+        <source>Sum</source>
+        <translation>Сумма</translation>
+    </message>
+    <message>
+        <source>Width</source>
+        <translation>Ширина</translation>
+    </message>
+    <message>
+        <source>Decimals</source>
+        <translation>Десятичные</translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation>Тип</translation>
+    </message>
+    <message>
+        <source>Flags</source>
+        <translation>Флаг</translation>
+    </message>
+    <message>
+        <source>Sort</source>
+        <translation>Сорт</translation>
+    </message>
+    <message>
+        <source>Positive</source>
+        <translation>Положительное</translation>
+    </message>
+    <message>
+        <source>Not null</source>
+        <translation>Не нулевое</translation>
+    </message>
+    <message>
+        <source>Saldo source</source>
+        <translation>Источник остатков</translation>
+    </message>
+</context>
+<context>
+    <name>dEditIReg</name>
+    <message>
+        <source>Information register</source>
+        <translation>Информационный регистр</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation>Имя:</translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation>Описание:</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation>Язык</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Information register:</source>
+        <translation>Информационный регистр:</translation>
+    </message>
+    <message>
+        <source>Don&apos;t delete record in unconduct</source>
+        <translation>Не удалять записи при отмене проведения документа</translation>
+    </message>
+</context>
+<context>
+    <name>dEditJournal</name>
+    <message>
+        <source>Journal</source>
+        <translation>Журнал</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation>Имя:</translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation>Описание:</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Journal:</source>
+        <translation>Журнал:</translation>
+    </message>
+    <message>
+        <source>Type:</source>
+        <translation>Тип:</translation>
+    </message>
+    <message>
+        <source>Special</source>
+        <translation>Специальный</translation>
+    </message>
+    <message>
+        <source>Othes</source>
+        <translation>Другой</translation>
+    </message>
+    <message>
+        <source>Documents</source>
+        <translation>Документы</translation>
+    </message>
+    <message>
+        <source>Action</source>
+        <translation>Действие</translation>
+    </message>
+    <message>
+        <source>Action_2</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Access</source>
+        <translation>Доступ</translation>
+    </message>
+    <message>
+        <source>Read</source>
+        <translation>Читать</translation>
+    </message>
+    <message>
+        <source>Write</source>
+        <translation>Изменять</translation>
+    </message>
+</context>
+<context>
+    <name>dEditLang</name>
+    <message>
+        <source>Language</source>
+        <translation>Язык</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Tag:</source>
+        <translation>Метка:</translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation>Имя:</translation>
+    </message>
+    <message>
+        <source>Translation file:</source>
+        <translation>Файл перевода:</translation>
+    </message>
+    <message>
+        <source>Language:</source>
+        <translation>Язык:</translation>
+    </message>
+</context>
+<context>
+    <name>dEditReport</name>
+    <message>
+        <source>Report</source>
+        <translation>Отчет</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation>Имя:</translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation>Описание:</translation>
+    </message>
+    <message>
+        <source>Module</source>
+        <translation>Модуль</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation>Язык</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Report:</source>
+        <translation>Отчет:</translation>
+    </message>
+</context>
+<context>
+    <name>dEditRole</name>
+    <message>
+        <source>Role</source>
+        <translation>Роль</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation>Описание:</translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation>Имя:</translation>
+    </message>
+    <message>
+        <source>Role:</source>
+        <translation>Роль:</translation>
+    </message>
+</context>
+<context>
+    <name>dEditToolbar</name>
+    <message>
+        <source>Form1</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Description:</source>
+        <translation>Описание:</translation>
+    </message>
+    <message>
+        <source>Hot Key:</source>
+        <translation>Клавиатурная комбинация:</translation>
+    </message>
+    <message>
+        <source>Ctrl</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Alt</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Shift</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>1</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>2</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>3</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>4</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>5</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>6</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>7</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>8</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>9</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>0</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>A</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>B</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>C</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>D</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>E</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>F</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>G</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>H</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>I</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>J</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>K</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>L</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>M</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>N</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>O</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>P</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Q</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>R</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>S</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>T</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>U</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>V</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>W</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>X</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Y</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Z</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Type:</source>
+        <translation>Тип:</translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation>Имя:</translation>
+    </message>
+    <message>
+        <source>Actions</source>
+        <translation>ДействияДействия</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Lang</source>
+        <translation>Язык</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Command:</source>
+        <translation>Команда:</translation>
+    </message>
+</context>
+<context>
+    <name>dEditWebForm</name>
+    <message>
+        <source>Web Form</source>
+        <translation>Веб-форма</translation>
+    </message>
+    <message>
+        <source>Common</source>
+        <translation>Общий</translation>
+    </message>
+    <message>
+        <source>Description</source>
+        <translation>Описание</translation>
+    </message>
+    <message>
+        <source>Name:</source>
+        <translation>Имя:</translation>
+    </message>
+    <message>
+        <source>Form editor</source>
+        <translation>Редактор форм</translation>
+    </message>
+    <message>
+        <source>Client module</source>
+        <translation>Модуль веб клиента</translation>
+    </message>
+    <message>
+        <source>Server module</source>
+        <translation>Модуль веб сервера</translation>
+    </message>
+    <message>
+        <source>Aliases</source>
+        <translation>Псевдонимы</translation>
+    </message>
+    <message>
+        <source>Web form:</source>
+        <translation>Веб-форма:</translation>
+    </message>
+</context>
+</TS>
diff --git a/translations/ananas-engine-en.ts b/translations/ananas-engine-en.ts
new file mode 100644 (file)
index 0000000..d7df61d
--- /dev/null
@@ -0,0 +1,48 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>MainForm</name>
+    <message>
+        <source>About</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Help</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ananas</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Windows</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Cascade</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Tile</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Tile &amp;horizontal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>About Ananas.Engine program</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas.Engin %1&lt;/h4&gt; is a programm&lt;br&gt;for executing application of accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2006 Leader Infotech, Valery Grazdankin, Copyright 2003-2006 Project Ananas, Andrey Paskal, Grigory Panov, Andrey Strelnikov&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;&lt;br&gt;Avalable extensions:&lt;br&gt;%2</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <source>Init application</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+</TS>
diff --git a/translations/ananas-engine-ru.ts b/translations/ananas-engine-ru.ts
new file mode 100644 (file)
index 0000000..df55bf9
--- /dev/null
@@ -0,0 +1,105 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>MainForm</name>
+    <message>
+        <source>About</source>
+        <translation>О программе</translation>
+    </message>
+    <message>
+        <source>&amp;Help</source>
+        <translation>&amp;Помощь</translation>
+    </message>
+    <message>
+        <source>About Ananas engine program</source>
+        <translation type="obsolete">О программе  Ананас</translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas engine&lt;/h4&gt; is a programm&lt;br&gt;for executing application of accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2004 Leader Infotech,&lt;br&gt;Valery Grazdankin, Andrey Pascal.&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@altlinux.ru&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.linux.ru.net&quot;&gt;http://ananas.linux.ru.net&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</source>
+        <translation type="obsolete">&lt;h4&gt;Оболочка АНАНАС&lt;/h4&gt; это программа&lt;br&gt;для выполнения приложений системы автоматизации учета&lt;br&gt;&lt;br&gt;Права 2003-2004 Лидер ИнфоТех,&lt;br&gt;Валерий Гражданкин, Андрей Паскаль.&lt;br&gt;Лицензия: GPL&lt;br&gt;&lt;br&gt;техническая поддержка:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@altlinux.ru&lt;br&gt;Веб сайты:&lt;br&gt;&lt;a href=&quot;http://ananas.linux.ru.net&quot;&gt;http://ananas.linux.ru.net&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</translation>
+    </message>
+    <message>
+        <source>Ananas </source>
+        <translation type="obsolete">Ананас</translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas engine&lt;/h4&gt; is a programm&lt;br&gt;for executing application of accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2004 Leader Infotech,&lt;br&gt;Valery Grazdankin, Andrey Paskal.&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.linux.ru.net&quot;&gt;http://ananas.linux.ru.net&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</source>
+        <translation type="obsolete">&lt;h4&gt;Ананас&lt;/h4&gt; 
+Ананас - платформа автоматизации учета.&lt;br&gt;
+Лицензия: GPL&lt;br&gt;
+Copyright 2003-2005 Лидер Инфотех, Валерий Гражданкин&lt;br&gt;
+Copyright 2003-2005 Проект Ананас, Андрей Паскаль, Григорий Панов, Андрей Стрельников....&lt;br&gt;
+&lt;br&gt;
+&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</translation>
+    </message>
+    <message>
+        <source>Ananas</source>
+        <translation>Ананас</translation>
+    </message>
+    <message>
+        <source>&amp;Windows</source>
+        <translation>&amp;Окна</translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas engine&lt;/h4&gt; is a programm&lt;br&gt;for executing application of accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2004 Leader Infotech,&lt;br&gt;Valery Grazdankin, Andrey Paskal.&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</source>
+        <translation type="obsolete">&lt;h4&gt;Ананас&lt;/h4&gt; 
+Ананас - платформа автоматизации учета.&lt;br&gt;
+Лицензия: GPL&lt;br&gt;
+Copyright 2003-2005 Лидер Инфотех, Валерий Гражданкин&lt;br&gt;
+Copyright 2003-2005 Проект Ананас, Андрей Паскаль, Григорий Панов, Андрей Стрельников....&lt;br&gt;
+&lt;br&gt;
+&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</translation>
+    </message>
+    <message>
+        <source>&amp;Cascade</source>
+        <translation>&amp;Каскадом</translation>
+    </message>
+    <message>
+        <source>&amp;Tile</source>
+        <translation>&amp;Черепицей</translation>
+    </message>
+    <message>
+        <source>Tile &amp;horizontal</source>
+        <translation>Черепицей &amp;горизонтально</translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas engine %1&lt;/h4&gt; is a programm&lt;br&gt;for executing application of accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2004 Leader Infotech,&lt;br&gt;Valery Grazdankin, Andrey Paskal.&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;&lt;br&gt;Avalable extensions:&lt;br&gt;%2</source>
+        <translation type="obsolete">&lt;h4&gt;Ананас %1&lt;/h4&gt; 
+Ананас - платформа автоматизации учета.&lt;br&gt;
+Лицензия: GPL&lt;br&gt;
+Copyright 2003-2006 Лидер Инфотех, Валерий Гражданкин&lt;br&gt;
+Copyright 2003-2006 Проект Ананас, Андрей Паскаль, Григорий Панов, Андрей Стрельников....&lt;br&gt;
+&lt;br&gt;
+&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;</translation>
+    </message>
+    <message>
+        <source>About Ananas.Engine program</source>
+        <translation>О программе Ананас</translation>
+    </message>
+    <message>
+        <source>&lt;h4&gt;Ananas.Engin %1&lt;/h4&gt; is a programm&lt;br&gt;for executing application of accounting automation system&lt;br&gt;&lt;br&gt;Copyright 2003-2006 Leader Infotech, Valery Grazdankin, Copyright 2003-2006 Project Ananas, Andrey Paskal, Grigory Panov, Andrey Strelnikov&lt;br&gt;License: GPL&lt;br&gt;&lt;br&gt;technical support:&lt;br&gt;lider-infotech@narod.ru&lt;br&gt;app@linux.ru.net&lt;br&gt;Web sites:&lt;br&gt;&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;&lt;br&gt;Avalable extensions:&lt;br&gt;%2</source>
+        <translation>&lt;h4&gt;Ананас %1&lt;/h4&gt; 
+Ананас - платформа автоматизации учета.&lt;br&gt;
+&lt;br&gt;
+Лицензия: GPL&lt;br&gt;
+Copyright 2003-2006 Лидер Инфотех, Валерий Гражданкин&lt;br&gt;
+Copyright 2003-2006 Проект Ананас, Андрей Паскаль, Григорий Панов, Андрей Стрельников&lt;br&gt;
+&lt;br&gt;
+Техподдержка:&lt;br&gt;
+lider-infotech@narod.ru&lt;br&gt;
+app@linux.ru.net&lt;br&gt;
+Сайты:&lt;br&gt;
+&lt;a href=&quot;http://ananas.lrn.ru&quot;&gt;http://ananas.lrn.ru&lt;/a&gt;&lt;br&gt;
+&lt;a href=&quot;http://www.leaderit.ru&quot;&gt;http://www.leaderit.ru&lt;/a&gt;&lt;br&gt;
+&lt;br&gt;
+Доступные расширения:&lt;br&gt;
+%2</translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <source>Init application</source>
+        <translation>Инициализация приложения</translation>
+    </message>
+</context>
+</TS>
diff --git a/translations/ananas-lib-en.ts b/translations/ananas-lib-en.ts
new file mode 100644 (file)
index 0000000..1eeaa55
--- /dev/null
@@ -0,0 +1,1518 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>HelpCfgForm</name>
+    <message>
+        <source>Create busines shema</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Make group, item, set item paramert and press Ok button. See http://ananas.lrn.ru/index.php?title=Manual:Disigner for details</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>MessagesWindow</name>
+    <message>
+        <source>Messages window</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <source>Unknown</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Numberic</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Char</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Date</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalogue</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Journal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Information Register</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumuliation Register</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Report</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Field</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Documents</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Element</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Header</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Boolean</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase drop field(s) %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase add field(s) %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase update field(s) %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase query: %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase text: %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase database text: %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase driver text: %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDataTable try set mdobject to null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDataTable get value of unknown field `%1&apos;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDataTable get document prefix to `%1&apos;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aService copy: source file %1 not exist</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aService copy: replace destination file %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aService copy: source file %1 open for read error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aService copy: destination file %1 open for write error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aService copy file %1 to %2 ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aTests file %1 not exists</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aTests file %1 not open for read</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Error read configuration line:%1 col:%2 %3</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDataTable clear filter</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDataTable set filter %1=&apos;%2&apos;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDataTable set filter %1=&apos;%2&apos;, %3 not exist</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aARegister</name>
+    <message>
+        <source>RecordDate</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation Register init</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation Register create main table</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation Register create saldo table</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation Register update</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation register convert datetime from string %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation register not found table %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation register set filter</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation register not found main table</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aBackup</name>
+    <message>
+        <source>Can&apos;t create temporary directory</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t connect to database</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t copy .cfg file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Database import without errors</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t create directory %s</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Invalid resource file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t write resource file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t write file META-INF/manifest.xml</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t copy template file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data export done without errors</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t start zip</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Zip ended anormal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Zip ended with code %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to start zip</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Zip ended with error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t write content.xml</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup create temporary directory %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup import data: unzip</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup unzip</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup filename = %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup workdir=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup copy unzipped business schema file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup copy business schema file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup import data ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup create temporary directory</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup invalid *.rc file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup valid *.rc file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup template %1 %2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup write %1 file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup dump base error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup bump base</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup write manifest.xml</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup zip archive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup export data ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup start unzip</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup unzip dead</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup unzip normal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup zip start error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup zip dead</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup dump tables ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup init rc file  %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup write content.xml</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup dump base to xml compleet</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup save xml %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup create manifest.xml</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup delete file %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup delete directory %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup cleanup temporary files</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup template dir `%1&apos; not exists, try create</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup create template dir `%1&apos; fail</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup create template dir `%1&apos;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aBackup template dir `%1&apos; exists</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aCManifest</name>
+    <message>
+        <source>aCManifest save xml %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCManifest read file `%1&apos;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCManifest read line: %1 column: %2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCManifest invalid manifest</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aCatGroup</name>
+    <message>
+        <source>aCatGroup new group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatGroup new group ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatGroup new group error %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aCatalogue</name>
+    <message>
+        <source>aCatalogue delete ido=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatalogue update</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatalogue update groups error %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatalogue update groups</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatalogue update elements error %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatalogue select group id=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatalogue  new group with id=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatalogue delete element with id=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatalogue delete group with id=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatalogue delete without selection</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCatalogue update group</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aCfg</name>
+    <message>
+        <source>Bad configuration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCfg swap: first element is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCfg swap: second element is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCfg swap element himself</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCfg swap: first parent null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCfg swap: second parent null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCfg swap elements with differernt parents</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalogue</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>DocJournal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Report</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>InfoRegister</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>AccumulationRegister</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCfg saveOneObject: context save to file `%1&apos;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCfg saveOneObject: context is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCfg loadOneObject: invalid cfg file `%1&apos;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aCfg loadOneObject: invalid file name or not permission to file `%1&apos;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aLog setup new id for %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aLog next id is %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aContainer</name>
+    <message>
+        <source>aContainer unzip</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t create temporary directory</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aContainer create temporary directory %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No manifest found!</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aContainer error copy file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aContainer manifest is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t start unzip</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aContainer start unzip</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unzip ended anormal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aContainer unzip dead</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aContainer unzip normal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unzip ended with code %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to start zip</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aContainer zip start error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Zip ended with error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aContainer zip dead</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Zip ended with code %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aContainer delete file %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aContainer delete directory %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aDatabase</name>
+    <message>
+        <source>Uniques table updated
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Documents journal updated
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalogue %s updated
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Document %s updated
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t open database connection
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Users updated
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Users roles updated
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Roles updated
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Rigths updated
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Information registers %s updated
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation registers %s updated
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase open connection to %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase drop database %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase generate new unique number for object type %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase generate new unique number %1 for objecttype %2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase get object type for unique id=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase check indices for %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase search index %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalogue %s processed
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase catalogue %1 import</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase catalogue %1 export</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Document %s processed
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase document %1 import</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase document %1 export</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Information registers %s processed
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase information register %1 import</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase information register %1 export</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Accumulation registers %s processed
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase accumulation register %1 import</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase accumulation register %1 export</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase export table: invalid XML file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase import table: invalid XML file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase import table: table %1 not exists</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase prepared for open connection to %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase open connection failed, try create %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase system database is open</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t create database
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase create database %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase open connection to %1 ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDatabase import table: get table %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aDocJournal</name>
+    <message>
+        <source>aDocJournal md object not exists</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocJournal columns not defined</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocJournal column defined</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocJournal invalid column define</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocJournal delete document with idd=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocJournal new document with idd=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocJournal generated next number for %1 is %2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocJournal document not found with idd=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocJournal document not found with number=%1 and type=%2 </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocJournal select document with number=%1 and md name=%2</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aDocument</name>
+    <message>
+        <source>aDocument have no sysjournal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument new document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument select new table line number</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument new table line number=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument insert new table line</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument delete from sysjournal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument delete from unicues</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument delete table %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument delete table of conducted document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument deleted table not exist</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument deleted table not selected</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument delete table from info register</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument delete table</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument not selected</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument table name is empty</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument update error=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument conducted table update</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument conduct</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument delete from accumulation register</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument aObject::New() ended with error code = %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument metaobject is null=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument new type = %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument New() error while added record in sysJournal =%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Deprecated method call. aDocument::Conduct(...)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Deprecated method call. aDocument::UnConduct()</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Deprecated method call. aDocument::IsConducted()</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDocument::GetDocumentValue(...): Can&apos;t find aDocument</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aIRegister</name>
+    <message>
+        <source>aIRegister metaobject is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aIRegister deleted document have invalid idd</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aIRegister select period from %1 to %2</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aOOTemplate</name>
+    <message>
+        <source>aOOTemplate temporary directory is %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aOOTemplate create temporary directory %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aOOTemplate start unzip</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aOOTemplate unzip dead</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aOOTemplate unzip normal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aOOTemplate open</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aOOTemplate value for field %1 not setted</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aOOTemplate save %1 open for write</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aOOTemplate save working dir =%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aOOTemplate start zip</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aOOTemplate zip dead</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aOOTemplate zip normal to %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aObject</name>
+    <message>
+        <source>Table `%s&apos; not found.
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObject have no database!</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObject md object not found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObject table with name %1 not found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObject have no system field %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObject update error. Driver message: %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObject decode doc number %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObject decode doc number ok, pref=%1 num=%2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObject table update: no table found with name %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObject display string context is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aObjectList</name>
+    <message>
+        <source>aObjectList have no database!</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObjectList md object not found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObjectList have no system field %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aObjectList display string context is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aReport</name>
+    <message>
+        <source>Warning</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aReport OpenOfficeExecutable not found in registery</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aReport OpenOfficeExecutable found %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aReport OpenOfficeExecutable not found in ~/.ananas/configrc</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to start OpenOffice (%1)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aReport OpenOfficeExecutable set to %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aReport working dir = %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aReport name for template = %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aReportBrowser</name>
+    <message>
+        <source>Print</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Print report</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aTemplate</name>
+    <message>
+        <source>aTemplate save file %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aWidget</name>
+    <message>
+        <source>aWidget init widget %1 form mode %2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget init: invalid database</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget init: invalid meta object</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget init: connect signals wDBTable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget invalid data source object</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget widgetEditor: invalid metadata object</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget table: invalid data source object</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget new: invalid data source object</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget select: invalid data source object</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget update: invalid data source object</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget value not fount widget with name %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget set value: not fount widget with name %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aWidget doc Id: invalid data source object</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dEditRC</name>
+    <message>
+        <source>Resource file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base header</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base server type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unknown</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>mysql</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>postgres</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base server address</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base server port</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base server user</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data base server password</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Work directory</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Resource file name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration file name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>internal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ananas config resource (*.rc)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ananas config file (*.cfg)</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dImportDB</name>
+    <message>
+        <source>Resource file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>archive file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Import</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>any files (*)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ananas business schema archiff file (*.bsa)</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dLogin</name>
+    <message>
+        <source>Ananas: Login</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Login name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Alt+C</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>O&amp;K</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Alt+K</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>dSelectDB</name>
+    <message>
+        <source>Information base</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Select data base</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Resource file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Alt+C</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Help</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Alt+H</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>save</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete item?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>confirm delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&amp;xit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New &amp;group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edi&amp;t</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Import</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Export</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Backup</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Select item</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Please, select item for export</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Program</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Actions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Service</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dSelectDB local settings not found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dSelectDB read settings for group with name %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dSelectDB save settings</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>save settings local?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dSelectDB business schema import</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dSelectDB restore: %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dSelectDB backup ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>dSelectDB backup: %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New shema</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;New shema</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+</TS>
diff --git a/translations/ananas-lib-ru.ts b/translations/ananas-lib-ru.ts
new file mode 100644 (file)
index 0000000..07a9771
--- /dev/null
@@ -0,0 +1,1608 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>HelpCfgForm</name>
+    <message>
+        <source>Create busines shema</source>
+        <translation>Создание бизнес схемы</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation>Закрыть</translation>
+    </message>
+    <message>
+        <source>Make group, item, set item paramert and press Ok button. See http://ananas.lrn.ru/index.php?title=Manual:Disigner for details</source>
+        <translation>Создайте группу, элемент. Задайте параметры элемента, нажмите Ок. Смотрите описание на http://ananas.lrn.ru/index.php?title=Manual:Disigner</translation>
+    </message>
+</context>
+<context>
+    <name>MessagesWindow</name>
+    <message>
+        <source>Messages window</source>
+        <translation>Окно сообщений</translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <source>Error read configuration line:%d col:%s %s</source>
+        <translation type="obsolete">Ошибка чтения файла метаданных в строке:%d позиция:%s %s</translation>
+    </message>
+    <message>
+        <source>Unknown</source>
+        <translation>Неизвестный</translation>
+    </message>
+    <message>
+        <source>Numberic</source>
+        <translation>Число</translation>
+    </message>
+    <message>
+        <source>Char</source>
+        <translation>Символ</translation>
+    </message>
+    <message>
+        <source>Date</source>
+        <translation>Дата</translation>
+    </message>
+    <message>
+        <source>Catalogue</source>
+        <translation>Каталог</translation>
+    </message>
+    <message>
+        <source>Document</source>
+        <translation>Документ</translation>
+    </message>
+    <message>
+        <source>Field</source>
+        <translation>Поле</translation>
+    </message>
+    <message>
+        <source>Journal</source>
+        <translation>Журнал</translation>
+    </message>
+    <message>
+        <source>Information Register</source>
+        <translation>Информационный регистр</translation>
+    </message>
+    <message>
+        <source>Accumuliation Register</source>
+        <translation>Накопительный регистр</translation>
+    </message>
+    <message>
+        <source>Report</source>
+        <translation>Отчет</translation>
+    </message>
+    <message>
+        <source>Documents</source>
+        <translation>Документы</translation>
+    </message>
+    <message>
+        <source>Element</source>
+        <translation>Элементы</translation>
+    </message>
+    <message>
+        <source>Group</source>
+        <translation>Группа</translation>
+    </message>
+    <message>
+        <source>Header</source>
+        <translation>Заголовок</translation>
+    </message>
+    <message>
+        <source>Boolean</source>
+        <translation>Логический</translation>
+    </message>
+    <message>
+        <source>aDatabase drop field(s) %1</source>
+        <translation>Удалены поля БД: %1</translation>
+    </message>
+    <message>
+        <source>aDatabase add field(s) %1</source>
+        <translation>Добавлены поля БД: %1</translation>
+    </message>
+    <message>
+        <source>aDatabase update field(s) %1</source>
+        <translation>Обновлены поля БД: %1</translation>
+    </message>
+    <message>
+        <source>aDatabase query: %1</source>
+        <translation>Запрос к БД: %1</translation>
+    </message>
+    <message>
+        <source>aDatabase text: %1</source>
+        <translation>Текст сообщения об ошибке при работе с БД: %1</translation>
+    </message>
+    <message>
+        <source>aDatabase database text: %1</source>
+        <translation>Текст сообщения об ошибке Сервера БД при работе с БД: %1</translation>
+    </message>
+    <message>
+        <source>aDatabase driver text: %1</source>
+        <translation>Текст сообщения об ошибке Драйвера при работе с БД: %1</translation>
+    </message>
+    <message>
+        <source>aDataTable try set mdobject to null</source>
+        <translation>aDataTable Попытка установить значение mdobject  в null</translation>
+    </message>
+    <message>
+        <source>aDataTable get value of unknown field `%1&apos;</source>
+        <translation>aDataTable Попытка получения значения неизвестного поля `%1&apos;</translation>
+    </message>
+    <message>
+        <source>aDataTable get document prefix to `%1&apos;</source>
+        <translation>aDataTable Установка префикса документа : `%1&apos;</translation>
+    </message>
+    <message>
+        <source>aService copy: source file %1 not exist</source>
+        <translation>aService copy: Исходный файл %1 не обнаружен</translation>
+    </message>
+    <message>
+        <source>aService copy: replace destination file %1</source>
+        <translation>aService copy: Замена целевого файла при копировании: %1</translation>
+    </message>
+    <message>
+        <source>aService copy: source file %1 open for read error</source>
+        <translation>aService copy: Ошибка открытия исходного файла %1 для чтения при копировании</translation>
+    </message>
+    <message>
+        <source>aService copy: destination file %1 open for write error</source>
+        <translation>aService copy: Ошибка открытия целевого файла %1 для записи</translation>
+    </message>
+    <message>
+        <source>aService copy file %1 to %2 ok</source>
+        <translation>aService: Файл %1 успешно скопирован в файл %2</translation>
+    </message>
+    <message>
+        <source>aTests file %1 not exists</source>
+        <translation>aTests: Файл %1 не существует</translation>
+    </message>
+    <message>
+        <source>aTests file %1 not open for read</source>
+        <translation>aTests: Файл %1 невозможно открыть для чтения</translation>
+    </message>
+    <message>
+        <source>Error read configuration line:%1 col:%2 %3</source>
+        <translation>Ошибка чтения конфигурации. Строка: %1, позиция: %2 %3</translation>
+    </message>
+    <message>
+        <source>aDataTable clear filter</source>
+        <translation>aDataTable: Очистка фильтра</translation>
+    </message>
+    <message>
+        <source>aDataTable set filter %1=&apos;%2&apos;</source>
+        <translation>aDataTable: Установка фильтра %1=&apos;%2&apos;</translation>
+    </message>
+    <message>
+        <source>aDataTable set filter %1=&apos;%2&apos;, %3 not exist</source>
+        <translation>aDataTable: Установка фильтра %1=&apos;%2&apos;, %3 не существует</translation>
+    </message>
+</context>
+<context>
+    <name>aARegister</name>
+    <message>
+        <source>Record Date</source>
+        <translation type="obsolete">Дата записи</translation>
+    </message>
+    <message>
+        <source>RecordDate</source>
+        <translation>Дата записи</translation>
+    </message>
+    <message>
+        <source>Accumulation Register init</source>
+        <translation>Инициализация накопительного регистра</translation>
+    </message>
+    <message>
+        <source>Accumulation Register create main table</source>
+        <translation>Создание главной таблицы накопительного регистра</translation>
+    </message>
+    <message>
+        <source>Accumulation Register create saldo table</source>
+        <translation>Создание таблицы остатков накопительного регистра</translation>
+    </message>
+    <message>
+        <source>Accumulation Register update</source>
+        <translation>Обновление накопительного регистра</translation>
+    </message>
+    <message>
+        <source>Accumulation register convert datetime from string %1</source>
+        <translation>Накопительный регистр: Конвертирование в тип ДатаВремя из строки %1</translation>
+    </message>
+    <message>
+        <source>Accumulation register not found table %1</source>
+        <translation>Накопительный регистр: Не найдена таблица %1</translation>
+    </message>
+    <message>
+        <source>Accumulation register set filter</source>
+        <translation>Накопительный регистр: Установка фильтра</translation>
+    </message>
+    <message>
+        <source>Accumulation register not found main table</source>
+        <translation>Накопительный регистр: Не найдена главная таблица</translation>
+    </message>
+</context>
+<context>
+    <name>aBackup</name>
+    <message>
+        <source>Can&apos;t create temporary directory</source>
+        <translation>Не могу создать временную директорию</translation>
+    </message>
+    <message>
+        <source>Can&apos;t connect to database</source>
+        <translation>Не могу присоединиться к базе данных</translation>
+    </message>
+    <message>
+        <source>Can&apos;t copy .cfg file</source>
+        <translation>Не могу скопировать cfg файл</translation>
+    </message>
+    <message>
+        <source>Database import without errors</source>
+        <translation>Восстановление из резервной копии завершено без ошибок</translation>
+    </message>
+    <message>
+        <source>Can&apos;t create directory %s</source>
+        <translation>Не могу создать каталог %1</translation>
+    </message>
+    <message>
+        <source>Invalid resource file</source>
+        <translation>Неправильный файл ресурса</translation>
+    </message>
+    <message>
+        <source>Can&apos;t write resource file</source>
+        <translation>Не могу записать файл ресурса</translation>
+    </message>
+    <message>
+        <source>Can&apos;t write file META-INF/manifest.xml</source>
+        <translation>Не могу записать файл META-INF/manifest.xml</translation>
+    </message>
+    <message>
+        <source>Can&apos;t copy template file</source>
+        <translation>Не могу записать файл шаблона</translation>
+    </message>
+    <message>
+        <source>Data export done without errors</source>
+        <translation>Резервная копия создана успешно</translation>
+    </message>
+    <message>
+        <source>Can&apos;t start zip</source>
+        <translation>Не могу запустить zip</translation>
+    </message>
+    <message>
+        <source>Zip ended anormal</source>
+        <translation>Запаковка завершилась с ошибкой</translation>
+    </message>
+    <message>
+        <source>Zip ended with code %1</source>
+        <translation>Zip завершился с кодом %1</translation>
+    </message>
+    <message>
+        <source>Unable to start zip</source>
+        <translation>Не могу запустить zip</translation>
+    </message>
+    <message>
+        <source>Zip ended with error</source>
+        <translation>Запаковка завершилась с ошибкой</translation>
+    </message>
+    <message>
+        <source>Can&apos;t write content.xml</source>
+        <translation>Не могу записать файл content.xml</translation>
+    </message>
+    <message>
+        <source>aBackup create temporary directory %1</source>
+        <translation>aBackup: Создание временной папки %1 в файловой системе</translation>
+    </message>
+    <message>
+        <source>aBackup import data: unzip</source>
+        <translation>aBackup: Импорт данных: unzip</translation>
+    </message>
+    <message>
+        <source>aBackup unzip</source>
+        <translation>aBackup: Распаковка unzip</translation>
+    </message>
+    <message>
+        <source>aBackup filename = %1</source>
+        <translation>aBackup: Имя файла = %1</translation>
+    </message>
+    <message>
+        <source>aBackup workdir=%1</source>
+        <translation>aBackup: Рабочая папка файловой системы =%1</translation>
+    </message>
+    <message>
+        <source>aBackup copy unzipped business schema file</source>
+        <translation>aBackup: Копирование распакованного файла бизнес схемы</translation>
+    </message>
+    <message>
+        <source>aBackup copy business schema file</source>
+        <translation>aBackup: Копирование файла бизнес схемы</translation>
+    </message>
+    <message>
+        <source>aBackup import data ok</source>
+        <translation>aBackup: Успешно импортированы данные резервной копии</translation>
+    </message>
+    <message>
+        <source>aBackup create temporary directory</source>
+        <translation>aBackup: Создание временной папки в файловой системе</translation>
+    </message>
+    <message>
+        <source>aBackup invalid *.rc file</source>
+        <translation>aBackup: Ошибка в  *.rc файле</translation>
+    </message>
+    <message>
+        <source>aBackup valid *.rc file</source>
+        <translation>aBackup: Нет ошибок в  *.rc файле</translation>
+    </message>
+    <message>
+        <source>aBackup template %1 %2</source>
+        <translation>aBackup: шаблон %1 %2</translation>
+    </message>
+    <message>
+        <source>aBackup write %1 file</source>
+        <translation>aBackup: Запись файла %1</translation>
+    </message>
+    <message>
+        <source>aBackup dump base error</source>
+        <translation>aBackup: Ошибка создания дампа БД</translation>
+    </message>
+    <message>
+        <source>aBackup bump base</source>
+        <translation>aBackup: Создание дампа БД</translation>
+    </message>
+    <message>
+        <source>aBackup write manifest.xml</source>
+        <translation>aBackup: Запись файла manifest.xml</translation>
+    </message>
+    <message>
+        <source>aBackup zip archive</source>
+        <translation>aBackup: zip архив</translation>
+    </message>
+    <message>
+        <source>aBackup export data ok</source>
+        <translation>aBackup: Успешно выполнен экспорт данных</translation>
+    </message>
+    <message>
+        <source>aBackup start unzip</source>
+        <translation>aBackup: Запуск распаковки unzip</translation>
+    </message>
+    <message>
+        <source>aBackup unzip dead</source>
+        <translation>aBackup: Ненормальное завершение распаковки zip </translation>
+    </message>
+    <message>
+        <source>aBackup unzip normal</source>
+        <translation>aBackup: Нормальное завершение распаковки zip </translation>
+    </message>
+    <message>
+        <source>aBackup zip start error</source>
+        <translation>aBackup: Ошибка запуска zip </translation>
+    </message>
+    <message>
+        <source>aBackup zip dead</source>
+        <translation>aBackup: Ненормальное завершение упаковки zip </translation>
+    </message>
+    <message>
+        <source>aBackup dump tables ok</source>
+        <translation>aBackup: Успешно создан дамп таблиц БД</translation>
+    </message>
+    <message>
+        <source>aBackup init rc file  %1</source>
+        <translation>aBackup: Файд инициализации (rc) %1</translation>
+    </message>
+    <message>
+        <source>aBackup write content.xml</source>
+        <translation>aBackup: Запись файла content.xml</translation>
+    </message>
+    <message>
+        <source>aBackup dump base to xml compleet</source>
+        <translation>aBackup: Перенос дампа БД в xml файл завершен</translation>
+    </message>
+    <message>
+        <source>aBackup save xml %1</source>
+        <translation>aBackup: Запись xml файла %1</translation>
+    </message>
+    <message>
+        <source>aBackup create manifest.xml</source>
+        <translation>aBackup: Создание файла manifest.xml</translation>
+    </message>
+    <message>
+        <source>aBackup delete file %1</source>
+        <translation>aBackup: Удаление файла %1</translation>
+    </message>
+    <message>
+        <source>aBackup delete directory %1</source>
+        <translation>aBackup: Удаление папки файловой системы %1</translation>
+    </message>
+    <message>
+        <source>aBackup cleanup temporary files</source>
+        <translation>aBackup: Удаление временных файлов</translation>
+    </message>
+    <message>
+        <source>aBackup template dir `%1&apos; not exists, try create</source>
+        <translation>aBackup: Папка `%1&apos; не существует, пробуем создать</translation>
+    </message>
+    <message>
+        <source>aBackup create template dir `%1&apos; fail</source>
+        <translation>aBackup: Не удалось создать временную папку `%1&apos;  в файловой системе</translation>
+    </message>
+    <message>
+        <source>aBackup create template dir `%1&apos;</source>
+        <translation>aBackup: Создание временной папки `%1&apos;  в файловой системе</translation>
+    </message>
+    <message>
+        <source>aBackup template dir `%1&apos; exists</source>
+        <translation>aBackup: Папка `%1&apos; в файловой системе уже существует</translation>
+    </message>
+</context>
+<context>
+    <name>aCManifest</name>
+    <message>
+        <source>aCManifest save xml %1</source>
+        <translation>aCManifest: Запись xml файла %1</translation>
+    </message>
+    <message>
+        <source>aCManifest read file `%1&apos;</source>
+        <translation>aCManifest: Чтение файла `%1</translation>
+    </message>
+    <message>
+        <source>aCManifest read line: %1 column: %2</source>
+        <translation>aCManifest: Чтение строки: %1 позиции: %2</translation>
+    </message>
+    <message>
+        <source>aCManifest invalid manifest</source>
+        <translation>aCManifest: Ошибки в manifest файле</translation>
+    </message>
+</context>
+<context>
+    <name>aCatGroup</name>
+    <message>
+        <source>aCatGroup new group</source>
+        <translation>aCatGroup: Новая группа</translation>
+    </message>
+    <message>
+        <source>aCatGroup new group ok</source>
+        <translation>aCatGroup: Новая группа успешно создана</translation>
+    </message>
+    <message>
+        <source>aCatGroup new group error %1</source>
+        <translation>aCatGroup: Ошибка при создании новой группы %1 </translation>
+    </message>
+</context>
+<context>
+    <name>aCatalogue</name>
+    <message>
+        <source>aCatalogue delete ido=%1</source>
+        <translation>aCatalogue: Удаление ido=%1</translation>
+    </message>
+    <message>
+        <source>aCatalogue update</source>
+        <translation>aCatalogue: Обновление</translation>
+    </message>
+    <message>
+        <source>aCatalogue update groups error %1</source>
+        <translation>aCatalogue: Ошибка обновления групп: %1 </translation>
+    </message>
+    <message>
+        <source>aCatalogue update groups</source>
+        <translation>aCatalogue: Обновление групп</translation>
+    </message>
+    <message>
+        <source>aCatalogue update elements error %1</source>
+        <translation>aCatalogue: Ошибка обновления элементов: %1</translation>
+    </message>
+    <message>
+        <source>aCatalogue select group id=%1</source>
+        <translation>aCatalogue: Выбор группы с идентификатором id=%1</translation>
+    </message>
+    <message>
+        <source>aCatalogue  new group with id=%1</source>
+        <translation>aCatalogue: Новая группа с идентификатором id=%1</translation>
+    </message>
+    <message>
+        <source>aCatalogue delete element with id=%1</source>
+        <translation>aCatalogue: Удаление элемента с идентификатором id=%1</translation>
+    </message>
+    <message>
+        <source>aCatalogue delete group with id=%1</source>
+        <translation>aCatalogue: Удаление группы с идентификатором id=%1</translation>
+    </message>
+    <message>
+        <source>aCatalogue delete without selection</source>
+        <translation>aCatalogue: Удаление без выбора</translation>
+    </message>
+    <message>
+        <source>aCatalogue update group</source>
+        <translation>aCatalogue: Обновление группы</translation>
+    </message>
+</context>
+<context>
+    <name>aCfg</name>
+    <message>
+        <source>Bad configuration</source>
+        <translation>Ошибка в файле бизнес схемы</translation>
+    </message>
+    <message>
+        <source>aCfg swap: first element is null</source>
+        <translation>aCfg swap: Первый элемент равен null</translation>
+    </message>
+    <message>
+        <source>aCfg swap: second element is null</source>
+        <translation>aCfg swap: Второй элемент равен null</translation>
+    </message>
+    <message>
+        <source>aCfg swap element himself</source>
+        <translation>aCfg: Замена элемента самим собой</translation>
+    </message>
+    <message>
+        <source>aCfg swap: first parent null</source>
+        <translation>aCfg swap: Первый родитель равен null</translation>
+    </message>
+    <message>
+        <source>aCfg swap: second parent null</source>
+        <translation>aCfg swap: Второй родитель равен null</translation>
+    </message>
+    <message>
+        <source>aCfg swap elements with differernt parents</source>
+        <translation>aCfg: Обмен элементов, имеющих разных родителей</translation>
+    </message>
+    <message>
+        <source>Document</source>
+        <translation>Документ</translation>
+    </message>
+    <message>
+        <source>Catalogue</source>
+        <translation>Каталог</translation>
+    </message>
+    <message>
+        <source>DocJournal</source>
+        <translation>Журнал документов</translation>
+    </message>
+    <message>
+        <source>Report</source>
+        <translation>Отчет</translation>
+    </message>
+    <message>
+        <source>InfoRegister</source>
+        <translation>Информационный<byte value="x9"/> регистр</translation>
+    </message>
+    <message>
+        <source>AccumulationRegister</source>
+        <translation>Накопительный регистр</translation>
+    </message>
+    <message>
+        <source>Form</source>
+        <translation>Форма</translation>
+    </message>
+    <message>
+        <source>aCfg saveOneObject: context save to file `%1&apos;</source>
+        <translation>aCfg saveOneObject: Запись содержимого в файл `%1&apos;</translation>
+    </message>
+    <message>
+        <source>aCfg saveOneObject: context is null</source>
+        <translation>aCfg saveOneObject: Содержимое равно null</translation>
+    </message>
+    <message>
+        <source>aCfg loadOneObject: invalid cfg file `%1&apos;</source>
+        <translation>aCfg loadOneObject: Ошибка в cfg файле `%1&apos;</translation>
+    </message>
+    <message>
+        <source>aCfg loadOneObject: invalid file name or not permission to file `%1&apos;</source>
+        <translation>aCfg loadOneObject: Ошибка в имени файла, либо недостаточно прав для доступа к файлу `%1&apos;</translation>
+    </message>
+    <message>
+        <source>aLog setup new id for %1</source>
+        <translation>aLog setup: Новый идентификатор id для %1</translation>
+    </message>
+    <message>
+        <source>aLog next id is %1</source>
+        <translation>aLog: Следующий идентификатор равен %1</translation>
+    </message>
+</context>
+<context>
+    <name>aContainer</name>
+    <message>
+        <source>aContainer unzip</source>
+        <translation>aContainer: Распаковка unzip</translation>
+    </message>
+    <message>
+        <source>Can&apos;t create temporary directory</source>
+        <translation>Не могу создать временную папку в файловой системе</translation>
+    </message>
+    <message>
+        <source>aContainer create temporary directory %1</source>
+        <translation>aContainer: Не могу создать временную папку в файловой системе %1</translation>
+    </message>
+    <message>
+        <source>No manifest found!</source>
+        <translation>Не найден файл manifest!</translation>
+    </message>
+    <message>
+        <source>aContainer error copy file</source>
+        <translation>aContainer: Ошибка копирования файла</translation>
+    </message>
+    <message>
+        <source>aContainer manifest is null</source>
+        <translation>aContainer: Файл manifest равен null</translation>
+    </message>
+    <message>
+        <source>Can&apos;t start unzip</source>
+        <translation>Не могу запустить unzip</translation>
+    </message>
+    <message>
+        <source>aContainer start unzip</source>
+        <translation>aContainer: Запуск unzip</translation>
+    </message>
+    <message>
+        <source>Unzip ended anormal</source>
+        <translation>Неудачное завершение распаковки unzip </translation>
+    </message>
+    <message>
+        <source>aContainer unzip dead</source>
+        <translation>aContainer: Ненормальное завершение распаковки unzip </translation>
+    </message>
+    <message>
+        <source>aContainer unzip normal</source>
+        <translation>aContainer: Нормальное завершение распаковки unzip </translation>
+    </message>
+    <message>
+        <source>Unzip ended with code %1</source>
+        <translation>Unzip вернул код %1</translation>
+    </message>
+    <message>
+        <source>Unable to start zip</source>
+        <translation>Не могу запустить zip</translation>
+    </message>
+    <message>
+        <source>aContainer zip start error</source>
+        <translation>aContainer: Ошибка запуска zip</translation>
+    </message>
+    <message>
+        <source>Zip ended with error</source>
+        <translation>Запаковка завершилась с ошибкой</translation>
+    </message>
+    <message>
+        <source>aContainer zip dead</source>
+        <translation>aContainer: Ненормальное завершение запаковки zip </translation>
+    </message>
+    <message>
+        <source>Zip ended with code %1</source>
+        <translation>Zip завершился с кодом %1</translation>
+    </message>
+    <message>
+        <source>aContainer delete file %1</source>
+        <translation>aContainer: Удаление файла %1</translation>
+    </message>
+    <message>
+        <source>aContainer delete directory %1</source>
+        <translation>aContainer: Удаление папки %1 файловой системы</translation>
+    </message>
+</context>
+<context>
+    <name>aDatabase</name>
+    <message>
+        <source>Can&apos;t open database connection
+</source>
+        <translation>Не могу установить соединение с сервером баз данных</translation>
+    </message>
+    <message>
+        <source>Uniques table updated
+</source>
+        <translation>Обновлена таблица уникальных идентификаторов</translation>
+    </message>
+    <message>
+        <source>Documents journal updated
+</source>
+        <translation>Обновлен журнал документов</translation>
+    </message>
+    <message>
+        <source>Users updated
+</source>
+        <translation>Обновлена информация о пользователях</translation>
+    </message>
+    <message>
+        <source>Users roles updated
+</source>
+        <translation>Обновлена информация о ролях</translation>
+    </message>
+    <message>
+        <source>Roles updated
+</source>
+        <translation>Обновлены роли</translation>
+    </message>
+    <message>
+        <source>Rigths updated
+</source>
+        <translation>Обновлена информация о правах</translation>
+    </message>
+    <message>
+        <source>Catalogue %s updated
+</source>
+        <translation>Каталог %s обновлен</translation>
+    </message>
+    <message>
+        <source>Document %s updated
+</source>
+        <translation>Документ %s обновлен</translation>
+    </message>
+    <message>
+        <source>Information registers %s updated
+</source>
+        <translation>Информационный регистр %s обновлен</translation>
+    </message>
+    <message>
+        <source>Accumulation registers %s updated
+</source>
+        <translation>Накопительный регистр %s обновлен</translation>
+    </message>
+    <message>
+        <source>Can&apos;t open database connection with ananas_system
+</source>
+        <translation type="obsolete">Не могу установить соединение с базой данных ananas_system</translation>
+    </message>
+    <message>
+        <source>Catalogue %s dump
+</source>
+        <translation type="obsolete">Каталог %s данные\n</translation>
+    </message>
+    <message>
+        <source>aDatabase open connection to %1</source>
+        <translation>aDatabase: Открытие соединения с %1</translation>
+    </message>
+    <message>
+        <source>aDatabase drop database %1</source>
+        <translation>aDatabase: Удаление БД %1</translation>
+    </message>
+    <message>
+        <source>aDatabase generate new unique number for object type %1</source>
+        <translation>aDatabase: Создание нового уникального номера для объекта типа %1</translation>
+    </message>
+    <message>
+        <source>aDatabase generate new unique number %1 for objecttype %2</source>
+        <translation>aDatabase: Создание нового уникального номера %1 для объекта типа %2</translation>
+    </message>
+    <message>
+        <source>aDatabase get object type for unique id=%1</source>
+        <translation>aDatabase: Получение типа объекта по его уникальному идентификатору id=%1</translation>
+    </message>
+    <message>
+        <source>aDatabase check indices for %1</source>
+        <translation>aDatabase: Проверка индексов для %1</translation>
+    </message>
+    <message>
+        <source>aDatabase search index %1</source>
+        <translation>aDatabase: Поиск индекса %1</translation>
+    </message>
+    <message>
+        <source>Catalogue %s processed
+</source>
+        <translation>Каталог %s обработан
+</translation>
+    </message>
+    <message>
+        <source>aDatabase catalogue %1 import</source>
+        <translation>aDatabase: Импорт каталога %1</translation>
+    </message>
+    <message>
+        <source>aDatabase catalogue %1 export</source>
+        <translation>aDatabase: Экспорт каталога %1</translation>
+    </message>
+    <message>
+        <source>Document %s processed
+</source>
+        <translation>Документ %s обработан</translation>
+    </message>
+    <message>
+        <source>aDatabase document %1 import</source>
+        <translation>aDatabase: Импорт Документа %1</translation>
+    </message>
+    <message>
+        <source>aDatabase document %1 export</source>
+        <translation>aDatabase: Экспорт документа %1</translation>
+    </message>
+    <message>
+        <source>Information registers %s processed
+</source>
+        <translation>Информационный регистр %s обработан</translation>
+    </message>
+    <message>
+        <source>aDatabase information register %1 import</source>
+        <translation>aDatabase: Импорт информационного регистра %1</translation>
+    </message>
+    <message>
+        <source>aDatabase information register %1 export</source>
+        <translation>aDatabase: Экспорт информационного регистра %1</translation>
+    </message>
+    <message>
+        <source>Accumulation registers %s processed
+</source>
+        <translation>Накопительный регистр %s обработан</translation>
+    </message>
+    <message>
+        <source>aDatabase accumulation register %1 import</source>
+        <translation>aDatabase: Импорт накопительного регистра %1</translation>
+    </message>
+    <message>
+        <source>aDatabase accumulation register %1 export</source>
+        <translation>aDatabase: Экспорт накопительного регистра %1</translation>
+    </message>
+    <message>
+        <source>aDatabase export table: invalid XML file</source>
+        <translation>aDatabase: Эеспорт таблицы БД: Ошибки в  XML файле</translation>
+    </message>
+    <message>
+        <source>aDatabase import table: invalid XML file</source>
+        <translation>aDatabase: Импорт таблицы БД: Ошибки в XML файле</translation>
+    </message>
+    <message>
+        <source>aDatabase import table: table %1 not exists</source>
+        <translation>aDatabase: Импорт таблицы БД: Таблица %1 не существует</translation>
+    </message>
+    <message>
+        <source>aDatabase prepared for open connection to %1</source>
+        <translation>aDatabase: Готов к открытию соединения с %</translation>
+    </message>
+    <message>
+        <source>aDatabase open connection failed, try create %1</source>
+        <translation>aDatabase: Ошибка открытия соединения, пытаюсь создать %1</translation>
+    </message>
+    <message>
+        <source>aDatabase system database is open</source>
+        <translation>aDatabase: Системная БД открыта</translation>
+    </message>
+    <message>
+        <source>Can&apos;t create database
+</source>
+        <translation>Не могу создать БД</translation>
+    </message>
+    <message>
+        <source>aDatabase create database %1</source>
+        <translation>aDatabase: Создание БД %1</translation>
+    </message>
+    <message>
+        <source>aDatabase open connection to %1 ok</source>
+        <translation>aDatabase: Успешное установление соединения с %1 </translation>
+    </message>
+    <message>
+        <source>aDatabase import table: get table %1</source>
+        <translation>aDatabase: Импорт таблицы БД: Таблица %1</translation>
+    </message>
+</context>
+<context>
+    <name>aDocJournal</name>
+    <message>
+        <source>aDocJournal md object not exists</source>
+        <translation>aDocJournal: Объект метаданных не существует</translation>
+    </message>
+    <message>
+        <source>aDocJournal columns not defined</source>
+        <translation>aDocJournal: Столбцы не определены</translation>
+    </message>
+    <message>
+        <source>aDocJournal column defined</source>
+        <translation>aDocJournal: Столбец определен</translation>
+    </message>
+    <message>
+        <source>aDocJournal invalid column define</source>
+        <translation>aDocJournal: Неверное определение столбца</translation>
+    </message>
+    <message>
+        <source>aDocJournal delete document with idd=%1</source>
+        <translation>aDocJournal: Удаление документа с идентификатором idd=%1</translation>
+    </message>
+    <message>
+        <source>aDocJournal new document with idd=%1</source>
+        <translation>aDocJournal: Новый документ с идентификатором idd=%1</translation>
+    </message>
+    <message>
+        <source>aDocJournal generated next number for %1 is %2</source>
+        <translation>aDocJournal: Создан новый номер %2 для %1</translation>
+    </message>
+    <message>
+        <source>aDocJournal document not found with idd=%1</source>
+        <translation>aDocJournal: Документ с идентификатором idd=%1 не найден</translation>
+    </message>
+    <message>
+        <source>aDocJournal document not found with number=%1 and type=%2 </source>
+        <translation>aDocJournal: Документ с номером=%1 и типом=%2 не найден</translation>
+    </message>
+    <message>
+        <source>aDocJournal select document with number=%1 and md name=%2</source>
+        <translation>aDocJournal: Выбор документа с номером=%1 и с заданным в метаданных именем=%2</translation>
+    </message>
+</context>
+<context>
+    <name>aDocument</name>
+    <message>
+        <source>aDocument have no sysjournal</source>
+        <translation>aDocument: Нет системного журнала</translation>
+    </message>
+    <message>
+        <source>aDocument new document</source>
+        <translation>aDocument: Новый документ</translation>
+    </message>
+    <message>
+        <source>aDocument select new table line number</source>
+        <translation>aDocument Выбор новой строки таблицы</translation>
+    </message>
+    <message>
+        <source>aDocument new table line number=%1</source>
+        <translation>aDocument: Номер новой строки таблицы=%1</translation>
+    </message>
+    <message>
+        <source>aDocument insert new table line</source>
+        <translation>aDocument: Вставка новой строки таблицы</translation>
+    </message>
+    <message>
+        <source>aDocument delete from sysjournal</source>
+        <translation>aDocument: Удаление из системного журнала</translation>
+    </message>
+    <message>
+        <source>aDocument delete from unicues</source>
+        <translation>aDocument: Удаление из индекса уникальных идентификаторов</translation>
+    </message>
+    <message>
+        <source>aDocument delete table %1</source>
+        <translation>aDocument: Удаление табличной части %1</translation>
+    </message>
+    <message>
+        <source>aDocument delete table of conducted document</source>
+        <translation>aDocument: Удаление табличной части проведенного документа</translation>
+    </message>
+    <message>
+        <source>aDocument deleted table not exist</source>
+        <translation>aDocument: Нет табличных частей для удаления</translation>
+    </message>
+    <message>
+        <source>aDocument deleted table not selected</source>
+        <translation>aDocument: Удаляемая таблица не существует</translation>
+    </message>
+    <message>
+        <source>aDocument delete table from info register</source>
+        <translation>aDocument: Удаление связанных с табличной частью записей из информационного регистра</translation>
+    </message>
+    <message>
+        <source>aDocument delete table</source>
+        <translation>aDocument: Удаление табличной части документа</translation>
+    </message>
+    <message>
+        <source>aDocument not selected</source>
+        <translation>aDocument: Сначала выберите документ</translation>
+    </message>
+    <message>
+        <source>aDocument table name is empty</source>
+        <translation>aDocument: Пустое имя таблицы. Для удаления табличной части документа необходимо указать ее имя</translation>
+    </message>
+    <message>
+        <source>aDocument update error=%1</source>
+        <translation>aDocument: Ошибка обновления документа=%1</translation>
+    </message>
+    <message>
+        <source>aDocument conducted table update</source>
+        <translation>aDocument: Невозможно обновить табличную часть проведенного документа</translation>
+    </message>
+    <message>
+        <source>aDocument conduct</source>
+        <translation>aDocument: Проведение документа</translation>
+    </message>
+    <message>
+        <source>aDocument delete from accumulation register</source>
+        <translation>aDocument: Удаление из накопительного регистра</translation>
+    </message>
+    <message>
+        <source>aDocument aObject::New() ended with error code = %1</source>
+        <translation>aDocument: aObject::New() вернул ошибку с кодом = %1</translation>
+    </message>
+    <message>
+        <source>aDocument metaobject is null=%1</source>
+        <translation>aDocument: Объект метаданных пуст =%1</translation>
+    </message>
+    <message>
+        <source>aDocument new type = %1</source>
+        <translation>aDocument: Тип нового документа = %1</translation>
+    </message>
+    <message>
+        <source>aDocument New() error while added record in sysJournal =%1</source>
+        <translation>aDocument: New() ошибка при добавлении в системный журнал =%1</translation>
+    </message>
+    <message>
+        <source>Deprecated method call. aDocument::Conduct(...)</source>
+        <translation>Вызов устаревшего метода  aDocument::Conduct(...)</translation>
+    </message>
+    <message>
+        <source>Deprecated method call. aDocument::UnConduct()</source>
+        <translation>Вызов устаревшего метода  aDocument::UnConduct(...)</translation>
+    </message>
+    <message>
+        <source>Deprecated method call. aDocument::IsConducted()</source>
+        <translation>Вызов устаревшего метода  aDocument::IsConduct(...)</translation>
+    </message>
+    <message>
+        <source>aDocument::GetDocumentValue(...): Can&apos;t find aDocument</source>
+        <translation>aDocument::GetDocumentValue(...): Невозможно найти документ</translation>
+    </message>
+</context>
+<context>
+    <name>aIRegister</name>
+    <message>
+        <source>aIRegister metaobject is null</source>
+        <translation>aIRegister: Объект метаданных =  null</translation>
+    </message>
+    <message>
+        <source>aIRegister deleted document have invalid idd</source>
+        <translation>aIRegister: Неверный идентификатор (idd) удаляемого документа</translation>
+    </message>
+    <message>
+        <source>aIRegister select period from %1 to %2</source>
+        <translation>aIRegister: Задание периода с %1 по %2</translation>
+    </message>
+</context>
+<context>
+    <name>aOOTemplate</name>
+    <message>
+        <source>aOOTemplate temporary directory is %1</source>
+        <translation>aOOTemplate: Временная папка файловой системы: %1</translation>
+    </message>
+    <message>
+        <source>aOOTemplate create temporary directory %1</source>
+        <translation>aOOTemplate: Создать временную папку файловой системы: %1</translation>
+    </message>
+    <message>
+        <source>aOOTemplate start unzip</source>
+        <translation>aOOTemplate: Запуск unzip</translation>
+    </message>
+    <message>
+        <source>aOOTemplate unzip dead</source>
+        <translation>aOOTemplate: Ненормальное завершение распаковки unzip </translation>
+    </message>
+    <message>
+        <source>aOOTemplate unzip normal</source>
+        <translation>aOOTemplate: Нормальное завершение распаковки unzip </translation>
+    </message>
+    <message>
+        <source>aOOTemplate open</source>
+        <translation>aOOTemplate: Открываем</translation>
+    </message>
+    <message>
+        <source>aOOTemplate value for field %1 not setted</source>
+        <translation>aOOTemplate: Значение поля %1 не задано</translation>
+    </message>
+    <message>
+        <source>aOOTemplate save %1 open for write</source>
+        <translation>aOOTemplate: Ошибка записи %1</translation>
+    </message>
+    <message>
+        <source>aOOTemplate save working dir =%1</source>
+        <translation>aOOTemplate: Запись шаблона в рабочей папке %1</translation>
+    </message>
+    <message>
+        <source>aOOTemplate start zip</source>
+        <translation>aOOTemplate: Запуск zip</translation>
+    </message>
+    <message>
+        <source>aOOTemplate zip dead</source>
+        <translation>aOOTemplate: Ненормальное завершение упаковки zip </translation>
+    </message>
+    <message>
+        <source>aOOTemplate zip normal to %1</source>
+        <translation>aOOTemplate: Упаковка zip успешно завершена: %1</translation>
+    </message>
+</context>
+<context>
+    <name>aObject</name>
+    <message>
+        <source>Table `%s&apos; not found.
+</source>
+        <translation>Таблица `%s&apos; не найдена.</translation>
+    </message>
+    <message>
+        <source>Table name is empty.
+</source>
+        <translation type="obsolete">Пустое имя таблицы.</translation>
+    </message>
+    <message>
+        <source>aObject have no database!</source>
+        <translation>aObject: Нет базы данных!</translation>
+    </message>
+    <message>
+        <source>aObject md object not found</source>
+        <translation>aObject: Объект метаданных не найден</translation>
+    </message>
+    <message>
+        <source>aObject table with name %1 not found</source>
+        <translation>aObject: Не найдена таблица %1 </translation>
+    </message>
+    <message>
+        <source>aObject have no system field %1</source>
+        <translation>aObject: Не найдено системное поле %1</translation>
+    </message>
+    <message>
+        <source>aObject update error. Driver message: %1</source>
+        <translation>aObject: Ошибка обновления. Сообщение драйвера: %1</translation>
+    </message>
+    <message>
+        <source>aObject decode doc number %1</source>
+        <translation>aObject: Декодирование номера документа %1</translation>
+    </message>
+    <message>
+        <source>aObject decode doc number ok, pref=%1 num=%2</source>
+        <translation>aObject: Успешное декодирование номера документа, pref=%1 num=%2</translation>
+    </message>
+    <message>
+        <source>aObject table update: no table found with name %1</source>
+        <translation>aObject: Обновление таблицы: Таблица с именем %1 не найдена</translation>
+    </message>
+    <message>
+        <source>aObject display string context is null</source>
+        <translation>aObject: Содержимое строки для отображения равно null</translation>
+    </message>
+</context>
+<context>
+    <name>aObjectList</name>
+    <message>
+        <source>aObjectList have no database!</source>
+        <translation>aObjectList: Нет базы данных!</translation>
+    </message>
+    <message>
+        <source>aObjectList md object not found</source>
+        <translation>aObjectList: Объект метаданных не найден</translation>
+    </message>
+    <message>
+        <source>aObjectList have no system field %1</source>
+        <translation>aObjectList: Не найдено системное поле %1</translation>
+    </message>
+    <message>
+        <source>aObjectList display string context is null</source>
+        <translation>aObjectList: Содержимое строки для отображения равно null</translation>
+    </message>
+</context>
+<context>
+    <name>aReport</name>
+    <message>
+        <source>Choose a OpenOffice executable file</source>
+        <translation type="obsolete">Выберите исполняемый файл OpenOffice </translation>
+    </message>
+    <message>
+        <source>Warning</source>
+        <translation>Предупреждение</translation>
+    </message>
+    <message>
+        <source>Unable to start OpenOffice</source>
+        <translation type="obsolete">Невозможно запустить OpenOffice</translation>
+    </message>
+    <message>
+        <source>aReport OpenOfficeExecutable not found in registery</source>
+        <translation>aReport: Исполняемый файл OpenOffice в регистри не найден</translation>
+    </message>
+    <message>
+        <source>aReport OpenOfficeExecutable found %1</source>
+        <translation>aReport: Исполняемый файл OpenOffice не найден: %1</translation>
+    </message>
+    <message>
+        <source>aReport OpenOfficeExecutable not found in ~/.ananas/configrc</source>
+        <translation>aReport: Исполняемый файл OpenOffice не найден в ~/.ananas/configrc</translation>
+    </message>
+    <message>
+        <source>Unable to start OpenOffice (%1)</source>
+        <translation>Не могу запустит OpenOffice (%1)</translation>
+    </message>
+    <message>
+        <source>aReport OpenOfficeExecutable set to %1</source>
+        <translation>aReport: Исполняемый файл OpenOffice определен как %1</translation>
+    </message>
+    <message>
+        <source>aReport working dir = %1</source>
+        <translation>aReport: Рабочая папка файловой системы = %1</translation>
+    </message>
+    <message>
+        <source>aReport name for template = %1</source>
+        <translation>aReport: Имя шаблона = %1</translation>
+    </message>
+</context>
+<context>
+    <name>aReportBrowser</name>
+    <message>
+        <source>Print</source>
+        <translation>Печать</translation>
+    </message>
+    <message>
+        <source>Print report</source>
+        <translation>Печать отчета</translation>
+    </message>
+</context>
+<context>
+    <name>aTemplate</name>
+    <message>
+        <source>aTemplate save file %1</source>
+        <translation>aTemplate: Запись файла %1</translation>
+    </message>
+</context>
+<context>
+    <name>aWidget</name>
+    <message>
+        <source>Error! Can&apos;t find widget by name==`%s`
+</source>
+        <translation type="obsolete">Ошибка! Не найден виджет с именем `%s&apos;</translation>
+    </message>
+    <message>
+        <source>aForm::SetValue() Error! Can&apos;t find widget by name==`%s`
+</source>
+        <translation type="obsolete">aForm::SetValue() Ошибка! Невозможно найти виджет с именем `%s`</translation>
+    </message>
+    <message>
+        <source>aWidget init widget %1 form mode %2</source>
+        <translation>aWidget: Инициализация виджета %1: режим формы %2</translation>
+    </message>
+    <message>
+        <source>aWidget init: invalid database</source>
+        <translation>aWidget: Инициализация: Не верно задана или недоступна БД</translation>
+    </message>
+    <message>
+        <source>aWidget init: invalid meta object</source>
+        <translation>aWidget: Инициализация: Неправильный объект метаданных</translation>
+    </message>
+    <message>
+        <source>aWidget init: connect signals wDBTable</source>
+        <translation>aWidget: Инициализация: Соединяем сигналы wDBTable</translation>
+    </message>
+    <message>
+        <source>aWidget invalid data source object</source>
+        <translation>aWidget: Неверный объект источника данных</translation>
+    </message>
+    <message>
+        <source>aWidget widgetEditor: invalid metadata object</source>
+        <translation>aWidget: widgetEditor: Неправильный объект метаданных</translation>
+    </message>
+    <message>
+        <source>aWidget table: invalid data source object</source>
+        <translation>aWidget: table: Неверный объект источника данных</translation>
+    </message>
+    <message>
+        <source>aWidget new: invalid data source object</source>
+        <translation>aWidget: new: Неверный объект источника данных</translation>
+    </message>
+    <message>
+        <source>aWidget select: invalid data source object</source>
+        <translation>aWidget: select: Неверный объект источника данных</translation>
+    </message>
+    <message>
+        <source>aWidget update: invalid data source object</source>
+        <translation>aWidget: update: Неверный объект источника данных</translation>
+    </message>
+    <message>
+        <source>aWidget value not fount widget with name %1</source>
+        <translation>aWidget: Не найдено значения виджета с именем %1</translation>
+    </message>
+    <message>
+        <source>aWidget set value: not fount widget with name %1</source>
+        <translation>aWidget: Установка значения: Не найден виджет с именем %1</translation>
+    </message>
+    <message>
+        <source>aWidget doc Id: invalid data source object</source>
+        <translation>aWidget: Идентификатор документа  Id: Неверный объект источника данных</translation>
+    </message>
+</context>
+<context>
+    <name>dEditRC</name>
+    <message>
+        <source>Resource file</source>
+        <translation>Файл ресурса</translation>
+    </message>
+    <message>
+        <source>Data base header</source>
+        <translation>Заголовок базы данных</translation>
+    </message>
+    <message>
+        <source>Data base name</source>
+        <translation>Имя базы данных</translation>
+    </message>
+    <message>
+        <source>Data base server type</source>
+        <translation>Тип сервера базы данных</translation>
+    </message>
+    <message>
+        <source>Unknown</source>
+        <translation>Неизвестный</translation>
+    </message>
+    <message>
+        <source>mysql</source>
+        <translation>mysql</translation>
+    </message>
+    <message>
+        <source>postgres</source>
+        <translation>postgres</translation>
+    </message>
+    <message>
+        <source>Data base server address</source>
+        <translation>Адрес сервера баз данных</translation>
+    </message>
+    <message>
+        <source>Data base server port</source>
+        <translation>Порт сервера база данных</translation>
+    </message>
+    <message>
+        <source>Data base server user</source>
+        <translation>Пользователь сервера баз данных</translation>
+    </message>
+    <message>
+        <source>Data base server password</source>
+        <translation>Пароль сервера баз данных</translation>
+    </message>
+    <message>
+        <source>Work directory</source>
+        <translation>Рабочий каталог</translation>
+    </message>
+    <message>
+        <source>Resource file name</source>
+        <translation>Файл ресурса</translation>
+    </message>
+    <message>
+        <source>...</source>
+        <translation>...</translation>
+    </message>
+    <message>
+        <source>Configuration file name</source>
+        <translation>Имя файла метаданных</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+    <message>
+        <source>internal</source>
+        <translation>встроенный</translation>
+    </message>
+    <message>
+        <source>ananas config resource (*.rc)</source>
+        <translation>Файл ресурсов Ананаса (*.rc)</translation>
+    </message>
+    <message>
+        <source>ananas config file (*.cfg)</source>
+        <translation>Файл бизнес схемы Ананаса (*.cfg)</translation>
+    </message>
+</context>
+<context>
+    <name>dImportDB</name>
+    <message>
+        <source>Resource file</source>
+        <translation>Файл ресурса</translation>
+    </message>
+    <message>
+        <source>archive file</source>
+        <translation>Файл резервной копии</translation>
+    </message>
+    <message>
+        <source>Import</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>any files (*)</source>
+        <translation>Все файлы (*)</translation>
+    </message>
+    <message>
+        <source>ananas business schema archiff file (*.bsa)</source>
+        <translation>Файлы архивов бизнес схем Ананаса (*.bsa)</translation>
+    </message>
+</context>
+<context>
+    <name>dLogin</name>
+    <message>
+        <source>Ananas: Login</source>
+        <translation>Ананас: Авторизация</translation>
+    </message>
+    <message>
+        <source>Login name</source>
+        <translation>Регистрационное имя</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <translation>Пароль</translation>
+    </message>
+    <message>
+        <source>&amp;Cancel</source>
+        <translation>&amp;Отмена</translation>
+    </message>
+    <message>
+        <source>Alt+C</source>
+        <translation>Alt+C</translation>
+    </message>
+    <message>
+        <source>O&amp;K</source>
+        <translation>O&amp;K</translation>
+    </message>
+    <message>
+        <source>Alt+K</source>
+        <translation>Alt+K</translation>
+    </message>
+</context>
+<context>
+    <name>dSelectDB</name>
+    <message>
+        <source>Information base</source>
+        <translation>Список бизнес схем</translation>
+    </message>
+    <message>
+        <source>Select data base</source>
+        <translation>Выбрать бизнес схему</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Resource file</source>
+        <translation>Файл ресурса</translation>
+    </message>
+    <message>
+        <source>&amp;OK</source>
+        <translation>&amp;OK</translation>
+    </message>
+    <message>
+        <source>&amp;New</source>
+        <translation type="obsolete">&amp;Новый</translation>
+    </message>
+    <message>
+        <source>Alt+N</source>
+        <translation type="obsolete">Alt+N</translation>
+    </message>
+    <message>
+        <source>&amp;Group</source>
+        <translation type="obsolete">&amp;Группа</translation>
+    </message>
+    <message>
+        <source>Alt+G</source>
+        <translation type="obsolete">Alt+G</translation>
+    </message>
+    <message>
+        <source>&amp;Delete</source>
+        <translation>&amp;Удалить</translation>
+    </message>
+    <message>
+        <source>Alt+D</source>
+        <translation type="obsolete">Alt+D</translation>
+    </message>
+    <message>
+        <source>&amp;Edit</source>
+        <translation type="obsolete">&amp;Изменить</translation>
+    </message>
+    <message>
+        <source>Alt+E</source>
+        <translation type="obsolete">Alt+E</translation>
+    </message>
+    <message>
+        <source>&amp;Cancel</source>
+        <translation>&amp;Отмена</translation>
+    </message>
+    <message>
+        <source>Alt+C</source>
+        <translation>Alt+C</translation>
+    </message>
+    <message>
+        <source>&amp;Help</source>
+        <translation>&amp;Помощь</translation>
+    </message>
+    <message>
+        <source>Alt+H</source>
+        <translation>Alt+H</translation>
+    </message>
+    <message>
+        <source>New group</source>
+        <translation>Новая группа</translation>
+    </message>
+    <message>
+        <source>New item</source>
+        <translation type="obsolete">Новая схема</translation>
+    </message>
+    <message>
+        <source>save</source>
+        <translation>Сохранить</translation>
+    </message>
+    <message>
+        <source>Delete item?</source>
+        <translation>Удалить элемент?</translation>
+    </message>
+    <message>
+        <source>confirm delete</source>
+        <translation>Подтверждение удаления</translation>
+    </message>
+    <message>
+        <source>E&amp;xit</source>
+        <translation>В&amp;ыход</translation>
+    </message>
+    <message>
+        <source>New &amp;group</source>
+        <translation>Новая &amp;группа</translation>
+    </message>
+    <message>
+        <source>&amp;New item</source>
+        <translation type="obsolete">&amp;Новая бизнес схема</translation>
+    </message>
+    <message>
+        <source>Edi&amp;t</source>
+        <translation>&amp;Редактировать</translation>
+    </message>
+    <message>
+        <source>&amp;Import</source>
+        <translation>Восстановить &amp;из резервной копии</translation>
+    </message>
+    <message>
+        <source>&amp;Export</source>
+        <translation>С&amp;оздать резервную копию</translation>
+    </message>
+    <message>
+        <source>Backup</source>
+        <translation>Резервная копия</translation>
+    </message>
+    <message>
+        <source>Select item</source>
+        <translation>Выберите элемент</translation>
+    </message>
+    <message>
+        <source>Please, select item for export</source>
+        <translation>Выберите элемент для создания резервной копии</translation>
+    </message>
+    <message>
+        <source>&amp;File</source>
+        <translation type="obsolete">&amp;Программа</translation>
+    </message>
+    <message>
+        <source>&amp;Actions</source>
+        <translation type="obsolete">&amp;Сервис</translation>
+    </message>
+    <message>
+        <source>Program</source>
+        <translation>Программа</translation>
+    </message>
+    <message>
+        <source>Actions</source>
+        <translation>Действия</translation>
+    </message>
+    <message>
+        <source>Service</source>
+        <translation>Сервис</translation>
+    </message>
+    <message>
+        <source>dSelectDB local settings not found</source>
+        <translation>dSelectDB: Пользовательские (локальные) настройки не найдены</translation>
+    </message>
+    <message>
+        <source>dSelectDB read settings for group with name %1</source>
+        <translation>dSelectDB: Чтение настроек для группы с именем %1</translation>
+    </message>
+    <message>
+        <source>dSelectDB save settings</source>
+        <translation>dSelectDB: Сохранение настроек</translation>
+    </message>
+    <message>
+        <source>save settings local?</source>
+        <translation>Сохранить настройки локально?</translation>
+    </message>
+    <message>
+        <source>dSelectDB business schema import</source>
+        <translation>dSelectDB Импорт бизнес схемы</translation>
+    </message>
+    <message>
+        <source>dSelectDB restore: %1</source>
+        <translation>dSelectDB: Восстанавливаем: %1</translation>
+    </message>
+    <message>
+        <source>Any files (*)</source>
+        <translation type="obsolete">Все файлы (*)</translation>
+    </message>
+    <message>
+        <source>dSelectDB backup ok</source>
+        <translation>dSelectDB: Успешно создана резервная копия</translation>
+    </message>
+    <message>
+        <source>dSelectDB backup: %1</source>
+        <translation>dSelectDB Резервная копия: %1</translation>
+    </message>
+    <message>
+        <source>New shema</source>
+        <translation>Новая бизнес схема</translation>
+    </message>
+    <message>
+        <source>&amp;New shema</source>
+        <translation>Новая бизнес &amp;схема</translation>
+    </message>
+</context>
+</TS>
diff --git a/translations/ananas-plugins-en.ts b/translations/ananas-plugins-en.ts
new file mode 100644 (file)
index 0000000..1b1ab30
--- /dev/null
@@ -0,0 +1,964 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>CatalogForm</name>
+    <message>
+        <source>Catalogue</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>displaying %1 from %2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t added new element to mark deleted group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t added group to element</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t added group to mark deleted group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t edit mark deleted element</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog haven&apos;t edit element form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can&apos;t edit mark deleted group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog haven&apos;t edit group form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Search</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>CatalogForm:setData begin</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>CatalogForm add first element in group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>CatalogForm add elements into root</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>CatalogForm init</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog Form image cat.png not loaded</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog Form group pixmap not load</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog Form element pixmap not load</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog Form mark deleted group pixmap not load</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog Form edit element form is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog Form edit group form is null</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog Form edit element start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog Form edit element with id=%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog Form edit group with id = %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Catalog Form main widget is not &apos;MainForm&apos;</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <source>aForm SelectByCurrent %1 ended with %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unknown classname &apos;%1&apos; or metaobject &apos;%2&apos;</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aEditorFactory</name>
+    <message>
+        <source>aEditorFactory field metaobject not found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aEditorFactory metadata in null</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aEngine</name>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aEngine open form %1 in mode %2, select %3</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aEngine form create error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aEngine open form mode %1 not supported</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Line:%1 Message:%2 Stack:(%3)</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aForm</name>
+    <message>
+        <source>Error</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Error while open dialog form. Init hasn&apos;t been completed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Error open dialog form. Form not found.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New document - &lt;Ins&gt;, Edit - &lt;Enter&gt;, View - &lt;Shift+Enter&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm creating form from ui</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm form create from ui ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm do not inherits aWidget!</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm load form module script</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm defined function %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm form module script is empty</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm form not found</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm not found widget with name %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm table value: column out of range</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm set read only</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm set read/write</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::show()</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::close()</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::turn_on()</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm conduct: function on_conduct() return false, document not conducted</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::turn_off()</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::update()</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Expected wDBTable widget but found %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm not found wDBTabe widget with name %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aForm not found wDBTable widget with name %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::done(...)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::setfocus()</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aLineEdit</name>
+    <message>
+        <source>Enter string for search</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aListBox</name>
+    <message>
+        <source>Press arrow down for go to drop down list</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use Enter for go to item and arrow for navigation</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>aListView</name>
+    <message>
+        <source>Select</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New element</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Undo mark delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete (mark deleted)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete (phisical)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type of new item</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&lt;p align=&quot;center&quot;&gt;Select type of new item&lt;/p&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Elemnt</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete item</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&lt;p align=&quot;center&quot;&gt;Mark deleted or delete?&lt;/p&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Mark deleted</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&lt;Enter&gt; - select, &lt;Ins&gt; - add, &lt;Del&gt; - delete items</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&lt;Enter&gt; - edit, &lt;Ins&gt; - add, &lt;Del&gt; - delete items</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>addfdialog</name>
+    <message>
+        <source>select field</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>field already binding, please select another field.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>eActionButton</name>
+    <message>
+        <source>Action button</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Update</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Simple action</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User action</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Execute</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Turn on</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>eAddObj</name>
+    <message>
+        <source>Form1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>eCatalogue</name>
+    <message>
+        <source>Catalogue</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>eDBField</name>
+    <message>
+        <source>Database field</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Field type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Field name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>eDBTable</name>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Width</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>aDBTable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Table name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Column list</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Column</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Header</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Field type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Field name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Column width</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>decimal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Up</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Down</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>table in use, please select another table</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>eDocument</name>
+    <message>
+        <source>Document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>eField</name>
+    <message>
+        <source>Input field</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Positive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Required</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Width</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Decimals</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>eJournal</name>
+    <message>
+        <source>Journal</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>eReport</name>
+    <message>
+        <source>Catalogue</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>eSelectDocType</name>
+    <message>
+        <source>Select document type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Document type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>wCatalogEditor</name>
+    <message>
+        <source>wCatalog Editor open form for select=%1 </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalog Editor found element forms</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalog Editor found group forms</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalog Editor meta object forms not found</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>wCatalogue</name>
+    <message>
+        <source>wCatalogue group value changed to %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalogue element value changed to %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalogue value for name %1 </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalogue set value %1 for name %2 </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalogue update</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalogue have not data source object </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalogue select group error = %1 </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalogue set new values for all fields</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalogue set new values for group field %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalogue value for element field %1 </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wCatalogue selection changed to %1 </source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>wDBTable</name>
+    <message>
+        <source>Available columns</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Date</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Prefix</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Number</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>View</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Refresh</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDBTable init ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDBTable init in engine </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDBTable not in Ananas object container </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDBTable init meta object not found </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDBTable container type is %1 </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDBTable filter is %1 </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDBTable init in engine ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDBTable: current record not setted</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDBTable: function Value() call</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDBTable: select document %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are going to remove record &lt;br&gt;Are you sure?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;No</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remove record?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Yes, remove</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>wDocument</name>
+    <message>
+        <source>wDocument new ok</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDocument set new value %1 for field %2 </source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>wField</name>
+    <message>
+        <source>^\-{0,1}\d{0,%1}\.{1}\d{0,%2}$</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>^\-{0,1}\d{0,%1}$</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>wGroupTree</name>
+    <message>
+        <source>New</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New group (Ins)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit group (Enter)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete group (Delete)</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>wJournal</name>
+    <message>
+        <source>New</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>View</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>View document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New document &lt;Ins&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Edit document &lt;Enter&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>View document &lt;Shift+Enter&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete document &lt;Delete&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Can not edit document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>To edit document you have to unconduct it. Or you can view it. Unconduct?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Unconduct</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;View</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirm</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Do you really want to delete document?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;Yes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&amp;No</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>wDBTable #%1 found </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Copy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Copy document</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Duplicate document &lt;Ctrl+D&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+</TS>
diff --git a/translations/ananas-plugins-ru.ts b/translations/ananas-plugins-ru.ts
new file mode 100644 (file)
index 0000000..3282106
--- /dev/null
@@ -0,0 +1,1153 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>CatalogForm</name>
+    <message>
+        <source>Catalogue</source>
+        <translation>Справочник</translation>
+    </message>
+    <message>
+        <source>Go</source>
+        <translation type="obsolete">Перейти</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation type="obsolete">Ок</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+    <message>
+        <source>displaying %1 from %2</source>
+        <translation>показано %1 из %2</translation>
+    </message>
+    <message>
+        <source>Can&apos;t added new element to mark deleted group</source>
+        <translation>Невозможно добавить новый элемент в удаленную группу</translation>
+    </message>
+    <message>
+        <source>Can&apos;t added element to element</source>
+        <translation type="obsolete">Невозможно добавить элемент в элемент</translation>
+    </message>
+    <message>
+        <source>Can&apos;t added group to element</source>
+        <translation>Невозможно добавить группу в элемент</translation>
+    </message>
+    <message>
+        <source>Can&apos;t added group to mark deleted group</source>
+        <translation>Невозможно добавить группу в удаленную группу</translation>
+    </message>
+    <message>
+        <source>Can&apos;t edit mark deleted element</source>
+        <translation>Невозможно редактировать удаленный элемент</translation>
+    </message>
+    <message>
+        <source>Catalog haven&apos;t edit element form</source>
+        <translation>Не задана форма редактирования элемента</translation>
+    </message>
+    <message>
+        <source>Can&apos;t edit mark deleted group</source>
+        <translation>Невозможно редактировать удаленную группу</translation>
+    </message>
+    <message>
+        <source>Catalog haven&apos;t edit group form</source>
+        <translation>Не задана форма редактирования группы</translation>
+    </message>
+    <message>
+        <source>Can&apos;t added element</source>
+        <translation type="obsolete">Невозможно добавить элемент</translation>
+    </message>
+    <message>
+        <source>Search</source>
+        <translation>Поиск</translation>
+    </message>
+    <message>
+        <source>CatalogForm:setData begin</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>CatalogForm add first element in group</source>
+        <translation>CatalogForm: Добавление первого элемента в группу</translation>
+    </message>
+    <message>
+        <source>CatalogForm add elements into root</source>
+        <translation>CatalogForm: Добавление элементов в корень</translation>
+    </message>
+    <message>
+        <source>CatalogForm init</source>
+        <translation>CatalogForm: Инициализа</translation>
+    </message>
+    <message>
+        <source>Catalog Form image cat.png not loaded</source>
+        <translation>CatalogForm: Изображение cat.png не загружено</translation>
+    </message>
+    <message>
+        <source>Catalog Form group pixmap not load</source>
+        <translation>CatalogForm: Значек изображения для групп не загружен</translation>
+    </message>
+    <message>
+        <source>Catalog Form element pixmap not load</source>
+        <translation>CatalogForm: Значек изображения элемента не загружен</translation>
+    </message>
+    <message>
+        <source>Catalog Form mark deleted group pixmap not load</source>
+        <translation>CatalogForm: Значек изображения для удаленной группы не загружен</translation>
+    </message>
+    <message>
+        <source>Catalog Form edit element form is null</source>
+        <translation>CatalogForm: Форма редактирования элемента = null</translation>
+    </message>
+    <message>
+        <source>Catalog Form edit group form is null</source>
+        <translation>CataloForm: Форма редактирования группы = null</translation>
+    </message>
+    <message>
+        <source>Catalog Form edit element start</source>
+        <translation>CatalogForm: Начинаем открывать форму редактирования элемента</translation>
+    </message>
+    <message>
+        <source>Catalog Form edit element with id=%1</source>
+        <translation>CatalogForm: Редактирование элемента с идентификатором id=%1</translation>
+    </message>
+    <message>
+        <source>Catalog Form edit group with id = %1</source>
+        <translation>CatalogForm: Редактирование группы с идентификатором id = %1</translation>
+    </message>
+    <message>
+        <source>Catalog Form main widget is not &apos;MainForm&apos;</source>
+        <translation>CatalogForm: Главный виджет не является &apos;MainForm&apos;</translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <source>report 
+</source>
+        <translation type="obsolete">отчет</translation>
+    </message>
+    <message>
+        <source>text report
+</source>
+        <translation type="obsolete">текстовый отчет</translation>
+    </message>
+    <message>
+        <source>invalid arguments
+</source>
+        <translation type="obsolete">неверный аргумент</translation>
+    </message>
+    <message>
+        <source>aForm SelectByCurrent %1 ended with %1</source>
+        <translation>aForm: Результат выполнения SelectByCurrent по идентификатору %1 равен %1</translation>
+    </message>
+    <message>
+        <source>Unknown classname &apos;%1&apos; or metaobject &apos;%2&apos;</source>
+        <translation>Неизвестное имя класса &apos;%1&apos; или неопределен объект метаданных  &apos;%2&apos;</translation>
+    </message>
+</context>
+<context>
+    <name>aEditorFactory</name>
+    <message>
+        <source>aEditorFactory field metaobject not found</source>
+        <translation>aEditorFactory: Поле в метаданных не найдено</translation>
+    </message>
+    <message>
+        <source>aEditorFactory metadata in null</source>
+        <translation>aEditorFactory: Объект метаданных = null</translation>
+    </message>
+</context>
+<context>
+    <name>aEngine</name>
+    <message>
+        <source>Line:%1 %2 (%3)</source>
+        <translation type="obsolete">Строка:%1 %2 (%3)</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+    <message>
+        <source>aEngine open form %1 in mode %2, select %3</source>
+        <translation>aEngine: Открытие формы %1 в режиме %2, UID = %3</translation>
+    </message>
+    <message>
+        <source>aEngine form create error</source>
+        <translation>aEngine: Ошибка создания формы</translation>
+    </message>
+    <message>
+        <source>aEngine open form mode %1 not supported</source>
+        <translation>aEngine: Открытие формы в режиме %1 не поддерживается</translation>
+    </message>
+    <message>
+        <source>Line:%1 Message:%2 Stack:(%3)</source>
+        <translation>Строка:%1 Сообщение:%2 Стэк:(%3)</translation>
+    </message>
+</context>
+<context>
+    <name>aForm</name>
+    <message>
+        <source>Invalid widget class. Widget class have to inherits aWidget.
+</source>
+        <translation type="obsolete">Неверно задан класс. Виджет должен быть унаследован от класса aWidget.</translation>
+    </message>
+    <message>
+        <source>Error</source>
+        <translation>Ошибка</translation>
+    </message>
+    <message>
+        <source>Error while open dialog form. Init hasn&apos;t been completed.</source>
+        <translation>Ошибка открытия диалога. Инициализация не завершена.</translation>
+    </message>
+    <message>
+        <source>Error open dialog form. Form not found.</source>
+        <translation>Ошибка открытия формы диалога. Форма не найдена.</translation>
+    </message>
+    <message>
+        <source>on_formstart()</source>
+        <translation type="obsolete">on_formstart()</translation>
+    </message>
+    <message>
+        <source>Error! Can&apos;t find widget by name==`%s`
+</source>
+        <translation type="obsolete">Ошибка, Не могу найти виджет по имени `%s`</translation>
+    </message>
+    <message>
+        <source>Error! Can&apos;t find wDBTable `%s`
+</source>
+        <translation type="obsolete">Ошибка! Не могу найти wDBTable `%s`</translation>
+    </message>
+    <message>
+        <source>on_button(&quot;</source>
+        <translation type="obsolete">on_button(&quot;</translation>
+    </message>
+    <message>
+        <source>&quot;)</source>
+        <translation type="obsolete">&quot;)</translation>
+    </message>
+    <message>
+        <source>on_conduct()</source>
+        <translation type="obsolete">on_conduct()</translation>
+    </message>
+    <message>
+        <source>New document - &lt;Ins&gt;, Edit - &lt;Enter&gt;, View - &lt;Shift+Enter&gt;</source>
+        <translation>Новый документ - &lt;Ins&gt;, Изменить - &lt;Enter&gt;,  Просмотр - &lt;Shift+Enter&gt;</translation>
+    </message>
+    <message>
+        <source>Error! Can&apos;t find widget wDBTable by name==`%s`
+</source>
+        <translation type="obsolete">Ошибка! Невозможно найти виджет wDBTable с именем `%s&apos;</translation>
+    </message>
+    <message>
+        <source>aForm creating form from ui</source>
+        <translation>aForm: Создание формы из ui файла</translation>
+    </message>
+    <message>
+        <source>aForm form create from ui ok</source>
+        <translation>aForm: Форма успешно создана из ui файла</translation>
+    </message>
+    <message>
+        <source>aForm do not inherits aWidget!</source>
+        <translation>aForm: Не является наследником aWidget!</translation>
+    </message>
+    <message>
+        <source>aForm load form module script</source>
+        <translation>aForm: Загрузка скрипта модуля формы</translation>
+    </message>
+    <message>
+        <source>aForm defined function %1</source>
+        <translation>aForm: Определена функция %1</translation>
+    </message>
+    <message>
+        <source>aForm form module script is empty</source>
+        <translation>aForm: Скрипт модуля формы пуст</translation>
+    </message>
+    <message>
+        <source>aForm form not found</source>
+        <translation>aForm: Форма не найдена</translation>
+    </message>
+    <message>
+        <source>aForm not found widget with name %1</source>
+        <translation>aForm: Не найден виджет по имени %1</translation>
+    </message>
+    <message>
+        <source>aForm table value: column out of range</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>aForm set read only</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>aForm set read/write</source>
+        <translation>aForm: Установка режима чтение/запись для формы</translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::show()</source>
+        <translation>Вызов устаревшего метода: aForm::show()</translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::close()</source>
+        <translation>Вызов устаревшего метода: aForm::close()</translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::turn_on()</source>
+        <translation>Вызов устаревшего метода: aForm::turn_on()</translation>
+    </message>
+    <message>
+        <source>aForm conduct: function on_conduct() return false, document not conducted</source>
+        <translation>aForm: Проведение документа: Функция on_conduct() вернула false. Документ не проведен</translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::turn_off()</source>
+        <translation>Вызов устаревшего метода: aForm::turn_off()</translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::update()</source>
+        <translation>Вызов устаревшего метода: aForm::update()</translation>
+    </message>
+    <message>
+        <source>Expected wDBTable widget but found %1</source>
+        <translation>Ожидался wDBTable виджет, но обнаружен %1</translation>
+    </message>
+    <message>
+        <source>aForm not found wDBTabe widget with name %1</source>
+        <translation>aForm: Виджет wDBTabe с именем %1 не обнаружен</translation>
+    </message>
+    <message>
+        <source>aForm not found wDBTable widget with name %1</source>
+        <translation>aForm: Виджет wDBTable с именем %1 не обнаружен</translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::done(...)</source>
+        <translation>Вызов устаревшего метода: aForm::done(...)</translation>
+    </message>
+    <message>
+        <source>Deprecated method call: aForm::setfocus()</source>
+        <translation>Вызов устаревшего метода: aForm::setfocus()</translation>
+    </message>
+</context>
+<context>
+    <name>aLineEdit</name>
+    <message>
+        <source>Enter string for search</source>
+        <translation>Задайте строку поиска</translation>
+    </message>
+</context>
+<context>
+    <name>aListBox</name>
+    <message>
+        <source>Press arrow down for go to drop down list</source>
+        <translation>Нажмите стрелку вниз для перемещения в выпадающий список</translation>
+    </message>
+    <message>
+        <source>Use Enter for go to item and arrow for navigation</source>
+        <translation>Используйте стрелки. Для перехода нажмите Enter</translation>
+    </message>
+</context>
+<context>
+    <name>aListView</name>
+    <message>
+        <source>Select</source>
+        <translation>Выбрать</translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation>Изменить</translation>
+    </message>
+    <message>
+        <source>New element</source>
+        <translation>Новый элемент</translation>
+    </message>
+    <message>
+        <source>New group</source>
+        <translation>Новая группа</translation>
+    </message>
+    <message>
+        <source>Undo mark delete</source>
+        <translation>Отменить удаление</translation>
+    </message>
+    <message>
+        <source>Delete (mark deleted)</source>
+        <translation>Удалить (логически)</translation>
+    </message>
+    <message>
+        <source>Delete (phisical)</source>
+        <translation>Удалить (физически)</translation>
+    </message>
+    <message>
+        <source>Type of new item</source>
+        <translation>Тип нового элемента</translation>
+    </message>
+    <message>
+        <source>&lt;p align=&quot;center&quot;&gt;Select type of new item&lt;/p&gt;</source>
+        <translation>&lt;p align=&quot;center&quot;&gt;Выберите тип нового элемента&lt;/p&gt;</translation>
+    </message>
+    <message>
+        <source>&amp;Elemnt</source>
+        <translation>&amp;Элемент</translation>
+    </message>
+    <message>
+        <source>&amp;Group</source>
+        <translation>&amp;Группа</translation>
+    </message>
+    <message>
+        <source>Delete item</source>
+        <translation>Удалить элемент</translation>
+    </message>
+    <message>
+        <source>&lt;p align=&quot;center&quot;&gt;Mark deleted or delete?&lt;/p&gt;</source>
+        <translation>&lt;p align=&quot;center&quot;&gt;Пометить удаленным или удалить совсем?&lt;/p&gt;</translation>
+    </message>
+    <message>
+        <source>&amp;Mark deleted</source>
+        <translation>&amp;Пометить удаленным</translation>
+    </message>
+    <message>
+        <source>&amp;Delete</source>
+        <translation>&amp;Удалить</translation>
+    </message>
+    <message>
+        <source>&lt;Enter&gt; - select, &lt;Ins&gt; - add, &lt;Del&gt; - delete items</source>
+        <translation>&lt;Enter&gt; - Выбрать, &lt;Ins&gt; - Новый, &lt;Del&gt; - Удалить</translation>
+    </message>
+    <message>
+        <source>&lt;Enter&gt; - edit, &lt;Ins&gt; - add, &lt;Del&gt; - delete items</source>
+        <translation>&lt;Enter&gt; - Изменить, &lt;Ins&gt; - Новый, &lt;Del&gt; - Удалить</translation>
+    </message>
+</context>
+<context>
+    <name>addfdialog</name>
+    <message>
+        <source>select field</source>
+        <translation>выбрать поле</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+    <message>
+        <source>field already binding, please select another field.</source>
+        <translation>поле уже используется, выберите другое поле.</translation>
+    </message>
+</context>
+<context>
+    <name>eActionButton</name>
+    <message>
+        <source>Action button</source>
+        <translation>Действие</translation>
+    </message>
+    <message>
+        <source>Script</source>
+        <translation type="obsolete">Скрипт</translation>
+    </message>
+    <message>
+        <source>Action</source>
+        <translation type="obsolete">Действие</translation>
+    </message>
+    <message>
+        <source>Update</source>
+        <translation>Обновить</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation>Закрыть</translation>
+    </message>
+    <message>
+        <source>Turn on</source>
+        <translation>Включить</translation>
+    </message>
+    <message>
+        <source>Print</source>
+        <translation type="obsolete">Печать</translation>
+    </message>
+    <message>
+        <source>Simple action</source>
+        <translation>Простое действие</translation>
+    </message>
+    <message>
+        <source>User action</source>
+        <translation>Пользовательское действие</translation>
+    </message>
+    <message>
+        <source>Execute</source>
+        <translation>Выполнить</translation>
+    </message>
+    <message>
+        <source>Conduct</source>
+        <translation type="obsolete">Провести</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+</context>
+<context>
+    <name>eAddObj</name>
+    <message>
+        <source>Form1</source>
+        <translation></translation>
+    </message>
+</context>
+<context>
+    <name>eCatalogue</name>
+    <message>
+        <source>Catalogue</source>
+        <translation>Справочник</translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation>Тип</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+</context>
+<context>
+    <name>eDBField</name>
+    <message>
+        <source>Database field</source>
+        <translation>Поле базы данных</translation>
+    </message>
+    <message>
+        <source>Field type</source>
+        <translation>Тип поля</translation>
+    </message>
+    <message>
+        <source>Field name</source>
+        <translation>Имя поля</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+</context>
+<context>
+    <name>eDBTable</name>
+    <message>
+        <source>Database table</source>
+        <translation type="obsolete">Таблица базы данных</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Field</source>
+        <translation type="obsolete">Поле</translation>
+    </message>
+    <message>
+        <source>Width</source>
+        <translation>Ширина</translation>
+    </message>
+    <message>
+        <source>Table</source>
+        <translation type="obsolete">Таблица</translation>
+    </message>
+    <message>
+        <source>aDBTable</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Table name</source>
+        <translation>Имя таблицы</translation>
+    </message>
+    <message>
+        <source>Column list</source>
+        <translation>Список столбцов</translation>
+    </message>
+    <message>
+        <source>Column</source>
+        <translation>Столбец</translation>
+    </message>
+    <message>
+        <source>Header</source>
+        <translation>Заголовок</translation>
+    </message>
+    <message>
+        <source>Field type</source>
+        <translation>Тип поля</translation>
+    </message>
+    <message>
+        <source>Field name</source>
+        <translation>Имя поля</translation>
+    </message>
+    <message>
+        <source>Column width</source>
+        <translation>Ширина столбца</translation>
+    </message>
+    <message>
+        <source>decimal</source>
+        <translation>десятичный</translation>
+    </message>
+    <message>
+        <source>Add</source>
+        <translation>Добавить</translation>
+    </message>
+    <message>
+        <source>Up</source>
+        <translation>Вверх</translation>
+    </message>
+    <message>
+        <source>Down</source>
+        <translation>Вниз</translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation>Удалить</translation>
+    </message>
+    <message>
+        <source>table in use, please select another table</source>
+        <translation>Таблица занята, выберите другую таблицу</translation>
+    </message>
+</context>
+<context>
+    <name>eDocument</name>
+    <message>
+        <source>Document</source>
+        <translation>Документ</translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation>Тип</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+</context>
+<context>
+    <name>eField</name>
+    <message>
+        <source>Input field</source>
+        <translation>Поле ввода</translation>
+    </message>
+    <message>
+        <source>Positive</source>
+        <translation>Положительное</translation>
+    </message>
+    <message>
+        <source>Required</source>
+        <translation>Обязательное</translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation>Тип</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+    <message>
+        <source>Width</source>
+        <translation>Ширина</translation>
+    </message>
+    <message>
+        <source>Decimals</source>
+        <translation>Десятичное</translation>
+    </message>
+</context>
+<context>
+    <name>eJournal</name>
+    <message>
+        <source>Journal</source>
+        <translation>Журнал</translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation>Тип</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+</context>
+<context>
+    <name>eReport</name>
+    <message>
+        <source>Catalogue</source>
+        <translation>Справочник</translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation>Тип</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+</context>
+<context>
+    <name>eSelectDocType</name>
+    <message>
+        <source>Select document type</source>
+        <translation>Выберите тип документа</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Отмена</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>Ок</translation>
+    </message>
+    <message>
+        <source>Document type</source>
+        <translation>Тип документа</translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <translation></translation>
+    </message>
+</context>
+<context>
+    <name>eTable</name>
+    <message>
+        <source>Form table</source>
+        <translation type="obsolete">Таблица формы</translation>
+    </message>
+    <message>
+        <source>List of columns</source>
+        <translation type="obsolete">Список столбцов</translation>
+    </message>
+    <message>
+        <source>Table name</source>
+        <translation type="obsolete">Имя таблицы</translation>
+    </message>
+    <message>
+        <source>Table column</source>
+        <translation type="obsolete">Столбец таблицы</translation>
+    </message>
+    <message>
+        <source>Header</source>
+        <translation type="obsolete">Заголовок</translation>
+    </message>
+    <message>
+        <source>Width</source>
+        <translation type="obsolete">Ширина</translation>
+    </message>
+    <message>
+        <source>Field type</source>
+        <translation type="obsolete">Тип поля</translation>
+    </message>
+    <message>
+        <source>Field name</source>
+        <translation type="obsolete">Имя поля</translation>
+    </message>
+    <message>
+        <source>View width</source>
+        <translation type="obsolete">Ширина просмотра</translation>
+    </message>
+    <message>
+        <source>decimals</source>
+        <translation type="obsolete">десятичные</translation>
+    </message>
+    <message>
+        <source>Add</source>
+        <translation type="obsolete">Добавить</translation>
+    </message>
+    <message>
+        <source>Up</source>
+        <translation type="obsolete">Вверх</translation>
+    </message>
+    <message>
+        <source>Down</source>
+        <translation type="obsolete">Вниз</translation>
+    </message>
+    <message>
+        <source>Remove</source>
+        <translation type="obsolete">Удалить</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Отмена</translation>
+    </message>
+</context>
+<context>
+    <name>wCatalogEditor</name>
+    <message>
+        <source>wCatalog Editor open form for select=%1 </source>
+        <translation>wCatalog: Открытие формы редактора для выбора %1</translation>
+    </message>
+    <message>
+        <source>wCatalog Editor found element forms</source>
+        <translation>wCatalog: Редактор нашел форму для редактирования элемента</translation>
+    </message>
+    <message>
+        <source>wCatalog Editor found group forms</source>
+        <translation>wCatalog: Редактор нашел форму для редактирования группы</translation>
+    </message>
+    <message>
+        <source>wCatalog Editor meta object forms not found</source>
+        <translation>wCatalog: Не найдены формы в метаданных</translation>
+    </message>
+</context>
+<context>
+    <name>wCatalogue</name>
+    <message>
+        <source>wCatalogue group value changed to %1</source>
+        <translation>wCatalogue: Значение группы изменено на %1</translation>
+    </message>
+    <message>
+        <source>wCatalogue element value changed to %1</source>
+        <translation>wCatalogue: Значение элемента изменено на %1</translation>
+    </message>
+    <message>
+        <source>wCatalogue value for name %1 </source>
+        <translation>wCatalogue: Значение для имени %1</translation>
+    </message>
+    <message>
+        <source>wCatalogue set value %1 for name %2 </source>
+        <translation>wCatalogue: Задаем значение %1 для имени %2</translation>
+    </message>
+    <message>
+        <source>wCatalogue update</source>
+        <translation>wCatalogue: Обновление</translation>
+    </message>
+    <message>
+        <source>wCatalogue have not data source object </source>
+        <translation>wCatalogue: Нет объекта источника данных</translation>
+    </message>
+    <message>
+        <source>wCatalogue select group error = %1 </source>
+        <translation>wCatalogue: Ошибка выбора группы: %1</translation>
+    </message>
+    <message>
+        <source>wCatalogue set new values for all fields</source>
+        <translation>wCatalogue: Установка новых значений для всех полей</translation>
+    </message>
+    <message>
+        <source>wCatalogue set new values for group field %1</source>
+        <translation>wCatalogue: Установка значения для поля %1 группы</translation>
+    </message>
+    <message>
+        <source>wCatalogue value for element field %1 </source>
+        <translation>wCatalogue: Установка значения для поля %1 элемента</translation>
+    </message>
+    <message>
+        <source>wCatalogue selection changed to %1 </source>
+        <translation>wCatalogue: Выбор изменен на %1</translation>
+    </message>
+</context>
+<context>
+    <name>wDBField</name>
+    <message>
+        <source>field already binding, please select another field.</source>
+        <translation type="obsolete">поле уже используется, выберите другое поле.</translation>
+    </message>
+</context>
+<context>
+    <name>wDBTable</name>
+    <message>
+        <source>Available columns</source>
+        <translation>Доступные столбцы</translation>
+    </message>
+    <message>
+        <source>Date</source>
+        <translation>Дата</translation>
+    </message>
+    <message>
+        <source>Prefix</source>
+        <translation>Префикс</translation>
+    </message>
+    <message>
+        <source>Number</source>
+        <translation>Номер</translation>
+    </message>
+    <message>
+        <source>New</source>
+        <translation>Новый</translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation>Изменить</translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation>Удалить</translation>
+    </message>
+    <message>
+        <source>View</source>
+        <translation>Просмотр</translation>
+    </message>
+    <message>
+        <source>Refresh</source>
+        <translation>Обновить</translation>
+    </message>
+    <message>
+        <source>wDBTable init ok</source>
+        <translation>wDBTable: Инициализация прошла успешно</translation>
+    </message>
+    <message>
+        <source>wDBTable init in engine </source>
+        <translation>wDBTable: Инициализация engine</translation>
+    </message>
+    <message>
+        <source>wDBTable not in Ananas object container </source>
+        <translation>wDBTable: Не является контейнером объектов Ananas</translation>
+    </message>
+    <message>
+        <source>wDBTable init meta object not found </source>
+        <translation>wDBTable: Объект мета данных не найден</translation>
+    </message>
+    <message>
+        <source>wDBTable container type is %1 </source>
+        <translation>wDBTable: Контейнер имеет тип %1</translation>
+    </message>
+    <message>
+        <source>wDBTable filter is %1 </source>
+        <translation>wDBTable: Текущий фильтр: %1</translation>
+    </message>
+    <message>
+        <source>wDBTable init in engine ok</source>
+        <translation>wDBTable: Успешное завершение инициализации в engine</translation>
+    </message>
+    <message>
+        <source>wDBTable: current record not setted</source>
+        <translation>wDBTable: Текущая запись не задана</translation>
+    </message>
+    <message>
+        <source>wDBTable: function Value() call</source>
+        <translation>wDBTable: Вызов функции Value()</translation>
+    </message>
+    <message>
+        <source>wDBTable: select document %1</source>
+        <translation>wDBTable: Выбор документа %1</translation>
+    </message>
+    <message>
+        <source>Remove record? -- Ananas</source>
+        <translation type="obsolete">Удалить запись? -- Ананас</translation>
+    </message>
+    <message>
+        <source>You are going to remove record &lt;br&gt;Are you sure?</source>
+        <translation>Вы собрались удалить запись &lt;br&gt; Действительно удалить?</translation>
+    </message>
+    <message>
+        <source>&amp;Yes</source>
+        <translation type="obsolete">&amp;Да</translation>
+    </message>
+    <message>
+        <source>&amp;No</source>
+        <translation>&amp;Нет</translation>
+    </message>
+    <message>
+        <source>Remove record?</source>
+        <translation>Удалить запись?</translation>
+    </message>
+    <message>
+        <source>&amp;Yes, remove</source>
+        <translation>&amp;Да, удалить</translation>
+    </message>
+</context>
+<context>
+    <name>wDocument</name>
+    <message>
+        <source>wDocument new ok</source>
+        <translation>wDocument: Новый wDocument успешно создан</translation>
+    </message>
+    <message>
+        <source>wDocument set new value %1 for field %2 </source>
+        <translation>wDocument: Задаем новое значение %1 полю %2</translation>
+    </message>
+</context>
+<context>
+    <name>wField</name>
+    <message>
+        <source>^\-{0,1}\d{0,%1}\.{1}\d{0,%2}$</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>^\-{0,1}\d{0,%1}$</source>
+        <translation></translation>
+    </message>
+</context>
+<context>
+    <name>wGroupTree</name>
+    <message>
+        <source>New</source>
+        <translation>Новый</translation>
+    </message>
+    <message>
+        <source>New group</source>
+        <translation>Новая группа</translation>
+    </message>
+    <message>
+        <source>New group (Ins)</source>
+        <translation>Новая группа (Ins)</translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation>Изменить</translation>
+    </message>
+    <message>
+        <source>Edit group</source>
+        <translation>Изменить группу</translation>
+    </message>
+    <message>
+        <source>Edit group (Enter)</source>
+        <translation>Изменить группу (Enter)</translation>
+    </message>
+    <message>
+        <source>Delete group</source>
+        <translation>Удалить группу</translation>
+    </message>
+    <message>
+        <source>Delete group (Delete)</source>
+        <translation>Удалить группу (Delete)</translation>
+    </message>
+</context>
+<context>
+    <name>wJournal</name>
+    <message>
+        <source>New</source>
+        <translation>Новый</translation>
+    </message>
+    <message>
+        <source>New document</source>
+        <translation>Новый документ</translation>
+    </message>
+    <message>
+        <source>New document (Ins)</source>
+        <translation type="obsolete">Новый документ (Ins)</translation>
+    </message>
+    <message>
+        <source>Edit</source>
+        <translation>Изменить</translation>
+    </message>
+    <message>
+        <source>Edit document</source>
+        <translation>Изменить документ</translation>
+    </message>
+    <message>
+        <source>Edit document (Enter)</source>
+        <translation type="obsolete">Изменить документ (Enter)</translation>
+    </message>
+    <message>
+        <source>View</source>
+        <translation>Просмотр</translation>
+    </message>
+    <message>
+        <source>View document</source>
+        <translation>Просмотр документа</translation>
+    </message>
+    <message>
+        <source>View document (Shift+Enter)</source>
+        <translation type="obsolete">Просмотр документа (Shift+Enter)</translation>
+    </message>
+    <message>
+        <source>Can not edit document</source>
+        <translation>Не могу редактировать документ</translation>
+    </message>
+    <message>
+        <source>To edit document you have to unconduct it. Or you can view it. Unconduct?</source>
+        <translation>Для редактирования документа Вы должны отменить его проведение. Или Вы можете просмотреть его. Отменить проведение?</translation>
+    </message>
+    <message>
+        <source>&amp;Unconduct</source>
+        <translation>&amp;Отменить проведение</translation>
+    </message>
+    <message>
+        <source>&amp;View</source>
+        <translation>&amp;Просмотр</translation>
+    </message>
+    <message>
+        <source>New document &lt;Ins&gt;</source>
+        <translation>Новый документ - &lt;Ins&gt;</translation>
+    </message>
+    <message>
+        <source>Edit document &lt;Enter&gt;</source>
+        <translation>Изменить документ - &lt;Enter&gt;</translation>
+    </message>
+    <message>
+        <source>View document &lt;Shift+Enter&gt;</source>
+        <translation>Просмотр документа - &lt;Shift+Enter&gt;</translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation>Удалить</translation>
+    </message>
+    <message>
+        <source>Delete document</source>
+        <translation>Удалить документ</translation>
+    </message>
+    <message>
+        <source>Delete document &lt;Delete&gt;</source>
+        <translation>Удалить документ - &lt;Delete&gt;</translation>
+    </message>
+    <message>
+        <source>Confirm</source>
+        <translation>Подтвердить</translation>
+    </message>
+    <message>
+        <source>Do you really want to delete document?</source>
+        <translation>Вы действительно хотите удалить документ?</translation>
+    </message>
+    <message>
+        <source>&amp;Yes</source>
+        <translation>&amp;Да</translation>
+    </message>
+    <message>
+        <source>&amp;No</source>
+        <translation>&amp;Нет</translation>
+    </message>
+    <message>
+        <source>wDBTable #%1 found </source>
+        <translation>wDBTable: Не удалось обнаружить #%1 </translation>
+    </message>
+    <message>
+        <source>Copy</source>
+        <translation>Копировать</translation>
+    </message>
+    <message>
+        <source>Copy document</source>
+        <translation>Копировать документ</translation>
+    </message>
+    <message>
+        <source>Duplicate document &lt;Ctrl+D&gt;</source>
+        <translation>Создать копию документа &lt;Ctrl+D&gt;</translation>
+    </message>
+</context>
+</TS>