kexi
kexireportpart.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <kdebug.h>
00022 #include <kgenericfactory.h>
00023
00024 #include "kexiviewbase.h"
00025 #include "keximainwindow.h"
00026 #include "kexiproject.h"
00027 #include <kexipartitem.h>
00028 #include <kexidialogbase.h>
00029
00030 #include <kexidb/connection.h>
00031 #include <kexidb/fieldlist.h>
00032 #include <kexidb/field.h>
00033
00034 #include <form.h>
00035 #include <formIO.h>
00036 #include <widgetlibrary.h>
00037
00038 #include <kexiformmanager.h>
00039 #include <kexiformpart.h>
00040
00041 #include "kexireportview.h"
00042 #include "kexireportpart.h"
00043
00044 KFormDesigner::WidgetLibrary* KexiReportPart::static_reportsLibrary = 0L;
00045
00046 KexiReportPart::KexiReportPart(QObject *parent, const char *name, const QStringList &l)
00047 : KexiPart::Part(parent, name, l)
00048 {
00049
00050 m_registeredPartID = (int)KexiPart::ReportObjectType;
00051
00052 kexipluginsdbg << "KexiReportPart::KexiReportPart()" << endl;
00053 m_names["instanceName"]
00054 = i18n("Translate this word using only lowercase alphanumeric characters (a..z, 0..9). "
00055 "Use '_' character instead of spaces. First character should be a..z character. "
00056 "If you cannot use latin characters in your language, use english word.",
00057 "report");
00058 m_names["instanceCaption"] = i18n("Report");
00059 m_supportedViewModes = Kexi::DataViewMode | Kexi::DesignViewMode;
00060
00061
00062
00063 KFormDesigner::FormManager *formManager = KFormDesigner::FormManager::self();
00064 if (!formManager)
00065 formManager = new KexiFormManager(this, "kexi_form_and_report_manager");
00066
00067
00068
00069 QStringList supportedFactoryGroups;
00070 supportedFactoryGroups += "kexi-report";
00071 static_reportsLibrary = KFormDesigner::FormManager::createWidgetLibrary(
00072 formManager, supportedFactoryGroups);
00073 static_reportsLibrary->setAdvancedPropertiesVisible(false);
00074 }
00075
00076 KexiReportPart::~KexiReportPart()
00077 {
00078 }
00079
00080 KFormDesigner::WidgetLibrary* KexiReportPart::library()
00081 {
00082 return static_reportsLibrary;
00083 }
00084
00085 void
00086 KexiReportPart::initPartActions()
00087 {
00088 }
00089
00090 void
00091 KexiReportPart::initInstanceActions()
00092 {
00093 KFormDesigner::FormManager::self()->createActions(
00094 library(), actionCollectionForMode(Kexi::DesignViewMode), guiClient());
00095 }
00096
00097 KexiDialogTempData*
00098 KexiReportPart::createTempData(KexiDialogBase* dialog)
00099 {
00100 return new KexiReportPart::TempData(dialog);
00101 }
00102
00103 KexiViewBase*
00104 KexiReportPart::createView(QWidget *parent, KexiDialogBase* dialog,
00105 KexiPart::Item &item, int, QMap<QString,QString>*)
00106 {
00107 kexipluginsdbg << "KexiReportPart::createView()" << endl;
00108 KexiMainWindow *win = dialog->mainWin();
00109 if (!win || !win->project() || !win->project()->dbConnection())
00110 return 0;
00111
00112 KexiReportView *view = new KexiReportView(win, parent, item.name().latin1(),
00113 win->project()->dbConnection() );
00114
00115 return view;
00116 }
00117
00118 QString
00119 KexiReportPart::i18nMessage(const QCString& englishMessage, KexiDialogBase* dlg) const
00120 {
00121 Q_UNUSED(dlg);
00122 if (englishMessage=="Design of object \"%1\" has been modified.")
00123 return i18n("Design of report \"%1\" has been modified.");
00124 if (englishMessage=="Object \"%1\" already exists.")
00125 return i18n("Report \"%1\" already exists.");
00126 return englishMessage;
00127 }
00128
00129
00130
00131 KexiReportPart::TempData::TempData(QObject* parent)
00132 : KexiDialogTempData(parent)
00133 {
00134 }
00135
00136 KexiReportPart::TempData::~TempData()
00137 {
00138 }
00139
00140 #include "kexireportpart.moc"
00141
|