author | llornkcor <llornkcor> | 2003-02-24 03:53:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-24 03:53:24 (UTC) |
commit | 009b85e8daa341d4a2fc62404f4a58715e775b86 (patch) (unidiff) | |
tree | 754ec3b77412e22c90b1da7d68c609436189dcfd | |
parent | 04470810d71cc8aa3ddde193559312fd3ecc7a11 (diff) | |
download | opie-009b85e8daa341d4a2fc62404f4a58715e775b86.zip opie-009b85e8daa341d4a2fc62404f4a58715e775b86.tar.gz opie-009b85e8daa341d4a2fc62404f4a58715e775b86.tar.bz2 |
whoops
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 062a013..f46503c 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -1,282 +1,282 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | #include "output.h" | 13 | #include "output.h" |
14 | #include "filePermissions.h" | 14 | #include "filePermissions.h" |
15 | 15 | ||
16 | #include <opie/otabwidget.h> | 16 | #include <opie/otabwidget.h> |
17 | #include <opie/oprocess.h> | 17 | #include <opie/oprocess.h> |
18 | 18 | ||
19 | #include <qpe/lnkproperties.h> | 19 | #include <qpe/lnkproperties.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
22 | #include <qpe/qpetoolbar.h> | 22 | #include <qpe/qpetoolbar.h> |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
26 | #include <qpe/ir.h> | 26 | #include <qpe/ir.h> |
27 | 27 | ||
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | #include <qmultilineedit.h> | 29 | #include <qmultilineedit.h> |
30 | 30 | ||
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | 32 | ||
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
36 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
37 | #include <qtabwidget.h> | 37 | #include <qtabwidget.h> |
38 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
39 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
40 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
41 | #include <qlistview.h> | 41 | #include <qlistview.h> |
42 | 42 | ||
43 | #include <stdlib.h> | 43 | #include <stdlib.h> |
44 | #include <unistd.h> | 44 | #include <unistd.h> |
45 | #include <sys/stat.h> | 45 | #include <sys/stat.h> |
46 | #include <dirent.h> | 46 | #include <dirent.h> |
47 | 47 | ||
48 | 48 | ||
49 | void AdvancedFm::doDirChange() | 49 | void AdvancedFm::doDirChange() |
50 | { | 50 | { |
51 | ListClicked( CurrentView()->currentItem()); | 51 | ListClicked( CurrentView()->currentItem()); |
52 | } | 52 | } |
53 | 53 | ||
54 | void AdvancedFm::showMenuHidden() | 54 | void AdvancedFm::showMenuHidden() |
55 | { | 55 | { |
56 | if (b) | 56 | if (b) |
57 | { | 57 | { |
58 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 58 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
59 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 59 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
60 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 60 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
61 | // b=FALSE; | 61 | // b=FALSE; |
62 | 62 | ||
63 | } | 63 | } |
64 | else | 64 | else |
65 | { | 65 | { |
66 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 66 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
67 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 67 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
68 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 68 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
69 | // b=TRUE; | 69 | // b=TRUE; |
70 | } | 70 | } |
71 | populateView(); | 71 | populateView(); |
72 | // populateRemoteView(); | 72 | // populateRemoteView(); |
73 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); | 73 | // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); |
74 | if(b) b = false; else b = true; | 74 | if(b) b = false; else b = true; |
75 | } | 75 | } |
76 | 76 | ||
77 | void AdvancedFm::showHidden() | 77 | void AdvancedFm::showHidden() |
78 | { | 78 | { |
79 | if (b) | 79 | if (b) |
80 | { | 80 | { |
81 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 81 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
82 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 82 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
83 | // fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 83 | // fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
84 | // b=FALSE; | 84 | // b=FALSE; |
85 | 85 | ||
86 | } | 86 | } |
87 | else | 87 | else |
88 | { | 88 | { |
89 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 89 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
90 | s OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 90 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
91 | // fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 91 | // fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
92 | // b=TRUE; | 92 | // b=TRUE; |
93 | } | 93 | } |
94 | populateView(); | 94 | populateView(); |
95 | } | 95 | } |
96 | 96 | ||
97 | QString AdvancedFm::dealWithSymName(const QString &fileName) | 97 | QString AdvancedFm::dealWithSymName(const QString &fileName) |
98 | { | 98 | { |
99 | QString strItem = fileName; | 99 | QString strItem = fileName; |
100 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 100 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
101 | } | 101 | } |
102 | 102 | ||
103 | void AdvancedFm::runThis() | 103 | void AdvancedFm::runThis() |
104 | { | 104 | { |
105 | QString fs; | 105 | QString fs; |
106 | QDir *thisDir = CurrentDir(); | 106 | QDir *thisDir = CurrentDir(); |
107 | 107 | ||
108 | QString curFile = CurrentView()->currentItem()->text(0); | 108 | QString curFile = CurrentView()->currentItem()->text(0); |
109 | QString path = thisDir->canonicalPath(); | 109 | QString path = thisDir->canonicalPath(); |
110 | 110 | ||
111 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | 111 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink |
112 | 112 | ||
113 | curFile = dealWithSymName((const QString&)curFile); | 113 | curFile = dealWithSymName((const QString&)curFile); |
114 | 114 | ||
115 | if(curFile != "../") | 115 | if(curFile != "../") |
116 | { | 116 | { |
117 | 117 | ||
118 | fs = getFileSystemType((const QString &) path); | 118 | fs = getFileSystemType((const QString &) path); |
119 | QFileInfo fileInfo( path + "/" + curFile); | 119 | QFileInfo fileInfo( path + "/" + curFile); |
120 | qDebug( fileInfo.owner()); | 120 | qDebug( fileInfo.owner()); |
121 | 121 | ||
122 | if( (fileInfo.permission( QFileInfo::ExeUser) | 122 | if( (fileInfo.permission( QFileInfo::ExeUser) |
123 | | fileInfo.permission( QFileInfo::ExeGroup) | 123 | | fileInfo.permission( QFileInfo::ExeGroup) |
124 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 124 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
125 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 125 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
126 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 126 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
127 | e << curFile; | 127 | e << curFile; |
128 | } | 128 | } |
129 | else | 129 | else |
130 | { | 130 | { |
131 | curFile = path + "/" + curFile; | 131 | curFile = path + "/" + curFile; |
132 | DocLnk nf(curFile); | 132 | DocLnk nf(curFile); |
133 | QString execStr = nf.exec(); | 133 | QString execStr = nf.exec(); |
134 | qDebug( execStr); | 134 | qDebug( execStr); |
135 | if( execStr.isEmpty() ) | 135 | if( execStr.isEmpty() ) |
136 | { | 136 | { |
137 | } | 137 | } |
138 | else | 138 | else |
139 | { | 139 | { |
140 | nf.execute(); | 140 | nf.execute(); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | void AdvancedFm::runText() | 146 | void AdvancedFm::runText() |
147 | { | 147 | { |
148 | QString curFile = CurrentView()->currentItem()->text(0); | 148 | QString curFile = CurrentView()->currentItem()->text(0); |
149 | if(curFile != "../") | 149 | if(curFile != "../") |
150 | { | 150 | { |
151 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | 151 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink |
152 | curFile = dealWithSymName((const QString&)curFile); | 152 | curFile = dealWithSymName((const QString&)curFile); |
153 | curFile = CurrentDir()->canonicalPath()+"/"+curFile; | 153 | curFile = CurrentDir()->canonicalPath()+"/"+curFile; |
154 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 154 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
155 | e << curFile; | 155 | e << curFile; |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | void AdvancedFm::makeDir() | 159 | void AdvancedFm::makeDir() |
160 | { | 160 | { |
161 | InputDialog *fileDlg; | 161 | InputDialog *fileDlg; |
162 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 162 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
163 | fileDlg->exec(); | 163 | fileDlg->exec(); |
164 | if( fileDlg->result() == 1 ) | 164 | if( fileDlg->result() == 1 ) |
165 | { | 165 | { |
166 | QDir *thisDir = CurrentDir(); | 166 | QDir *thisDir = CurrentDir(); |
167 | QString filename = fileDlg->LineEdit1->text(); | 167 | QString filename = fileDlg->LineEdit1->text(); |
168 | thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); | 168 | thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); |
169 | } | 169 | } |
170 | populateView(); | 170 | populateView(); |
171 | } | 171 | } |
172 | 172 | ||
173 | void AdvancedFm::doDelete() | 173 | void AdvancedFm::doDelete() |
174 | { | 174 | { |
175 | 175 | ||
176 | QStringList curFileList = getPath(); | 176 | QStringList curFileList = getPath(); |
177 | bool doMsg=true; | 177 | bool doMsg=true; |
178 | int count = curFileList.count(); | 178 | int count = curFileList.count(); |
179 | if( count > 0) | 179 | if( count > 0) |
180 | { | 180 | { |
181 | if(count > 1 ) | 181 | if(count > 1 ) |
182 | { | 182 | { |
183 | QString msg; | 183 | QString msg; |
184 | msg=tr("Really delete\n%1 files?").arg(count); | 184 | msg=tr("Really delete\n%1 files?").arg(count); |
185 | switch ( QMessageBox::warning(this,tr("Delete"),msg | 185 | switch ( QMessageBox::warning(this,tr("Delete"),msg |
186 | ,tr("Yes"),tr("No"),0,0,1) ) | 186 | ,tr("Yes"),tr("No"),0,0,1) ) |
187 | { | 187 | { |
188 | case 0: | 188 | case 0: |
189 | doMsg=false; | 189 | doMsg=false; |
190 | break; | 190 | break; |
191 | case 1: | 191 | case 1: |
192 | return; | 192 | return; |
193 | break; | 193 | break; |
194 | }; | 194 | }; |
195 | } | 195 | } |
196 | 196 | ||
197 | QString myFile; | 197 | QString myFile; |
198 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 198 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) |
199 | { | 199 | { |
200 | myFile = (*it); | 200 | myFile = (*it); |
201 | if( myFile.find(" -> ",0,TRUE) != -1) | 201 | if( myFile.find(" -> ",0,TRUE) != -1) |
202 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 202 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
203 | 203 | ||
204 | QString f = CurrentDir()->canonicalPath(); | 204 | QString f = CurrentDir()->canonicalPath(); |
205 | if(f.right(1).find("/",0,TRUE) == -1) | 205 | if(f.right(1).find("/",0,TRUE) == -1) |
206 | f += "/"; | 206 | f += "/"; |
207 | f += myFile; | 207 | f += myFile; |
208 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) | 208 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) |
209 | { | 209 | { |
210 | switch ( QMessageBox::warning( this, tr("Delete Directory?"), tr("Really delete\n") + f + | 210 | switch ( QMessageBox::warning( this, tr("Delete Directory?"), tr("Really delete\n") + f + |
211 | "\nand all it's contents ?" | 211 | "\nand all it's contents ?" |
212 | ,tr("Yes"),tr("No"),0,0,1) ) | 212 | ,tr("Yes"),tr("No"),0,0,1) ) |
213 | { | 213 | { |
214 | case 0: | 214 | case 0: |
215 | { | 215 | { |
216 | f=f.left(f.length()-1); | 216 | f=f.left(f.length()-1); |
217 | QString cmd="rm -rf "+f; | 217 | QString cmd="rm -rf "+f; |
218 | startProcess( (const QString)cmd.latin1() ); | 218 | startProcess( (const QString)cmd.latin1() ); |
219 | populateView(); | 219 | populateView(); |
220 | } | 220 | } |
221 | break; | 221 | break; |
222 | case 1: | 222 | case 1: |
223 | // exit | 223 | // exit |
224 | break; | 224 | break; |
225 | }; | 225 | }; |
226 | 226 | ||
227 | } else { | 227 | } else { |
228 | if(doMsg) { | 228 | if(doMsg) { |
229 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f | 229 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f |
230 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 230 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
231 | case 1: | 231 | case 1: |
232 | return; | 232 | return; |
233 | break; | 233 | break; |
234 | }; | 234 | }; |
235 | } | 235 | } |
236 | QString cmd="rm "+f; | 236 | QString cmd="rm "+f; |
237 | QFile file(f); | 237 | QFile file(f); |
238 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) | 238 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) |
239 | file.remove(); | 239 | file.remove(); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | } | 242 | } |
243 | populateView(); | 243 | populateView(); |
244 | } | 244 | } |
245 | 245 | ||
246 | void AdvancedFm::filePerms() | 246 | void AdvancedFm::filePerms() |
247 | { | 247 | { |
248 | QStringList curFileList = getPath(); | 248 | QStringList curFileList = getPath(); |
249 | QString filePath; | 249 | QString filePath; |
250 | 250 | ||
251 | filePath = CurrentDir()->canonicalPath()+"/"; | 251 | filePath = CurrentDir()->canonicalPath()+"/"; |
252 | 252 | ||
253 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 253 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) |
254 | { | 254 | { |
255 | filePermissions *filePerm; | 255 | filePermissions *filePerm; |
256 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 256 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
257 | filePerm->showMaximized(); | 257 | filePerm->showMaximized(); |
258 | filePerm->exec(); | 258 | filePerm->exec(); |
259 | if( filePerm) | 259 | if( filePerm) |
260 | delete filePerm; | 260 | delete filePerm; |
261 | } | 261 | } |
262 | populateView(); | 262 | populateView(); |
263 | } | 263 | } |
264 | 264 | ||
265 | void AdvancedFm::doProperties() | 265 | void AdvancedFm::doProperties() |
266 | { | 266 | { |
267 | #if defined(QT_QWS_OPIE) | 267 | #if defined(QT_QWS_OPIE) |
268 | 268 | ||
269 | QStringList curFileList = getPath(); | 269 | QStringList curFileList = getPath(); |
270 | 270 | ||
271 | QString filePath; | 271 | QString filePath; |
272 | filePath = CurrentDir()->canonicalPath()+"/"; | 272 | filePath = CurrentDir()->canonicalPath()+"/"; |
273 | 273 | ||
274 | qDebug("%d",curFileList.count()); | 274 | qDebug("%d",curFileList.count()); |
275 | 275 | ||
276 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) | 276 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) |
277 | { | 277 | { |
278 | qDebug((filePath+*it)); | 278 | qDebug((filePath+*it)); |
279 | DocLnk lnk( (filePath+*it)); | 279 | DocLnk lnk( (filePath+*it)); |
280 | LnkProperties prop( &lnk ); | 280 | LnkProperties prop( &lnk ); |
281 | prop.showMaximized(); | 281 | prop.showMaximized(); |
282 | prop.exec(); | 282 | prop.exec(); |