author | llornkcor <llornkcor> | 2002-02-24 07:39:56 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-24 07:39:56 (UTC) |
commit | f7be370d10a69cfe78b04687fe728b32d566083a (patch) (side-by-side diff) | |
tree | 6e586d6543cfd3a60e9734b515642bd86fc052cd /core/apps/textedit/textedit.cpp | |
parent | f1c800025cf759ca0d6257a42f548216d217b16b (diff) | |
download | opie-f7be370d10a69cfe78b04687fe728b32d566083a.zip opie-f7be370d10a69cfe78b04687fe728b32d566083a.tar.gz opie-f7be370d10a69cfe78b04687fe728b32d566083a.tar.bz2 |
added file permissions dialog
Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/apps/textedit/textedit.cpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index c869dc9..515fcdc 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -22,6 +22,7 @@ #include "textedit.h" #include "fileBrowser.h" #include "fileSaver.h" +#include "filePermissions.h" #include "fontDialog.h" @@ -47,6 +48,9 @@ #include <qspinbox.h> #include <qtoolbutton.h> #include <qwidgetstack.h> +#include <qcheckbox.h> +#include <unistd.h> +#include <sys/stat.h> #include <stdlib.h> //getenv /* XPM */ @@ -415,7 +419,7 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) TextEdit::~TextEdit() { -// saveAs(); +// save(); Config cfg("TextEdit"); cfg.setGroup("View"); @@ -694,19 +698,24 @@ bool TextEdit::save() { QString file = doc->file(); QString name= doc->name(); + QString rt = editor->text(); currentFileName= name ; qDebug("saveFile "+currentFileName); + struct stat buf; + mode_t mode; + lstat(file.latin1(), &buf); + mode = buf.st_mode; + doc->setName( name); FileManager fm; if ( !fm.saveFile( *doc, rt ) ) { return false; } -// if(doc) -// delete doc; -// doc = 0; editor->setEdited( false ); + + chmod( file.latin1(), mode); return true; } @@ -714,7 +723,7 @@ bool TextEdit::save() prompted save */ bool TextEdit::saveAs() { - qDebug("saveAsFile "+currentFileName); +// qDebug("saveAsFile "+currentFileName); // case of nothing to save... /// there's always something to save // if ( !doc )//|| !bFromDocView) @@ -753,6 +762,7 @@ bool TextEdit::saveAs() } } + fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName); qDebug("wanna save filename "+currentFileName); fileSaveDlg->exec(); @@ -772,7 +782,6 @@ bool TextEdit::saveAs() doc = new DocLnk(nf); // editor->setText(rt); qDebug("openFile doclnk "+currentFileName); - } doc->setName( currentFileName); updateCaption( currentFileName); @@ -780,10 +789,17 @@ bool TextEdit::saveAs() if ( !fm.saveFile( *doc, rt ) ) { return false; } -// delete doc; -// doc = 0; + if( fileSaveDlg->filePermCheck->isChecked() ) { + filePermissions *filePerm; + filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm); + filePerm->exec(); editor->setEdited( false ); + if( filePerm) + delete filePerm; } + } + } + if(fileSaveDlg) delete fileSaveDlg; return true; @@ -835,6 +851,7 @@ void TextEdit::closeEvent( QCloseEvent *e ) void TextEdit::accept() { + save(); close(); // fileOpen(); //godamn thats obnoxious! lemme out!!! } |