summaryrefslogtreecommitdiff
path: root/core
authorllornkcor <llornkcor>2003-02-28 18:13:41 (UTC)
committer llornkcor <llornkcor>2003-02-28 18:13:41 (UTC)
commit64423f1852a13178f23365f2bba995ef2c355b3b (patch) (side-by-side diff)
tree074d12cbd3b762fbcd0eac686c5b7fab3617453d /core
parentd4db61dbd748040bed740e08a839e01b86af2c87 (diff)
downloadopie-64423f1852a13178f23365f2bba995ef2c355b3b.zip
opie-64423f1852a13178f23365f2bba995ef2c355b3b.tar.gz
opie-64423f1852a13178f23365f2bba995ef2c355b3b.tar.bz2
no goto for 0 length texts
Diffstat (limited to 'core') (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 797c61b..5edf102 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -1165,39 +1165,41 @@ void TextEdit::doTimer(bool b)
void TextEdit::setTimer()
{
if(featureAutoSave)
{
// qDebug("setting autosave");
QTimer *timer = new QTimer(this );
connect( timer, SIGNAL(timeout()), this, SLOT(timerCrank()) );
timer->start( 300000, true); //5 minutes
}
}
void TextEdit::gotoLine() {
-
+ if( editor->length() < 1)
+ return;
QWidget *d = QApplication::desktop();
gotoEdit = new QLineEdit( 0, "Goto line");
gotoEdit->move( (d->width()/2) - ( gotoEdit->width()/2) , (d->height()/2) - (gotoEdit->height()/2));
gotoEdit->setFrame(true);
gotoEdit->show();
connect (gotoEdit,SIGNAL(returnPressed()), this, SLOT(doGoto()));
}
void TextEdit::doGoto() {
QString number = gotoEdit->text();
gotoEdit->hide();
+
if(gotoEdit) {
delete gotoEdit;
gotoEdit = 0;
}
bool ok;
int lineNumber = number.toInt(&ok, 10);
- if(editor->numLines() < lineNumber)
+ if( editor->numLines() < lineNumber)
QMessageBox::message(tr("Text Edit"),tr("Not enough lines"));
else
{
editor->setCursorPosition(lineNumber, 0, false);
}
}