-rw-r--r-- | core/apps/textedit/textedit.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index c9178a5..086fdb6 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -1,109 +1,111 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | // textedit.cpp | 2 | // textedit.cpp |
3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file is part of Opie Environment. | 5 | ** This file is part of Opie Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | **********************************************************************/ | 12 | **********************************************************************/ |
13 | // changes added by L. J. Potter Sun 02-17-2002 21:31:31 | 13 | // changes added by L. J. Potter Sun 02-17-2002 21:31:31 |
14 | 14 | ||
15 | #include "textedit.h" | 15 | #include "textedit.h" |
16 | #include "filePermissions.h" | 16 | #include "filePermissions.h" |
17 | 17 | ||
18 | /* OPIE */ | 18 | /* OPIE */ |
19 | #include <opie2/odebug.h> | 19 | #include <opie2/odebug.h> |
20 | #include <opie2/ofileselector.h> | 20 | #include <opie2/ofileselector.h> |
21 | #include <opie2/ofiledialog.h> | 21 | #include <opie2/ofiledialog.h> |
22 | #include <opie2/ofontselector.h> | 22 | #include <opie2/ofontselector.h> |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | using namespace Opie::Core; | 26 | |
27 | using namespace Opie::Ui; | ||
28 | 27 | ||
29 | /* QT */ | 28 | /* QT */ |
30 | #include <qmenubar.h> | 29 | #include <qmenubar.h> |
31 | #include <qtoolbar.h> | 30 | #include <qtoolbar.h> |
32 | #include <qtextstream.h> | 31 | #include <qtextstream.h> |
33 | #include <qclipboard.h> | 32 | #include <qclipboard.h> |
34 | #include <qaction.h> | 33 | #include <qaction.h> |
35 | #include <qlineedit.h> | 34 | #include <qlineedit.h> |
36 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
37 | #include <qlayout.h> | 36 | #include <qlayout.h> |
38 | #include <qtimer.h> | 37 | #include <qtimer.h> |
39 | #include <qdir.h> | 38 | #include <qdir.h> |
40 | 39 | ||
41 | /* STD */ | 40 | /* STD */ |
42 | #include <unistd.h> | 41 | #include <unistd.h> |
43 | #include <sys/stat.h> | 42 | #include <sys/stat.h> |
44 | #include <stdlib.h> //getenv | 43 | #include <stdlib.h> //getenv |
45 | 44 | ||
45 | using namespace Opie::Core; | ||
46 | using namespace Opie::Ui; | ||
47 | |||
46 | #if QT_VERSION < 300 | 48 | #if QT_VERSION < 300 |
47 | class QpeEditor : public QMultiLineEdit | 49 | class QpeEditor : public QMultiLineEdit |
48 | { | 50 | { |
49 | 51 | ||
50 | public: | 52 | public: |
51 | QpeEditor( QWidget *parent, const char * name = 0 ) | 53 | QpeEditor( QWidget *parent, const char * name = 0 ) |
52 | : QMultiLineEdit( parent, name ) { | 54 | : QMultiLineEdit( parent, name ) { |
53 | clearTableFlags(); | 55 | clearTableFlags(); |
54 | setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); | 56 | setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); |
55 | } | 57 | } |
56 | 58 | ||
57 | void find( const QString &txt, bool caseSensitive, | 59 | void find( const QString &txt, bool caseSensitive, |
58 | bool backwards ); | 60 | bool backwards ); |
59 | protected: | 61 | protected: |
60 | bool markIt; | 62 | bool markIt; |
61 | int line1, line2, col1, col2; | 63 | int line1, line2, col1, col2; |
62 | void mousePressEvent( QMouseEvent * ); | 64 | void mousePressEvent( QMouseEvent * ); |
63 | void mouseReleaseEvent( QMouseEvent * ); | 65 | void mouseReleaseEvent( QMouseEvent * ); |
64 | 66 | ||
65 | //public slots: | 67 | //public slots: |
66 | /* | 68 | /* |
67 | signals: | 69 | signals: |
68 | void notFound(); | 70 | void notFound(); |
69 | void searchWrapped(); | 71 | void searchWrapped(); |
70 | */ | 72 | */ |
71 | 73 | ||
72 | private: | 74 | private: |
73 | 75 | ||
74 | }; | 76 | }; |
75 | 77 | ||
76 | void QpeEditor::mousePressEvent( QMouseEvent *e ) { | 78 | void QpeEditor::mousePressEvent( QMouseEvent *e ) { |
77 | switch(e->button()) { | 79 | switch(e->button()) { |
78 | case RightButton: | 80 | case RightButton: |
79 | { //rediculous workaround for qt popup menu | 81 | { //rediculous workaround for qt popup menu |
80 | //and the hold right click mechanism | 82 | //and the hold right click mechanism |
81 | this->setSelection( line1, col1, line2, col2); | 83 | this->setSelection( line1, col1, line2, col2); |
82 | QMultiLineEdit::mousePressEvent( e ); | 84 | QMultiLineEdit::mousePressEvent( e ); |
83 | markIt = false; | 85 | markIt = false; |
84 | } | 86 | } |
85 | break; | 87 | break; |
86 | default: | 88 | default: |
87 | { | 89 | { |
88 | if(!markIt) { | 90 | if(!markIt) { |
89 | int line, col; | 91 | int line, col; |
90 | this->getCursorPosition(&line, &col); | 92 | this->getCursorPosition(&line, &col); |
91 | line1=line2=line; | 93 | line1=line2=line; |
92 | col1=col2=col; | 94 | col1=col2=col; |
93 | } | 95 | } |
94 | QMultiLineEdit::mousePressEvent( e ); | 96 | QMultiLineEdit::mousePressEvent( e ); |
95 | } | 97 | } |
96 | break; | 98 | break; |
97 | }; | 99 | }; |
98 | } | 100 | } |
99 | 101 | ||
100 | void QpeEditor::mouseReleaseEvent( QMouseEvent * ) { | 102 | void QpeEditor::mouseReleaseEvent( QMouseEvent * ) { |
101 | if(this->hasMarkedText()) { | 103 | if(this->hasMarkedText()) { |
102 | markIt = true; | 104 | markIt = true; |
103 | this->getMarkedRegion( &line1, &col1, &line2, & col2 ); | 105 | this->getMarkedRegion( &line1, &col1, &line2, & col2 ); |
104 | } else { | 106 | } else { |
105 | markIt = false; | 107 | markIt = false; |
106 | } | 108 | } |
107 | } | 109 | } |
108 | 110 | ||
109 | void QpeEditor::find ( const QString &txt, bool caseSensitive, | 111 | void QpeEditor::find ( const QString &txt, bool caseSensitive, |