~ubuntu-branches/ubuntu/breezy/koffice/breezy-security

« back to all changes in this revision

Viewing changes to krita/plugins/screenshot/ksnapshot.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-10-11 14:49:50 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051011144950-lwpngbifzp8nk0ds
Tags: 1:1.4.1-0ubuntu7
* SECURITY UPDATE: fix heap based buffer overflow in the RTF importer of KWord
* Opening specially crafted RTF files in KWord can cause
  execution of abitrary code.
* Add kubuntu_01_rtfimport_heap_overflow.diff
* References:
  CAN-2005-2971
  CESA-2005-005
  http://www.koffice.org/security/advisory-20051011-1.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c++ -*-
 
2
 
 
3
#ifndef KSNAPSHOT_H
 
4
#define KSNAPSHOT_H
 
5
 
 
6
#include <qlabel.h>
 
7
#include <qpixmap.h>
 
8
#include <qtimer.h>
 
9
 
 
10
#include <dcopclient.h>
 
11
#include <kglobalsettings.h>
 
12
#include <kdialogbase.h>
 
13
#include <kurl.h>
 
14
 
 
15
class RegionGrabber;
 
16
class KSnapshotWidget;
 
17
 
 
18
class KSnapshotThumb : public QLabel
 
19
{
 
20
        Q_OBJECT
 
21
 
 
22
public:
 
23
        KSnapshotThumb(QWidget *parent, const char *name = 0)
 
24
                : QLabel(parent, name)
 
25
                {
 
26
                        setAlignment(AlignHCenter | AlignVCenter);
 
27
                }
 
28
        virtual ~KSnapshotThumb() {}
 
29
 
 
30
signals:
 
31
        void startDrag();
 
32
 
 
33
protected:
 
34
        void mousePressEvent(QMouseEvent * e)
 
35
                {
 
36
                        mClickPt = e->pos();
 
37
                }
 
38
 
 
39
        void mouseMoveEvent(QMouseEvent * e)
 
40
                {
 
41
                        if (mClickPt != QPoint(0, 0) &&
 
42
                            (e->pos() - mClickPt).manhattanLength() > KGlobalSettings::dndEventDelay())
 
43
                        {
 
44
                                mClickPt = QPoint(0, 0);
 
45
                                emit startDrag();
 
46
                        }
 
47
                }
 
48
 
 
49
        void mouseReleaseEvent(QMouseEvent * /*e*/)
 
50
                {
 
51
                        mClickPt = QPoint(0, 0);
 
52
                }
 
53
 
 
54
        QPoint mClickPt;
 
55
};
 
56
 
 
57
class KSnapshot : public KDialogBase
 
58
{
 
59
        typedef KDialogBase super;
 
60
        Q_OBJECT
 
61
 
 
62
public:
 
63
        KSnapshot(QWidget *parent= 0, const char *name= 0);
 
64
        ~KSnapshot();
 
65
 
 
66
        enum CaptureMode { FullScreen=0, WindowUnderCursor=1, Region=2 };
 
67
 
 
68
        bool save( const QString &filename );
 
69
        bool save( const KURL& url );
 
70
 
 
71
        QString url() const { return filename.url(); }
 
72
 
 
73
signals:
 
74
        void screenGrabbed();
 
75
 
 
76
protected slots:
 
77
        void slotGrab();
 
78
        void slotCopy();
 
79
        void slotPrint();
 
80
        void slotMovePointer( int x, int y );
 
81
 
 
82
        void setTime(int newTime);
 
83
        void setURL(const QString &newURL);
 
84
        void setGrabMode( int m );
 
85
        void exit();
 
86
 
 
87
        void slotOk();
 
88
 
 
89
 
 
90
protected:
 
91
        void reject() { close(); }
 
92
        bool eventFilter( QObject*, QEvent* );
 
93
    
 
94
private slots:
 
95
        void grabTimerDone();
 
96
        void slotDragSnapshot();
 
97
        void slotRegionGrabbed( const QPixmap & );
 
98
 
 
99
private:
 
100
        void updatePreview();
 
101
        void performGrab();
 
102
        void autoincFilename();
 
103
 
 
104
        QPixmap snapshot;
 
105
        QTimer grabTimer;
 
106
        QWidget* grabber;
 
107
        KURL filename;
 
108
        KSnapshotWidget *mainWidget;
 
109
        RegionGrabber *rgnGrab;
 
110
        bool modified;
 
111
        bool haveXShape;
 
112
};
 
113
 
 
114
#endif // KSNAPSHOT_H
 
115