kexi
object.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KEXIDB_OBJECT_H
00021 #define KEXIDB_OBJECT_H
00022
00023 #include <kexidb/error.h>
00024 #include <kmessagebox.h>
00025 #include <kstdguiitem.h>
00026 #include <qstring.h>
00027
00028 namespace KexiDB {
00029
00030 class MessageHandler;
00031
00034 class KEXI_DB_EXPORT Object
00035 {
00036 public:
00038 bool error() const { return m_hasError; }
00039
00042 const QString& errorMsg() const { return m_errMsg; }
00043
00046 int errorNum() const { return m_errno; }
00047
00049 int previousServerResult() const { return m_previousServerResultNum; }
00050
00051 QString previousServerResultName() const { return m_previousServerResultName; }
00052
00054 void debugError();
00055
00060 virtual void clearError();
00061
00074 virtual QString serverErrorMsg();
00075
00084 virtual int serverResult();
00085
00096 virtual QString serverResultName();
00097
00100 QString msgTitle() const { return m_msgTitle; }
00101
00105 const QString recentSQLString() const { return m_errorSql.isEmpty() ? m_sql : m_errorSql; }
00106
00107 protected:
00108
00109
00110 Object(MessageHandler* handler = 0);
00111
00112 virtual ~Object();
00113
00121 virtual void setError(int code = ERR_OTHER, const QString &msg = QString::null );
00122
00127 virtual void setError( const QString &msg );
00128
00131 virtual void setError( const QString &title, const QString &msg );
00132
00134 void setError( KexiDB::Object *obj, const QString& prependMessage = QString::null );
00135
00138 virtual void setError( KexiDB::Object *obj, int code,
00139 const QString& prependMessage = QString::null );
00140
00144 virtual int askQuestion( const QString& message,
00145 KMessageBox::DialogType dlgType, KMessageBox::ButtonCode defaultResult,
00146 const KGuiItem &buttonYes=KStdGuiItem::yes(),
00147 const KGuiItem &buttonNo=KStdGuiItem::no(),
00148 const QString &dontShowAskAgainName = QString::null,
00149 int options = KMessageBox::Notify,
00150 MessageHandler* msgHandler = 0 );
00151
00158 virtual void drv_clearServerResult() {};
00159
00161 QString m_sql, m_errorSql;
00162 int m_serverResult;
00163 QString m_serverResultName, m_serverErrorMsg;
00164 QString m_errMsg;
00165
00166 private:
00167 int m_errno;
00168 bool m_hasError;
00169
00171 int m_previousServerResultNum, m_previousServerResultNum2;
00173 QString m_previousServerResultName, m_previousServerResultName2;
00174
00175 QString m_msgTitle;
00176 MessageHandler *m_msgHandler;
00177
00178 class Private;
00179 Private *d;
00180
00181 friend class MessageTitle;
00182 };
00183
00184 }
00185
00186 #endif
|