summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fontDialog.cpp237
-rw-r--r--core/apps/textedit/fontDialog.h63
-rw-r--r--core/apps/textedit/textedit.cpp124
-rw-r--r--core/apps/textedit/textedit.pro4
4 files changed, 49 insertions, 379 deletions
diff --git a/core/apps/textedit/fontDialog.cpp b/core/apps/textedit/fontDialog.cpp
deleted file mode 100644
index 5cdf538..0000000
--- a/core/apps/textedit/fontDialog.cpp
+++ b/dev/null
@@ -1,237 +0,0 @@
1/****************************************************************************
2** Created: Sun Jan 27 11:03:24 2002 fileDialog.cpp
3copyright 2002 by L.J. Potter ljp@llornkcor.com
4
5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file.
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13****************************************************************************/
14#include "fontDialog.h"
15
16#include <qpe/fontdatabase.h>
17#include <qpe/config.h>
18
19#include <qstringlist.h>
20#include <qfontinfo.h>
21#include <qvaluelist.h>
22#include <qpe/qpeapplication.h>
23
24#include <qgroupbox.h>
25#include <qlabel.h>
26#include <qlistbox.h>
27#include <qmultilineedit.h>
28#include <qpushbutton.h>
29#include <qlayout.h>
30#include <qvariant.h>
31#include <qtooltip.h>
32#include <qwhatsthis.h>
33
34FontDialog::FontDialog( QWidget * parent, const char* name , bool modal, WFlags fl )
35 :QDialog /*QWidget*/( parent, name , modal, fl )
36{
37 if ( !name )
38 setName( tr("FontDialog") );
39 setCaption( tr( "Font Dialog" ) );
40 FontTextLabel4 = new QLabel( this, "TextLabel4" );
41 FontTextLabel4->setGeometry( QRect( 145, 100, 30, 19 /*192, 0, 43, 19*/ ) );
42 FontTextLabel4->setText( tr( "Size" ) );
43
44 FamilyGroup = new QGroupBox( this, "FamilyGroup" );
45 FamilyGroup->setGeometry( QRect( 5, 5, 115, 135 /*0, 6, 185, 131 */) );
46 FamilyGroup->setTitle( tr( "Font" ) );
47
48 familyListBox = new QListBox( FamilyGroup, "familyListBox" );
49 familyListBox->setGeometry( QRect( 5, 20, 100, 105 /* 6, 18, 170, 105 */) );
50
51 GroupBox2 = new QGroupBox( this, "GroupBox2" );
52 GroupBox2->setGeometry( QRect( 120, 5, 100, 90/* 0, 138, 170, 90*/ ) );
53 GroupBox2->setTitle( tr( "Font Style" ) );
54
55 styleListBox = new QListBox( GroupBox2, "styleListBox" );
56 styleListBox->setGeometry( QRect( 5, 20, 90, 60 /*10, 20, 150, 61*/ ) );
57
58 sizeListBox = new QListBox( this, "sizeListBox" );
59 sizeListBox->setGeometry( QRect( 180, 100, 40, 60 /* 192, 24, 40, 108 */) );
60
61 MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" );
62 MultiLineEdit1->setGeometry( QRect( 5, 165, 215, 45 /* 6, 234, 222, 55*/ ) );
63 MultiLineEdit1->setText( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ) );
64 MultiLineEdit1->setWordWrap(QMultiLineEdit::WidgetWidth);
65
66 connect( familyListBox,SIGNAL( highlighted( const QString &)),SLOT( familyListBoxSlot(const QString &) ));
67 connect( styleListBox,SIGNAL( highlighted( const QString &)),SLOT( styleListBoxSlot(const QString &) ));
68 connect( sizeListBox,SIGNAL( highlighted( const QString &)),SLOT( sizeListBoxSlot(const QString &) ));
69
70 populateLists();
71// MultiLineEdit1
72// connect();
73// move(5,15);
74 showMaximized();
75}
76
77FontDialog::~FontDialog()
78{
79}
80
81void FontDialog::familyListBoxSlot(const QString & text)
82{
83 int styleInt=styleListBox->currentItem();
84 int sizeInt=sizeListBox->currentItem();
85
86 styleListBox->clear();
87 sizeListBox->clear();
88 family= text;
89// qDebug(family);
90 QStringList styles = fdb.styles( family ); // string list of styles of our current font family
91 styleListBox->insertStringList( styles);
92 QString dstyle;// = "\t" + style + " (";
93 QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) );
94 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) {
95 dstyle = QString::number( *points );
96 sizeListBox ->insertItem( dstyle.left( dstyle.length() - 1 ));
97 }
98 if(styleInt == -1 || styleInt > styleListBox->count() )
99 styleListBox->setCurrentItem(0);
100 else
101 styleListBox->setCurrentItem(styleInt);
102
103 if(sizeInt == -1 || sizeInt > sizeListBox->count())
104 sizeListBox->setCurrentItem(0);
105 else
106 sizeListBox->setCurrentItem(sizeInt);
107
108 changeText();
109}
110
111void FontDialog::styleListBoxSlot(const QString &text)
112{
113 changeText();
114}
115
116void FontDialog::sizeListBoxSlot(const QString & text)
117{
118 changeText();
119}
120
121void FontDialog::populateLists()
122{
123// QFont defaultFont=MultiLineEdit1->font();
124// QFont defaultFont=Lview->font();
125// QFontInfo fontInfo(defaultFont);
126 Config config("TextEdit");
127 config.setGroup("Font");
128 QString familyStr = config.readEntry("Family", "fixed");
129 QString styleStr = config.readEntry("Style", "Regular");
130 QString sizeStr = config.readEntry("Size", "10");
131 QString charSetStr = config.readEntry("CharSet", "iso10646-1" );
132 bool ok;
133 int i_size=sizeStr.toInt(&ok,10);
134 selectedFont = fdb.font(familyStr,styleStr,i_size,charSetStr);
135// defaultFont.setItalic(TRUE);
136 families = fdb.families();
137 for ( QStringList::Iterator f = families.begin(); f != families.end();++f ) {
138 QString family = *f;
139// if(family == defaultFont.family())
140// qDebug(family);
141 familyListBox->insertItem( family);
142
143 if( familyListBox->text(0) == family) {
144 QStringList styles = fdb.styles( family ); // string list of styles of our current font family
145 styleListBox->insertStringList( styles);
146 for ( QStringList::Iterator s = styles.begin(); s != styles.end();++s ) { // for each font style
147 style = *s;
148 QString dstyle;// = "\t" + style + " (";
149 if(styleListBox->text(0) == style) {
150 QValueList<int> smoothies = fdb.smoothSizes( family, style );
151 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) {
152 dstyle = QString::number( *points ) + " ";
153
154 sizeListBox ->insertItem( dstyle.left( dstyle.length() - 1 ));
155 }
156 dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
157 }
158 } // styles
159 }
160 }
161 for(int i=0;i < familyListBox->count();i++) {
162 if( familyListBox->text(i) == familyStr)
163 familyListBox->setSelected( i, TRUE);
164 }
165
166 for(int i=0;i < styleListBox->count();i++) {
167 if( styleListBox->text(i) == styleStr)
168 styleListBox->setSelected( i, TRUE);
169 }
170
171 for(int i=0;i < sizeListBox->count();i++) {
172 if( sizeListBox->text(i) == sizeStr)
173 sizeListBox->setSelected( i, TRUE);
174 }
175 changeText();
176}
177
178void FontDialog::clearListBoxes() {
179 familyListBox->clear();
180 sizeListBox->clear();
181 styleListBox->clear();
182}
183
184void FontDialog::changeText()
185{
186 if( familyListBox->currentItem() == -1)
187 family= familyListBox->text(0);
188 else {
189 family = familyListBox->currentText();
190 }
191// qDebug("Font family is "+family);
192 if( styleListBox->currentItem() == -1)
193 style=styleListBox->text(0);
194 else {
195 style = styleListBox->currentText();
196 }
197// qDebug("font style is "+style);
198 if( sizeListBox->currentItem() == -1 )
199 size= sizeListBox->text(0);
200 else {
201 size = sizeListBox->currentText();
202 }
203
204// qDebug("Font size is "+size);
205 bool ok;
206 int i_size= size.toInt(&ok,10);
207 QStringList charSetList= fdb.charSets(family);
208// QStringList styles = fdb.styles( family ); // string list of styles of our current font family
209 QString charSet;
210 for ( QStringList::Iterator s = charSetList.begin(); s != charSetList.end();++s ) { // for each font style
211 charSet = *s;
212// qDebug(charSet);
213 }
214 selectedFont = fdb.font(family,style,i_size,charSet);
215 QFontInfo fontInfo( selectedFont);
216// if(fontInfo.italic() ) qDebug("italic");
217 selectedFont.setWeight(fontInfo.weight() );
218// qDebug("Style are "+style+" %d ",fontInfo.weight());
219 Config cfg("TextEdit");
220 cfg.setGroup("Font");
221 cfg.writeEntry("Family",family);
222 cfg.writeEntry("Style",style);
223 cfg.writeEntry("Size",size);
224 cfg.writeEntry("CharSet",charSet);
225
226 if(style.find("Italic",0,TRUE) != -1) {
227 selectedFont = fdb.font(family,"Regular",i_size,charSet);
228 selectedFont.setItalic(TRUE); //ya right
229 cfg.writeEntry("Italic","TRUE");
230// qDebug("Style is "+styleListBox->currentText());
231 } else
232 cfg.writeEntry("Italic","FALSE");
233 changedFonts=TRUE;
234 MultiLineEdit1->setFont( selectedFont);
235 MultiLineEdit1->update();
236}
237
diff --git a/core/apps/textedit/fontDialog.h b/core/apps/textedit/fontDialog.h
deleted file mode 100644
index ef930df..0000000
--- a/core/apps/textedit/fontDialog.h
+++ b/dev/null
@@ -1,63 +0,0 @@
1/****************************************************************************
2** Created: Sun Jan 27 11:02:59 2002 fileDialog.h
3copyright 2002 by L.J. Potter ljp@llornkcor.com
4
5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file.
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13****************************************************************************/
14#ifndef FONTDIALOG_H
15#define FONTDIALOG_H
16
17#include <qvariant.h>
18#include <qdialog.h>
19#include <qpe/fontdatabase.h>
20#include <qfont.h>
21
22class QVBoxLayout;
23class QHBoxLayout;
24class QGridLayout;
25class QLabel;
26class QListBox;
27class QListBoxItem;
28class QPushButton;
29class QGroupBox;
30class QMultiLineEdit;
31
32class FontDialog : public QDialog// QWidget
33{
34 Q_OBJECT
35
36public:
37 FontDialog( QWidget * parent = 0, const char* name = 0 , bool modal=FALSE, WFlags fl = 0 );
38 ~FontDialog();
39
40 QLabel *FontTextLabel4;
41 QGroupBox *FamilyGroup, *GroupBox2;
42 QListBox *familyListBox, *styleListBox, *sizeListBox;
43 QMultiLineEdit *MultiLineEdit1;
44 QPushButton *PushButtonOk,*PushButtonCancel;
45 QStringList families;
46
47 FontDatabase fdb;
48 QString family, style, size;
49 QFont selectedFont;
50 bool changedFonts;
51 void populateLists();
52 void clearListBoxes();
53 void changeText();
54protected slots:
55
56 void familyListBoxSlot(const QString &);
57 void styleListBoxSlot(const QString &);
58 void sizeListBoxSlot(const QString &);
59
60
61};
62
63#endif // FONTDIALOG_H
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index f6a869a..7b50a6c 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -1,990 +1,960 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20// changes added by L. J. Potter Sun 02-17-2002 21:31:31 20// changes added by L. J. Potter Sun 02-17-2002 21:31:31
21/* 21/*
22 useAdvancedfeatures = 22 useAdvancedfeatures =
23 1) do not prompt on cancel, even if text is edited. 23 1) do not prompt on cancel, even if text is edited.
24 2) prompt user is .desktop file 24 2) prompt user is .desktop file
25 3) prompt user for File Permissions on saveAs 25 3) prompt user for File Permissions on saveAs
26 */ 26 */
27#include "textedit.h" 27#include "textedit.h"
28#include "filePermissions.h" 28#include "filePermissions.h"
29#include "fontDialog.h" 29//#include "fontDialog.h"
30 30
31#include <opie/ofileselector.h> 31#include <opie/ofileselector.h>
32#include <opie/ofiledialog.h> 32#include <opie/ofiledialog.h>
33#include <opie/ofontselector.h>
33 34
34#include <qpe/fontdatabase.h> 35#include <qpe/fontdatabase.h>
35#include <qpe/global.h> 36#include <qpe/global.h>
36#include <qpe/fileselector.h> 37#include <qpe/fileselector.h>
37#include <qpe/applnk.h> 38#include <qpe/applnk.h>
38#include <qpe/resource.h> 39#include <qpe/resource.h>
39#include <qpe/config.h> 40#include <qpe/config.h>
40#include <qpe/qpeapplication.h> 41#include <qpe/qpeapplication.h>
41#include <qpe/qpemenubar.h> 42#include <qpe/qpemenubar.h>
42#include <qpe/qpetoolbar.h> 43#include <qpe/qpetoolbar.h>
43#include <qpe/qcopenvelope_qws.h> 44#include <qpe/qcopenvelope_qws.h>
44 45
45#include <qdatetime.h> 46#include <qdatetime.h>
46#include <qclipboard.h> 47#include <qclipboard.h>
47#include <qstringlist.h> 48#include <qstringlist.h>
48#include <qaction.h> 49#include <qaction.h>
49#include <qcolordialog.h> 50#include <qcolordialog.h>
50#include <qfileinfo.h> 51#include <qfileinfo.h>
51#include <qlineedit.h> 52#include <qlineedit.h>
52#include <qmessagebox.h> 53#include <qmessagebox.h>
53#include <qobjectlist.h> 54#include <qobjectlist.h>
54#include <qpopupmenu.h> 55#include <qpopupmenu.h>
55#include <qspinbox.h> 56#include <qspinbox.h>
56#include <qtoolbutton.h> 57#include <qtoolbutton.h>
57#include <qwidgetstack.h> 58#include <qwidgetstack.h>
58#include <qcheckbox.h> 59#include <qcheckbox.h>
59#include <qcombo.h> 60#include <qcombo.h>
61#include <qlayout.h>
60 62
61#include <unistd.h> 63#include <unistd.h>
62#include <sys/stat.h> 64#include <sys/stat.h>
63#include <stdlib.h> //getenv 65#include <stdlib.h> //getenv
64 66
65 67
66/* XPM */ 68/* XPM */
67static char * filesave_xpm[] = { 69static char * filesave_xpm[] = {
68"16 16 78 1", 70"16 16 78 1",
69" c None", 71" c None",
70". c #343434", 72". c #343434",
71"+ c #A0A0A0", 73"+ c #A0A0A0",
72"@ c #565656", 74"@ c #565656",
73"# c #9E9E9E", 75"# c #9E9E9E",
74"$ c #525252", 76"$ c #525252",
75"% c #929292", 77"% c #929292",
76"& c #676767", 78"& c #676767",
77"* c #848484", 79"* c #848484",
78"= c #666666", 80"= c #666666",
79"- c #D8D8D8", 81"- c #D8D8D8",
80"; c #FFFFFF", 82"; c #FFFFFF",
81"> c #DBDBDB", 83"> c #DBDBDB",
82", c #636363", 84", c #636363",
83"' c #989898", 85"' c #989898",
84") c #2D2D2D", 86") c #2D2D2D",
85"! c #909090", 87"! c #909090",
86"~ c #AEAEAE", 88"~ c #AEAEAE",
87"{ c #EAEAEA", 89"{ c #EAEAEA",
88"] c #575757", 90"] c #575757",
89"^ c #585858", 91"^ c #585858",
90"/ c #8A8A8A", 92"/ c #8A8A8A",
91"( c #828282", 93"( c #828282",
92"_ c #6F6F6F", 94"_ c #6F6F6F",
93": c #C9C9C9", 95": c #C9C9C9",
94"< c #050505", 96"< c #050505",
95"[ c #292929", 97"[ c #292929",
96"} c #777777", 98"} c #777777",
97"| c #616161", 99"| c #616161",
98"1 c #3A3A3A", 100"1 c #3A3A3A",
99"2 c #BEBEBE", 101"2 c #BEBEBE",
100"3 c #2C2C2C", 102"3 c #2C2C2C",
101"4 c #7C7C7C", 103"4 c #7C7C7C",
102"5 c #F6F6F6", 104"5 c #F6F6F6",
103"6 c #FCFCFC", 105"6 c #FCFCFC",
104"7 c #6B6B6B", 106"7 c #6B6B6B",
105"8 c #959595", 107"8 c #959595",
106"9 c #4F4F4F", 108"9 c #4F4F4F",
107"0 c #808080", 109"0 c #808080",
108"a c #767676", 110"a c #767676",
109"b c #818181", 111"b c #818181",
110"c c #B8B8B8", 112"c c #B8B8B8",
111"d c #FBFBFB", 113"d c #FBFBFB",
112"e c #F9F9F9", 114"e c #F9F9F9",
113"f c #CCCCCC", 115"f c #CCCCCC",
114"g c #030303", 116"g c #030303",
115"h c #737373", 117"h c #737373",
116"i c #7A7A7A", 118"i c #7A7A7A",
117"j c #7E7E7E", 119"j c #7E7E7E",
118"k c #6A6A6A", 120"k c #6A6A6A",
119"l c #FAFAFA", 121"l c #FAFAFA",
120"m c #505050", 122"m c #505050",
121"n c #9D9D9D", 123"n c #9D9D9D",
122"o c #333333", 124"o c #333333",
123"p c #7B7B7B", 125"p c #7B7B7B",
124"q c #787878", 126"q c #787878",
125"r c #696969", 127"r c #696969",
126"s c #494949", 128"s c #494949",
127"t c #555555", 129"t c #555555",
128"u c #949494", 130"u c #949494",
129"v c #E6E6E6", 131"v c #E6E6E6",
130"w c #424242", 132"w c #424242",
131"x c #515151", 133"x c #515151",
132"y c #535353", 134"y c #535353",
133"z c #3E3E3E", 135"z c #3E3E3E",
134"A c #D4D4D4", 136"A c #D4D4D4",
135"B c #0C0C0C", 137"B c #0C0C0C",
136"C c #353535", 138"C c #353535",
137"D c #474747", 139"D c #474747",
138"E c #ECECEC", 140"E c #ECECEC",
139"F c #919191", 141"F c #919191",
140"G c #7D7D7D", 142"G c #7D7D7D",
141"H c #000000", 143"H c #000000",
142"I c #404040", 144"I c #404040",
143"J c #858585", 145"J c #858585",
144"K c #323232", 146"K c #323232",
145"L c #D0D0D0", 147"L c #D0D0D0",
146"M c #1C1C1C", 148"M c #1C1C1C",
147" ...+ ", 149" ...+ ",
148" @#$%&..+ ", 150" @#$%&..+ ",
149" .*=-;;>,..+ ", 151" .*=-;;>,..+ ",
150" ')!~;;;;;;{]..", 152" ')!~;;;;;;{]..",
151" ^/(-;;;;;;;_:<", 153" ^/(-;;;;;;;_:<",
152" [}|;;;;;;;{12$", 154" [}|;;;;;;;{12$",
153" #34-55;;;;678$+", 155" #34-55;;;;678$+",
154" 90ab=c;dd;e1fg ", 156" 90ab=c;dd;e1fg ",
155" [ahij((kbl0mn$ ", 157" [ahij((kbl0mn$ ",
156" op^q^^7r&]s/$+ ", 158" op^q^^7r&]s/$+ ",
157"@btu;vbwxy]zAB ", 159"@btu;vbwxy]zAB ",
158"CzDEvEv;;DssF$ ", 160"CzDEvEv;;DssF$ ",
159"G.H{E{E{IxsJ$+ ", 161"G.H{E{E{IxsJ$+ ",
160" +...vEKxzLM ", 162" +...vEKxzLM ",
161" +...z]n$ ", 163" +...z]n$ ",
162" +... "}; 164" +... "};
163 165
164 166
165#if QT_VERSION < 300 167#if QT_VERSION < 300
166 168
167class QpeEditor : public QMultiLineEdit 169class QpeEditor : public QMultiLineEdit
168{ 170{
169 // Q_OBJECT 171 // Q_OBJECT
170public: 172public:
171 QpeEditor( QWidget *parent, const char * name = 0 ) 173 QpeEditor( QWidget *parent, const char * name = 0 )
172 : QMultiLineEdit( parent, name ) 174 : QMultiLineEdit( parent, name )
173 { 175 {
174 clearTableFlags(); 176 clearTableFlags();
175 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); 177 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar );
176 } 178 }
177 179
178 void find( const QString &txt, bool caseSensitive, 180 void find( const QString &txt, bool caseSensitive,
179 bool backwards ); 181 bool backwards );
180//public slots: 182//public slots:
181 /* 183 /*
182signals: 184signals:
183 void notFound(); 185 void notFound();
184 void searchWrapped(); 186 void searchWrapped();
185 */ 187 */
186 188
187private: 189private:
188 190
189}; 191};
190 192
191 193
192void QpeEditor::find ( const QString &txt, bool caseSensitive, 194void QpeEditor::find ( const QString &txt, bool caseSensitive,
193 bool backwards ) 195 bool backwards )
194{ 196{
195 static bool wrap = FALSE; 197 static bool wrap = FALSE;
196 int line, col; 198 int line, col;
197 if ( wrap ) { 199 if ( wrap ) {
198 if ( !backwards ) 200 if ( !backwards )
199 line = col = 0; 201 line = col = 0;
200 wrap = FALSE; 202 wrap = FALSE;
201 // emit searchWrapped(); 203 // emit searchWrapped();
202 } else { 204 } else {
203 getCursorPosition( &line, &col ); 205 getCursorPosition( &line, &col );
204 } 206 }
205 //ignore backwards for now.... 207 //ignore backwards for now....
206 if ( !backwards ) { 208 if ( !backwards ) {
207 for ( ; ; ) { 209 for ( ; ; ) {
208 if ( line >= numLines() ) { 210 if ( line >= numLines() ) {
209 wrap = TRUE; 211 wrap = TRUE;
210 //emit notFound(); 212 //emit notFound();
211 break; 213 break;
212 } 214 }
213 int findCol = getString( line )->find( txt, col, caseSensitive ); 215 int findCol = getString( line )->find( txt, col, caseSensitive );
214 if ( findCol >= 0 ) { 216 if ( findCol >= 0 ) {
215 setCursorPosition( line, findCol, FALSE ); 217 setCursorPosition( line, findCol, FALSE );
216 col = findCol + txt.length(); 218 col = findCol + txt.length();
217 setCursorPosition( line, col, TRUE ); 219 setCursorPosition( line, col, TRUE );
218 220
219 //found = TRUE; 221 //found = TRUE;
220 break; 222 break;
221 } 223 }
222 line++; 224 line++;
223 col = 0; 225 col = 0;
224 } 226 }
225 227
226 } 228 }
227 229
228} 230}
229 231
230 232
231#else 233#else
232 234
233#error "Must make a QpeEditor that inherits QTextEdit" 235#error "Must make a QpeEditor that inherits QTextEdit"
234 236
235#endif 237#endif
236 238
237 239
238static const int nfontsizes = 6; 240static const int nfontsizes = 6;
239static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; 241static const int fontsize[nfontsizes] = {8,10,12,14,18,24};
240 242
241TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) 243TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
242 : QMainWindow( parent, name, f ), bFromDocView( FALSE ) 244 : QMainWindow( parent, name, f ), bFromDocView( FALSE )
243{ 245{
244 doc = 0; 246 doc = 0;
245 edited=FALSE; 247 edited=FALSE;
246 edited1=FALSE; 248 edited1=FALSE;
247 setToolBarsMovable( FALSE ); 249 setToolBarsMovable( FALSE );
248 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 250 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
249 251
250 channel = new QCopChannel( "QPE/Application/textedit", this ); 252 channel = new QCopChannel( "QPE/Application/textedit", this );
251 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 253 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
252 this, SLOT(receive(const QCString&, const QByteArray&)) ); 254 this, SLOT(receive(const QCString&, const QByteArray&)) );
253 255
254 setIcon( Resource::loadPixmap( "TextEditor" ) ); 256 setIcon( Resource::loadPixmap( "TextEditor" ) );
255 257
256 QPEToolBar *bar = new QPEToolBar( this ); 258 QPEToolBar *bar = new QPEToolBar( this );
257 bar->setHorizontalStretchable( TRUE ); 259 bar->setHorizontalStretchable( TRUE );
258 menu = bar; 260 menu = bar;
259 261
260 QPEMenuBar *mb = new QPEMenuBar( bar ); 262 QPEMenuBar *mb = new QPEMenuBar( bar );
261 QPopupMenu *file = new QPopupMenu( this ); 263 QPopupMenu *file = new QPopupMenu( this );
262 QPopupMenu *edit = new QPopupMenu( this ); 264 QPopupMenu *edit = new QPopupMenu( this );
263 font = new QPopupMenu( this ); 265 font = new QPopupMenu( this );
264 266
265 bar = new QPEToolBar( this ); 267 bar = new QPEToolBar( this );
266 editBar = bar; 268 editBar = bar;
267 269
268 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 270 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
269 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 271 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
270 a->addTo( bar ); 272 a->addTo( bar );
271 a->addTo( file ); 273 a->addTo( file );
272 274
273 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); 275 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
274 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); 276 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
275 a->addTo( bar ); 277 a->addTo( bar );
276 a->addTo( file ); 278 a->addTo( file );
277 279
278 a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); 280 a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 );
279 connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); 281 connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
280 file->insertSeparator(); 282 file->insertSeparator();
281 a->addTo( file ); 283 a->addTo( file );
282 284
283 a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); 285 a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 );
284 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); 286 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) );
285 a->addTo( file ); 287 a->addTo( file );
286 288
287 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); 289 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 );
288 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 290 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
289 a->addTo( editBar ); 291 a->addTo( editBar );
290 a->addTo( edit ); 292 a->addTo( edit );
291 293
292 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); 294 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 );
293 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); 295 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
294 a->addTo( editBar ); 296 a->addTo( editBar );
295 a->addTo( edit ); 297 a->addTo( edit );
296 298
297 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 299 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
298 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); 300 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
299 a->addTo( editBar ); 301 a->addTo( editBar );
300 a->addTo( edit ); 302 a->addTo( edit );
301 303
302 304
303#ifndef QT_NO_CLIPBOARD 305#ifndef QT_NO_CLIPBOARD
304 a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 306 a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
305 connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); 307 connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) );
306 a->addTo( edit ); 308 a->addTo( edit );
307#endif 309#endif
308 310
309 a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 311 a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
310 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); 312 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) );
311 edit->insertSeparator(); 313 edit->insertSeparator();
312 a->addTo( bar ); 314 a->addTo( bar );
313 a->addTo( edit ); 315 a->addTo( edit );
314 316
315 int defsize;
316 bool defb, defi, wrap;
317
318 Config cfg("TextEdit");
319 cfg.setGroup("View");
320 defsize = cfg.readNumEntry("FontSize",10);
321 defb = cfg.readBoolEntry("Bold",FALSE);
322 defi = cfg.readBoolEntry("Italic",FALSE);
323 wrap = cfg.readBoolEntry("Wrap",TRUE);
324 317
325 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); 318 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 );
326 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); 319 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) );
327 zin->addTo( font ); 320 zin->addTo( font );
328 321
329 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); 322 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 );
330 connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); 323 connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) );
331 zout->addTo( font ); 324 zout->addTo( font );
332 325
333 font->insertSeparator(); 326 font->insertSeparator();
334 327
335#if 0
336 QAction *ba = new QAction( tr("Bold"), QString::null, 0, this, 0 );
337 connect( ba, SIGNAL( toggled(bool) ), this, SLOT( setBold(bool) ) );
338 ba->setToggleAction(TRUE);
339 ba->addTo( font );
340
341 QAction *ia = new QAction( tr("Italic"), QString::null, 0, this, 0 );
342 connect( ia, SIGNAL( toggled(bool) ), this, SLOT( setItalic(bool) ) );
343 ia->setToggleAction(TRUE);
344 ia->addTo( font );
345
346 ba->setOn(defb);
347 ia->setOn(defi);
348
349 font->insertSeparator();
350#endif
351
352 QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 ); 328 QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 );
353 connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) ); 329 connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) );
354 wa->setToggleAction(TRUE); 330 wa->setToggleAction(TRUE);
355 wa->addTo( font ); 331 wa->addTo( font );
356 332
357 font->insertSeparator(); 333 font->insertSeparator();
358 font->insertItem(tr("Font"), this, SLOT(changeFont()) ); 334 font->insertItem(tr("Font"), this, SLOT(changeFont()) );
359 335
360 font->insertSeparator(); 336 font->insertSeparator();
361 337
362 nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); 338 nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 );
363 connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); 339 connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) );
364 nStart->setToggleAction(TRUE); 340 nStart->setToggleAction(TRUE);
365 nStart->addTo( font ); 341 nStart->addTo( font );
366 342
367 nAdvanced = new QAction( tr("Advanced features"), QString::null, 0, this, 0 ); 343 nAdvanced = new QAction( tr("Advanced features"), QString::null, 0, this, 0 );
368 connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doAdvanced(bool) ) ); 344 connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doAdvanced(bool) ) );
369 nAdvanced->setToggleAction(TRUE); 345 nAdvanced->setToggleAction(TRUE);
370 nAdvanced->addTo( font ); 346 nAdvanced->addTo( font );
371 347
372 if(cfg.readBoolEntry("AdvancedFeatures")) {
373 qDebug("using advanced features");
374 useAdvancedFeatures = true;
375 nAdvanced->setOn(TRUE);
376 } else
377 useAdvancedFeatures = false;
378 348
379 font->insertSeparator(); 349 font->insertSeparator();
380 350
381 font->insertItem(tr("About"), this, SLOT( doAbout()) ); 351 font->insertItem(tr("About"), this, SLOT( doAbout()) );
382 352
383 mb->insertItem( tr( "File" ), file ); 353 mb->insertItem( tr( "File" ), file );
384 mb->insertItem( tr( "Edit" ), edit ); 354 mb->insertItem( tr( "Edit" ), edit );
385 mb->insertItem( tr( "View" ), font ); 355 mb->insertItem( tr( "View" ), font );
386 356
387 searchBar = new QPEToolBar(this); 357 searchBar = new QPEToolBar(this);
388 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 358 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
389 359
390 searchBar->setHorizontalStretchable( TRUE ); 360 searchBar->setHorizontalStretchable( TRUE );
391 361
392 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 362 searchEdit = new QLineEdit( searchBar, "searchEdit" );
393 searchBar->setStretchableWidget( searchEdit ); 363 searchBar->setStretchableWidget( searchEdit );
394 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 364 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
395 this, SLOT( search() ) ); 365 this, SLOT( search() ) );
396 366
397 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); 367 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
398 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); 368 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
399 a->addTo( searchBar ); 369 a->addTo( searchBar );
400 a->addTo( edit ); 370 a->addTo( edit );
401 371
402 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 372 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
403 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 373 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
404 a->addTo( searchBar ); 374 a->addTo( searchBar );
405 375
406 edit->insertSeparator(); 376 edit->insertSeparator();
407 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 377 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
408 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); 378 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) );
409 a->addTo( edit ); 379 a->addTo( edit );
410 380
411 searchBar->hide(); 381 searchBar->hide();
412 382
413 editor = new QpeEditor( this ); 383 editor = new QpeEditor( this );
414 setCentralWidget( editor ); 384 setCentralWidget( editor );
415 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 385 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken );
416 connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); 386 connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
417 387
418// resize( 200, 300 ); 388 Config cfg("TextEdit");
389
390 cfg. setGroup ( "Font" );
419 391
420// setFontSize(defsize,TRUE); 392 QFont defaultFont = editor-> font ( );
421 FontDatabase fdb;
422 QFont defaultFont=editor->font();
423 QFontInfo fontInfo(defaultFont);
424 393
425 cfg.setGroup("Font"); 394 QString family = cfg. readEntry ( "Family", defaultFont. family ( ));
426 QString family = cfg.readEntry("Family", fontInfo.family()); 395 int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( ));
427 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); 396 int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( ));
428 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); 397 bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( ));
429 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) );
430 398
431 defaultFont = fdb.font(family,style,i_size,charSet); 399 defaultFont = QFont ( family, size, weight, italic );
432 editor->setFont( defaultFont); 400 editor-> setFont ( defaultFont );
433 401
434 wa->setOn(wrap);
435 updateCaption(); 402 updateCaption();
436 403
437 cfg.setGroup("View"); 404 cfg.setGroup ( "View" );
405
406 useAdvancedFeatures = cfg. readBoolEntry ( "AdvancedFeatures", false );
407
408 if ( useAdvancedFeatures )
409 nAdvanced-> setOn ( true );
410
411 bool wrap = cfg. readBoolEntry ( "Wrap", true );
412 wa-> setOn ( wrap );
413 setWordWrap ( wrap );
414
438 if(cfg.readEntry("startNew","TRUE") == "TRUE") { 415 if(cfg.readEntry("startNew","TRUE") == "TRUE") {
439 nStart->setOn(TRUE); 416 nStart->setOn(TRUE);
440 fileNew(); 417 fileNew();
441 } else { 418 } else {
442 fileOpen(); 419 fileOpen();
443 } 420 }
444 421
445 viewSelection = cfg.readNumEntry( "FileView", 0 ); 422 viewSelection = cfg.readNumEntry( "FileView", 0 );
446} 423}
447 424
448TextEdit::~TextEdit() { 425TextEdit::~TextEdit() {
449 if( edited1 & !useAdvancedFeatures ) 426 if( edited1 & !useAdvancedFeatures )
450 saveAs(); 427 saveAs();
451} 428}
452 429
453void TextEdit::cleanUp() { 430void TextEdit::cleanUp() {
454qDebug("cleanUp");// save(); 431 qDebug("cleanUp");// save();
455 Config cfg("TextEdit"); 432
456 cfg.setGroup("View"); 433 Config cfg ( "TextEdit" );
434 cfg. setGroup ( "Font" );
457 QFont f = editor->font(); 435 QFont f = editor->font();
458 cfg.writeEntry("FontSize",f.pointSize()); 436 cfg. writeEntry ( "Family", f. family ( ));
459 cfg.writeEntry("Bold",f.bold()); 437 cfg. writeEntry ( "Size", f. pointSize ( ));
460 cfg.writeEntry("Italic",f.italic()); 438 cfg. writeEntry ( "Weight", f. weight ( ));
461 cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); 439 cfg. writeEntry ( "Italic", f. italic ( ));
462 cfg.writeEntry( "FileView", viewSelection ); 440
441 cfg. setGroup ( "View" );
442 cfg. writeEntry ( "Wrap", editor-> wordWrap ( ) == QMultiLineEdit::WidgetWidth );
443 cfg. writeEntry ( "FileView", viewSelection );
444 cfg. writeEntry ( "AdvancedFeatures", useAdvancedFeatures );
463} 445}
464 446
465 447
466void TextEdit::accept() { 448void TextEdit::accept() {
467 if( edited1) 449 if( edited1)
468 saveAs(); 450 saveAs();
469 exit(0); 451 exit(0);
470} 452}
471 453
472void TextEdit::zoomIn() { 454void TextEdit::zoomIn() {
473 setFontSize(editor->font().pointSize()+1,FALSE); 455 setFontSize(editor->font().pointSize()+1,FALSE);
474} 456}
475 457
476void TextEdit::zoomOut() { 458void TextEdit::zoomOut() {
477 setFontSize(editor->font().pointSize()-1,TRUE); 459 setFontSize(editor->font().pointSize()-1,TRUE);
478} 460}
479 461
480 462
481void TextEdit::setFontSize(int sz, bool round_down_not_up) { 463void TextEdit::setFontSize(int sz, bool round_down_not_up) {
482 int s=10; 464 int s=10;
483 for (int i=0; i<nfontsizes; i++) { 465 for (int i=0; i<nfontsizes; i++) {
484 if ( fontsize[i] == sz ) { 466 if ( fontsize[i] == sz ) {
485 s = sz; 467 s = sz;
486 break; 468 break;
487 } else if ( round_down_not_up ) { 469 } else if ( round_down_not_up ) {
488 if ( fontsize[i] < sz ) 470 if ( fontsize[i] < sz )
489 s = fontsize[i]; 471 s = fontsize[i];
490 } else { 472 } else {
491 if ( fontsize[i] > sz ) { 473 if ( fontsize[i] > sz ) {
492 s = fontsize[i]; 474 s = fontsize[i];
493 break; 475 break;
494 } 476 }
495 } 477 }
496 } 478 }
497 479
498 QFont f = editor->font(); 480 QFont f = editor->font();
499 f.setPointSize(s); 481 f.setPointSize(s);
500 editor->setFont(f); 482 editor->setFont(f);
501 483
502 zin->setEnabled(s != fontsize[nfontsizes-1]); 484 zin->setEnabled(s != fontsize[nfontsizes-1]);
503 zout->setEnabled(s != fontsize[0]); 485 zout->setEnabled(s != fontsize[0]);
504} 486}
505 487
506void TextEdit::setBold(bool y) { 488void TextEdit::setBold(bool y) {
507 QFont f = editor->font(); 489 QFont f = editor->font();
508 f.setBold(y); 490 f.setBold(y);
509 editor->setFont(f); 491 editor->setFont(f);
510} 492}
511 493
512void TextEdit::setItalic(bool y) { 494void TextEdit::setItalic(bool y) {
513 QFont f = editor->font(); 495 QFont f = editor->font();
514 f.setItalic(y); 496 f.setItalic(y);
515 editor->setFont(f); 497 editor->setFont(f);
516} 498}
517 499
518void TextEdit::setWordWrap(bool y) { 500void TextEdit::setWordWrap(bool y) {
519 bool state = editor->edited(); 501 bool state = editor->edited();
520 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); 502 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap );
521 editor->setEdited( state ); 503 editor->setEdited( state );
522} 504}
523 505
524void TextEdit::fileNew() { 506void TextEdit::fileNew() {
525// if( !bFromDocView ) { 507// if( !bFromDocView ) {
526// saveAs(); 508// saveAs();
527// } 509// }
528 newFile(DocLnk()); 510 newFile(DocLnk());
529} 511}
530 512
531void TextEdit::fileOpen() { 513void TextEdit::fileOpen() {
532 Config cfg("TextEdit"); 514 Config cfg("TextEdit");
533 cfg.setGroup("View"); 515 cfg.setGroup("View");
534 // bool b=FALSE; 516 // bool b=FALSE;
535 517
536 QMap<QString, QStringList> map; 518 QMap<QString, QStringList> map;
537 map.insert(tr("All"), QStringList() ); 519 map.insert(tr("All"), QStringList() );
538 QStringList text; 520 QStringList text;
539 text << "text/*"; 521 text << "text/*";
540 map.insert(tr("Text"), text ); 522 map.insert(tr("Text"), text );
541 text << "*"; 523 text << "*";
542 map.insert(tr("All"), text ); 524 map.insert(tr("All"), text );
543 QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map); 525 QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map);
544 if(!str.isEmpty() ) 526 if(!str.isEmpty() )
545 openFile( str ); 527 openFile( str );
546 528
547} 529}
548 530
549void TextEdit::doSearchBar() { 531void TextEdit::doSearchBar() {
550 Config cfg("TextEdit"); 532 Config cfg("TextEdit");
551 cfg.setGroup("View"); 533 cfg.setGroup("View");
552 if(cfg.readEntry("SearchBar","Closed") != "Opened") 534 if(cfg.readEntry("SearchBar","Closed") != "Opened")
553 searchBar->hide(); 535 searchBar->hide();
554} 536}
555 537
556#if 0 538#if 0
557void TextEdit::slotFind() { 539void TextEdit::slotFind() {
558 FindDialog frmFind( tr("Text Editor"), this ); 540 FindDialog frmFind( tr("Text Editor"), this );
559 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 541 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)),
560 editor, SLOT(slotDoFind( const QString&,bool,bool))); 542 editor, SLOT(slotDoFind( const QString&,bool,bool)));
561 543
562 //case sensitive, backwards, [category] 544 //case sensitive, backwards, [category]
563 545
564 connect( editor, SIGNAL(notFound()), 546 connect( editor, SIGNAL(notFound()),
565 &frmFind, SLOT(slotNotFound()) ); 547 &frmFind, SLOT(slotNotFound()) );
566 connect( editor, SIGNAL(searchWrapped()), 548 connect( editor, SIGNAL(searchWrapped()),
567 &frmFind, SLOT(slotWrapAround()) ); 549 &frmFind, SLOT(slotWrapAround()) );
568 550
569 frmFind.exec(); 551 frmFind.exec();
570 552
571 553
572} 554}
573#endif 555#endif
574 556
575void TextEdit::fileRevert() { 557void TextEdit::fileRevert() {
576 clear(); 558 clear();
577 fileOpen(); 559 fileOpen();
578} 560}
579 561
580void TextEdit::editCut() { 562void TextEdit::editCut() {
581#ifndef QT_NO_CLIPBOARD 563#ifndef QT_NO_CLIPBOARD
582 editor->cut(); 564 editor->cut();
583#endif 565#endif
584} 566}
585 567
586void TextEdit::editCopy() { 568void TextEdit::editCopy() {
587#ifndef QT_NO_CLIPBOARD 569#ifndef QT_NO_CLIPBOARD
588 editor->copy(); 570 editor->copy();
589#endif 571#endif
590} 572}
591 573
592void TextEdit::editPaste() { 574void TextEdit::editPaste() {
593#ifndef QT_NO_CLIPBOARD 575#ifndef QT_NO_CLIPBOARD
594 editor->paste(); 576 editor->paste();
595#endif 577#endif
596} 578}
597 579
598void TextEdit::editFind() { 580void TextEdit::editFind() {
599 searchBar->show(); 581 searchBar->show();
600 searchVisible = TRUE; 582 searchVisible = TRUE;
601 searchEdit->setFocus(); 583 searchEdit->setFocus();
602 Config cfg("TextEdit"); 584 Config cfg("TextEdit");
603 cfg.setGroup("View"); 585 cfg.setGroup("View");
604 cfg.writeEntry("SearchBar","Opened"); 586 cfg.writeEntry("SearchBar","Opened");
605 587
606} 588}
607 589
608void TextEdit::findNext() { 590void TextEdit::findNext() {
609 editor->find( searchEdit->text(), FALSE, FALSE ); 591 editor->find( searchEdit->text(), FALSE, FALSE );
610 592
611} 593}
612 594
613void TextEdit::findClose() { 595void TextEdit::findClose() {
614 searchVisible = FALSE; 596 searchVisible = FALSE;
615 searchBar->hide(); 597 searchBar->hide();
616 Config cfg("TextEdit"); 598 Config cfg("TextEdit");
617 cfg.setGroup("View"); 599 cfg.setGroup("View");
618 cfg.writeEntry("SearchBar","Closed"); 600 cfg.writeEntry("SearchBar","Closed");
619 cfg.write(); 601 cfg.write();
620} 602}
621 603
622void TextEdit::search() { 604void TextEdit::search() {
623 editor->find( searchEdit->text(), FALSE, FALSE ); 605 editor->find( searchEdit->text(), FALSE, FALSE );
624} 606}
625 607
626void TextEdit::newFile( const DocLnk &f ) { 608void TextEdit::newFile( const DocLnk &f ) {
627 DocLnk nf = f; 609 DocLnk nf = f;
628 nf.setType("text/plain"); 610 nf.setType("text/plain");
629 clear(); 611 clear();
630 setWState (WState_Reserved1 ); 612 setWState (WState_Reserved1 );
631 editor->setFocus(); 613 editor->setFocus();
632 doc = new DocLnk(nf); 614 doc = new DocLnk(nf);
633 currentFileName = "Unnamed"; 615 currentFileName = "Unnamed";
634 qDebug("newFile "+currentFileName); 616 qDebug("newFile "+currentFileName);
635 updateCaption( currentFileName); 617 updateCaption( currentFileName);
636// editor->setEdited( FALSE); 618// editor->setEdited( FALSE);
637} 619}
638 620
639void TextEdit::openFile( const QString &f ) { 621void TextEdit::openFile( const QString &f ) {
640 qDebug("filename is "+ f); 622 qDebug("filename is "+ f);
641 QString filer; 623 QString filer;
642// bFromDocView = TRUE; 624// bFromDocView = TRUE;
643 if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) { 625 if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) {
644 switch ( QMessageBox::warning(this,tr("Text Editor"), 626 switch ( QMessageBox::warning(this,tr("Text Editor"),
645 tr("Text Editor has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"), 627 tr("Text Editor has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"),
646 tr(".desktop File"),tr("Linked Document"),0,1,1) ) { 628 tr(".desktop File"),tr("Linked Document"),0,1,1) ) {
647 case 0: 629 case 0:
648 filer = f; 630 filer = f;
649 break; 631 break;
650 case 1: 632 case 1:
651 DocLnk sf(f); 633 DocLnk sf(f);
652 filer = sf.file(); 634 filer = sf.file();
653 break; 635 break;
654 } 636 }
655 } else { 637 } else {
656 DocLnk sf(f); 638 DocLnk sf(f);
657 filer = sf.file(); 639 filer = sf.file();
658// filer = f; 640// filer = f;
659// fileIs = TRUE; 641// fileIs = TRUE;
660 } 642 }
661 643
662 DocLnk nf; 644 DocLnk nf;
663 nf.setType("text/plain"); 645 nf.setType("text/plain");
664 nf.setFile(filer); 646 nf.setFile(filer);
665 currentFileName=filer; 647 currentFileName=filer;
666 QFileInfo fi( currentFileName); 648 QFileInfo fi( currentFileName);
667 nf.setName(fi.baseName()); 649 nf.setName(fi.baseName());
668 qDebug("openFile string "+currentFileName); 650 qDebug("openFile string "+currentFileName);
669 651
670 openFile(nf); 652 openFile(nf);
671 showEditTools(); 653 showEditTools();
672 // Show filename in caption 654 // Show filename in caption
673 QString name = filer; 655 QString name = filer;
674 int sep = name.findRev( '/' ); 656 int sep = name.findRev( '/' );
675 if ( sep > 0 ) 657 if ( sep > 0 )
676 name = name.mid( sep+1 ); 658 name = name.mid( sep+1 );
677 updateCaption( name ); 659 updateCaption( name );
678} 660}
679 661
680void TextEdit::openFile( const DocLnk &f ) { 662void TextEdit::openFile( const DocLnk &f ) {
681// clear(); 663// clear();
682// bFromDocView = TRUE; 664// bFromDocView = TRUE;
683 FileManager fm; 665 FileManager fm;
684 QString txt; 666 QString txt;
685 currentFileName=f.file(); 667 currentFileName=f.file();
686 qDebug("openFile doclnk " + currentFileName); 668 qDebug("openFile doclnk " + currentFileName);
687 if ( !fm.loadFile( f, txt ) ) { 669 if ( !fm.loadFile( f, txt ) ) {
688 // ####### could be a new file 670 // ####### could be a new file
689 qDebug( "Cannot open file" ); 671 qDebug( "Cannot open file" );
690 } 672 }
691// fileNew(); 673// fileNew();
692 if ( doc ) 674 if ( doc )
693 delete doc; 675 delete doc;
694 doc = new DocLnk(f); 676 doc = new DocLnk(f);
695 editor->setText(txt); 677 editor->setText(txt);
696 editor->setEdited( FALSE); 678 editor->setEdited( FALSE);
697 edited1=FALSE; 679 edited1=FALSE;
698 edited=FALSE; 680 edited=FALSE;
699 681
700 doc->setName(currentFileName); 682 doc->setName(currentFileName);
701 updateCaption(); 683 updateCaption();
702} 684}
703 685
704void TextEdit::showEditTools() { 686void TextEdit::showEditTools() {
705// if ( !doc ) 687// if ( !doc )
706// close(); 688// close();
707// clear(); 689// clear();
708 menu->show(); 690 menu->show();
709 editBar->show(); 691 editBar->show();
710 if ( searchVisible ) 692 if ( searchVisible )
711 searchBar->show(); 693 searchBar->show();
712// updateCaption(); 694// updateCaption();
713 setWState (WState_Reserved1 ); 695 setWState (WState_Reserved1 );
714} 696}
715 697
716/*! 698/*!
717 unprompted save */ 699 unprompted save */
718bool TextEdit::save() { 700bool TextEdit::save() {
719 QString file = doc->file(); 701 QString file = doc->file();
720 qDebug("saver file "+file); 702 qDebug("saver file "+file);
721 QString name= doc->name(); 703 QString name= doc->name();
722 qDebug("File named "+name); 704 qDebug("File named "+name);
723 QString rt = editor->text(); 705 QString rt = editor->text();
724 if( !rt.isEmpty() ) { 706 if( !rt.isEmpty() ) {
725 if(name.isEmpty()) { 707 if(name.isEmpty()) {
726 saveAs(); 708 saveAs();
727 } else { 709 } else {
728 currentFileName= name ; 710 currentFileName= name ;
729 qDebug("saveFile "+currentFileName); 711 qDebug("saveFile "+currentFileName);
730 712
731 struct stat buf; 713 struct stat buf;
732 mode_t mode; 714 mode_t mode;
733 stat(file.latin1(), &buf); 715 stat(file.latin1(), &buf);
734 mode = buf.st_mode; 716 mode = buf.st_mode;
735 717
736 if(!fileIs) { 718 if(!fileIs) {
737 doc->setName( name); 719 doc->setName( name);
738 FileManager fm; 720 FileManager fm;
739 if ( !fm.saveFile( *doc, rt ) ) { 721 if ( !fm.saveFile( *doc, rt ) ) {
740 return false; 722 return false;
741 } 723 }
742 } else { 724 } else {
743 qDebug("regular save file"); 725 qDebug("regular save file");
744 QFile f(file); 726 QFile f(file);
745 if( f.open(IO_WriteOnly)) { 727 if( f.open(IO_WriteOnly)) {
746 QCString crt = rt.utf8(); 728 QCString crt = rt.utf8();
747 f.writeBlock(crt,crt.length()); 729 f.writeBlock(crt,crt.length());
748 } else { 730 } else {
749 QMessageBox::message(tr("Text Edit"),tr("Write Failed")); 731 QMessageBox::message(tr("Text Edit"),tr("Write Failed"));
750 return false; 732 return false;
751 } 733 }
752 734
753 } 735 }
754 editor->setEdited( FALSE); 736 editor->setEdited( FALSE);
755 edited1=FALSE; 737 edited1=FALSE;
756 edited=FALSE; 738 edited=FALSE;
757 if(caption().left(1)=="*") 739 if(caption().left(1)=="*")
758 setCaption(caption().right(caption().length()-1)); 740 setCaption(caption().right(caption().length()-1));
759 741
760 742
761 chmod( file.latin1(), mode); 743 chmod( file.latin1(), mode);
762 } 744 }
763 return true; 745 return true;
764 } 746 }
765 return false; 747 return false;
766} 748}
767 749
768/*! 750/*!
769 prompted save */ 751 prompted save */
770bool TextEdit::saveAs() { 752bool TextEdit::saveAs() {
771 qDebug("saveAsFile "+currentFileName); 753 qDebug("saveAsFile "+currentFileName);
772 // case of nothing to save... 754 // case of nothing to save...
773 if ( !doc ) { 755 if ( !doc ) {
774//|| !bFromDocView) 756//|| !bFromDocView)
775 qDebug("no doc"); 757 qDebug("no doc");
776 return true; 758 return true;
777 } 759 }
778 if ( !editor->edited() ) { 760 if ( !editor->edited() ) {
779 delete doc; 761 delete doc;
780 doc = 0; 762 doc = 0;
781 return true; 763 return true;
782 } 764 }
783 765
784 QString rt = editor->text(); 766 QString rt = editor->text();
785 qDebug(currentFileName); 767 qDebug(currentFileName);
786 768
787 if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) { 769 if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) {
788// qDebug("do silly TT filename thing"); 770// qDebug("do silly TT filename thing");
789 if ( doc->name().isEmpty() ) { 771 if ( doc->name().isEmpty() ) {
790 QString pt = rt.simplifyWhiteSpace(); 772 QString pt = rt.simplifyWhiteSpace();
791 int i = pt.find( ' ' ); 773 int i = pt.find( ' ' );
792 QString docname = pt; 774 QString docname = pt;
793 if ( i > 0 ) 775 if ( i > 0 )
794 docname = pt.left( i ); 776 docname = pt.left( i );
795 // remove "." at the beginning 777 // remove "." at the beginning
796 while( docname.startsWith( "." ) ) 778 while( docname.startsWith( "." ) )
797 docname = docname.mid( 1 ); 779 docname = docname.mid( 1 );
798 docname.replace( QRegExp("/"), "_" ); 780 docname.replace( QRegExp("/"), "_" );
799 // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. 781 // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long.
800 if ( docname.length() > 40 ) 782 if ( docname.length() > 40 )
801 docname = docname.left(40); 783 docname = docname.left(40);
802 if ( docname.isEmpty() ) 784 if ( docname.isEmpty() )
803 docname = tr("Unnamed"); 785 docname = tr("Unnamed");
804 doc->setName(docname); 786 doc->setName(docname);
805 currentFileName=docname; 787 currentFileName=docname;
806 } 788 }
807 } 789 }
808 790
809 QMap<QString, QStringList> map; 791 QMap<QString, QStringList> map;
810 map.insert(tr("All"), QStringList() ); 792 map.insert(tr("All"), QStringList() );
811 QStringList text; 793 QStringList text;
812 text << "text/*"; 794 text << "text/*";
813 map.insert(tr("Text"), text ); 795 map.insert(tr("Text"), text );
814 text << "*"; 796 text << "*";
815 map.insert(tr("All"), text ); 797 map.insert(tr("All"), text );
816 798
817 QString str = OFileDialog::getSaveFileName( 2,"/", QString::null, map); 799 QString str = OFileDialog::getSaveFileName( 2,"/", QString::null, map);
818 800
819 if(!str.isEmpty() ) { 801 if(!str.isEmpty() ) {
820 QString fileNm=str; 802 QString fileNm=str;
821 803
822 qDebug("saving filename "+fileNm); 804 qDebug("saving filename "+fileNm);
823 QFileInfo fi(fileNm); 805 QFileInfo fi(fileNm);
824 currentFileName=fi.fileName(); 806 currentFileName=fi.fileName();
825 if(doc) { 807 if(doc) {
826// QString file = doc->file(); 808// QString file = doc->file();
827// doc->removeFiles(); 809// doc->removeFiles();
828 delete doc; 810 delete doc;
829 DocLnk nf; 811 DocLnk nf;
830 nf.setType("text/plain"); 812 nf.setType("text/plain");
831 nf.setFile( fileNm); 813 nf.setFile( fileNm);
832 doc = new DocLnk(nf); 814 doc = new DocLnk(nf);
833// editor->setText(rt); 815// editor->setText(rt);
834// qDebug("openFile doclnk "+currentFileName); 816// qDebug("openFile doclnk "+currentFileName);
835 doc->setName( currentFileName); 817 doc->setName( currentFileName);
836 updateCaption( currentFileName); 818 updateCaption( currentFileName);
837 819
838 FileManager fm; 820 FileManager fm;
839 if ( !fm.saveFile( *doc, rt ) ) { 821 if ( !fm.saveFile( *doc, rt ) ) {
840 return false; 822 return false;
841 } 823 }
842 824
843 if( useAdvancedFeatures ) { 825 if( useAdvancedFeatures ) {
844 filePermissions *filePerm; 826 filePermissions *filePerm;
845 filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); 827 filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm);
846 filePerm->showMaximized(); 828 filePerm->showMaximized();
847 filePerm->exec(); 829 filePerm->exec();
848 830
849 if( filePerm) 831 if( filePerm)
850 delete filePerm; 832 delete filePerm;
851 } 833 }
852 } 834 }
853 editor->setEdited( false); 835 editor->setEdited( false);
854 edited1 = false; 836 edited1 = false;
855 edited = false; 837 edited = false;
856 if(caption().left(1)=="*") 838 if(caption().left(1)=="*")
857 setCaption(caption().right(caption().length()-1)); 839 setCaption(caption().right(caption().length()-1));
858 840
859 return true; 841 return true;
860 } 842 }
861 qDebug("returning false"); 843 qDebug("returning false");
862 return false; 844 return false;
863} //end saveAs 845} //end saveAs
864 846
865void TextEdit::clear() { 847void TextEdit::clear() {
866 delete doc; 848 delete doc;
867 doc = 0; 849 doc = 0;
868 editor->clear(); 850 editor->clear();
869} 851}
870 852
871void TextEdit::updateCaption( const QString &name ) { 853void TextEdit::updateCaption( const QString &name ) {
872 if ( !doc ) 854 if ( !doc )
873 setCaption( tr("Text Editor") ); 855 setCaption( tr("Text Editor") );
874 else { 856 else {
875 QString s = name; 857 QString s = name;
876 if ( s.isNull() ) 858 if ( s.isNull() )
877 s = doc->name(); 859 s = doc->name();
878 if ( s.isEmpty() ) { 860 if ( s.isEmpty() ) {
879 s = tr( "Unnamed" ); 861 s = tr( "Unnamed" );
880 currentFileName=s; 862 currentFileName=s;
881 } 863 }
882 if(s.left(1) == "/") 864 if(s.left(1) == "/")
883 s = s.right(s.length()-1); 865 s = s.right(s.length()-1);
884 setCaption( s + " - " + tr("Text Editor") ); 866 setCaption( s + " - " + tr("Text Editor") );
885 } 867 }
886} 868}
887 869
888void TextEdit::setDocument(const QString& fileref) { 870void TextEdit::setDocument(const QString& fileref) {
889 bFromDocView = TRUE; 871 bFromDocView = TRUE;
890 openFile(fileref); 872 openFile(fileref);
891 editor->setEdited(TRUE); 873 editor->setEdited(TRUE);
892 edited1=FALSE; 874 edited1=FALSE;
893 edited=TRUE; 875 edited=TRUE;
894 doSearchBar(); 876 doSearchBar();
895} 877}
896 878
897void TextEdit::closeEvent( QCloseEvent *e ) { 879void TextEdit::closeEvent( QCloseEvent *e ) {
898 bFromDocView = FALSE; 880 bFromDocView = FALSE;
899 e->accept(); 881 e->accept();
900} 882}
901 883
902void TextEdit::changeFont() { 884void TextEdit::changeFont() {
903 FontDatabase fdb; 885 QDialog *d = new QDialog ( this, "FontDialog", true );
904 QFont defaultFont=editor->font(); 886 d-> setCaption ( tr( "Choose font" ));
905 QFontInfo fontInfo(defaultFont); 887 QBoxLayout *lay = new QVBoxLayout ( d );
906 Config cfg("TextEdit"); 888 OFontSelector *ofs = new OFontSelector ( true, d );
907 cfg.setGroup("Font"); 889 lay-> addWidget ( ofs );
908 QString family = cfg.readEntry("Family", fontInfo.family()); 890 ofs-> setSelectedFont ( editor-> font ( ));
909 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont));
910 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10);
911 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) );
912
913 defaultFont = fdb.font(family,style,i_size,charSet);
914
915 FontDialog *fontDlg;
916 fontDlg=new FontDialog(this,tr("FontDialog"),TRUE);
917 891
918 fontDlg->exec(); 892 d-> showMaximized ( );
919 893 if ( d-> exec ( ) == QDialog::Accepted )
920 QFont myFont=fontDlg->selectedFont; 894 editor-> setFont ( ofs-> selectedFont ( ));
921 editor->setFont( myFont); 895 delete d;
922 delete fontDlg;
923 896
924} 897}
925 898
926void TextEdit::editDelete() { 899void TextEdit::editDelete() {
927 switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want<BR>to <B>delete</B> the current file\nfrom the disk?<BR>This is <B>irreversable!!</B>"),tr("Yes"),tr("No"),0,0,1) ) { 900 switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want<BR>to <B>delete</B> the current file\nfrom the disk?<BR>This is <B>irreversable!!</B>"),tr("Yes"),tr("No"),0,0,1) ) {
928 case 0: 901 case 0:
929 if(doc) { 902 if(doc) {
930 doc->removeFiles(); 903 doc->removeFiles();
931 clear(); 904 clear();
932 setCaption( tr("Text Editor") ); 905 setCaption( tr("Text Editor") );
933 } 906 }
934 break; 907 break;
935 case 1: 908 case 1:
936 // exit 909 // exit
937 break; 910 break;
938 }; 911 };
939} 912}
940 913
941void TextEdit::changeStartConfig( bool b ) { 914void TextEdit::changeStartConfig( bool b ) {
942 915
943 Config cfg("TextEdit"); 916 Config cfg("TextEdit");
944 cfg.setGroup("View"); 917 cfg.setGroup("View");
945 if(b) { 918 if(b) {
946 qDebug("bool"); 919 qDebug("bool");
947 cfg.writeEntry("startNew","TRUE"); 920 cfg.writeEntry("startNew","TRUE");
948 } else { 921 } else {
949 cfg.writeEntry("startNew","FALSE"); 922 cfg.writeEntry("startNew","FALSE");
950 } 923 }
951 update(); 924 update();
952} 925}
953 926
954void TextEdit::editorChanged() { 927void TextEdit::editorChanged() {
955 if(editor->edited() && edited && !edited1) { 928 if(editor->edited() && edited && !edited1) {
956 setCaption( "*"+caption()); 929 setCaption( "*"+caption());
957 edited1=TRUE; 930 edited1=TRUE;
958 } 931 }
959 edited=TRUE; 932 edited=TRUE;
960} 933}
961 934
962void TextEdit::receive(const QCString&msg, const QByteArray&) { 935void TextEdit::receive(const QCString&msg, const QByteArray&) {
963 qDebug("QCop "+msg); 936 qDebug("QCop "+msg);
964 if ( msg == "setDocument(QString)" ) { 937 if ( msg == "setDocument(QString)" ) {
965 qDebug("bugger all"); 938 qDebug("bugger all");
966 } 939 }
967 940
968} 941}
969void TextEdit::doAbout() { 942void TextEdit::doAbout() {
970 QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>" 943 QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>"
971 "2000 Trolltech AS, and<BR>" 944 "2000 Trolltech AS, and<BR>"
972 "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>" 945 "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>"
973 "and is licensed under the GPL")); 946 "and is licensed under the GPL"));
974} 947}
975 948
976void TextEdit::doAdvanced(bool b) { 949void TextEdit::doAdvanced(bool b) {
977 useAdvancedFeatures=b; 950 useAdvancedFeatures=b;
978 Config cfg("TextEdit");
979 cfg.setGroup("View");
980 cfg.writeEntry("AdvancedFeatures",b);
981} 951}
982 952
983void TextEdit::editPasteTimeDate() { 953void TextEdit::editPasteTimeDate() {
984#ifndef QT_NO_CLIPBOARD 954#ifndef QT_NO_CLIPBOARD
985 QClipboard *cb = QApplication::clipboard(); 955 QClipboard *cb = QApplication::clipboard();
986 QDateTime dt = QDateTime::currentDateTime(); 956 QDateTime dt = QDateTime::currentDateTime();
987 cb->setText( dt.toString()); 957 cb->setText( dt.toString());
988 editor->paste(); 958 editor->paste();
989#endif 959#endif
990} 960}
diff --git a/core/apps/textedit/textedit.pro b/core/apps/textedit/textedit.pro
index f6e6530..500abde 100644
--- a/core/apps/textedit/textedit.pro
+++ b/core/apps/textedit/textedit.pro
@@ -1,24 +1,24 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4HEADERS = textedit.h fontDialog.h filePermissions.h 4HEADERS = textedit.h filePermissions.h
5SOURCES = main.cpp textedit.cpp fontDialog.cpp filePermissions.cpp 5SOURCES = main.cpp textedit.cpp filePermissions.cpp
6INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include 7DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lqpe -lopie 8LIBS += -lqpe -lopie
9TARGET = textedit 9TARGET = textedit
10 10
11TRANSLATIONS = ../../../i18n/de/textedit.ts \ 11TRANSLATIONS = ../../../i18n/de/textedit.ts \
12 ../../../i18n/en/textedit.ts \ 12 ../../../i18n/en/textedit.ts \
13 ../../../i18n/es/textedit.ts \ 13 ../../../i18n/es/textedit.ts \
14 ../../../i18n/fr/textedit.ts \ 14 ../../../i18n/fr/textedit.ts \
15 ../../../i18n/hu/textedit.ts \ 15 ../../../i18n/hu/textedit.ts \
16 ../../../i18n/ja/textedit.ts \ 16 ../../../i18n/ja/textedit.ts \
17 ../../../i18n/ko/textedit.ts \ 17 ../../../i18n/ko/textedit.ts \
18 ../../../i18n/no/textedit.ts \ 18 ../../../i18n/no/textedit.ts \
19 ../../../i18n/pl/textedit.ts \ 19 ../../../i18n/pl/textedit.ts \
20 ../../../i18n/pt/textedit.ts \ 20 ../../../i18n/pt/textedit.ts \
21 ../../../i18n/pt_BR/textedit.ts \ 21 ../../../i18n/pt_BR/textedit.ts \
22 ../../../i18n/sl/textedit.ts \ 22 ../../../i18n/sl/textedit.ts \
23 ../../../i18n/zh_CN/textedit.ts \ 23 ../../../i18n/zh_CN/textedit.ts \
24 ../../../i18n/zh_TW/textedit.ts 24 ../../../i18n/zh_TW/textedit.ts