summaryrefslogtreecommitdiff
path: root/core/apps/textedit
authorllornkcor <llornkcor>2002-08-30 12:16:14 (UTC)
committer llornkcor <llornkcor>2002-08-30 12:16:14 (UTC)
commit73ccaa41947cd22902b96c18f3b96a6f9f3e565c (patch) (side-by-side diff)
treedbddb746c97da59cd0af50e24ac2ef71603ee553 /core/apps/textedit
parent146dfec7bdcac24df009b434d0f4683c53ce7552 (diff)
downloadopie-73ccaa41947cd22902b96c18f3b96a6f9f3e565c.zip
opie-73ccaa41947cd22902b96c18f3b96a6f9f3e565c.tar.gz
opie-73ccaa41947cd22902b96c18f3b96a6f9f3e565c.tar.bz2
fixed canceling saveas dialog return
Diffstat (limited to 'core/apps/textedit') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp158
1 files changed, 67 insertions, 91 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 107695a..d61da2a 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -365,4 +365,10 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
nAdvanced->addTo( font );
- if(cfg.readBoolEntry("AdvancedFeatures"))
- nAdvanced->setOn(TRUE);
+
+ if(cfg.readBoolEntry("AdvancedFeatures")) {
+ qDebug("using advanced features");
+ useAdvancedFeatures = true;
+ nAdvanced->setOn(TRUE);
+ } else
+ useAdvancedFeatures = false;
+
font->insertSeparator();
@@ -436,4 +442,6 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
-void TextEdit::cleanUp()
-{
+TextEdit::~TextEdit() {
+}
+
+void TextEdit::cleanUp() {
// save();
@@ -447,11 +455,12 @@ void TextEdit::cleanUp()
cfg.writeEntry( "FileView", viewSelection );
-
}
-TextEdit::~TextEdit()
-{
+
+void TextEdit::accept() {
+ if(edited1)
+ saveAs();
+ exit(0);
}
-void TextEdit::zoomIn()
-{
+void TextEdit::zoomIn() {
setFontSize(editor->font().pointSize()+1,FALSE);
@@ -459,4 +468,3 @@ void TextEdit::zoomIn()
-void TextEdit::zoomOut()
-{
+void TextEdit::zoomOut() {
setFontSize(editor->font().pointSize()-1,TRUE);
@@ -465,4 +473,3 @@ void TextEdit::zoomOut()
-void TextEdit::setFontSize(int sz, bool round_down_not_up)
-{
+void TextEdit::setFontSize(int sz, bool round_down_not_up) {
int s=10;
@@ -491,4 +498,3 @@ void TextEdit::setFontSize(int sz, bool round_down_not_up)
-void TextEdit::setBold(bool y)
-{
+void TextEdit::setBold(bool y) {
QFont f = editor->font();
@@ -498,4 +504,3 @@ void TextEdit::setBold(bool y)
-void TextEdit::setItalic(bool y)
-{
+void TextEdit::setItalic(bool y) {
QFont f = editor->font();
@@ -505,4 +510,3 @@ void TextEdit::setItalic(bool y)
-void TextEdit::setWordWrap(bool y)
-{
+void TextEdit::setWordWrap(bool y) {
bool state = editor->edited();
@@ -512,4 +516,3 @@ void TextEdit::setWordWrap(bool y)
-void TextEdit::fileNew()
-{
+void TextEdit::fileNew() {
// if( !bFromDocView ) {
@@ -520,4 +523,3 @@ void TextEdit::fileNew()
-void TextEdit::fileOpen()
-{
+void TextEdit::fileOpen() {
Config cfg("TextEdit");
@@ -539,4 +541,3 @@ void TextEdit::fileOpen()
-void TextEdit::doSearchBar()
-{
+void TextEdit::doSearchBar() {
Config cfg("TextEdit");
@@ -548,4 +549,3 @@ void TextEdit::doSearchBar()
#if 0
-void TextEdit::slotFind()
-{
+void TextEdit::slotFind() {
FindDialog frmFind( tr("Text Editor"), this );
@@ -567,4 +567,3 @@ void TextEdit::slotFind()
-void TextEdit::fileRevert()
-{
+void TextEdit::fileRevert() {
clear();
@@ -573,4 +572,3 @@ void TextEdit::fileRevert()
-void TextEdit::editCut()
-{
+void TextEdit::editCut() {
#ifndef QT_NO_CLIPBOARD
@@ -580,4 +578,3 @@ void TextEdit::editCut()
-void TextEdit::editCopy()
-{
+void TextEdit::editCopy() {
#ifndef QT_NO_CLIPBOARD
@@ -587,4 +584,3 @@ void TextEdit::editCopy()
-void TextEdit::editPaste()
-{
+void TextEdit::editPaste() {
#ifndef QT_NO_CLIPBOARD
@@ -594,4 +590,3 @@ void TextEdit::editPaste()
-void TextEdit::editFind()
-{
+void TextEdit::editFind() {
searchBar->show();
@@ -605,4 +600,3 @@ void TextEdit::editFind()
-void TextEdit::findNext()
-{
+void TextEdit::findNext() {
editor->find( searchEdit->text(), FALSE, FALSE );
@@ -611,4 +605,3 @@ void TextEdit::findNext()
-void TextEdit::findClose()
-{
+void TextEdit::findClose() {
searchVisible = FALSE;
@@ -621,4 +614,3 @@ void TextEdit::findClose()
-void TextEdit::search()
-{
+void TextEdit::search() {
editor->find( searchEdit->text(), FALSE, FALSE );
@@ -626,4 +618,3 @@ void TextEdit::search()
-void TextEdit::newFile( const DocLnk &f )
-{
+void TextEdit::newFile( const DocLnk &f ) {
DocLnk nf = f;
@@ -640,4 +631,3 @@ void TextEdit::newFile( const DocLnk &f )
-void TextEdit::openFile( const QString &f )
-{
+void TextEdit::openFile( const QString &f ) {
qDebug("filename is "+ f);
@@ -680,4 +670,3 @@ void TextEdit::openFile( const QString &f )
-void TextEdit::openFile( const DocLnk &f )
-{
+void TextEdit::openFile( const DocLnk &f ) {
// clear();
@@ -705,4 +694,3 @@ void TextEdit::openFile( const DocLnk &f )
-void TextEdit::showEditTools()
-{
+void TextEdit::showEditTools() {
// if ( !doc )
@@ -720,4 +708,3 @@ void TextEdit::showEditTools()
unprompted save */
-bool TextEdit::save()
-{
+bool TextEdit::save() {
QString file = doc->file();
@@ -773,11 +760,10 @@ bool TextEdit::save()
prompted save */
-bool TextEdit::saveAs()
-{
-// qDebug("saveAsFile "+currentFileName);
- // case of nothing to save...
- if ( !doc )//|| !bFromDocView)
- {
- qDebug("no doc");
- return true;
- }
+bool TextEdit::saveAs() {
+ qDebug("saveAsFile "+currentFileName);
+ // case of nothing to save...
+ if ( !doc ) {
+//|| !bFromDocView)
+ qDebug("no doc");
+ return true;
+ }
if ( !editor->edited() ) {
@@ -792,3 +778,3 @@ bool TextEdit::saveAs()
if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) {
- qDebug("do silly TT filename thing");
+// qDebug("do silly TT filename thing");
if ( doc->name().isEmpty() ) {
@@ -820,3 +806,5 @@ bool TextEdit::saveAs()
map.insert(tr("All"), text );
+
QString str = OFileDialog::getSaveFileName( 2,"/", QString::null, map);
+
if(!str.isEmpty() ) {
@@ -850,18 +838,19 @@ bool TextEdit::saveAs()
- if( filePerm)
- delete filePerm;
+ if( filePerm)
+ delete filePerm;
}
}
+ editor->setEdited( false);
+ edited1 = false;
+ edited = false;
+ if(caption().left(1)=="*")
+ setCaption(caption().right(caption().length()-1));
+
+ return true;
}
- editor->setEdited(TRUE);
- edited1=FALSE;
- edited=TRUE;
- if(caption().left(1)=="*")
- setCaption(caption().right(caption().length()-1));
-
- return true;
+ qDebug("returning false");
+ return false;
} //end saveAs
-void TextEdit::clear()
-{
+void TextEdit::clear() {
delete doc;
@@ -871,4 +860,3 @@ void TextEdit::clear()
-void TextEdit::updateCaption( const QString &name )
-{
+void TextEdit::updateCaption( const QString &name ) {
if ( !doc )
@@ -889,4 +877,3 @@ void TextEdit::updateCaption( const QString &name )
-void TextEdit::setDocument(const QString& fileref)
-{
+void TextEdit::setDocument(const QString& fileref) {
bFromDocView = TRUE;
@@ -899,4 +886,3 @@ void TextEdit::setDocument(const QString& fileref)
-void TextEdit::closeEvent( QCloseEvent *e )
-{
+void TextEdit::closeEvent( QCloseEvent *e ) {
bFromDocView = FALSE;
@@ -905,11 +891,2 @@ void TextEdit::closeEvent( QCloseEvent *e )
-void TextEdit::accept()
- {
- //if(caption() !="Unnamed")
- if(edited1)
- saveAs();
- exit(0);
-
-}
-
void TextEdit::changeFont() {
@@ -938,4 +915,3 @@ void TextEdit::changeFont() {
-void TextEdit::editDelete()
-{
+void TextEdit::editDelete() {
switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!"),tr("Yes"),tr("No"),0,0,1) ) {