1
/* This file is part of the KDE project
2
Copyright (C) 2003-2012 Jarosław Staniek <staniek@kde.org>
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this program; see the file COPYING. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
* Boston, MA 02110-1301, USA.
25
#include <KexiVersion.h>
26
#include "kexiprojectdata.h"
27
#include "kexidbconnectionset.h"
28
#include "kexiprojectset.h"
31
class KDbDriverManager;
32
class KexiRecentProjects;
41
/*! Modes of view for the dialogs. Used mostly for parts and KexiWindow. */
43
AllViewModes = 0, //!< Usable primarily in KexiPart::initInstanceActions()
44
NoViewMode = 0, //!< In KexiView::afterSwitchFrom() and KexiView::beforeSwitchTo()
45
//!< means that parent dialog of the view has not been defined yet.
48
TextViewMode = 4 //!< Also known as SQL View Mode
50
Q_DECLARE_FLAGS(ViewModes, ViewMode)
52
/*! @return i18n'ed name of view mode @a mode. If @a withAmpersand is true,
53
ampersands used for accelerators are included, e.g. "&Data View".*/
54
KEXICORE_EXPORT QString nameForViewMode(ViewMode mode, bool withAmpersand = false);
56
/*! @return icon name of view mode @a mode. */
57
KEXICORE_EXPORT QString iconNameForViewMode(ViewMode mode);
59
//! A set of known connections
60
KEXICORE_EXPORT KexiDBConnectionSet& connset();
62
//! A set available of project information
63
KEXICORE_EXPORT KexiRecentProjects* recentProjects();
65
//! shared driver manager
66
KEXICORE_EXPORT KDbDriverManager& driverManager();
68
//! shared part manager
69
KEXICORE_EXPORT KexiPart::Manager& partManager();
71
//! can be called to delete global objects like driverManager and partManager
72
//! (and thus, all loaded factories/plugins)
73
//! before KLibrary::~KLibrary() do this for us
74
KEXICORE_EXPORT void deleteGlobalObjects();
76
//some temporary flags
78
//! false by default, flag loaded on main window startup
79
KEXICORE_EXPORT bool& tempShowMacros();
81
//! false by default, flag loaded on main window startup
82
KEXICORE_EXPORT bool& tempShowScripts();
84
//! false by default, flag loaded on main window startup
85
KEXICORE_EXPORT bool& tempShowScripts();
87
/*! Helper class for storing object status. */
88
class KEXICORE_EXPORT ObjectStatus
93
ObjectStatus(const QString& message, const QString& description);
95
ObjectStatus(const KDbResultable* resultable, const QString& message, const QString& description);
99
const ObjectStatus& status() const;
103
void setStatus(const QString& message, const QString& description);
105
//! Note: for safety, \a dbObject needs to be derived from QObject,
106
//! otherwise it won't be assigned
107
void setStatus(const KDbResultable* resultable,
108
const QString& message = QString(), const QString& description = QString());
110
void setStatus(KDbResultInfo* resultInfo,
111
const QString& message = QString(), const QString& description = QString());
113
void setStatus(const KDbResultable* resultable, KDbResultInfo* resultInfo,
114
const QString& message = QString(), const QString& description = QString());
116
void setStatus(const KDbResult& result, KDbResultInfo* resultInfo,
117
const QString& message = QString(), const QString& description = QString());
121
QString singleStatusString() const;
123
void append(const ObjectStatus& otherStatus);
125
const KDbResultable* resultable() const { return m_resultable; }
127
//! Helper returning pseudo handler that just updates this ObjectStatus object
128
//! by receiving a message
129
operator KDbMessageHandler*();
131
QString message, description;
133
const KDbResultable* m_resultable;
134
KDbMessageHandler* m_msgHandler;
137
/*! \return icon name for default file-based driver
138
(typically icon for something like "application/x-kexiproject-sqlite").
139
@see KDb::defaultFileBasedDriverMimeType() */
140
KEXICORE_EXPORT QString defaultFileBasedDriverIconName();
142
/*! \return icon for default file-based driver
143
(typically icon for something like "application/x-kexiproject-sqlite").
144
If contains special workaround to properly load mimetype icon according to current theme,
145
at least needed for Breeze.
146
@see KDb::defaultFileBasedDriverIconName() */
147
KEXICORE_EXPORT QIcon defaultFileBasedDriverIcon();
149
/*! \return icon name for database servers. */
150
KEXICORE_EXPORT QString serverIconName();
152
/*! \return icon for database servers. */
153
KEXICORE_EXPORT QIcon serverIcon();
155
/*! @return message text "Kexi could have been incorrectly installed or started.
156
The application will be closed." useful for critical errors. */
157
KEXICORE_EXPORT QString appIncorrectlyInstalledMessage();
159
//! @return base path (without the filename for file-based connection data @a connectionData.
160
//! Empty string is returned if @a connectionData does not point to a file-based connection with
161
//! database name specified.
162
KEXICORE_EXPORT QString basePathForProject(const KDbConnectionData& connectionData);
166
Q_DECLARE_OPERATORS_FOR_FLAGS(Kexi::ViewModes)
168
//! Displays information that feature "feature_name" is not availabe in the current application version
169
KEXICORE_EXPORT void KEXI_UNFINISHED(
170
const QString& feature_name, const QString& extra_text = QString());
172
//! Like KEXI_UNFINISHED but returns new label instance with expected text
173
KEXICORE_EXPORT QLabel *KEXI_UNFINISHED_LABEL(
174
const QString& feature_name, const QString& extra_text = QString());
176
//! Like above - for use inside KexiActionProxy subclass - reuses feature name from shared action's text
177
#define KEXI_UNFINISHED_SHARED_ACTION(action_name) \
178
KEXI_UNFINISHED(sharedAction(action_name) ? sharedAction(action_name)->text() : QString())
180
//! Implementation of plugin's entry point
181
#define KEXI_PLUGIN_FACTORY(class_name, name) \
182
K_PLUGIN_FACTORY_WITH_JSON(class_name ## Factory, name, registerPlugin<class_name>();)