~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kexi/plugins/queries/kexiquerydesignersqlhistory.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2003 Lucijan Busch <lucijan@kde.org>
 
3
   Copyright (C) 2004-2007 Jarosław Staniek <staniek@kde.org>
 
4
 
 
5
   This program is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Library General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2 of the License, or (at your option) any later version.
 
9
 
 
10
   This program is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Library General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Library General Public License
 
16
   along with this program; see the file COPYING.  If not, write to
 
17
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
 * Boston, MA 02110-1301, USA.
 
19
*/
 
20
 
 
21
#ifndef KEXIQUERYDESIGNERSQLHISTORY_H
 
22
#define KEXIQUERYDESIGNERSQLHISTORY_H
 
23
 
 
24
#include <q3scrollview.h>
 
25
#include <qdatetime.h>
 
26
#include <qlist.h>
 
27
#include <qmap.h>
 
28
#include <QMouseEvent>
 
29
 
 
30
class Q3SimpleRichText;
 
31
class KMenu;
 
32
class KexiQueryDesignerSQLHistory;
 
33
 
 
34
class HistoryEntry
 
35
{
 
36
public:
 
37
    HistoryEntry(KexiQueryDesignerSQLHistory *parent, bool success, const QTime &time,
 
38
                 const QString &statement, /*int y,*/ const QString &error = QString());
 
39
    ~HistoryEntry();
 
40
 
 
41
    QRect geometry(int y, int width, const QFontMetrics& f);
 
42
    void drawItem(QPainter *p, int width);
 
43
 
 
44
    void setSelected(bool selected);
 
45
    bool isSelected() const {
 
46
        return m_selected;
 
47
    }
 
48
    void highlight();
 
49
 
 
50
    QString statement() const {
 
51
        return m_statement;
 
52
    }
 
53
    void setTime(const QTime &execTime);
 
54
 
 
55
private:
 
56
    QTime m_execTime;
 
57
    QString m_execTimeString;
 
58
    QString m_statement;
 
59
    QString m_error;
 
60
    Q3SimpleRichText *m_formated;
 
61
    KexiQueryDesignerSQLHistory *m_parent;
 
62
 
 
63
    int m_y;
 
64
    bool m_succeeded : 1;
 
65
    bool m_selected : 1;
 
66
};
 
67
 
 
68
typedef QList<HistoryEntry*> History;
 
69
 
 
70
class KexiQueryDesignerSQLHistory : public Q3ScrollView
 
71
{
 
72
    Q_OBJECT
 
73
 
 
74
public:
 
75
    KexiQueryDesignerSQLHistory(QWidget *parent);
 
76
    virtual ~KexiQueryDesignerSQLHistory();
 
77
 
 
78
    KMenu* popupMenu() const;
 
79
 
 
80
//  void  contextMenu(const QPoint &pos, HistoryEntry *e);
 
81
 
 
82
    void setHistory(History *h);
 
83
 
 
84
    QString selectedStatement() const;
 
85
 
 
86
public slots:
 
87
    void addEvent(const QString& q, bool s, const QString &error);
 
88
 
 
89
    void slotToClipboard();
 
90
    void slotEdit();
 
91
 
 
92
    void clear();
 
93
 
 
94
//  HistoryItem itemAt(int y);
 
95
 
 
96
protected:
 
97
    void addEntry(HistoryEntry *e);
 
98
    virtual void drawContents(QPainter *p, int cx, int cy, int cw, int ch);
 
99
    virtual void contentsMousePressEvent(QMouseEvent * e);
 
100
    virtual void contentsMouseDoubleClickEvent(QMouseEvent * e);
 
101
    virtual bool eventFilter(QObject *obj, QEvent *event);
 
102
 
 
103
signals:
 
104
    void editRequested(const QString &text);
 
105
    void currentItemDoubleClicked();
 
106
 
 
107
private:
 
108
    History *m_history;
 
109
    HistoryEntry *m_selected;
 
110
    QPalette::ColorGroup m_prevColorGroup;
 
111
    KMenu *m_popup;
 
112
};
 
113
 
 
114
#endif