author | cniehaus <cniehaus> | 2003-05-17 18:17:11 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2003-05-17 18:17:11 (UTC) |
commit | 982d7a64a7526379fc0f3b0ae64fdcce430775ff (patch) (unidiff) | |
tree | fedd5d50bb4cdfd923a9deb09e8cd6c19f8b2e31 | |
parent | 325096fb28d129429b17a781c4c1e8d6ca9aa585 (diff) | |
download | opie-982d7a64a7526379fc0f3b0ae64fdcce430775ff.zip opie-982d7a64a7526379fc0f3b0ae64fdcce430775ff.tar.gz opie-982d7a64a7526379fc0f3b0ae64fdcce430775ff.tar.bz2 |
ported to HEAD
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 2201960..9f21245 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -112,213 +112,222 @@ void AdvancedFm::runThis() | |||
112 | 112 | ||
113 | if(curFile != "../") | 113 | if(curFile != "../") |
114 | { | 114 | { |
115 | 115 | ||
116 | fs = getFileSystemType((const QString &) path); | 116 | fs = getFileSystemType((const QString &) path); |
117 | QFileInfo fileInfo( path + "/" + curFile); | 117 | QFileInfo fileInfo( path + "/" + curFile); |
118 | qDebug( fileInfo.owner()); | 118 | qDebug( fileInfo.owner()); |
119 | 119 | ||
120 | if( (fileInfo.permission( QFileInfo::ExeUser) | 120 | if( (fileInfo.permission( QFileInfo::ExeUser) |
121 | | fileInfo.permission( QFileInfo::ExeGroup) | 121 | | fileInfo.permission( QFileInfo::ExeGroup) |
122 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 122 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
123 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 123 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
124 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 124 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
125 | e << curFile; | 125 | e << curFile; |
126 | } | 126 | } |
127 | else | 127 | else |
128 | { | 128 | { |
129 | curFile = path + "/" + curFile; | 129 | curFile = path + "/" + curFile; |
130 | DocLnk nf(curFile); | 130 | DocLnk nf(curFile); |
131 | QString execStr = nf.exec(); | 131 | QString execStr = nf.exec(); |
132 | qDebug( execStr); | 132 | qDebug( execStr); |
133 | if( execStr.isEmpty() ) | 133 | if( execStr.isEmpty() ) |
134 | { | 134 | { |
135 | } | 135 | } |
136 | else | 136 | else |
137 | { | 137 | { |
138 | nf.execute(); | 138 | nf.execute(); |
139 | } | 139 | } |
140 | } | 140 | } |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | void AdvancedFm::runText() | 144 | void AdvancedFm::runText() |
145 | { | 145 | { |
146 | QString curFile = CurrentView()->currentItem()->text(0); | 146 | QString curFile = CurrentView()->currentItem()->text(0); |
147 | if(curFile != "../") | 147 | if(curFile != "../") |
148 | { | 148 | { |
149 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | 149 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink |
150 | curFile = dealWithSymName((const QString&)curFile); | 150 | curFile = dealWithSymName((const QString&)curFile); |
151 | curFile = CurrentDir()->canonicalPath()+"/"+curFile; | 151 | curFile = CurrentDir()->canonicalPath()+"/"+curFile; |
152 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 152 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
153 | e << curFile; | 153 | e << curFile; |
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | void AdvancedFm::makeDir() | 157 | void AdvancedFm::makeDir() |
158 | { | 158 | { |
159 | InputDialog *fileDlg; | 159 | InputDialog *fileDlg; |
160 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 160 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
161 | fileDlg->exec(); | 161 | fileDlg->exec(); |
162 | if( fileDlg->result() == 1 ) | 162 | if( fileDlg->result() == 1 ) |
163 | { | 163 | { |
164 | QDir *thisDir = CurrentDir(); | 164 | QDir *thisDir = CurrentDir(); |
165 | QString filename = fileDlg->LineEdit1->text(); | 165 | QString filename = fileDlg->LineEdit1->text(); |
166 | thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); | 166 | thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); |
167 | } | 167 | } |
168 | populateView(); | 168 | populateView(); |
169 | } | 169 | } |
170 | 170 | ||
171 | void AdvancedFm::doDelete() | 171 | void AdvancedFm::doDelete() |
172 | { | 172 | { |
173 | 173 | ||
174 | QStringList curFileList = getPath(); | 174 | QStringList curFileList = getPath(); |
175 | bool doMsg=true; | 175 | bool doMsg=true; |
176 | int count = curFileList.count(); | 176 | int count = curFileList.count(); |
177 | if( count > 0) | 177 | if( count > 0) |
178 | { | 178 | { |
179 | if(count > 1 ) | 179 | if(count > 1 ) |
180 | { | 180 | { |
181 | QString msg; | 181 | QString msg; |
182 | msg=tr("Really delete\n%1 files?").arg(count); | 182 | msg=tr("Really delete\n%1 files?").arg(count); |
183 | switch ( QMessageBox::warning(this,tr("Delete"),msg | 183 | switch ( QMessageBox::warning(this,tr("Delete"),msg |
184 | ,tr("Yes"),tr("No"),0,0,1) ) | 184 | ,tr("Yes"),tr("No"),0,0,1) ) |
185 | { | 185 | { |
186 | case 0: | 186 | case 0: |
187 | doMsg=false; | 187 | doMsg=false; |
188 | break; | 188 | break; |
189 | case 1: | 189 | case 1: |
190 | return; | 190 | return; |
191 | break; | 191 | break; |
192 | }; | 192 | }; |
193 | } | 193 | } |
194 | 194 | ||
195 | QString myFile; | 195 | QString myFile; |
196 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 196 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) |
197 | { | 197 | { |
198 | myFile = (*it); | 198 | myFile = (*it); |
199 | if( myFile.find(" -> ",0,TRUE) != -1) | 199 | if( myFile.find(" -> ",0,TRUE) != -1) |
200 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 200 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
201 | 201 | ||
202 | QString f = CurrentDir()->canonicalPath(); | 202 | QString f = CurrentDir()->canonicalPath(); |
203 | if(f.right(1).find("/",0,TRUE) == -1) | 203 | if(f.right(1).find("/",0,TRUE) == -1) |
204 | f += "/"; | 204 | f += "/"; |
205 | f += myFile; | 205 | f += myFile; |
206 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) //if file is a directory | 206 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) //if file is a directory |
207 | { | 207 | { |
208 | switch ( QMessageBox::warning( this, tr("Delete Directory?"), tr("Really delete\n") + f + | 208 | switch ( QMessageBox::warning( this, tr("Delete Directory?"), |
209 | "\nand all it's contents ?" | 209 | tr("Really delete %1\nand all it's contents ?" ).arg( f ) , |
210 | ,tr("Yes"),tr("No"),0,0,1) ) | 210 | tr("Yes"), |
211 | tr("No"), | ||
212 | 0, | ||
213 | 0, | ||
214 | 1) ) | ||
211 | { | 215 | { |
212 | case 0: | 216 | case 0: |
213 | { | 217 | { |
214 | f=f.left(f.length()-1); | 218 | f=f.left(f.length()-1); |
215 | QString cmd="rm -rf "+f; | 219 | QString cmd="rm -rf "+f; |
216 | startProcess( (const QString)cmd.latin1() ); | 220 | startProcess( (const QString)cmd.latin1() ); |
217 | populateView(); | 221 | populateView(); |
218 | } | 222 | } |
219 | break; | 223 | break; |
220 | case 1: | 224 | case 1: |
221 | // exit | 225 | // exit |
222 | break; | 226 | break; |
223 | }; | 227 | }; |
224 | 228 | ||
225 | } else { | 229 | } else { |
226 | if(doMsg) { | 230 | if(doMsg) { |
227 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f | 231 | switch ( QMessageBox::warning(this,tr("Delete"), |
228 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 232 | tr("Really delete\n%1?").arg( f ), |
233 | tr("Yes"), | ||
234 | tr("No"), | ||
235 | 0, | ||
236 | 0, | ||
237 | 1) ) { | ||
229 | case 1: | 238 | case 1: |
230 | return; | 239 | return; |
231 | break; | 240 | break; |
232 | }; | 241 | }; |
233 | } | 242 | } |
234 | QString cmd="rm "+f; | 243 | QString cmd="rm "+f; |
235 | QFile file(f); | 244 | QFile file(f); |
236 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) { | 245 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) { |
237 | qDebug("remove link files "+f); | 246 | qDebug("remove link files "+f); |
238 | // AppLnk lnk(f); | 247 | // AppLnk lnk(f); |
239 | // qDebug(lnk.linkFile()); | 248 | // qDebug(lnk.linkFile()); |
240 | // lnk.removeLinkFile(); | 249 | // lnk.removeLinkFile(); |
241 | file.remove(); | 250 | file.remove(); |
242 | } | 251 | } |
243 | } | 252 | } |
244 | } | 253 | } |
245 | } | 254 | } |
246 | populateView(); | 255 | populateView(); |
247 | } | 256 | } |
248 | 257 | ||
249 | void AdvancedFm::filePerms() | 258 | void AdvancedFm::filePerms() |
250 | { | 259 | { |
251 | QStringList curFileList = getPath(); | 260 | QStringList curFileList = getPath(); |
252 | QString filePath; | 261 | QString filePath; |
253 | 262 | ||
254 | filePath = CurrentDir()->canonicalPath()+"/"; | 263 | filePath = CurrentDir()->canonicalPath()+"/"; |
255 | 264 | ||
256 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 265 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) |
257 | { | 266 | { |
258 | filePermissions *filePerm; | 267 | filePermissions *filePerm; |
259 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 268 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
260 | filePerm->showMaximized(); | 269 | filePerm->showMaximized(); |
261 | filePerm->exec(); | 270 | filePerm->exec(); |
262 | if( filePerm) | 271 | if( filePerm) |
263 | delete filePerm; | 272 | delete filePerm; |
264 | } | 273 | } |
265 | populateView(); | 274 | populateView(); |
266 | } | 275 | } |
267 | 276 | ||
268 | void AdvancedFm::doProperties() | 277 | void AdvancedFm::doProperties() |
269 | { | 278 | { |
270 | #if defined(QT_QWS_OPIE) | 279 | #if defined(QT_QWS_OPIE) |
271 | 280 | ||
272 | QStringList curFileList = getPath(); | 281 | QStringList curFileList = getPath(); |
273 | 282 | ||
274 | QString filePath; | 283 | QString filePath; |
275 | filePath = CurrentDir()->canonicalPath()+"/"; | 284 | filePath = CurrentDir()->canonicalPath()+"/"; |
276 | 285 | ||
277 | qDebug("%d",curFileList.count()); | 286 | qDebug("%d",curFileList.count()); |
278 | 287 | ||
279 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 288 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) |
280 | { | 289 | { |
281 | qDebug((filePath+*it)); | 290 | qDebug((filePath+*it)); |
282 | DocLnk lnk( (filePath+*it)); | 291 | DocLnk lnk( (filePath+*it)); |
283 | LnkProperties prop( &lnk ); | 292 | LnkProperties prop( &lnk ); |
284 | prop.showMaximized(); | 293 | prop.showMaximized(); |
285 | prop.exec(); | 294 | prop.exec(); |
286 | } | 295 | } |
287 | #endif | 296 | #endif |
288 | 297 | ||
289 | } | 298 | } |
290 | 299 | ||
291 | void AdvancedFm::upDir() | 300 | void AdvancedFm::upDir() |
292 | { | 301 | { |
293 | QDir *thisDir = CurrentDir(); | 302 | QDir *thisDir = CurrentDir(); |
294 | QString current = thisDir->canonicalPath(); | 303 | QString current = thisDir->canonicalPath(); |
295 | QDir dir(current); | 304 | QDir dir(current); |
296 | dir.cdUp(); | 305 | dir.cdUp(); |
297 | current = dir.canonicalPath(); | 306 | current = dir.canonicalPath(); |
298 | chdir( current.latin1() ); | 307 | chdir( current.latin1() ); |
299 | thisDir->cd( current, TRUE); | 308 | thisDir->cd( current, TRUE); |
300 | 309 | ||
301 | populateView(); | 310 | populateView(); |
302 | update(); | 311 | update(); |
303 | } | 312 | } |
304 | 313 | ||
305 | void AdvancedFm::copy() | 314 | void AdvancedFm::copy() |
306 | { | 315 | { |
307 | qApp->processEvents(); | 316 | qApp->processEvents(); |
308 | QStringList curFileList = getPath(); | 317 | QStringList curFileList = getPath(); |
309 | 318 | ||
310 | QDir *thisDir = CurrentDir(); | 319 | QDir *thisDir = CurrentDir(); |
311 | QDir *thatDir = OtherDir(); | 320 | QDir *thatDir = OtherDir(); |
312 | 321 | ||
313 | bool doMsg=true; | 322 | bool doMsg=true; |
314 | int count=curFileList.count(); | 323 | int count=curFileList.count(); |
315 | if( count > 0) { | 324 | if( count > 0) { |
316 | if(count > 1 ){ | 325 | if(count > 1 ){ |
317 | QString msg; | 326 | QString msg; |
318 | msg=tr("Really copy\n%1 files?").arg(count); | 327 | msg=tr("Really copy\n%1 files?").arg(count); |
319 | switch ( QMessageBox::warning(this,tr("Copy"),msg | 328 | switch ( QMessageBox::warning(this,tr("Copy"),msg |
320 | ,tr("Yes"),tr("No"),0,0,1) ) | 329 | ,tr("Yes"),tr("No"),0,0,1) ) |
321 | { | 330 | { |
322 | case 0: | 331 | case 0: |
323 | doMsg=false; | 332 | doMsg=false; |
324 | break; | 333 | break; |