summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-10 11:41:43 (UTC)
committer zecke <zecke>2004-09-10 11:41:43 (UTC)
commit854e3af27ee7208bbb3620733a24f0214c0b118a (patch) (unidiff)
treee079d95a72e6254b210b0b759b16e941073d7fbe
parent77ebc6898d1828b8c728838813c5ddd2bc25a424 (diff)
downloadopie-854e3af27ee7208bbb3620733a24f0214c0b118a.zip
opie-854e3af27ee7208bbb3620733a24f0214c0b118a.tar.gz
opie-854e3af27ee7208bbb3620733a24f0214c0b118a.tar.bz2
Move the using namespace expression below all includes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp6
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,173 +1,175 @@
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>
26using namespace Opie::Core; 26
27using 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
45using namespace Opie::Core;
46using namespace Opie::Ui;
47
46#if QT_VERSION < 300 48#if QT_VERSION < 300
47class QpeEditor : public QMultiLineEdit 49class QpeEditor : public QMultiLineEdit
48{ 50{
49 51
50public: 52public:
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 );
59protected: 61protected:
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 /*
67signals: 69signals:
68 void notFound(); 70 void notFound();
69 void searchWrapped(); 71 void searchWrapped();
70 */ 72 */
71 73
72private: 74private:
73 75
74}; 76};
75 77
76void QpeEditor::mousePressEvent( QMouseEvent *e ) { 78void 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
100void QpeEditor::mouseReleaseEvent( QMouseEvent * ) { 102void 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
109void QpeEditor::find ( const QString &txt, bool caseSensitive, 111void QpeEditor::find ( const QString &txt, bool caseSensitive,
110 bool backwards ) 112 bool backwards )
111{ 113{
112 static bool wrap = false; 114 static bool wrap = false;
113 int line, col; 115 int line, col;
114 if ( wrap ) { 116 if ( wrap ) {
115 if ( !backwards ) 117 if ( !backwards )
116 line = col = 0; 118 line = col = 0;
117 wrap = false; 119 wrap = false;
118 // emit searchWrapped(); 120 // emit searchWrapped();
119 } else { 121 } else {
120 getCursorPosition( &line, &col ); 122 getCursorPosition( &line, &col );
121 } 123 }
122 //ignore backwards for now.... 124 //ignore backwards for now....
123 if ( !backwards ) { 125 if ( !backwards ) {
124 for ( ; ; ) { 126 for ( ; ; ) {
125 if ( line >= numLines() ) { 127 if ( line >= numLines() ) {
126 wrap = true; 128 wrap = true;
127 //emit notFound(); 129 //emit notFound();
128 break; 130 break;
129 } 131 }
130 int findCol = getString( line )->find( txt, col, caseSensitive ); 132 int findCol = getString( line )->find( txt, col, caseSensitive );
131 if ( findCol >= 0 ) { 133 if ( findCol >= 0 ) {
132 setCursorPosition( line, findCol, false ); 134 setCursorPosition( line, findCol, false );
133 col = findCol + txt.length(); 135 col = findCol + txt.length();
134 setCursorPosition( line, col, true ); 136 setCursorPosition( line, col, true );
135 137
136 //found = true; 138 //found = true;
137 break; 139 break;
138 } 140 }
139 line++; 141 line++;
140 col = 0; 142 col = 0;
141 } 143 }
142 } 144 }
143} 145}
144 146
145 147
146#else 148#else
147 149
148#error "Must make a QpeEditor that inherits QTextEdit" 150#error "Must make a QpeEditor that inherits QTextEdit"
149 151
150#endif 152#endif
151 153
152 154
153static const int nfontsizes = 6; 155static const int nfontsizes = 6;
154static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; 156static const int fontsize[nfontsizes] = {8,10,12,14,18,24};
155 157
156TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) 158TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
157 : QMainWindow( parent, name, f ), bFromDocView( false ) 159 : QMainWindow( parent, name, f ), bFromDocView( false )
158{ 160{
159 doc = 0; 161 doc = 0;
160 edited=false; 162 edited=false;
161 fromSetDocument=false; 163 fromSetDocument=false;
162 164
163 setToolBarsMovable( false ); 165 setToolBarsMovable( false );
164 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 166 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
165 167
166 channel = new QCopChannel( "QPE/Application/textedit", this ); 168 channel = new QCopChannel( "QPE/Application/textedit", this );
167 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 169 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
168 this, SLOT(receive(const QCString&,const QByteArray&)) ); 170 this, SLOT(receive(const QCString&,const QByteArray&)) );
169 171
170 setIcon( Resource::loadPixmap( "TextEditor" ) ); 172 setIcon( Resource::loadPixmap( "TextEditor" ) );
171 173
172 QToolBar *bar = new QToolBar( this ); 174 QToolBar *bar = new QToolBar( this );
173 bar->setHorizontalStretchable( true ); 175 bar->setHorizontalStretchable( true );