kexi

kexi.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003-2005 Jaroslaw Staniek <js@iidea.pl>
00003 
00004    This program is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KEXI_H
00021 #define KEXI_H
00022 
00023 #include <qguardedptr.h>
00024 #include <qfont.h>
00025 
00026 #include <kexi_version.h>
00027 #include "kexiprojectdata.h"
00028 #include "kexipartmanager.h"
00029 #include "kexidbconnectionset.h"
00030 #include "kexiprojectset.h"
00031 #include <kexidb/drivermanager.h>
00032 #include <kexidb/driver.h>
00033 
00034 #include <klocale.h>
00035 #include <kmessagebox.h>
00036 
00037 namespace Kexi
00038 {
00039     KEXICORE_EXPORT void initCmdLineArgs(int argc, char *argv[], KAboutData* aboutData = 0);
00040 
00042     enum ViewMode { 
00043         AllViewModes = 0, 
00044         NoViewMode = 0, 
00045 
00046         DataViewMode = 1,
00047         DesignViewMode = 2,
00048         TextViewMode = 4 
00049     };
00051     KEXICORE_EXPORT QString nameForViewMode(int m);
00052 
00054     KEXICORE_EXPORT KexiDBConnectionSet& connset();
00055     
00057     KEXICORE_EXPORT KexiProjectSet& recentProjects();
00058     
00060     KEXICORE_EXPORT KexiDB::DriverManager& driverManager();
00061     
00063     KEXICORE_EXPORT KexiPart::Manager& partManager();
00064     
00068     KEXICORE_EXPORT void deleteGlobalObjects();
00069 
00070     //some temporary flags
00071 
00073     KEXICORE_EXPORT bool& tempShowForms(); 
00074 
00076     KEXICORE_EXPORT bool& tempShowReports(); 
00077 
00079     KEXICORE_EXPORT bool& tempShowScripts(); 
00080 
00084     KEXICORE_EXPORT QFont smallFont(QWidget *init = 0);
00085 
00087     class KEXICORE_EXPORT ObjectStatus
00088     {
00089         public:
00090             ObjectStatus();
00091 
00092             ObjectStatus(const QString& message, const QString& description);
00093 
00094             ObjectStatus(KexiDB::Object* dbObject, const QString& message, const QString& description);
00095 
00096             ~ObjectStatus();
00097 
00098             const ObjectStatus& status() const;
00099 
00100             bool error() const;
00101 
00102             void setStatus(const QString& message, const QString& description);
00103 
00106             void setStatus(KexiDB::Object* dbObject, const QString& message = QString::null, const QString& description = QString::null);
00107 
00108             void clearStatus();
00109 
00110             QString singleStatusString() const;
00111 
00112             void append( const ObjectStatus& otherStatus );
00113 
00114             KexiDB::Object *dbObject() const { return dynamic_cast<KexiDB::Object*>((QObject*)dbObj); }
00115 
00118             operator KexiDB::MessageHandler*();
00119 
00120             QString message, description;
00121         protected:
00122             QGuardedPtr<QObject> dbObj; 
00123             KexiDB::MessageHandler* msgHandler;
00124     };
00125 
00126     KEXICORE_EXPORT QString msgYouCanImproveData();
00127 
00128 }//namespace Kexi
00129 
00131 inline void KEXI_UNFINISHED(QString feature_name, QString extra_text = QString::null) 
00132 {
00133     QString msg;
00134     if (feature_name.isEmpty())
00135         msg = i18n("This function is not available for version %1 of %2 application.")
00136             .arg(KEXI_VERSION_STRING)
00137             .arg(KEXI_APP_NAME); 
00138     else 
00139         msg = i18n("\"%1\" function is not available for version %2 of %3 application.")
00140             .arg(feature_name.replace("&",""))
00141             .arg(KEXI_VERSION_STRING)
00142             .arg(KEXI_APP_NAME); 
00143 
00144     if (!extra_text.isEmpty())
00145         extra_text.prepend("\n");
00146 
00147     KMessageBox::sorry(0, msg + extra_text);
00148 }
00149 
00151 #define KEXI_UNFINISHED_SHARED_ACTION(action_name) \
00152     KEXI_UNFINISHED(sharedAction(action_name) ? sharedAction(action_name)->text() : QString::null)
00153 
00154 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys