summaryrefslogtreecommitdiff
path: root/core/apps/textedit/textedit.cpp
authorllornkcor <llornkcor>2003-02-28 17:23:19 (UTC)
committer llornkcor <llornkcor>2003-02-28 17:23:19 (UTC)
commita5a5a25bee2596608906ae44cdad45bf89276385 (patch) (unidiff)
treea618cc62fceb34b0aa9a1f7a9d9bb744c57c5460 /core/apps/textedit/textedit.cpp
parent81cbb2d97b4f0cd7eef56536d791434856d7ae8d (diff)
downloadopie-a5a5a25bee2596608906ae44cdad45bf89276385.zip
opie-a5a5a25bee2596608906ae44cdad45bf89276385.tar.gz
opie-a5a5a25bee2596608906ae44cdad45bf89276385.tar.bz2
moved xmp to resource, and added goto line number
Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp130
1 files changed, 31 insertions, 99 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index f571511..b81f3b4 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -52,111 +52,13 @@
52#include <qtimer.h> 52#include <qtimer.h>
53#include <qdir.h> 53#include <qdir.h>
54#include <unistd.h> 54#include <unistd.h>
55#include <sys/stat.h> 55#include <sys/stat.h>
56#include <stdlib.h> //getenv 56#include <stdlib.h> //getenv
57 57
58 58#include "resource.h"
59/* XPM */
60static char * filesave_xpm[] = {
61"16 16 78 1",
62" c None",
63". c #343434",
64"+ c #A0A0A0",
65"@ c #565656",
66"# c #9E9E9E",
67"$ c #525252",
68"% c #929292",
69"& c #676767",
70"* c #848484",
71"= c #666666",
72"- c #D8D8D8",
73"; c #FFFFFF",
74"> c #DBDBDB",
75", c #636363",
76"' c #989898",
77") c #2D2D2D",
78"! c #909090",
79"~ c #AEAEAE",
80"{ c #EAEAEA",
81"] c #575757",
82"^ c #585858",
83"/ c #8A8A8A",
84"( c #828282",
85"_ c #6F6F6F",
86": c #C9C9C9",
87"< c #050505",
88"[ c #292929",
89"} c #777777",
90"| c #616161",
91"1 c #3A3A3A",
92"2 c #BEBEBE",
93"3 c #2C2C2C",
94"4 c #7C7C7C",
95"5 c #F6F6F6",
96"6 c #FCFCFC",
97"7 c #6B6B6B",
98"8 c #959595",
99"9 c #4F4F4F",
100"0 c #808080",
101"a c #767676",
102"b c #818181",
103"c c #B8B8B8",
104"d c #FBFBFB",
105"e c #F9F9F9",
106"f c #CCCCCC",
107"g c #030303",
108"h c #737373",
109"i c #7A7A7A",
110"j c #7E7E7E",
111"k c #6A6A6A",
112"l c #FAFAFA",
113"m c #505050",
114"n c #9D9D9D",
115"o c #333333",
116"p c #7B7B7B",
117"q c #787878",
118"r c #696969",
119"s c #494949",
120"t c #555555",
121"u c #949494",
122"v c #E6E6E6",
123"w c #424242",
124"x c #515151",
125"y c #535353",
126"z c #3E3E3E",
127"A c #D4D4D4",
128"B c #0C0C0C",
129"C c #353535",
130"D c #474747",
131"E c #ECECEC",
132"F c #919191",
133"G c #7D7D7D",
134"H c #000000",
135"I c #404040",
136"J c #858585",
137"K c #323232",
138"L c #D0D0D0",
139"M c #1C1C1C",
140" ...+ ",
141" @#$%&..+ ",
142" .*=-;;>,..+ ",
143" ')!~;;;;;;{]..",
144" ^/(-;;;;;;;_:<",
145" [}|;;;;;;;{12$",
146" #34-55;;;;678$+",
147" 90ab=c;dd;e1fg ",
148" [ahij((kbl0mn$ ",
149" op^q^^7r&]s/$+ ",
150"@btu;vbwxy]zAB ",
151"CzDEvEv;;DssF$ ",
152"G.H{E{E{IxsJ$+ ",
153" +...vEKxzLM ",
154" +...z]n$ ",
155" +... "};
156
157 59
158#if QT_VERSION < 300 60#if QT_VERSION < 300
159 61
160class QpeEditor : public QMultiLineEdit 62class QpeEditor : public QMultiLineEdit
161{ 63{
162 64
@@ -350,12 +252,17 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
350 QString::null, 0, this, 0 ); 252 QString::null, 0, this, 0 );
351 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); 253 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) );
352 edit->insertSeparator(); 254 edit->insertSeparator();
353 a->addTo( bar ); 255 a->addTo( bar );
354 a->addTo( edit ); 256 a->addTo( edit );
355 257
258 a = new QAction( tr( "Goto Line..." ), Resource::loadPixmap( "find" ),
259 QString::null, 0, this, 0 );
260 connect( a, SIGNAL( activated() ), this, SLOT( gotoLine() ) );
261 a->addTo( edit );
262
356 263
357 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); 264 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 );
358 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); 265 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) );
359 zin->addTo( font ); 266 zin->addTo( font );
360 267
361 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); 268 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 );
@@ -1257,6 +1164,31 @@ if(featureAutoSave)
1257// qDebug("setting autosave"); 1164// qDebug("setting autosave");
1258 QTimer *timer = new QTimer(this ); 1165 QTimer *timer = new QTimer(this );
1259 connect( timer, SIGNAL(timeout()), this, SLOT(timerCrank()) ); 1166 connect( timer, SIGNAL(timeout()), this, SLOT(timerCrank()) );
1260 timer->start( 300000, true); //5 minutes 1167 timer->start( 300000, true); //5 minutes
1261 } 1168 }
1262} 1169}
1170
1171void TextEdit::gotoLine() {
1172
1173 QWidget *d = QApplication::desktop();
1174 gotoEdit = new QLineEdit( 0, "Goto line");
1175
1176 gotoEdit->move( (d->width()/2) - ( gotoEdit->width()/2) , (d->height()/2) - (gotoEdit->height()/2));
1177 gotoEdit->setFrame(true);
1178 gotoEdit->show();
1179 connect (gotoEdit,SIGNAL(returnPressed()), this, SLOT(doGoto()));
1180}
1181
1182void TextEdit::doGoto() {
1183 QString number = gotoEdit->text();
1184 gotoEdit->hide();
1185 if(gotoEdit) delete gotoEdit;
1186 bool ok;
1187 int lineNumber = number.toInt(&ok, 10);
1188 if(editor->numLines() < lineNumber)
1189 QMessageBox::message(tr("Text Edit"),tr("Not enough lines"));
1190 else
1191 {
1192 editor->setCursorPosition(lineNumber, 0, false);
1193 }
1194}