summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-24 17:15:20 (UTC)
committer llornkcor <llornkcor>2002-02-24 17:15:20 (UTC)
commitc8c16041847fa96ffc4283fcedf4431917bc7bf5 (patch) (side-by-side diff)
treee26e910dd0c62038a54c1d91b24c2515a15a601e
parent8b61e69b52e8bb046f23d8dea734edcdc90e805e (diff)
downloadopie-c8c16041847fa96ffc4283fcedf4431917bc7bf5.zip
opie-c8c16041847fa96ffc4283fcedf4431917bc7bf5.tar.gz
opie-c8c16041847fa96ffc4283fcedf4431917bc7bf5.tar.bz2
changed lstat to stat
Diffstat (more/less context) (show 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
@@ -105,97 +105,97 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal
TextLabel5 = new QLabel( this, "TextLabel5" );
TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) );
TextLabel5->setText( tr( "Owner" ) );
TextLabel5_2 = new QLabel( this, "TextLabel5_2" );
TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) );
TextLabel5_2->setText( tr( "Group" ) );
ModeLine = new QLineEdit( this, "TextLabelMode" );
ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) );
TextLabel3_2 = new QLabel( this, "TextLabel3_2" );
TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) );
TextLabel3_2->setText( tr( "read" ) );
TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" );
TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) );
TextLabel3_2_2->setText( tr( "write" ) );
TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
TextLabel3 = new QLabel( this, "TextLabel3" );
TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) );
TextLabel3->setText( tr( "execute" ) );
TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
struct stat buf;
mode_t mode;
file = fileName;
QFileInfo fi(file);
LineEdit1->setText( file);
OwnerLineEdit->setText( fi.owner());
GroupLineEdit->setText( fi.group());
if( fi.permission( QFileInfo::ReadUser)) { CheckBox1->setChecked(true); }
if( fi.permission( QFileInfo::WriteUser)) { CheckBox1_2->setChecked(true); }
if( fi.permission( QFileInfo::ExeUser)) { CheckBox1_3->setChecked(true); }
if( fi.permission( QFileInfo::ReadGroup)) { CheckBox1_4->setChecked(true); }
if( fi.permission( QFileInfo::WriteGroup)) { CheckBox1_5->setChecked(true); }
if( fi.permission( QFileInfo::ExeGroup)) { CheckBox1_6->setChecked(true); }
if( fi.permission( QFileInfo::ReadOther)) { CheckBox1_7->setChecked(true); }
if( fi.permission( QFileInfo::WriteOther)) { CheckBox1_8->setChecked(true); }
if( fi.permission( QFileInfo::ExeOther)) { CheckBox1_8_2->setChecked(true); }
- lstat(file.latin1(), &buf);
+ stat(file.latin1(), &buf);
mode = buf.st_mode;
modeStr.sprintf("%#o", buf.st_mode & ~(S_IFMT) );
ModeLine->setText(modeStr);
bool ok;
i_mode = modeStr.toInt(&ok,10);
}
/*
* Destroys the object and frees any allocated resources
*/
filePermissions::~filePermissions()
{
}
// might this be better as a callback routine???
void filePermissions::ownReadCheck() {
if(CheckBox1->isChecked()) { i_mode +=400; }
else i_mode -=400;
modeStr.sprintf("0%d",i_mode);
ModeLine->setText( modeStr);
// 0400
}
void filePermissions::ownWriteCheck() {
if(CheckBox1_2->isChecked()) { i_mode +=200; }
else i_mode -=200;
modeStr.sprintf("0%d",i_mode);
ModeLine->setText(modeStr);
// 0200
}
void filePermissions::ownExeCheck() {
if(CheckBox1_3->isChecked()) { i_mode +=100; }
else i_mode -=100;
modeStr.sprintf("0%d",i_mode);
ModeLine->setText(modeStr);
// 0100
}
void filePermissions::grpReadCheck() {
if(CheckBox1_4->isChecked()) { i_mode +=40; }
else i_mode -=40;
modeStr.sprintf("0%d",i_mode);
ModeLine->setText(modeStr);
// 0040
}
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
@@ -660,97 +660,97 @@ void TextEdit::openFile( const DocLnk &f )
currentFileName=f.name();
qDebug("openFile doclnk " + currentFileName);
if ( !fm.loadFile( f, txt ) ) {
// ####### could be a new file
qDebug( "Cannot open file" );
//return;
}
fileNew();
if ( doc )
delete doc;
doc = new DocLnk(f);
editor->setText(txt);
editor->setEdited( false);
qDebug("openFile doclnk "+currentFileName);
doc->setName(currentFileName);
updateCaption();
}
void TextEdit::showEditTools()
{
// if ( !doc )
// close();
// clear();
fileSelector->hide();
menu->show();
editBar->show();
if ( searchVisible )
searchBar->show();
// updateCaption();
editorStack->raiseWidget( editor );
setWState (WState_Reserved1 );
}
/*!
unprompted save */
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);
+ stat(file.latin1(), &buf);
mode = buf.st_mode;
doc->setName( name);
FileManager fm;
if ( !fm.saveFile( *doc, rt ) ) {
return false;
}
editor->setEdited( false );
chmod( file.latin1(), mode);
return true;
}
/*!
prompted save */
bool TextEdit::saveAs()
{
// qDebug("saveAsFile "+currentFileName);
// case of nothing to save... /// there's always something to save
// if ( !doc )//|| !bFromDocView)
// {
// qDebug("no doc");
// return true;
// }
if ( !editor->edited() ) {
delete doc;
doc = 0;
return true;
}
QString rt = editor->text();
qDebug(currentFileName);
if( currentFileName.isEmpty() || currentFileName == "Unnamed") {
qDebug("do silly TT filename thing");
if ( doc->name().isEmpty() ) {
QString pt = rt.simplifyWhiteSpace();
int i = pt.find( ' ' );
QString docname = pt;
if ( i > 0 )
docname = pt.left( i );
// remove "." at the beginning
while( docname.startsWith( "." ) )
docname = docname.mid( 1 );
docname.replace( QRegExp("/"), "_" );
// cut the length. filenames longer than that don't make sense and something goes wrong when they get too long.
if ( docname.length() > 40 )
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
@@ -105,97 +105,97 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal
TextLabel5 = new QLabel( this, "TextLabel5" );
TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) );
TextLabel5->setText( tr( "Owner" ) );
TextLabel5_2 = new QLabel( this, "TextLabel5_2" );
TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) );
TextLabel5_2->setText( tr( "Group" ) );
ModeLine = new QLineEdit( this, "TextLabelMode" );
ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) );
TextLabel3_2 = new QLabel( this, "TextLabel3_2" );
TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) );
TextLabel3_2->setText( tr( "read" ) );
TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" );
TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) );
TextLabel3_2_2->setText( tr( "write" ) );
TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
TextLabel3 = new QLabel( this, "TextLabel3" );
TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) );
TextLabel3->setText( tr( "execute" ) );
TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
struct stat buf;
mode_t mode;
file = fileName;
QFileInfo fi(file);
LineEdit1->setText( file);
OwnerLineEdit->setText( fi.owner());
GroupLineEdit->setText( fi.group());
if( fi.permission( QFileInfo::ReadUser)) { CheckBox1->setChecked(true); }
if( fi.permission( QFileInfo::WriteUser)) { CheckBox1_2->setChecked(true); }
if( fi.permission( QFileInfo::ExeUser)) { CheckBox1_3->setChecked(true); }
if( fi.permission( QFileInfo::ReadGroup)) { CheckBox1_4->setChecked(true); }
if( fi.permission( QFileInfo::WriteGroup)) { CheckBox1_5->setChecked(true); }
if( fi.permission( QFileInfo::ExeGroup)) { CheckBox1_6->setChecked(true); }
if( fi.permission( QFileInfo::ReadOther)) { CheckBox1_7->setChecked(true); }
if( fi.permission( QFileInfo::WriteOther)) { CheckBox1_8->setChecked(true); }
if( fi.permission( QFileInfo::ExeOther)) { CheckBox1_8_2->setChecked(true); }
- lstat(file.latin1(), &buf);
+ stat(file.latin1(), &buf);
mode = buf.st_mode;
modeStr.sprintf("%#o", buf.st_mode & ~(S_IFMT) );
ModeLine->setText(modeStr);
bool ok;
i_mode = modeStr.toInt(&ok,10);
}
/*
* Destroys the object and frees any allocated resources
*/
filePermissions::~filePermissions()
{
}
// might this be better as a callback routine???
void filePermissions::ownReadCheck() {
if(CheckBox1->isChecked()) { i_mode +=400; }
else i_mode -=400;
modeStr.sprintf("0%d",i_mode);
ModeLine->setText( modeStr);
// 0400
}
void filePermissions::ownWriteCheck() {
if(CheckBox1_2->isChecked()) { i_mode +=200; }
else i_mode -=200;
modeStr.sprintf("0%d",i_mode);
ModeLine->setText(modeStr);
// 0200
}
void filePermissions::ownExeCheck() {
if(CheckBox1_3->isChecked()) { i_mode +=100; }
else i_mode -=100;
modeStr.sprintf("0%d",i_mode);
ModeLine->setText(modeStr);
// 0100
}
void filePermissions::grpReadCheck() {
if(CheckBox1_4->isChecked()) { i_mode +=40; }
else i_mode -=40;
modeStr.sprintf("0%d",i_mode);
ModeLine->setText(modeStr);
// 0040
}