summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-24 17:15:20 (UTC)
committer llornkcor <llornkcor>2002-02-24 17:15:20 (UTC)
commitc8c16041847fa96ffc4283fcedf4431917bc7bf5 (patch) (unidiff)
treee26e910dd0c62038a54c1d91b24c2515a15a601e
parent8b61e69b52e8bb046f23d8dea734edcdc90e805e (diff)
downloadopie-c8c16041847fa96ffc4283fcedf4431917bc7bf5.zip
opie-c8c16041847fa96ffc4283fcedf4431917bc7bf5.tar.gz
opie-c8c16041847fa96ffc4283fcedf4431917bc7bf5.tar.bz2
changed lstat to stat
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/filePermissions.cpp2
-rw-r--r--core/apps/textedit/textedit.cpp2
-rw-r--r--noncore/unsupported/filebrowser/filePermissions.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/core/apps/textedit/filePermissions.cpp b/core/apps/textedit/filePermissions.cpp
index 1938b84..5af3971 100644
--- a/core/apps/textedit/filePermissions.cpp
+++ b/core/apps/textedit/filePermissions.cpp
@@ -121,65 +121,65 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal
121 121
122 TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" ); 122 TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" );
123 TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) ); 123 TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) );
124 TextLabel3_2_2->setText( tr( "write" ) ); 124 TextLabel3_2_2->setText( tr( "write" ) );
125 TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); 125 TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
126 126
127 TextLabel3 = new QLabel( this, "TextLabel3" ); 127 TextLabel3 = new QLabel( this, "TextLabel3" );
128 TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) ); 128 TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) );
129 TextLabel3->setText( tr( "execute" ) ); 129 TextLabel3->setText( tr( "execute" ) );
130 TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); 130 TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
131 131
132 struct stat buf; 132 struct stat buf;
133 mode_t mode; 133 mode_t mode;
134 file = fileName; 134 file = fileName;
135 QFileInfo fi(file); 135 QFileInfo fi(file);
136 136
137 LineEdit1->setText( file); 137 LineEdit1->setText( file);
138 OwnerLineEdit->setText( fi.owner()); 138 OwnerLineEdit->setText( fi.owner());
139 GroupLineEdit->setText( fi.group()); 139 GroupLineEdit->setText( fi.group());
140 140
141 if( fi.permission( QFileInfo::ReadUser)) { CheckBox1->setChecked(true); } 141 if( fi.permission( QFileInfo::ReadUser)) { CheckBox1->setChecked(true); }
142 if( fi.permission( QFileInfo::WriteUser)) { CheckBox1_2->setChecked(true); } 142 if( fi.permission( QFileInfo::WriteUser)) { CheckBox1_2->setChecked(true); }
143 if( fi.permission( QFileInfo::ExeUser)) { CheckBox1_3->setChecked(true); } 143 if( fi.permission( QFileInfo::ExeUser)) { CheckBox1_3->setChecked(true); }
144 144
145 if( fi.permission( QFileInfo::ReadGroup)) { CheckBox1_4->setChecked(true); } 145 if( fi.permission( QFileInfo::ReadGroup)) { CheckBox1_4->setChecked(true); }
146 if( fi.permission( QFileInfo::WriteGroup)) { CheckBox1_5->setChecked(true); } 146 if( fi.permission( QFileInfo::WriteGroup)) { CheckBox1_5->setChecked(true); }
147 if( fi.permission( QFileInfo::ExeGroup)) { CheckBox1_6->setChecked(true); } 147 if( fi.permission( QFileInfo::ExeGroup)) { CheckBox1_6->setChecked(true); }
148 148
149 if( fi.permission( QFileInfo::ReadOther)) { CheckBox1_7->setChecked(true); } 149 if( fi.permission( QFileInfo::ReadOther)) { CheckBox1_7->setChecked(true); }
150 if( fi.permission( QFileInfo::WriteOther)) { CheckBox1_8->setChecked(true); } 150 if( fi.permission( QFileInfo::WriteOther)) { CheckBox1_8->setChecked(true); }
151 if( fi.permission( QFileInfo::ExeOther)) { CheckBox1_8_2->setChecked(true); } 151 if( fi.permission( QFileInfo::ExeOther)) { CheckBox1_8_2->setChecked(true); }
152 152
153 lstat(file.latin1(), &buf); 153 stat(file.latin1(), &buf);
154 mode = buf.st_mode; 154 mode = buf.st_mode;
155 modeStr.sprintf("%#o", buf.st_mode & ~(S_IFMT) ); 155 modeStr.sprintf("%#o", buf.st_mode & ~(S_IFMT) );
156 ModeLine->setText(modeStr); 156 ModeLine->setText(modeStr);
157 bool ok; 157 bool ok;
158 i_mode = modeStr.toInt(&ok,10); 158 i_mode = modeStr.toInt(&ok,10);
159 159
160} 160}
161 161
162/* 162/*
163 * Destroys the object and frees any allocated resources 163 * Destroys the object and frees any allocated resources
164 */ 164 */
165filePermissions::~filePermissions() 165filePermissions::~filePermissions()
166{ 166{
167} 167}
168 168
169 169
170// might this be better as a callback routine??? 170// might this be better as a callback routine???
171void filePermissions::ownReadCheck() { 171void filePermissions::ownReadCheck() {
172 if(CheckBox1->isChecked()) { i_mode +=400; } 172 if(CheckBox1->isChecked()) { i_mode +=400; }
173 else i_mode -=400; 173 else i_mode -=400;
174 modeStr.sprintf("0%d",i_mode); 174 modeStr.sprintf("0%d",i_mode);
175 ModeLine->setText( modeStr); 175 ModeLine->setText( modeStr);
176// 0400 176// 0400
177} 177}
178 178
179void filePermissions::ownWriteCheck() { 179void filePermissions::ownWriteCheck() {
180 if(CheckBox1_2->isChecked()) { i_mode +=200; } 180 if(CheckBox1_2->isChecked()) { i_mode +=200; }
181 else i_mode -=200; 181 else i_mode -=200;
182 modeStr.sprintf("0%d",i_mode); 182 modeStr.sprintf("0%d",i_mode);
183 ModeLine->setText(modeStr); 183 ModeLine->setText(modeStr);
184// 0200 184// 0200
185} 185}
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 515fcdc..603f032 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -676,65 +676,65 @@ void TextEdit::openFile( const DocLnk &f )
676 doc->setName(currentFileName); 676 doc->setName(currentFileName);
677 updateCaption(); 677 updateCaption();
678} 678}
679 679
680void TextEdit::showEditTools() 680void TextEdit::showEditTools()
681{ 681{
682// if ( !doc ) 682// if ( !doc )
683// close(); 683// close();
684// clear(); 684// clear();
685 fileSelector->hide(); 685 fileSelector->hide();
686 menu->show(); 686 menu->show();
687 editBar->show(); 687 editBar->show();
688 if ( searchVisible ) 688 if ( searchVisible )
689 searchBar->show(); 689 searchBar->show();
690// updateCaption(); 690// updateCaption();
691 editorStack->raiseWidget( editor ); 691 editorStack->raiseWidget( editor );
692 setWState (WState_Reserved1 ); 692 setWState (WState_Reserved1 );
693} 693}
694 694
695/*! 695/*!
696 unprompted save */ 696 unprompted save */
697bool TextEdit::save() 697bool TextEdit::save()
698{ 698{
699 QString file = doc->file(); 699 QString file = doc->file();
700 QString name= doc->name(); 700 QString name= doc->name();
701 701
702 QString rt = editor->text(); 702 QString rt = editor->text();
703 currentFileName= name ; 703 currentFileName= name ;
704 qDebug("saveFile "+currentFileName); 704 qDebug("saveFile "+currentFileName);
705 705
706 struct stat buf; 706 struct stat buf;
707 mode_t mode; 707 mode_t mode;
708 lstat(file.latin1(), &buf); 708 stat(file.latin1(), &buf);
709 mode = buf.st_mode; 709 mode = buf.st_mode;
710 710
711 doc->setName( name); 711 doc->setName( name);
712 FileManager fm; 712 FileManager fm;
713 if ( !fm.saveFile( *doc, rt ) ) { 713 if ( !fm.saveFile( *doc, rt ) ) {
714 return false; 714 return false;
715 } 715 }
716 editor->setEdited( false ); 716 editor->setEdited( false );
717 717
718 chmod( file.latin1(), mode); 718 chmod( file.latin1(), mode);
719 return true; 719 return true;
720} 720}
721 721
722/*! 722/*!
723 prompted save */ 723 prompted save */
724bool TextEdit::saveAs() 724bool TextEdit::saveAs()
725{ 725{
726// qDebug("saveAsFile "+currentFileName); 726// qDebug("saveAsFile "+currentFileName);
727 727
728 // case of nothing to save... /// there's always something to save 728 // case of nothing to save... /// there's always something to save
729// if ( !doc )//|| !bFromDocView) 729// if ( !doc )//|| !bFromDocView)
730// { 730// {
731// qDebug("no doc"); 731// qDebug("no doc");
732// return true; 732// return true;
733// } 733// }
734 if ( !editor->edited() ) { 734 if ( !editor->edited() ) {
735 delete doc; 735 delete doc;
736 doc = 0; 736 doc = 0;
737 return true; 737 return true;
738 } 738 }
739 739
740 QString rt = editor->text(); 740 QString rt = editor->text();
diff --git a/noncore/unsupported/filebrowser/filePermissions.cpp b/noncore/unsupported/filebrowser/filePermissions.cpp
index 1938b84..5af3971 100644
--- a/noncore/unsupported/filebrowser/filePermissions.cpp
+++ b/noncore/unsupported/filebrowser/filePermissions.cpp
@@ -121,65 +121,65 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal
121 121
122 TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" ); 122 TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" );
123 TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) ); 123 TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) );
124 TextLabel3_2_2->setText( tr( "write" ) ); 124 TextLabel3_2_2->setText( tr( "write" ) );
125 TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); 125 TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
126 126
127 TextLabel3 = new QLabel( this, "TextLabel3" ); 127 TextLabel3 = new QLabel( this, "TextLabel3" );
128 TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) ); 128 TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) );
129 TextLabel3->setText( tr( "execute" ) ); 129 TextLabel3->setText( tr( "execute" ) );
130 TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); 130 TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
131 131
132 struct stat buf; 132 struct stat buf;
133 mode_t mode; 133 mode_t mode;
134 file = fileName; 134 file = fileName;
135 QFileInfo fi(file); 135 QFileInfo fi(file);
136 136
137 LineEdit1->setText( file); 137 LineEdit1->setText( file);
138 OwnerLineEdit->setText( fi.owner()); 138 OwnerLineEdit->setText( fi.owner());
139 GroupLineEdit->setText( fi.group()); 139 GroupLineEdit->setText( fi.group());
140 140
141 if( fi.permission( QFileInfo::ReadUser)) { CheckBox1->setChecked(true); } 141 if( fi.permission( QFileInfo::ReadUser)) { CheckBox1->setChecked(true); }
142 if( fi.permission( QFileInfo::WriteUser)) { CheckBox1_2->setChecked(true); } 142 if( fi.permission( QFileInfo::WriteUser)) { CheckBox1_2->setChecked(true); }
143 if( fi.permission( QFileInfo::ExeUser)) { CheckBox1_3->setChecked(true); } 143 if( fi.permission( QFileInfo::ExeUser)) { CheckBox1_3->setChecked(true); }
144 144
145 if( fi.permission( QFileInfo::ReadGroup)) { CheckBox1_4->setChecked(true); } 145 if( fi.permission( QFileInfo::ReadGroup)) { CheckBox1_4->setChecked(true); }
146 if( fi.permission( QFileInfo::WriteGroup)) { CheckBox1_5->setChecked(true); } 146 if( fi.permission( QFileInfo::WriteGroup)) { CheckBox1_5->setChecked(true); }
147 if( fi.permission( QFileInfo::ExeGroup)) { CheckBox1_6->setChecked(true); } 147 if( fi.permission( QFileInfo::ExeGroup)) { CheckBox1_6->setChecked(true); }
148 148
149 if( fi.permission( QFileInfo::ReadOther)) { CheckBox1_7->setChecked(true); } 149 if( fi.permission( QFileInfo::ReadOther)) { CheckBox1_7->setChecked(true); }
150 if( fi.permission( QFileInfo::WriteOther)) { CheckBox1_8->setChecked(true); } 150 if( fi.permission( QFileInfo::WriteOther)) { CheckBox1_8->setChecked(true); }
151 if( fi.permission( QFileInfo::ExeOther)) { CheckBox1_8_2->setChecked(true); } 151 if( fi.permission( QFileInfo::ExeOther)) { CheckBox1_8_2->setChecked(true); }
152 152
153 lstat(file.latin1(), &buf); 153 stat(file.latin1(), &buf);
154 mode = buf.st_mode; 154 mode = buf.st_mode;
155 modeStr.sprintf("%#o", buf.st_mode & ~(S_IFMT) ); 155 modeStr.sprintf("%#o", buf.st_mode & ~(S_IFMT) );
156 ModeLine->setText(modeStr); 156 ModeLine->setText(modeStr);
157 bool ok; 157 bool ok;
158 i_mode = modeStr.toInt(&ok,10); 158 i_mode = modeStr.toInt(&ok,10);
159 159
160} 160}
161 161
162/* 162/*
163 * Destroys the object and frees any allocated resources 163 * Destroys the object and frees any allocated resources
164 */ 164 */
165filePermissions::~filePermissions() 165filePermissions::~filePermissions()
166{ 166{
167} 167}
168 168
169 169
170// might this be better as a callback routine??? 170// might this be better as a callback routine???
171void filePermissions::ownReadCheck() { 171void filePermissions::ownReadCheck() {
172 if(CheckBox1->isChecked()) { i_mode +=400; } 172 if(CheckBox1->isChecked()) { i_mode +=400; }
173 else i_mode -=400; 173 else i_mode -=400;
174 modeStr.sprintf("0%d",i_mode); 174 modeStr.sprintf("0%d",i_mode);
175 ModeLine->setText( modeStr); 175 ModeLine->setText( modeStr);
176// 0400 176// 0400
177} 177}
178 178
179void filePermissions::ownWriteCheck() { 179void filePermissions::ownWriteCheck() {
180 if(CheckBox1_2->isChecked()) { i_mode +=200; } 180 if(CheckBox1_2->isChecked()) { i_mode +=200; }
181 else i_mode -=200; 181 else i_mode -=200;
182 modeStr.sprintf("0%d",i_mode); 182 modeStr.sprintf("0%d",i_mode);
183 ModeLine->setText(modeStr); 183 ModeLine->setText(modeStr);
184// 0200 184// 0200
185} 185}