21#include "kexiaboutdata.h"
22#include "kexicmdlineargs.h"
24#include <kexiutils/identifier.h>
25#include <kexidb/msghandler.h>
30#include <tqpixmapcache.h>
32#include <tqfileinfo.h>
36#include <tdeapplication.h>
37#include <kiconloader.h>
38#include <kiconeffect.h>
39#include <ksharedptr.h>
41#include <kstaticdeleter.h>
42#include <tdeglobalsettings.h>
48class KexiInternal :
public TDEShared
51 KexiInternal() : TDEShared()
69static KStaticDeleter<KexiInternal> Kexi_intDeleter;
70KexiInternal* _int = 0;
72#define _INIT_SHARED { if (!_int) Kexi_intDeleter.setObject( _int, new KexiInternal() ); }
81 _int->connset->load();
83 return *_int->connset;
88 return _int->recentProjects;
94 return _int->driverManager;
100 return _int->partManager;
109bool _tempShowForms =
true;
111#ifndef KEXI_FORMS_SUPPORT
112 _tempShowForms =
false;
114 return _tempShowForms;
117bool _tempShowReports =
true;
119#ifndef KEXI_REPORTS_SUPPORT
120 _tempShowReports =
false;
122 return _tempShowReports;
125bool _tempShowMacros =
true;
127#ifndef KEXI_MACROS_SUPPORT
128 _tempShowMacros =
false;
130 return _tempShowMacros;
133bool _tempShowScripts =
true;
135#ifndef KEXI_SCRIPTS_SUPPORT
136 _tempShowScripts =
false;
138 return _tempShowScripts;
146 if (!_int->smallFont) {
147 _int->smallFont =
new TQFont( init->font() );
148 const int wdth = TDEGlobalSettings::desktopGeometry(init).width();
149 int size = 10 + TQMAX(0, wdth - 1100) / 100;
150 size = TQMIN( init->fontInfo().pixelSize(), size );
151 _int->smallFont->setPixelSize( size );
153 return *_int->smallFont;
160 else if (m==DataViewMode)
return i18n(
"Data View");
161 else if (m==DesignViewMode)
return i18n(
"Design View");
164 return i18n(
"Unknown");
169TQString Kexi::msgYouCanImproveData() {
170 return i18n(
"You can correct data in this row or use \"Cancel row changes\" function.");
175ObjectStatus::ObjectStatus()
180ObjectStatus::ObjectStatus(
const TQString& message,
const TQString& description)
183 setStatus(message, description);
186ObjectStatus::ObjectStatus(
KexiDB::Object* dbObject,
const TQString& message,
const TQString& description)
189 setStatus(dbObject, message, description);
192ObjectStatus::~ObjectStatus()
202bool ObjectStatus::error()
const
204 return !message.isEmpty()
208void ObjectStatus::setStatus(
const TQString& message,
const TQString& description)
211 this->message=message;
212 this->description=description;
215void ObjectStatus::setStatus(
KexiDB::Object* dbObject,
const TQString& message,
const TQString& description)
217 if (
dynamic_cast<TQObject*
>(dbObject)) {
218 dbObj =
dynamic_cast<TQObject*
>(dbObject);
220 this->message=message;
221 this->description=description;
224void ObjectStatus::setStatus(
KexiDB::ResultInfo* result,
const TQString& message,
const TQString& description)
227 if (message.isEmpty())
228 this->message = result->msg;
230 this->message = message +
" " + result->msg;
232 if (description.isEmpty())
233 this->description = result->
desc;
235 this->description = description +
" " + result->
desc;
242 const TQString& message,
const TQString& description)
245 setStatus(result, message, description);
247 setStatus(dbObject, message, description);
249 setStatus(dbObject, message, description);
250 setStatus(result, this->message, this->description);
254void ObjectStatus::clearStatus()
257 description=TQString();
260TQString ObjectStatus::singleStatusString()
const {
261 if (message.isEmpty() || description.isEmpty())
263 return message +
" " + description;
266void ObjectStatus::append(
const ObjectStatus& otherStatus ) {
267 if (message.isEmpty()) {
268 message = otherStatus.message;
269 description = otherStatus.description;
272 const TQString s( otherStatus.singleStatusString() );
275 if (description.isEmpty()) {
279 description = description +
" " + s;
287 :
KexiDB::MessageHandler()
291 virtual ~ObjectStatusMessageHandler()
295 virtual void showErrorMessage(
const TQString &title,
296 const TQString &details = TQString())
298 m_status->setStatus(title, details);
301 virtual void showErrorMessage(
KexiDB::Object *obj,
const TQString& msg = TQString())
303 m_status->setStatus(obj, msg);
312 msgHandler =
new ObjectStatusMessageHandler(
this);
316void Kexi::initCmdLineArgs(
int argc,
char *argv[], TDEAboutData* aboutData)
318 TDEAboutData *about = aboutData;
320 about = Kexi::createAboutData();
322# include "../custom_startup.h"
324 TDECmdLineArgs::init( argc, argv, about );
325 TDECmdLineArgs::addCmdLineOptions( options );
328void KEXI_UNFINISHED(
const TQString& feature_name,
const TQString& extra_text)
331 if (feature_name.isEmpty())
332 msg = i18n(
"This function is not available for version %1 of %2 application.")
333 .arg(KEXI_VERSION_STRING)
336 TQString feature_name_(feature_name);
337 msg = i18n(
"\"%1\" function is not available for version %2 of %3 application.")
338 .arg(feature_name_.replace(
"&",
""))
339 .arg(KEXI_VERSION_STRING)
343 TQString extra_text_(extra_text);
344 if (!extra_text_.isEmpty())
345 extra_text_.prepend(
"\n");
347 KMessageBox::sorry(0, msg + extra_text_);
Database driver management, e.g. finding and loading drivers.
TQString desc
error message and detailed description, both empty by default
KexiPart's manager: looks up and instantiates them.
Stores information about multiple kexi project-data items.
KexiDB::MessageHandler * msgHandler
This is in fact KexiDB::Object.
High-level database connectivity library with database backend drivers.
Namespace for general Kexi functions.
KEXICORE_EXPORT bool & tempShowScripts()
false by default, flag loaded on main window startup
KEXICORE_EXPORT void deleteGlobalObjects()
can be called to delete global objects like driverManager and partManager (and thus,...
KEXICORE_EXPORT bool & tempShowForms()
false by default, flag loaded on main window startup
KEXICORE_EXPORT bool & tempShowMacros()
false by default, flag loaded on main window startup
KEXICORE_EXPORT TQFont smallFont(TQWidget *init=0)
KEXICORE_EXPORT KexiPart::Manager & partManager()
shared part manager
KEXICORE_EXPORT KexiDB::DriverManager & driverManager()
shared driver manager
KEXICORE_EXPORT bool & tempShowReports()
false by default, flag loaded on main window startup
KEXICORE_EXPORT KexiDBConnectionSet & connset()
A set of known connections.
KEXICORE_EXPORT TQString nameForViewMode(int m)
i18n'ed name of view mode m
KEXICORE_EXPORT KexiProjectSet & recentProjects()
A set avaiulable of project infos.
@ TextViewMode
Also known as SQL View Mode.
@ NoViewMode
In KexiViewBase::afterSwitchFrom() and KexiViewBase::beforeSwitchTo() means that parent dialog of the...