summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index b81f3b4..ce868d6 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -1057,138 +1057,142 @@ void TextEdit::receive(const QCString&msg, const QByteArray &) {
1057} 1057}
1058 1058
1059void TextEdit::doAbout() { 1059void TextEdit::doAbout() {
1060 QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>" 1060 QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>"
1061 "2000 Trolltech AS, and<BR>" 1061 "2000 Trolltech AS, and<BR>"
1062 "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>" 1062 "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>"
1063 "and is licensed under the GPL")); 1063 "and is licensed under the GPL"));
1064} 1064}
1065 1065
1066void TextEdit::doPrompt(bool b) { 1066void TextEdit::doPrompt(bool b) {
1067 promptExit=b; 1067 promptExit=b;
1068 Config cfg("TextEdit"); 1068 Config cfg("TextEdit");
1069 cfg.setGroup ( "View" ); 1069 cfg.setGroup ( "View" );
1070 cfg.writeEntry ( "PromptExit", b); 1070 cfg.writeEntry ( "PromptExit", b);
1071} 1071}
1072 1072
1073void TextEdit::doDesktop(bool b) { 1073void TextEdit::doDesktop(bool b) {
1074 openDesktop=b; 1074 openDesktop=b;
1075 Config cfg("TextEdit"); 1075 Config cfg("TextEdit");
1076 cfg.setGroup ( "View" ); 1076 cfg.setGroup ( "View" );
1077 cfg.writeEntry ( "OpenDesktop", b); 1077 cfg.writeEntry ( "OpenDesktop", b);
1078} 1078}
1079 1079
1080void TextEdit::doFilePerms(bool b) { 1080void TextEdit::doFilePerms(bool b) {
1081 filePerms=b; 1081 filePerms=b;
1082 Config cfg("TextEdit"); 1082 Config cfg("TextEdit");
1083 cfg.setGroup ( "View" ); 1083 cfg.setGroup ( "View" );
1084 cfg.writeEntry ( "FilePermissions", b); 1084 cfg.writeEntry ( "FilePermissions", b);
1085} 1085}
1086 1086
1087void TextEdit::editPasteTimeDate() { 1087void TextEdit::editPasteTimeDate() {
1088#ifndef QT_NO_CLIPBOARD 1088#ifndef QT_NO_CLIPBOARD
1089 QClipboard *cb = QApplication::clipboard(); 1089 QClipboard *cb = QApplication::clipboard();
1090 QDateTime dt = QDateTime::currentDateTime(); 1090 QDateTime dt = QDateTime::currentDateTime();
1091 cb->setText( dt.toString()); 1091 cb->setText( dt.toString());
1092 editor->paste(); 1092 editor->paste();
1093#endif 1093#endif
1094} 1094}
1095 1095
1096int TextEdit::savePrompt() 1096int TextEdit::savePrompt()
1097{ 1097{
1098 switch( QMessageBox::information( 0, (tr("Textedit")), 1098 switch( QMessageBox::information( 0, (tr("Textedit")),
1099 (tr("Textedit detected\n" 1099 (tr("Textedit detected\n"
1100 "you have unsaved changes\n" 1100 "you have unsaved changes\n"
1101 "Go ahead and save?\n")), 1101 "Go ahead and save?\n")),
1102 (tr("Save")), (tr("Don't Save")), (tr("&Cancel")), 2, 2 ) ) 1102 (tr("Save")), (tr("Don't Save")), (tr("&Cancel")), 2, 2 ) )
1103 { 1103 {
1104 case 0: 1104 case 0:
1105 { 1105 {
1106 return 1; 1106 return 1;
1107 } 1107 }
1108 break; 1108 break;
1109 1109
1110 case 1: 1110 case 1:
1111 { 1111 {
1112 return 2; 1112 return 2;
1113 } 1113 }
1114 break; 1114 break;
1115 1115
1116 case 2: 1116 case 2:
1117 { 1117 {
1118 return -1; 1118 return -1;
1119 } 1119 }
1120 break; 1120 break;
1121 }; 1121 };
1122 1122
1123 return 0; 1123 return 0;
1124} 1124}
1125 1125
1126void TextEdit::timerCrank() 1126void TextEdit::timerCrank()
1127{ 1127{
1128 if(featureAutoSave && edited1) 1128 if(featureAutoSave && edited1)
1129 { 1129 {
1130 if(currentFileName.isEmpty()) 1130 if(currentFileName.isEmpty())
1131 { 1131 {
1132 currentFileName = QDir::homeDirPath()+"/textedit.tmp"; 1132 currentFileName = QDir::homeDirPath()+"/textedit.tmp";
1133 saveAs(); 1133 saveAs();
1134 } 1134 }
1135 else 1135 else
1136 { 1136 {
1137// qDebug("autosave"); 1137// qDebug("autosave");
1138 save(); 1138 save();
1139 } 1139 }
1140 setTimer(); 1140 setTimer();
1141 } 1141 }
1142} 1142}
1143 1143
1144void TextEdit::doTimer(bool b) 1144void TextEdit::doTimer(bool b)
1145{ 1145{
1146 Config cfg("TextEdit"); 1146 Config cfg("TextEdit");
1147 cfg.setGroup ( "View" ); 1147 cfg.setGroup ( "View" );
1148 cfg.writeEntry ( "autosave", b); 1148 cfg.writeEntry ( "autosave", b);
1149 featureAutoSave = b; 1149 featureAutoSave = b;
1150 nAutoSave->setOn(b); 1150 nAutoSave->setOn(b);
1151 if(b) 1151 if(b)
1152 { 1152 {
1153// qDebug("doTimer true"); 1153// qDebug("doTimer true");
1154 setTimer(); 1154 setTimer();
1155 } 1155 }
1156// else 1156// else
1157// qDebug("doTimer false"); 1157// qDebug("doTimer false");
1158} 1158}
1159 1159
1160void TextEdit::setTimer() 1160void TextEdit::setTimer()
1161{ 1161{
1162if(featureAutoSave) 1162if(featureAutoSave)
1163 { 1163 {
1164// qDebug("setting autosave"); 1164// qDebug("setting autosave");
1165 QTimer *timer = new QTimer(this ); 1165 QTimer *timer = new QTimer(this );
1166 connect( timer, SIGNAL(timeout()), this, SLOT(timerCrank()) ); 1166 connect( timer, SIGNAL(timeout()), this, SLOT(timerCrank()) );
1167 timer->start( 300000, true); //5 minutes 1167 timer->start( 300000, true); //5 minutes
1168 } 1168 }
1169} 1169}
1170 1170
1171void TextEdit::gotoLine() { 1171void TextEdit::gotoLine() {
1172 1172
1173 QWidget *d = QApplication::desktop(); 1173 QWidget *d = QApplication::desktop();
1174 gotoEdit = new QLineEdit( 0, "Goto line"); 1174 gotoEdit = new QLineEdit( 0, "Goto line");
1175 1175
1176 gotoEdit->move( (d->width()/2) - ( gotoEdit->width()/2) , (d->height()/2) - (gotoEdit->height()/2)); 1176 gotoEdit->move( (d->width()/2) - ( gotoEdit->width()/2) , (d->height()/2) - (gotoEdit->height()/2));
1177 gotoEdit->setFrame(true); 1177 gotoEdit->setFrame(true);
1178 gotoEdit->show(); 1178 gotoEdit->show();
1179 connect (gotoEdit,SIGNAL(returnPressed()), this, SLOT(doGoto())); 1179 connect (gotoEdit,SIGNAL(returnPressed()), this, SLOT(doGoto()));
1180} 1180}
1181 1181
1182void TextEdit::doGoto() { 1182void TextEdit::doGoto() {
1183 QString number = gotoEdit->text(); 1183 QString number = gotoEdit->text();
1184 gotoEdit->hide(); 1184 gotoEdit->hide();
1185 if(gotoEdit) delete gotoEdit; 1185 if(gotoEdit) {
1186 delete gotoEdit;
1187 gotoEdit = 0;
1188 }
1189
1186 bool ok; 1190 bool ok;
1187 int lineNumber = number.toInt(&ok, 10); 1191 int lineNumber = number.toInt(&ok, 10);
1188 if(editor->numLines() < lineNumber) 1192 if(editor->numLines() < lineNumber)
1189 QMessageBox::message(tr("Text Edit"),tr("Not enough lines")); 1193 QMessageBox::message(tr("Text Edit"),tr("Not enough lines"));
1190 else 1194 else
1191 { 1195 {
1192 editor->setCursorPosition(lineNumber, 0, false); 1196 editor->setCursorPosition(lineNumber, 0, false);
1193 } 1197 }
1194} 1198}