author | llornkcor <llornkcor> | 2002-02-24 17:15:20 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-24 17:15:20 (UTC) |
commit | c8c16041847fa96ffc4283fcedf4431917bc7bf5 (patch) (unidiff) | |
tree | e26e910dd0c62038a54c1d91b24c2515a15a601e | |
parent | 8b61e69b52e8bb046f23d8dea734edcdc90e805e (diff) | |
download | opie-c8c16041847fa96ffc4283fcedf4431917bc7bf5.zip opie-c8c16041847fa96ffc4283fcedf4431917bc7bf5.tar.gz opie-c8c16041847fa96ffc4283fcedf4431917bc7bf5.tar.bz2 |
changed lstat to stat
-rw-r--r-- | core/apps/textedit/filePermissions.cpp | 2 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/filebrowser/filePermissions.cpp | 2 |
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 | |||
@@ -57,193 +57,193 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal | |||
57 | TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) ); | 57 | TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) ); |
58 | TextLabel4_2->setText( tr( "group" ) ); | 58 | TextLabel4_2->setText( tr( "group" ) ); |
59 | 59 | ||
60 | TextLabel4_3 = new QLabel( this, "TextLabel4_3" ); | 60 | TextLabel4_3 = new QLabel( this, "TextLabel4_3" ); |
61 | TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) ); | 61 | TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) ); |
62 | TextLabel4_3->setText( tr( "others" ) ); | 62 | TextLabel4_3->setText( tr( "others" ) ); |
63 | 63 | ||
64 | CheckBox1 = new QCheckBox( this, "CheckBox1" ); | 64 | CheckBox1 = new QCheckBox( this, "CheckBox1" ); |
65 | CheckBox1->setGeometry( QRect( 75, 85, 20, 16 ) ); | 65 | CheckBox1->setGeometry( QRect( 75, 85, 20, 16 ) ); |
66 | connect(CheckBox1, SIGNAL(released()),this,SLOT(ownReadCheck())); | 66 | connect(CheckBox1, SIGNAL(released()),this,SLOT(ownReadCheck())); |
67 | 67 | ||
68 | CheckBox1_2 = new QCheckBox( this, "CheckBox1_2" ); | 68 | CheckBox1_2 = new QCheckBox( this, "CheckBox1_2" ); |
69 | CheckBox1_2->setGeometry( QRect( 135, 85, 20, 16 ) ); | 69 | CheckBox1_2->setGeometry( QRect( 135, 85, 20, 16 ) ); |
70 | connect(CheckBox1_2, SIGNAL(released()),this,SLOT(ownWriteCheck())); | 70 | connect(CheckBox1_2, SIGNAL(released()),this,SLOT(ownWriteCheck())); |
71 | 71 | ||
72 | CheckBox1_3 = new QCheckBox( this, "CheckBox1_3" ); | 72 | CheckBox1_3 = new QCheckBox( this, "CheckBox1_3" ); |
73 | CheckBox1_3->setGeometry( QRect( 195, 85, 20, 16 ) ); | 73 | CheckBox1_3->setGeometry( QRect( 195, 85, 20, 16 ) ); |
74 | connect(CheckBox1_3, SIGNAL(released()),this,SLOT(ownExeCheck())); | 74 | connect(CheckBox1_3, SIGNAL(released()),this,SLOT(ownExeCheck())); |
75 | 75 | ||
76 | CheckBox1_4 = new QCheckBox( this, "CheckBox1_4" ); | 76 | CheckBox1_4 = new QCheckBox( this, "CheckBox1_4" ); |
77 | CheckBox1_4->setGeometry( QRect( 75, 105, 20, 16 ) ); | 77 | CheckBox1_4->setGeometry( QRect( 75, 105, 20, 16 ) ); |
78 | connect(CheckBox1_4, SIGNAL(released()),this,SLOT(grpReadCheck())); | 78 | connect(CheckBox1_4, SIGNAL(released()),this,SLOT(grpReadCheck())); |
79 | 79 | ||
80 | CheckBox1_5 = new QCheckBox( this, "CheckBox1_5" ); | 80 | CheckBox1_5 = new QCheckBox( this, "CheckBox1_5" ); |
81 | CheckBox1_5->setGeometry( QRect( 135, 105, 20, 16 ) ); | 81 | CheckBox1_5->setGeometry( QRect( 135, 105, 20, 16 ) ); |
82 | connect(CheckBox1_5, SIGNAL(released()),this,SLOT(grpWriteCheck())); | 82 | connect(CheckBox1_5, SIGNAL(released()),this,SLOT(grpWriteCheck())); |
83 | 83 | ||
84 | CheckBox1_6 = new QCheckBox( this, "CheckBox1_6" ); | 84 | CheckBox1_6 = new QCheckBox( this, "CheckBox1_6" ); |
85 | CheckBox1_6->setGeometry( QRect( 195, 105, 20, 16 ) ); | 85 | CheckBox1_6->setGeometry( QRect( 195, 105, 20, 16 ) ); |
86 | connect(CheckBox1_6, SIGNAL(released()),this,SLOT(grpExeCheck())); | 86 | connect(CheckBox1_6, SIGNAL(released()),this,SLOT(grpExeCheck())); |
87 | 87 | ||
88 | CheckBox1_7 = new QCheckBox( this, "CheckBox1_7" ); | 88 | CheckBox1_7 = new QCheckBox( this, "CheckBox1_7" ); |
89 | CheckBox1_7->setGeometry( QRect( 75, 125, 16, 16 ) ); | 89 | CheckBox1_7->setGeometry( QRect( 75, 125, 16, 16 ) ); |
90 | connect(CheckBox1_7, SIGNAL(released()),this,SLOT(wrldReadCheck())); | 90 | connect(CheckBox1_7, SIGNAL(released()),this,SLOT(wrldReadCheck())); |
91 | 91 | ||
92 | CheckBox1_8 = new QCheckBox( this, "CheckBox1_8" ); | 92 | CheckBox1_8 = new QCheckBox( this, "CheckBox1_8" ); |
93 | CheckBox1_8->setGeometry( QRect( 135, 125, 20, 16 ) ); | 93 | CheckBox1_8->setGeometry( QRect( 135, 125, 20, 16 ) ); |
94 | connect(CheckBox1_8, SIGNAL(released()),this,SLOT(wrldWriteCheck())); | 94 | connect(CheckBox1_8, SIGNAL(released()),this,SLOT(wrldWriteCheck())); |
95 | 95 | ||
96 | CheckBox1_8_2 = new QCheckBox( this, "CheckBox1_8_2" ); | 96 | CheckBox1_8_2 = new QCheckBox( this, "CheckBox1_8_2" ); |
97 | CheckBox1_8_2->setGeometry( QRect( 195, 125, 20, 16 ) ); | 97 | CheckBox1_8_2->setGeometry( QRect( 195, 125, 20, 16 ) ); |
98 | connect(CheckBox1_8_2, SIGNAL(released()),this,SLOT(wrldExeCheck())); | 98 | connect(CheckBox1_8_2, SIGNAL(released()),this,SLOT(wrldExeCheck())); |
99 | 99 | ||
100 | GroupLineEdit = new QLineEdit( this, "GroupLineEdit" ); | 100 | GroupLineEdit = new QLineEdit( this, "GroupLineEdit" ); |
101 | GroupLineEdit->setGeometry( QRect( 125, 155, 106, 22 ) ); | 101 | GroupLineEdit->setGeometry( QRect( 125, 155, 106, 22 ) ); |
102 | 102 | ||
103 | OwnerLineEdit = new QLineEdit( this, "OwnerLineEdit" ); | 103 | OwnerLineEdit = new QLineEdit( this, "OwnerLineEdit" ); |
104 | OwnerLineEdit->setGeometry( QRect( 10, 155, 106, 22 ) ); | 104 | OwnerLineEdit->setGeometry( QRect( 10, 155, 106, 22 ) ); |
105 | 105 | ||
106 | TextLabel5 = new QLabel( this, "TextLabel5" ); | 106 | TextLabel5 = new QLabel( this, "TextLabel5" ); |
107 | TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) ); | 107 | TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) ); |
108 | TextLabel5->setText( tr( "Owner" ) ); | 108 | TextLabel5->setText( tr( "Owner" ) ); |
109 | 109 | ||
110 | TextLabel5_2 = new QLabel( this, "TextLabel5_2" ); | 110 | TextLabel5_2 = new QLabel( this, "TextLabel5_2" ); |
111 | TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) ); | 111 | TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) ); |
112 | TextLabel5_2->setText( tr( "Group" ) ); | 112 | TextLabel5_2->setText( tr( "Group" ) ); |
113 | 113 | ||
114 | ModeLine = new QLineEdit( this, "TextLabelMode" ); | 114 | ModeLine = new QLineEdit( this, "TextLabelMode" ); |
115 | ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) ); | 115 | ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) ); |
116 | 116 | ||
117 | TextLabel3_2 = new QLabel( this, "TextLabel3_2" ); | 117 | TextLabel3_2 = new QLabel( this, "TextLabel3_2" ); |
118 | TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) ); | 118 | TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) ); |
119 | TextLabel3_2->setText( tr( "read" ) ); | 119 | TextLabel3_2->setText( tr( "read" ) ); |
120 | TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); | 120 | TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); |
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 | */ |
165 | filePermissions::~filePermissions() | 165 | filePermissions::~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??? |
171 | void filePermissions::ownReadCheck() { | 171 | void 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 | ||
179 | void filePermissions::ownWriteCheck() { | 179 | void 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 | } |
186 | 186 | ||
187 | void filePermissions::ownExeCheck() { | 187 | void filePermissions::ownExeCheck() { |
188 | if(CheckBox1_3->isChecked()) { i_mode +=100; } | 188 | if(CheckBox1_3->isChecked()) { i_mode +=100; } |
189 | else i_mode -=100; | 189 | else i_mode -=100; |
190 | modeStr.sprintf("0%d",i_mode); | 190 | modeStr.sprintf("0%d",i_mode); |
191 | ModeLine->setText(modeStr); | 191 | ModeLine->setText(modeStr); |
192 | // 0100 | 192 | // 0100 |
193 | } | 193 | } |
194 | 194 | ||
195 | void filePermissions::grpReadCheck() { | 195 | void filePermissions::grpReadCheck() { |
196 | if(CheckBox1_4->isChecked()) { i_mode +=40; } | 196 | if(CheckBox1_4->isChecked()) { i_mode +=40; } |
197 | else i_mode -=40; | 197 | else i_mode -=40; |
198 | modeStr.sprintf("0%d",i_mode); | 198 | modeStr.sprintf("0%d",i_mode); |
199 | ModeLine->setText(modeStr); | 199 | ModeLine->setText(modeStr); |
200 | // 0040 | 200 | // 0040 |
201 | } | 201 | } |
202 | 202 | ||
203 | void filePermissions::grpWriteCheck() { | 203 | void filePermissions::grpWriteCheck() { |
204 | if(CheckBox1_5->isChecked()) { i_mode +=20; } | 204 | if(CheckBox1_5->isChecked()) { i_mode +=20; } |
205 | else i_mode -=20; | 205 | else i_mode -=20; |
206 | modeStr.sprintf("0%d",i_mode); | 206 | modeStr.sprintf("0%d",i_mode); |
207 | ModeLine->setText(modeStr); | 207 | ModeLine->setText(modeStr); |
208 | // 0020 | 208 | // 0020 |
209 | } | 209 | } |
210 | 210 | ||
211 | void filePermissions::grpExeCheck() { | 211 | void filePermissions::grpExeCheck() { |
212 | if(CheckBox1_6->isChecked()) { i_mode +=10; } | 212 | if(CheckBox1_6->isChecked()) { i_mode +=10; } |
213 | else i_mode -=10; | 213 | else i_mode -=10; |
214 | modeStr.sprintf("0%d",i_mode); | 214 | modeStr.sprintf("0%d",i_mode); |
215 | ModeLine->setText(modeStr); | 215 | ModeLine->setText(modeStr); |
216 | // 0010 | 216 | // 0010 |
217 | } | 217 | } |
218 | 218 | ||
219 | void filePermissions::wrldReadCheck() { | 219 | void filePermissions::wrldReadCheck() { |
220 | if(CheckBox1_7->isChecked()) { i_mode +=4; } | 220 | if(CheckBox1_7->isChecked()) { i_mode +=4; } |
221 | else i_mode -=4; | 221 | else i_mode -=4; |
222 | modeStr.sprintf("0%d",i_mode); | 222 | modeStr.sprintf("0%d",i_mode); |
223 | ModeLine->setText(modeStr); | 223 | ModeLine->setText(modeStr); |
224 | // 0004 | 224 | // 0004 |
225 | } | 225 | } |
226 | 226 | ||
227 | void filePermissions::wrldWriteCheck() { | 227 | void filePermissions::wrldWriteCheck() { |
228 | if(CheckBox1_8->isChecked()) { i_mode +=2; } | 228 | if(CheckBox1_8->isChecked()) { i_mode +=2; } |
229 | else i_mode -=2; | 229 | else i_mode -=2; |
230 | modeStr.sprintf("0%d",i_mode); | 230 | modeStr.sprintf("0%d",i_mode); |
231 | ModeLine->setText(modeStr); | 231 | ModeLine->setText(modeStr); |
232 | // 0002 | 232 | // 0002 |
233 | } | 233 | } |
234 | 234 | ||
235 | void filePermissions::wrldExeCheck() { | 235 | void filePermissions::wrldExeCheck() { |
236 | if(CheckBox1_8_2->isChecked()) { i_mode +=1; } | 236 | if(CheckBox1_8_2->isChecked()) { i_mode +=1; } |
237 | else i_mode -=1; | 237 | else i_mode -=1; |
238 | modeStr.sprintf("0%d",i_mode); | 238 | modeStr.sprintf("0%d",i_mode); |
239 | ModeLine->setText(modeStr); | 239 | ModeLine->setText(modeStr); |
240 | // 0001 | 240 | // 0001 |
241 | } | 241 | } |
242 | 242 | ||
243 | void filePermissions::accept() { | 243 | void filePermissions::accept() { |
244 | 244 | ||
245 | QFileInfo fi(file); | 245 | QFileInfo fi(file); |
246 | struct passwd *pwd=0; | 246 | struct passwd *pwd=0; |
247 | struct group *grp=0; | 247 | struct group *grp=0; |
248 | pwd = getpwnam(OwnerLineEdit->text().latin1() ); | 248 | pwd = getpwnam(OwnerLineEdit->text().latin1() ); |
249 | if(pwd == NULL) { | 249 | if(pwd == NULL) { |
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 | |||
@@ -612,193 +612,193 @@ void TextEdit::findClose() | |||
612 | searchBar->hide(); | 612 | searchBar->hide(); |
613 | } | 613 | } |
614 | 614 | ||
615 | void TextEdit::search() | 615 | void TextEdit::search() |
616 | { | 616 | { |
617 | editor->find( searchEdit->text(), FALSE, FALSE ); | 617 | editor->find( searchEdit->text(), FALSE, FALSE ); |
618 | } | 618 | } |
619 | 619 | ||
620 | void TextEdit::newFile( const DocLnk &f ) | 620 | void TextEdit::newFile( const DocLnk &f ) |
621 | { | 621 | { |
622 | DocLnk nf = f; | 622 | DocLnk nf = f; |
623 | nf.setType("text/plain"); | 623 | nf.setType("text/plain"); |
624 | clear(); | 624 | clear(); |
625 | editorStack->raiseWidget( editor ); | 625 | editorStack->raiseWidget( editor ); |
626 | setWState (WState_Reserved1 ); | 626 | setWState (WState_Reserved1 ); |
627 | editor->setFocus(); | 627 | editor->setFocus(); |
628 | doc = new DocLnk(nf); | 628 | doc = new DocLnk(nf); |
629 | qDebug("newFile "+currentFileName); | 629 | qDebug("newFile "+currentFileName); |
630 | updateCaption(currentFileName); | 630 | updateCaption(currentFileName); |
631 | } | 631 | } |
632 | 632 | ||
633 | void TextEdit::openFile( const QString &f ) | 633 | void TextEdit::openFile( const QString &f ) |
634 | { | 634 | { |
635 | bFromDocView = TRUE; | 635 | bFromDocView = TRUE; |
636 | DocLnk nf; | 636 | DocLnk nf; |
637 | nf.setType("text/plain"); | 637 | nf.setType("text/plain"); |
638 | nf.setFile(f); | 638 | nf.setFile(f); |
639 | currentFileName=f; | 639 | currentFileName=f; |
640 | QFileInfo fi( currentFileName); | 640 | QFileInfo fi( currentFileName); |
641 | nf.setName(fi.baseName()); | 641 | nf.setName(fi.baseName()); |
642 | qDebug("openFile string"+currentFileName); | 642 | qDebug("openFile string"+currentFileName); |
643 | 643 | ||
644 | openFile(nf); | 644 | openFile(nf); |
645 | showEditTools(); | 645 | showEditTools(); |
646 | // Show filename in caption | 646 | // Show filename in caption |
647 | QString name = f; | 647 | QString name = f; |
648 | int sep = name.findRev( '/' ); | 648 | int sep = name.findRev( '/' ); |
649 | if ( sep > 0 ) | 649 | if ( sep > 0 ) |
650 | name = name.mid( sep+1 ); | 650 | name = name.mid( sep+1 ); |
651 | updateCaption( name ); | 651 | updateCaption( name ); |
652 | } | 652 | } |
653 | 653 | ||
654 | void TextEdit::openFile( const DocLnk &f ) | 654 | void TextEdit::openFile( const DocLnk &f ) |
655 | { | 655 | { |
656 | // clear(); | 656 | // clear(); |
657 | bFromDocView = TRUE; | 657 | bFromDocView = TRUE; |
658 | FileManager fm; | 658 | FileManager fm; |
659 | QString txt; | 659 | QString txt; |
660 | currentFileName=f.name(); | 660 | currentFileName=f.name(); |
661 | qDebug("openFile doclnk " + currentFileName); | 661 | qDebug("openFile doclnk " + currentFileName); |
662 | if ( !fm.loadFile( f, txt ) ) { | 662 | if ( !fm.loadFile( f, txt ) ) { |
663 | // ####### could be a new file | 663 | // ####### could be a new file |
664 | qDebug( "Cannot open file" ); | 664 | qDebug( "Cannot open file" ); |
665 | 665 | ||
666 | //return; | 666 | //return; |
667 | } | 667 | } |
668 | 668 | ||
669 | fileNew(); | 669 | fileNew(); |
670 | if ( doc ) | 670 | if ( doc ) |
671 | delete doc; | 671 | delete doc; |
672 | doc = new DocLnk(f); | 672 | doc = new DocLnk(f); |
673 | editor->setText(txt); | 673 | editor->setText(txt); |
674 | editor->setEdited( false); | 674 | editor->setEdited( false); |
675 | qDebug("openFile doclnk "+currentFileName); | 675 | qDebug("openFile doclnk "+currentFileName); |
676 | doc->setName(currentFileName); | 676 | doc->setName(currentFileName); |
677 | updateCaption(); | 677 | updateCaption(); |
678 | } | 678 | } |
679 | 679 | ||
680 | void TextEdit::showEditTools() | 680 | void 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 */ |
697 | bool TextEdit::save() | 697 | bool 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 */ |
724 | bool TextEdit::saveAs() | 724 | bool 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(); |
741 | qDebug(currentFileName); | 741 | qDebug(currentFileName); |
742 | 742 | ||
743 | if( currentFileName.isEmpty() || currentFileName == "Unnamed") { | 743 | if( currentFileName.isEmpty() || currentFileName == "Unnamed") { |
744 | qDebug("do silly TT filename thing"); | 744 | qDebug("do silly TT filename thing"); |
745 | if ( doc->name().isEmpty() ) { | 745 | if ( doc->name().isEmpty() ) { |
746 | QString pt = rt.simplifyWhiteSpace(); | 746 | QString pt = rt.simplifyWhiteSpace(); |
747 | int i = pt.find( ' ' ); | 747 | int i = pt.find( ' ' ); |
748 | QString docname = pt; | 748 | QString docname = pt; |
749 | if ( i > 0 ) | 749 | if ( i > 0 ) |
750 | docname = pt.left( i ); | 750 | docname = pt.left( i ); |
751 | // remove "." at the beginning | 751 | // remove "." at the beginning |
752 | while( docname.startsWith( "." ) ) | 752 | while( docname.startsWith( "." ) ) |
753 | docname = docname.mid( 1 ); | 753 | docname = docname.mid( 1 ); |
754 | docname.replace( QRegExp("/"), "_" ); | 754 | docname.replace( QRegExp("/"), "_" ); |
755 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. | 755 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. |
756 | if ( docname.length() > 40 ) | 756 | if ( docname.length() > 40 ) |
757 | docname = docname.left(40); | 757 | docname = docname.left(40); |
758 | if ( docname.isEmpty() ) | 758 | if ( docname.isEmpty() ) |
759 | docname = "Unnamed"; | 759 | docname = "Unnamed"; |
760 | doc->setName(docname); | 760 | doc->setName(docname); |
761 | currentFileName=docname; | 761 | currentFileName=docname; |
762 | } | 762 | } |
763 | } | 763 | } |
764 | 764 | ||
765 | 765 | ||
766 | fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName); | 766 | fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName); |
767 | qDebug("wanna save filename "+currentFileName); | 767 | qDebug("wanna save filename "+currentFileName); |
768 | fileSaveDlg->exec(); | 768 | fileSaveDlg->exec(); |
769 | if( fileSaveDlg->result() == 1 ) { | 769 | if( fileSaveDlg->result() == 1 ) { |
770 | QString fileNm=fileSaveDlg->selectedFileName; | 770 | QString fileNm=fileSaveDlg->selectedFileName; |
771 | qDebug("saving filename "+fileNm); | 771 | qDebug("saving filename "+fileNm); |
772 | QFileInfo fi(fileNm); | 772 | QFileInfo fi(fileNm); |
773 | currentFileName=fi.fileName(); | 773 | currentFileName=fi.fileName(); |
774 | if(doc) { | 774 | if(doc) { |
775 | qDebug("doclnk exists"); | 775 | qDebug("doclnk exists"); |
776 | // QString file = doc->file(); | 776 | // QString file = doc->file(); |
777 | // doc->removeFiles(); | 777 | // doc->removeFiles(); |
778 | delete doc; | 778 | delete doc; |
779 | DocLnk nf; | 779 | DocLnk nf; |
780 | nf.setType("text/plain"); | 780 | nf.setType("text/plain"); |
781 | nf.setFile( fileNm); | 781 | nf.setFile( fileNm); |
782 | doc = new DocLnk(nf); | 782 | doc = new DocLnk(nf); |
783 | // editor->setText(rt); | 783 | // editor->setText(rt); |
784 | qDebug("openFile doclnk "+currentFileName); | 784 | qDebug("openFile doclnk "+currentFileName); |
785 | doc->setName( currentFileName); | 785 | doc->setName( currentFileName); |
786 | updateCaption( currentFileName); | 786 | updateCaption( currentFileName); |
787 | 787 | ||
788 | FileManager fm; | 788 | FileManager fm; |
789 | if ( !fm.saveFile( *doc, rt ) ) { | 789 | if ( !fm.saveFile( *doc, rt ) ) { |
790 | return false; | 790 | return false; |
791 | } | 791 | } |
792 | if( fileSaveDlg->filePermCheck->isChecked() ) { | 792 | if( fileSaveDlg->filePermCheck->isChecked() ) { |
793 | filePermissions *filePerm; | 793 | filePermissions *filePerm; |
794 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm); | 794 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm); |
795 | filePerm->exec(); | 795 | filePerm->exec(); |
796 | editor->setEdited( false ); | 796 | editor->setEdited( false ); |
797 | if( filePerm) | 797 | if( filePerm) |
798 | delete filePerm; | 798 | delete filePerm; |
799 | } | 799 | } |
800 | } | 800 | } |
801 | } | 801 | } |
802 | 802 | ||
803 | if(fileSaveDlg) | 803 | if(fileSaveDlg) |
804 | delete fileSaveDlg; | 804 | delete fileSaveDlg; |
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 | |||
@@ -57,193 +57,193 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal | |||
57 | TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) ); | 57 | TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) ); |
58 | TextLabel4_2->setText( tr( "group" ) ); | 58 | TextLabel4_2->setText( tr( "group" ) ); |
59 | 59 | ||
60 | TextLabel4_3 = new QLabel( this, "TextLabel4_3" ); | 60 | TextLabel4_3 = new QLabel( this, "TextLabel4_3" ); |
61 | TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) ); | 61 | TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) ); |
62 | TextLabel4_3->setText( tr( "others" ) ); | 62 | TextLabel4_3->setText( tr( "others" ) ); |
63 | 63 | ||
64 | CheckBox1 = new QCheckBox( this, "CheckBox1" ); | 64 | CheckBox1 = new QCheckBox( this, "CheckBox1" ); |
65 | CheckBox1->setGeometry( QRect( 75, 85, 20, 16 ) ); | 65 | CheckBox1->setGeometry( QRect( 75, 85, 20, 16 ) ); |
66 | connect(CheckBox1, SIGNAL(released()),this,SLOT(ownReadCheck())); | 66 | connect(CheckBox1, SIGNAL(released()),this,SLOT(ownReadCheck())); |
67 | 67 | ||
68 | CheckBox1_2 = new QCheckBox( this, "CheckBox1_2" ); | 68 | CheckBox1_2 = new QCheckBox( this, "CheckBox1_2" ); |
69 | CheckBox1_2->setGeometry( QRect( 135, 85, 20, 16 ) ); | 69 | CheckBox1_2->setGeometry( QRect( 135, 85, 20, 16 ) ); |
70 | connect(CheckBox1_2, SIGNAL(released()),this,SLOT(ownWriteCheck())); | 70 | connect(CheckBox1_2, SIGNAL(released()),this,SLOT(ownWriteCheck())); |
71 | 71 | ||
72 | CheckBox1_3 = new QCheckBox( this, "CheckBox1_3" ); | 72 | CheckBox1_3 = new QCheckBox( this, "CheckBox1_3" ); |
73 | CheckBox1_3->setGeometry( QRect( 195, 85, 20, 16 ) ); | 73 | CheckBox1_3->setGeometry( QRect( 195, 85, 20, 16 ) ); |
74 | connect(CheckBox1_3, SIGNAL(released()),this,SLOT(ownExeCheck())); | 74 | connect(CheckBox1_3, SIGNAL(released()),this,SLOT(ownExeCheck())); |
75 | 75 | ||
76 | CheckBox1_4 = new QCheckBox( this, "CheckBox1_4" ); | 76 | CheckBox1_4 = new QCheckBox( this, "CheckBox1_4" ); |
77 | CheckBox1_4->setGeometry( QRect( 75, 105, 20, 16 ) ); | 77 | CheckBox1_4->setGeometry( QRect( 75, 105, 20, 16 ) ); |
78 | connect(CheckBox1_4, SIGNAL(released()),this,SLOT(grpReadCheck())); | 78 | connect(CheckBox1_4, SIGNAL(released()),this,SLOT(grpReadCheck())); |
79 | 79 | ||
80 | CheckBox1_5 = new QCheckBox( this, "CheckBox1_5" ); | 80 | CheckBox1_5 = new QCheckBox( this, "CheckBox1_5" ); |
81 | CheckBox1_5->setGeometry( QRect( 135, 105, 20, 16 ) ); | 81 | CheckBox1_5->setGeometry( QRect( 135, 105, 20, 16 ) ); |
82 | connect(CheckBox1_5, SIGNAL(released()),this,SLOT(grpWriteCheck())); | 82 | connect(CheckBox1_5, SIGNAL(released()),this,SLOT(grpWriteCheck())); |
83 | 83 | ||
84 | CheckBox1_6 = new QCheckBox( this, "CheckBox1_6" ); | 84 | CheckBox1_6 = new QCheckBox( this, "CheckBox1_6" ); |
85 | CheckBox1_6->setGeometry( QRect( 195, 105, 20, 16 ) ); | 85 | CheckBox1_6->setGeometry( QRect( 195, 105, 20, 16 ) ); |
86 | connect(CheckBox1_6, SIGNAL(released()),this,SLOT(grpExeCheck())); | 86 | connect(CheckBox1_6, SIGNAL(released()),this,SLOT(grpExeCheck())); |
87 | 87 | ||
88 | CheckBox1_7 = new QCheckBox( this, "CheckBox1_7" ); | 88 | CheckBox1_7 = new QCheckBox( this, "CheckBox1_7" ); |
89 | CheckBox1_7->setGeometry( QRect( 75, 125, 16, 16 ) ); | 89 | CheckBox1_7->setGeometry( QRect( 75, 125, 16, 16 ) ); |
90 | connect(CheckBox1_7, SIGNAL(released()),this,SLOT(wrldReadCheck())); | 90 | connect(CheckBox1_7, SIGNAL(released()),this,SLOT(wrldReadCheck())); |
91 | 91 | ||
92 | CheckBox1_8 = new QCheckBox( this, "CheckBox1_8" ); | 92 | CheckBox1_8 = new QCheckBox( this, "CheckBox1_8" ); |
93 | CheckBox1_8->setGeometry( QRect( 135, 125, 20, 16 ) ); | 93 | CheckBox1_8->setGeometry( QRect( 135, 125, 20, 16 ) ); |
94 | connect(CheckBox1_8, SIGNAL(released()),this,SLOT(wrldWriteCheck())); | 94 | connect(CheckBox1_8, SIGNAL(released()),this,SLOT(wrldWriteCheck())); |
95 | 95 | ||
96 | CheckBox1_8_2 = new QCheckBox( this, "CheckBox1_8_2" ); | 96 | CheckBox1_8_2 = new QCheckBox( this, "CheckBox1_8_2" ); |
97 | CheckBox1_8_2->setGeometry( QRect( 195, 125, 20, 16 ) ); | 97 | CheckBox1_8_2->setGeometry( QRect( 195, 125, 20, 16 ) ); |
98 | connect(CheckBox1_8_2, SIGNAL(released()),this,SLOT(wrldExeCheck())); | 98 | connect(CheckBox1_8_2, SIGNAL(released()),this,SLOT(wrldExeCheck())); |
99 | 99 | ||
100 | GroupLineEdit = new QLineEdit( this, "GroupLineEdit" ); | 100 | GroupLineEdit = new QLineEdit( this, "GroupLineEdit" ); |
101 | GroupLineEdit->setGeometry( QRect( 125, 155, 106, 22 ) ); | 101 | GroupLineEdit->setGeometry( QRect( 125, 155, 106, 22 ) ); |
102 | 102 | ||
103 | OwnerLineEdit = new QLineEdit( this, "OwnerLineEdit" ); | 103 | OwnerLineEdit = new QLineEdit( this, "OwnerLineEdit" ); |
104 | OwnerLineEdit->setGeometry( QRect( 10, 155, 106, 22 ) ); | 104 | OwnerLineEdit->setGeometry( QRect( 10, 155, 106, 22 ) ); |
105 | 105 | ||
106 | TextLabel5 = new QLabel( this, "TextLabel5" ); | 106 | TextLabel5 = new QLabel( this, "TextLabel5" ); |
107 | TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) ); | 107 | TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) ); |
108 | TextLabel5->setText( tr( "Owner" ) ); | 108 | TextLabel5->setText( tr( "Owner" ) ); |
109 | 109 | ||
110 | TextLabel5_2 = new QLabel( this, "TextLabel5_2" ); | 110 | TextLabel5_2 = new QLabel( this, "TextLabel5_2" ); |
111 | TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) ); | 111 | TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) ); |
112 | TextLabel5_2->setText( tr( "Group" ) ); | 112 | TextLabel5_2->setText( tr( "Group" ) ); |
113 | 113 | ||
114 | ModeLine = new QLineEdit( this, "TextLabelMode" ); | 114 | ModeLine = new QLineEdit( this, "TextLabelMode" ); |
115 | ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) ); | 115 | ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) ); |
116 | 116 | ||
117 | TextLabel3_2 = new QLabel( this, "TextLabel3_2" ); | 117 | TextLabel3_2 = new QLabel( this, "TextLabel3_2" ); |
118 | TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) ); | 118 | TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) ); |
119 | TextLabel3_2->setText( tr( "read" ) ); | 119 | TextLabel3_2->setText( tr( "read" ) ); |
120 | TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); | 120 | TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); |
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 | */ |
165 | filePermissions::~filePermissions() | 165 | filePermissions::~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??? |
171 | void filePermissions::ownReadCheck() { | 171 | void 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 | ||
179 | void filePermissions::ownWriteCheck() { | 179 | void 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 | } |
186 | 186 | ||
187 | void filePermissions::ownExeCheck() { | 187 | void filePermissions::ownExeCheck() { |
188 | if(CheckBox1_3->isChecked()) { i_mode +=100; } | 188 | if(CheckBox1_3->isChecked()) { i_mode +=100; } |
189 | else i_mode -=100; | 189 | else i_mode -=100; |
190 | modeStr.sprintf("0%d",i_mode); | 190 | modeStr.sprintf("0%d",i_mode); |
191 | ModeLine->setText(modeStr); | 191 | ModeLine->setText(modeStr); |
192 | // 0100 | 192 | // 0100 |
193 | } | 193 | } |
194 | 194 | ||
195 | void filePermissions::grpReadCheck() { | 195 | void filePermissions::grpReadCheck() { |
196 | if(CheckBox1_4->isChecked()) { i_mode +=40; } | 196 | if(CheckBox1_4->isChecked()) { i_mode +=40; } |
197 | else i_mode -=40; | 197 | else i_mode -=40; |
198 | modeStr.sprintf("0%d",i_mode); | 198 | modeStr.sprintf("0%d",i_mode); |
199 | ModeLine->setText(modeStr); | 199 | ModeLine->setText(modeStr); |
200 | // 0040 | 200 | // 0040 |
201 | } | 201 | } |
202 | 202 | ||
203 | void filePermissions::grpWriteCheck() { | 203 | void filePermissions::grpWriteCheck() { |
204 | if(CheckBox1_5->isChecked()) { i_mode +=20; } | 204 | if(CheckBox1_5->isChecked()) { i_mode +=20; } |
205 | else i_mode -=20; | 205 | else i_mode -=20; |
206 | modeStr.sprintf("0%d",i_mode); | 206 | modeStr.sprintf("0%d",i_mode); |
207 | ModeLine->setText(modeStr); | 207 | ModeLine->setText(modeStr); |
208 | // 0020 | 208 | // 0020 |
209 | } | 209 | } |
210 | 210 | ||
211 | void filePermissions::grpExeCheck() { | 211 | void filePermissions::grpExeCheck() { |
212 | if(CheckBox1_6->isChecked()) { i_mode +=10; } | 212 | if(CheckBox1_6->isChecked()) { i_mode +=10; } |
213 | else i_mode -=10; | 213 | else i_mode -=10; |
214 | modeStr.sprintf("0%d",i_mode); | 214 | modeStr.sprintf("0%d",i_mode); |
215 | ModeLine->setText(modeStr); | 215 | ModeLine->setText(modeStr); |
216 | // 0010 | 216 | // 0010 |
217 | } | 217 | } |
218 | 218 | ||
219 | void filePermissions::wrldReadCheck() { | 219 | void filePermissions::wrldReadCheck() { |
220 | if(CheckBox1_7->isChecked()) { i_mode +=4; } | 220 | if(CheckBox1_7->isChecked()) { i_mode +=4; } |
221 | else i_mode -=4; | 221 | else i_mode -=4; |
222 | modeStr.sprintf("0%d",i_mode); | 222 | modeStr.sprintf("0%d",i_mode); |
223 | ModeLine->setText(modeStr); | 223 | ModeLine->setText(modeStr); |
224 | // 0004 | 224 | // 0004 |
225 | } | 225 | } |
226 | 226 | ||
227 | void filePermissions::wrldWriteCheck() { | 227 | void filePermissions::wrldWriteCheck() { |
228 | if(CheckBox1_8->isChecked()) { i_mode +=2; } | 228 | if(CheckBox1_8->isChecked()) { i_mode +=2; } |
229 | else i_mode -=2; | 229 | else i_mode -=2; |
230 | modeStr.sprintf("0%d",i_mode); | 230 | modeStr.sprintf("0%d",i_mode); |
231 | ModeLine->setText(modeStr); | 231 | ModeLine->setText(modeStr); |
232 | // 0002 | 232 | // 0002 |
233 | } | 233 | } |
234 | 234 | ||
235 | void filePermissions::wrldExeCheck() { | 235 | void filePermissions::wrldExeCheck() { |
236 | if(CheckBox1_8_2->isChecked()) { i_mode +=1; } | 236 | if(CheckBox1_8_2->isChecked()) { i_mode +=1; } |
237 | else i_mode -=1; | 237 | else i_mode -=1; |
238 | modeStr.sprintf("0%d",i_mode); | 238 | modeStr.sprintf("0%d",i_mode); |
239 | ModeLine->setText(modeStr); | 239 | ModeLine->setText(modeStr); |
240 | // 0001 | 240 | // 0001 |
241 | } | 241 | } |
242 | 242 | ||
243 | void filePermissions::accept() { | 243 | void filePermissions::accept() { |
244 | 244 | ||
245 | QFileInfo fi(file); | 245 | QFileInfo fi(file); |
246 | struct passwd *pwd=0; | 246 | struct passwd *pwd=0; |
247 | struct group *grp=0; | 247 | struct group *grp=0; |
248 | pwd = getpwnam(OwnerLineEdit->text().latin1() ); | 248 | pwd = getpwnam(OwnerLineEdit->text().latin1() ); |
249 | if(pwd == NULL) { | 249 | if(pwd == NULL) { |