summaryrefslogtreecommitdiff
path: root/core/apps
authorllornkcor <llornkcor>2002-02-24 07:39:56 (UTC)
committer llornkcor <llornkcor>2002-02-24 07:39:56 (UTC)
commitf7be370d10a69cfe78b04687fe728b32d566083a (patch) (unidiff)
tree6e586d6543cfd3a60e9734b515642bd86fc052cd /core/apps
parentf1c800025cf759ca0d6257a42f548216d217b16b (diff)
downloadopie-f7be370d10a69cfe78b04687fe728b32d566083a.zip
opie-f7be370d10a69cfe78b04687fe728b32d566083a.tar.gz
opie-f7be370d10a69cfe78b04687fe728b32d566083a.tar.bz2
added file permissions dialog
Diffstat (limited to 'core/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/filePermissions.cpp274
-rw-r--r--core/apps/textedit/filePermissions.h56
-rw-r--r--core/apps/textedit/fileSaver.cpp8
-rw-r--r--core/apps/textedit/fileSaver.h2
-rw-r--r--core/apps/textedit/opie-textedit.control2
-rw-r--r--core/apps/textedit/textedit.cpp75
-rw-r--r--core/apps/textedit/textedit.pro4
7 files changed, 387 insertions, 34 deletions
diff --git a/core/apps/textedit/filePermissions.cpp b/core/apps/textedit/filePermissions.cpp
new file mode 100644
index 0000000..1938b84
--- a/dev/null
+++ b/core/apps/textedit/filePermissions.cpp
@@ -0,0 +1,274 @@
1/****************************************************************************
2** copyright 2002 ljp ljp@llornkcor.com
3** Created: Sat Feb 23 19:44:40 2002 L.J. Potter
4**
5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file.
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13****************************************************************************/
14#include "filePermissions.h"
15
16#include <qfile.h>
17#include <qfileinfo.h>
18
19#include <qcheckbox.h>
20#include <qlabel.h>
21#include <qlineedit.h>
22#include <qlayout.h>
23#include <qvariant.h>
24#include <qtooltip.h>
25#include <qmessagebox.h>
26
27#include <unistd.h>
28#include <sys/stat.h>
29#include <stdlib.h>
30#include <sys/types.h>
31#include <pwd.h>
32#include <grp.h>
33
34filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName )
35 : QDialog( parent, name, modal, fl )
36{
37 if ( !name )
38 setName( "filePermissions" );
39 qDebug("FilePermissions "+fileName);
40 resize( 236, 210 );
41 setMaximumSize( QSize( 236, 210 ) );
42 setCaption( tr( "Set File Permissions" ) );
43
44 TextLabel1 = new QLabel( this, "TextLabel1" );
45 TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) );
46 TextLabel1->setText( tr( "Set file permissions for:" ) );
47
48 LineEdit1 = new QLineEdit( this, "LineEdit1" );
49 LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) );
50 LineEdit1->setReadOnly(true);
51
52 TextLabel4 = new QLabel( this, "TextLabel4" );
53 TextLabel4->setGeometry( QRect( 5, 85, 50, 15 ) );
54 TextLabel4->setText( tr( "owner" ) );
55
56 TextLabel4_2 = new QLabel( this, "TextLabel4_2" );
57 TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) );
58 TextLabel4_2->setText( tr( "group" ) );
59
60 TextLabel4_3 = new QLabel( this, "TextLabel4_3" );
61 TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) );
62 TextLabel4_3->setText( tr( "others" ) );
63
64 CheckBox1 = new QCheckBox( this, "CheckBox1" );
65 CheckBox1->setGeometry( QRect( 75, 85, 20, 16 ) );
66 connect(CheckBox1, SIGNAL(released()),this,SLOT(ownReadCheck()));
67
68 CheckBox1_2 = new QCheckBox( this, "CheckBox1_2" );
69 CheckBox1_2->setGeometry( QRect( 135, 85, 20, 16 ) );
70 connect(CheckBox1_2, SIGNAL(released()),this,SLOT(ownWriteCheck()));
71
72 CheckBox1_3 = new QCheckBox( this, "CheckBox1_3" );
73 CheckBox1_3->setGeometry( QRect( 195, 85, 20, 16 ) );
74 connect(CheckBox1_3, SIGNAL(released()),this,SLOT(ownExeCheck()));
75
76 CheckBox1_4 = new QCheckBox( this, "CheckBox1_4" );
77 CheckBox1_4->setGeometry( QRect( 75, 105, 20, 16 ) );
78 connect(CheckBox1_4, SIGNAL(released()),this,SLOT(grpReadCheck()));
79
80 CheckBox1_5 = new QCheckBox( this, "CheckBox1_5" );
81 CheckBox1_5->setGeometry( QRect( 135, 105, 20, 16 ) );
82 connect(CheckBox1_5, SIGNAL(released()),this,SLOT(grpWriteCheck()));
83
84 CheckBox1_6 = new QCheckBox( this, "CheckBox1_6" );
85 CheckBox1_6->setGeometry( QRect( 195, 105, 20, 16 ) );
86 connect(CheckBox1_6, SIGNAL(released()),this,SLOT(grpExeCheck()));
87
88 CheckBox1_7 = new QCheckBox( this, "CheckBox1_7" );
89 CheckBox1_7->setGeometry( QRect( 75, 125, 16, 16 ) );
90 connect(CheckBox1_7, SIGNAL(released()),this,SLOT(wrldReadCheck()));
91
92 CheckBox1_8 = new QCheckBox( this, "CheckBox1_8" );
93 CheckBox1_8->setGeometry( QRect( 135, 125, 20, 16 ) );
94 connect(CheckBox1_8, SIGNAL(released()),this,SLOT(wrldWriteCheck()));
95
96 CheckBox1_8_2 = new QCheckBox( this, "CheckBox1_8_2" );
97 CheckBox1_8_2->setGeometry( QRect( 195, 125, 20, 16 ) );
98 connect(CheckBox1_8_2, SIGNAL(released()),this,SLOT(wrldExeCheck()));
99
100 GroupLineEdit = new QLineEdit( this, "GroupLineEdit" );
101 GroupLineEdit->setGeometry( QRect( 125, 155, 106, 22 ) );
102
103 OwnerLineEdit = new QLineEdit( this, "OwnerLineEdit" );
104 OwnerLineEdit->setGeometry( QRect( 10, 155, 106, 22 ) );
105
106 TextLabel5 = new QLabel( this, "TextLabel5" );
107 TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) );
108 TextLabel5->setText( tr( "Owner" ) );
109
110 TextLabel5_2 = new QLabel( this, "TextLabel5_2" );
111 TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) );
112 TextLabel5_2->setText( tr( "Group" ) );
113
114 ModeLine = new QLineEdit( this, "TextLabelMode" );
115 ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) );
116
117 TextLabel3_2 = new QLabel( this, "TextLabel3_2" );
118 TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) );
119 TextLabel3_2->setText( tr( "read" ) );
120 TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
121
122 TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" );
123 TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) );
124 TextLabel3_2_2->setText( tr( "write" ) );
125 TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
126
127 TextLabel3 = new QLabel( this, "TextLabel3" );
128 TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) );
129 TextLabel3->setText( tr( "execute" ) );
130 TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
131
132 struct stat buf;
133 mode_t mode;
134 file = fileName;
135 QFileInfo fi(file);
136
137 LineEdit1->setText( file);
138 OwnerLineEdit->setText( fi.owner());
139 GroupLineEdit->setText( fi.group());
140
141 if( fi.permission( QFileInfo::ReadUser)) { CheckBox1->setChecked(true); }
142 if( fi.permission( QFileInfo::WriteUser)) { CheckBox1_2->setChecked(true); }
143 if( fi.permission( QFileInfo::ExeUser)) { CheckBox1_3->setChecked(true); }
144
145 if( fi.permission( QFileInfo::ReadGroup)) { CheckBox1_4->setChecked(true); }
146 if( fi.permission( QFileInfo::WriteGroup)) { CheckBox1_5->setChecked(true); }
147 if( fi.permission( QFileInfo::ExeGroup)) { CheckBox1_6->setChecked(true); }
148
149 if( fi.permission( QFileInfo::ReadOther)) { CheckBox1_7->setChecked(true); }
150 if( fi.permission( QFileInfo::WriteOther)) { CheckBox1_8->setChecked(true); }
151 if( fi.permission( QFileInfo::ExeOther)) { CheckBox1_8_2->setChecked(true); }
152
153 lstat(file.latin1(), &buf);
154 mode = buf.st_mode;
155 modeStr.sprintf("%#o", buf.st_mode & ~(S_IFMT) );
156 ModeLine->setText(modeStr);
157 bool ok;
158 i_mode = modeStr.toInt(&ok,10);
159
160}
161
162/*
163 * Destroys the object and frees any allocated resources
164 */
165filePermissions::~filePermissions()
166{
167}
168
169
170// might this be better as a callback routine???
171void filePermissions::ownReadCheck() {
172 if(CheckBox1->isChecked()) { i_mode +=400; }
173 else i_mode -=400;
174 modeStr.sprintf("0%d",i_mode);
175 ModeLine->setText( modeStr);
176// 0400
177}
178
179void filePermissions::ownWriteCheck() {
180 if(CheckBox1_2->isChecked()) { i_mode +=200; }
181 else i_mode -=200;
182 modeStr.sprintf("0%d",i_mode);
183 ModeLine->setText(modeStr);
184// 0200
185}
186
187void filePermissions::ownExeCheck() {
188 if(CheckBox1_3->isChecked()) { i_mode +=100; }
189 else i_mode -=100;
190 modeStr.sprintf("0%d",i_mode);
191 ModeLine->setText(modeStr);
192// 0100
193}
194
195void filePermissions::grpReadCheck() {
196 if(CheckBox1_4->isChecked()) { i_mode +=40; }
197 else i_mode -=40;
198 modeStr.sprintf("0%d",i_mode);
199 ModeLine->setText(modeStr);
200// 0040
201}
202
203void filePermissions::grpWriteCheck() {
204 if(CheckBox1_5->isChecked()) { i_mode +=20; }
205 else i_mode -=20;
206 modeStr.sprintf("0%d",i_mode);
207 ModeLine->setText(modeStr);
208// 0020
209}
210
211void filePermissions::grpExeCheck() {
212 if(CheckBox1_6->isChecked()) { i_mode +=10; }
213 else i_mode -=10;
214 modeStr.sprintf("0%d",i_mode);
215 ModeLine->setText(modeStr);
216// 0010
217}
218
219void filePermissions::wrldReadCheck() {
220 if(CheckBox1_7->isChecked()) { i_mode +=4; }
221 else i_mode -=4;
222 modeStr.sprintf("0%d",i_mode);
223 ModeLine->setText(modeStr);
224// 0004
225}
226
227void filePermissions::wrldWriteCheck() {
228 if(CheckBox1_8->isChecked()) { i_mode +=2; }
229 else i_mode -=2;
230 modeStr.sprintf("0%d",i_mode);
231 ModeLine->setText(modeStr);
232// 0002
233}
234
235void filePermissions::wrldExeCheck() {
236 if(CheckBox1_8_2->isChecked()) { i_mode +=1; }
237 else i_mode -=1;
238 modeStr.sprintf("0%d",i_mode);
239 ModeLine->setText(modeStr);
240// 0001
241}
242
243void filePermissions::accept() {
244
245 QFileInfo fi(file);
246 struct passwd *pwd=0;
247 struct group *grp=0;
248 pwd = getpwnam(OwnerLineEdit->text().latin1() );
249 if(pwd == NULL) {
250 perror("getpwnam");
251 QMessageBox::warning(this,"Warning","Error- no user");
252 return;
253 } else {
254 grp = getgrnam(GroupLineEdit->text().latin1());
255 if(grp==NULL) {
256 perror("getgrnam");
257 QMessageBox::warning(this,"Warning","Error- no group");
258 return;
259 }
260 if( chown( file.latin1(), pwd->pw_uid, grp->gr_gid) <0) {
261 perror("chown");
262 QMessageBox::warning(this,"Warning","Error setting ownership or group");
263 return;
264 }
265 bool ok;
266 uint moder = modeStr.toUInt(&ok,8);
267 if( chmod( file.latin1(), moder) < 0) {
268 perror("chmod");
269 QMessageBox::warning(this,"Warning","Error setting mode");
270 return;
271 }
272 }
273 close();
274}
diff --git a/core/apps/textedit/filePermissions.h b/core/apps/textedit/filePermissions.h
new file mode 100644
index 0000000..880304f
--- a/dev/null
+++ b/core/apps/textedit/filePermissions.h
@@ -0,0 +1,56 @@
1/****************************************************************************
2** copyright 2002 ljp ljp@llornkcor.com
3** Created: Sat Feb 23 19:44:17 2002
4**
5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file.
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13****************************************************************************/
14#ifndef FILEPERMISSIONS_H
15#define FILEPERMISSIONS_H
16
17#include <qvariant.h>
18#include <qdialog.h>
19class QVBoxLayout;
20class QHBoxLayout;
21class QGridLayout;
22class QCheckBox;
23class QLabel;
24class QLineEdit;
25class QString;
26
27class filePermissions : public QDialog
28{
29 Q_OBJECT
30
31public:
32 filePermissions( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 , const QString & fileName ="");
33 ~filePermissions();
34
35 QLineEdit *LineEdit1, *ModeLine;
36 QLabel *TextLabel1, *TextLabel4, *TextLabel4_2, *TextLabel4_3, *TextLabel3_2_2, *TextLabel3_2, *TextLabel3, *TextLabel5_2, *TextLabel5;
37 QCheckBox*CheckBox1, *CheckBox1_3, *CheckBox1_2, *CheckBox1_4, *CheckBox1_5, *CheckBox1_6, *CheckBox1_7, *CheckBox1_8, *CheckBox1_8_2;
38 QLineEdit*GroupLineEdit, *OwnerLineEdit;
39 QString modeStr, file;
40 int i_mode;
41private slots:
42 void ownReadCheck();
43 void ownWriteCheck();
44 void ownExeCheck();
45
46 void grpReadCheck();
47 void grpWriteCheck();
48 void grpExeCheck();
49
50 void wrldReadCheck();
51 void wrldWriteCheck();
52 void wrldExeCheck();
53 void accept();
54};
55
56#endif // FILEPERMISSIONS_H
diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp
index b813ed3..9e9e863 100644
--- a/core/apps/textedit/fileSaver.cpp
+++ b/core/apps/textedit/fileSaver.cpp
@@ -14,13 +14,14 @@
14#include "fileSaver.h" 14#include "fileSaver.h"
15#include <qpe/config.h> 15#include <qpe/config.h>
16#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17
18#include <qlistview.h> 17#include <qlistview.h>
19#include <qpushbutton.h> 18#include <qpushbutton.h>
20#include <qfile.h> 19#include <qfile.h>
21#include <qmessagebox.h> 20#include <qmessagebox.h>
22#include <unistd.h>
23#include <qlineedit.h> 21#include <qlineedit.h>
22#include <qcheckbox.h>
23
24#include <unistd.h>
24 25
25fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl , const QString currentFileName ) 26fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl , const QString currentFileName )
26 : QDialog( parent, name, modal, fl ) 27 : QDialog( parent, name, modal, fl )
@@ -56,6 +57,9 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl
56 57
57 fileEdit->setText( tmpFileName); 58 fileEdit->setText( tmpFileName);
58 59
60 filePermCheck = new QCheckBox( this, "SetFilePerms" );
61 filePermCheck->setText("set file permissions");
62 filePermCheck->setGeometry(10, 220, 150,22);
59 // signals and slots connections 63 // signals and slots connections
60 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); 64 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
61 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 65 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
diff --git a/core/apps/textedit/fileSaver.h b/core/apps/textedit/fileSaver.h
index 4a38a65..ce4493e 100644
--- a/core/apps/textedit/fileSaver.h
+++ b/core/apps/textedit/fileSaver.h
@@ -31,6 +31,7 @@ class QListView;
31class QListViewItem; 31class QListViewItem;
32class QPushButton; 32class QPushButton;
33class QLineEdit; 33class QLineEdit;
34class QCheckBox;
34 35
35class fileSaver : public QDialog 36class fileSaver : public QDialog
36{ 37{
@@ -50,6 +51,7 @@ public:
50 QDir currentDir; 51 QDir currentDir;
51 QFile file; 52 QFile file;
52 QStringList fileList; 53 QStringList fileList;
54 QCheckBox *filePermCheck;
53 55
54QListViewItem * item; 56QListViewItem * item;
55public slots: 57public slots:
diff --git a/core/apps/textedit/opie-textedit.control b/core/apps/textedit/opie-textedit.control
index 4990466..55fc644 100644
--- a/core/apps/textedit/opie-textedit.control
+++ b/core/apps/textedit/opie-textedit.control
@@ -6,4 +6,4 @@ Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION)
8Description: Text Editor 8Description: Text Editor
9 The text editor for the Opie environment. 9 The (slightly enchanced) text editor for the Opie environment.
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 @@
22#include "textedit.h" 22#include "textedit.h"
23#include "fileBrowser.h" 23#include "fileBrowser.h"
24#include "fileSaver.h" 24#include "fileSaver.h"
25#include "filePermissions.h"
25 26
26#include "fontDialog.h" 27#include "fontDialog.h"
27 28
@@ -47,6 +48,9 @@
47#include <qspinbox.h> 48#include <qspinbox.h>
48#include <qtoolbutton.h> 49#include <qtoolbutton.h>
49#include <qwidgetstack.h> 50#include <qwidgetstack.h>
51#include <qcheckbox.h>
52#include <unistd.h>
53#include <sys/stat.h>
50 54
51#include <stdlib.h> //getenv 55#include <stdlib.h> //getenv
52/* XPM */ 56/* XPM */
@@ -415,7 +419,7 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
415 419
416TextEdit::~TextEdit() 420TextEdit::~TextEdit()
417{ 421{
418// saveAs(); 422// save();
419 423
420 Config cfg("TextEdit"); 424 Config cfg("TextEdit");
421 cfg.setGroup("View"); 425 cfg.setGroup("View");
@@ -694,19 +698,24 @@ bool TextEdit::save()
694{ 698{
695 QString file = doc->file(); 699 QString file = doc->file();
696 QString name= doc->name(); 700 QString name= doc->name();
701
697 QString rt = editor->text(); 702 QString rt = editor->text();
698 currentFileName= name ; 703 currentFileName= name ;
699 qDebug("saveFile "+currentFileName); 704 qDebug("saveFile "+currentFileName);
700 705
706 struct stat buf;
707 mode_t mode;
708 lstat(file.latin1(), &buf);
709 mode = buf.st_mode;
710
701 doc->setName( name); 711 doc->setName( name);
702 FileManager fm; 712 FileManager fm;
703 if ( !fm.saveFile( *doc, rt ) ) { 713 if ( !fm.saveFile( *doc, rt ) ) {
704 return false; 714 return false;
705 } 715 }
706// if(doc)
707// delete doc;
708// doc = 0;
709 editor->setEdited( false ); 716 editor->setEdited( false );
717
718 chmod( file.latin1(), mode);
710 return true; 719 return true;
711} 720}
712 721
@@ -714,7 +723,7 @@ bool TextEdit::save()
714 prompted save */ 723 prompted save */
715bool TextEdit::saveAs() 724bool TextEdit::saveAs()
716{ 725{
717 qDebug("saveAsFile "+currentFileName); 726// qDebug("saveAsFile "+currentFileName);
718 727
719 // case of nothing to save... /// there's always something to save 728 // case of nothing to save... /// there's always something to save
720// if ( !doc )//|| !bFromDocView) 729// if ( !doc )//|| !bFromDocView)
@@ -753,39 +762,46 @@ bool TextEdit::saveAs()
753 } 762 }
754 } 763 }
755 764
765
756 fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName); 766 fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName);
757 qDebug("wanna save filename "+currentFileName); 767 qDebug("wanna save filename "+currentFileName);
758 fileSaveDlg->exec(); 768 fileSaveDlg->exec();
759 if( fileSaveDlg->result() == 1 ) { 769 if( fileSaveDlg->result() == 1 ) {
760 QString fileNm=fileSaveDlg->selectedFileName; 770 QString fileNm=fileSaveDlg->selectedFileName;
761 qDebug("saving filename "+fileNm); 771 qDebug("saving filename "+fileNm);
762 QFileInfo fi(fileNm); 772 QFileInfo fi(fileNm);
763 currentFileName=fi.fileName(); 773 currentFileName=fi.fileName();
764 if(doc) { 774 if(doc) {
765 qDebug("doclnk exists"); 775 qDebug("doclnk exists");
766// QString file = doc->file(); 776// QString file = doc->file();
767// doc->removeFiles(); 777// doc->removeFiles();
768 delete doc; 778 delete doc;
769 DocLnk nf; 779 DocLnk nf;
770 nf.setType("text/plain"); 780 nf.setType("text/plain");
771 nf.setFile( fileNm); 781 nf.setFile( fileNm);
772 doc = new DocLnk(nf); 782 doc = new DocLnk(nf);
773// editor->setText(rt); 783// editor->setText(rt);
774 qDebug("openFile doclnk "+currentFileName); 784 qDebug("openFile doclnk "+currentFileName);
775 } 785 doc->setName( currentFileName);
776 doc->setName( currentFileName); 786 updateCaption( currentFileName);
777 updateCaption( currentFileName); 787
778 788 FileManager fm;
779 FileManager fm; 789 if ( !fm.saveFile( *doc, rt ) ) {
780 if ( !fm.saveFile( *doc, rt ) ) { 790 return false;
781 return false; 791 }
782 } 792 if( fileSaveDlg->filePermCheck->isChecked() ) {
783// delete doc; 793 filePermissions *filePerm;
784// doc = 0; 794 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm);
785 editor->setEdited( false ); 795 filePerm->exec();
796 editor->setEdited( false );
797 if( filePerm)
798 delete filePerm;
799 }
800 }
786 } 801 }
802
787 if(fileSaveDlg) 803 if(fileSaveDlg)
788 delete fileSaveDlg; 804 delete fileSaveDlg;
789 return true; 805 return true;
790} 806}
791 807
@@ -835,6 +851,7 @@ void TextEdit::closeEvent( QCloseEvent *e )
835 851
836void TextEdit::accept() 852void TextEdit::accept()
837{ 853{
854 save();
838 close(); 855 close();
839// fileOpen(); //godamn thats obnoxious! lemme out!!! 856// fileOpen(); //godamn thats obnoxious! lemme out!!!
840} 857}
diff --git a/core/apps/textedit/textedit.pro b/core/apps/textedit/textedit.pro
index 9b1a841..2c25d43 100644
--- a/core/apps/textedit/textedit.pro
+++ b/core/apps/textedit/textedit.pro
@@ -3,9 +3,9 @@ CONFIG += qt warn_on release
3 3
4DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
5 5
6HEADERS = textedit.h fileBrowser.h fontDialog.h fileSaver.h 6HEADERS = textedit.h fileBrowser.h fontDialog.h fileSaver.h filePermissions.h
7 7
8SOURCES = main.cpp textedit.cpp fileBrowser.cpp fontDialog.cpp fileSaver.cpp 8SOURCES = main.cpp textedit.cpp fileBrowser.cpp fontDialog.cpp fileSaver.cpp filePermissions.cpp
9 9
10INCLUDEPATH += $(OPIEDIR)/include 10INCLUDEPATH += $(OPIEDIR)/include
11DEPENDPATH += $(OPIEDIR)/include 11DEPENDPATH += $(OPIEDIR)/include