kexi
kexiquerydesignersqlhistory.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KEXIQUERYDESIGNERSQLHISTORY_H
00022 #define KEXIQUERYDESIGNERSQLHISTORY_H
00023
00024 #include <qscrollview.h>
00025 #include <qdatetime.h>
00026 #include <qptrlist.h>
00027 #include <qmap.h>
00028 #include <qsimplerichtext.h>
00029
00030 class QSimpleRichText;
00031 class KPopupMenu;
00032
00033 class HistoryEntry
00034 {
00035 public:
00036 HistoryEntry(bool success, const QTime &time, const QString &statement, const QString &error = QString::null);
00037 ~HistoryEntry();
00038
00039 QRect geometry(int y, int width, QFontMetrics f);
00040 void drawItem(QPainter *p, int width, const QColorGroup &cg);
00041
00042 void setSelected(bool selected, const QColorGroup &cg);
00043 bool isSelected() const { return m_selected; }
00044 void highlight(const QColorGroup &selected);
00045
00046 QString statement() { return m_statement; }
00047 void updateTime(const QTime &execTime);
00048
00049 private:
00050 bool m_succeed;
00051 QTime m_execTime;
00052 QString m_statement;
00053 QString m_error;
00054 QSimpleRichText *m_formated;
00055
00056 int m_y;
00057 bool m_selected;
00058 };
00059
00060 typedef QPtrList<HistoryEntry> History;
00061
00062 class KexiQueryDesignerSQLHistory : public QScrollView
00063 {
00064 Q_OBJECT
00065
00066 public:
00067 KexiQueryDesignerSQLHistory(QWidget *parent, const char *name=0);
00068 virtual ~KexiQueryDesignerSQLHistory();
00069
00070 KPopupMenu* popupMenu() const;
00071
00072
00073
00074 void setHistory(History *h);
00075
00076 QString selectedStatement() const;
00077
00078 public slots:
00079 void addEvent(const QString& q, bool s, const QString &error);
00080
00081 void slotToClipboard();
00082 void slotEdit();
00083
00084 void clear();
00085
00086
00087
00088 protected:
00089 void addEntry(HistoryEntry *e);
00090 virtual void drawContents(QPainter *p, int cx, int cy, int cw, int ch);
00091 virtual void contentsMousePressEvent(QMouseEvent * e);
00092 virtual void contentsMouseDoubleClickEvent(QMouseEvent * e);
00093
00094 signals:
00095 void editRequested(const QString &text);
00096 void currentItemDoubleClicked();
00097
00098 private:
00099 History *m_history;
00100 HistoryEntry *m_selected;
00101 KPopupMenu *m_popup;
00102 };
00103
00104 #endif
|