author | llornkcor <llornkcor> | 2004-09-25 08:22:22 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-25 08:22:22 (UTC) |
commit | ff6c55833c0cba33469f668ca158e96b409b4967 (patch) (unidiff) | |
tree | 63299a67e6f9bf1a06c8668775f95f96366efce0 /noncore/apps/advancedfm | |
parent | 946445e87ce74b8b28817ea63854054dbf165003 (diff) | |
download | opie-ff6c55833c0cba33469f668ca158e96b409b4967.zip opie-ff6c55833c0cba33469f668ca158e96b409b4967.tar.gz opie-ff6c55833c0cba33469f668ca158e96b409b4967.tar.bz2 |
fix
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.pro | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 5 |
4 files changed, 13 insertions, 16 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index f1be471..0dc822d 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,170 +1,168 @@ | |||
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 | #define DEVELOPERS_VERSION | 12 | #define DEVELOPERS_VERSION |
13 | #include "advancedfm.h" | 13 | #include "advancedfm.h" |
14 | 14 | ||
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | 16 | ||
17 | #include <opie2/ostorageinfo.h> | 17 | #include <opie2/ostorageinfo.h> |
18 | 18 | ||
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
21 | #include <qpe/mimetype.h> | 21 | #include <qpe/mimetype.h> |
22 | #include <qpe/applnk.h> | 22 | #include <qpe/applnk.h> |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/menubutton.h> | 24 | #include <qpe/menubutton.h> |
25 | 25 | ||
26 | #include <qcombobox.h> | 26 | #include <qcombobox.h> |
27 | #include <qpopupmenu.h> | 27 | #include <qpopupmenu.h> |
28 | #include <qlistview.h> | 28 | #include <qlistview.h> |
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | 31 | ||
32 | 32 | ||
33 | #include <sys/stat.h> | 33 | #include <sys/stat.h> |
34 | #include <time.h> | 34 | #include <time.h> |
35 | #include <dirent.h> | 35 | #include <dirent.h> |
36 | #include <fcntl.h> | 36 | #include <fcntl.h> |
37 | #include <sys/vfs.h> | 37 | #include <sys/vfs.h> |
38 | #include <mntent.h> | 38 | #include <mntent.h> |
39 | 39 | ||
40 | using namespace Opie::Ui; | 40 | using namespace Opie::Ui; |
41 | 41 | ||
42 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) | 42 | AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) |
43 | : QMainWindow( ) { | 43 | : QMainWindow( ) { |
44 | init(); | 44 | init(); |
45 | renameBox = 0; | 45 | renameBox = 0; |
46 | 46 | whichTab = 1; | |
47 | unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); | 47 | unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); |
48 | 48 | ||
49 | initConnections(); | 49 | initConnections(); |
50 | rePopulate(); | 50 | rePopulate(); |
51 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); | 51 | channel = new QCopChannel( "QPE/Application/advancedfm", this ); |
52 | connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&))); | 52 | connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&))); |
53 | switchToLocalTab(); | 53 | switchToLocalTab(); |
54 | } | 54 | } |
55 | 55 | ||
56 | AdvancedFm::~AdvancedFm() { | 56 | AdvancedFm::~AdvancedFm() { |
57 | } | 57 | } |
58 | 58 | ||
59 | 59 | ||
60 | void AdvancedFm::cleanUp() { | 60 | void AdvancedFm::cleanUp() { |
61 | QString sfile=QDir::homeDirPath(); | 61 | QString sfile=QDir::homeDirPath(); |
62 | if(sfile.right(1) != "/") | 62 | if(sfile.right(1) != "/") |
63 | sfile+="/._temp"; | 63 | sfile+="/._temp"; |
64 | else | 64 | else |
65 | sfile+="._temp"; | 65 | sfile+="._temp"; |
66 | QFile file( sfile); | 66 | QFile file( sfile); |
67 | if(file.exists()) | 67 | if(file.exists()) |
68 | file.remove(); | 68 | file.remove(); |
69 | } | 69 | } |
70 | 70 | ||
71 | void AdvancedFm::tabChanged(QWidget *wd) { | 71 | void AdvancedFm::tabChanged(QWidget *wd) { |
72 | // qDebug("tabChanged"); | 72 | // qDebug("tabChanged"); |
73 | if(wd == tab) { | 73 | if(wd == tab) { |
74 | whichTab = 1; | 74 | whichTab = 1; |
75 | // qDebug("tabchanged: LOCAL VIEW SHOWN"); | 75 | // qDebug("tabchanged: LOCAL VIEW SHOWN"); |
76 | } | 76 | } |
77 | else if(wd == tab_2) { | 77 | else if(wd == tab_2) { |
78 | whichTab = 2; | 78 | whichTab = 2; |
79 | // qDebug("tabchanged: REMOTE VIEW SHOWN"); | 79 | // qDebug("tabchanged: REMOTE VIEW SHOWN"); |
80 | } | 80 | } |
81 | qApp->processEvents(); | 81 | qApp->processEvents(); |
82 | QString path = CurrentDir()->canonicalPath(); | 82 | QString path = CurrentDir()->canonicalPath(); |
83 | // qDebug(path); | 83 | // qDebug(path); |
84 | if ( TabWidget->currentWidget() == tab) { | 84 | if ( TabWidget->currentWidget() == tab) { |
85 | viewMenu->setItemChecked(viewMenu->idAt(0), true); | 85 | viewMenu->setItemChecked(viewMenu->idAt(0), true); |
86 | viewMenu->setItemChecked(viewMenu->idAt(1), false); | 86 | viewMenu->setItemChecked(viewMenu->idAt(1), false); |
87 | } else { | 87 | } else { |
88 | viewMenu->setItemChecked(viewMenu->idAt(0), false); | 88 | viewMenu->setItemChecked(viewMenu->idAt(0), false); |
89 | viewMenu->setItemChecked(viewMenu->idAt(1), true); | 89 | viewMenu->setItemChecked(viewMenu->idAt(1), true); |
90 | } | 90 | } |
91 | 91 | ||
92 | QString fs= getFileSystemType( (const QString &) path); | ||
93 | |||
94 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | ||
95 | +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); | ||
96 | chdir( path.latin1()); | 92 | chdir( path.latin1()); |
97 | currentPathCombo->lineEdit()->setText(path); | 93 | currentPathCombo->lineEdit()->setText(path); |
98 | } | 94 | } |
99 | 95 | ||
100 | 96 | ||
101 | void AdvancedFm::populateView() { | 97 | void AdvancedFm::populateView() { |
102 | 98 | ||
103 | QPixmap pm; | 99 | QPixmap pm; |
104 | QListView *thisView = CurrentView(); | 100 | QListView *thisView = CurrentView(); |
105 | QDir *thisDir = CurrentDir(); | 101 | QDir *thisDir = CurrentDir(); |
106 | QString path = thisDir->canonicalPath(); | 102 | QString path = thisDir->canonicalPath(); |
107 | 103 | ||
108 | thisView->clear(); | 104 | thisView->clear(); |
109 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 105 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
110 | thisDir->setMatchAllDirs(TRUE); | 106 | thisDir->setMatchAllDirs(TRUE); |
111 | thisDir->setNameFilter(filterStr); | 107 | thisDir->setNameFilter(filterStr); |
112 | QString fileL, fileS, fileDate; | 108 | QString fileL, fileS, fileDate; |
113 | QString fs= getFileSystemType((const QString &) path); | 109 | |
110 | QString fs = getFileSystemType((const QString &) path); | ||
114 | setCaption(tr("AdvancedFm :: ")+fs+" :: " | 111 | setCaption(tr("AdvancedFm :: ")+fs+" :: " |
115 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); | 112 | +checkDiskSpace((const QString &) path)+ tr(" kB free") ); |
116 | bool isDir=FALSE; | 113 | bool isDir = FALSE; |
114 | |||
117 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 115 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
118 | QFileInfoListIterator it(*list); | 116 | QFileInfoListIterator it(*list); |
119 | QFileInfo *fi; | 117 | QFileInfo *fi; |
120 | while ( (fi=it.current()) ) { | 118 | while ( (fi=it.current()) ) { |
121 | if (fi->isSymLink() ) { | 119 | if (fi->isSymLink() ) { |
122 | QString symLink=fi->readLink(); | 120 | QString symLink = fi->readLink(); |
123 | QFileInfo sym( symLink); | 121 | QFileInfo sym( symLink); |
124 | fileS.sprintf( "%10i", sym.size() ); | 122 | fileS.sprintf( "%10i", sym.size() ); |
125 | fileL = fi->fileName() +" -> " + sym.filePath().data(); | 123 | fileL = fi->fileName() +" -> " + sym.filePath().data(); |
126 | fileDate = sym.lastModified().toString(); | 124 | fileDate = sym.lastModified().toString(); |
127 | } else { | 125 | } else { |
128 | fileS.sprintf( "%10i", fi->size() ); | 126 | fileS.sprintf( "%10i", fi->size() ); |
129 | fileL = fi->fileName(); | 127 | fileL = fi->fileName(); |
130 | fileDate= fi->lastModified().toString(); | 128 | fileDate= fi->lastModified().toString(); |
131 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { | 129 | if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { |
132 | // if(fileL == "..") | 130 | // if(fileL == "..") |
133 | fileL += "/"; | 131 | fileL += "/"; |
134 | isDir=TRUE; | 132 | isDir=TRUE; |
135 | } | 133 | } |
136 | } | 134 | } |
137 | QFileInfo fileInfo( path + "/" + fileL); | 135 | QFileInfo fileInfo( path + "/" + fileL); |
138 | 136 | ||
139 | if(fileL !="./" && fi->exists()) { | 137 | if(fileL !="./" && fi->exists()) { |
140 | item = new QListViewItem( thisView, fileL, fileS , fileDate); | 138 | item = new QListViewItem( thisView, fileL, fileS , fileDate); |
141 | 139 | ||
142 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 140 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
143 | 141 | ||
144 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 142 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
145 | pm = Resource::loadPixmap( "lockedfolder" ); | 143 | pm = Resource::loadPixmap( "lockedfolder" ); |
146 | else | 144 | else |
147 | pm= Resource::loadPixmap( "folder" ); | 145 | pm= Resource::loadPixmap( "folder" ); |
148 | } | 146 | } |
149 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 147 | else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
150 | pm = Resource::loadPixmap( "exec"); | 148 | pm = Resource::loadPixmap( "exec"); |
151 | } | 149 | } |
152 | else if( (fileInfo.permission( QFileInfo::ExeUser) | 150 | else if( (fileInfo.permission( QFileInfo::ExeUser) |
153 | | fileInfo.permission( QFileInfo::ExeGroup) | 151 | | fileInfo.permission( QFileInfo::ExeGroup) |
154 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 152 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
155 | pm = Resource::loadPixmap( "exec"); | 153 | pm = Resource::loadPixmap( "exec"); |
156 | } | 154 | } |
157 | else if( !fi->isReadable() ) { | 155 | else if( !fi->isReadable() ) { |
158 | pm = Resource::loadPixmap( "locked" ); | 156 | pm = Resource::loadPixmap( "locked" ); |
159 | } | 157 | } |
160 | else { //everything else goes by mimetype | 158 | else { //everything else goes by mimetype |
161 | MimeType mt(fi->filePath()); | 159 | MimeType mt(fi->filePath()); |
162 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 160 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
163 | if(pm.isNull()) { | 161 | if(pm.isNull()) { |
164 | pm = unknownXpm; | 162 | pm = unknownXpm; |
165 | } | 163 | } |
166 | } | 164 | } |
167 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { | 165 | if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { |
168 | // odebug << " overlay link image" << oendl; | 166 | // odebug << " overlay link image" << oendl; |
169 | pm= Resource::loadPixmap( "advancedfm/symlink" ); | 167 | pm= Resource::loadPixmap( "advancedfm/symlink" ); |
170 | // pm= Resource::loadPixmap( "folder" ); | 168 | // pm= Resource::loadPixmap( "folder" ); |
@@ -278,119 +276,119 @@ void AdvancedFm::switchToRemoteTab() { | |||
278 | // Remote_View->setFocus(); | 276 | // Remote_View->setFocus(); |
279 | whichTab = 2; | 277 | whichTab = 2; |
280 | } | 278 | } |
281 | 279 | ||
282 | void AdvancedFm::currentPathComboChanged() { | 280 | void AdvancedFm::currentPathComboChanged() { |
283 | QString pDir = currentPathCombo->lineEdit()->text(); | 281 | QString pDir = currentPathCombo->lineEdit()->text(); |
284 | if(QDir(pDir).exists()) { | 282 | if(QDir(pDir).exists()) { |
285 | CurrentDir()->setPath(pDir ); | 283 | CurrentDir()->setPath(pDir ); |
286 | populateView(); | 284 | populateView(); |
287 | } else { | 285 | } else { |
288 | QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); | 286 | QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); |
289 | } | 287 | } |
290 | } | 288 | } |
291 | 289 | ||
292 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 290 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
293 | 291 | ||
294 | if ( TabWidget->currentWidget() == tab) { | 292 | if ( TabWidget->currentWidget() == tab) { |
295 | // if ( whichTab == 1) { | 293 | // if ( whichTab == 1) { |
296 | currentPathCombo->lineEdit()->setText( currentPath); | 294 | currentPathCombo->lineEdit()->setText( currentPath); |
297 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 295 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
298 | currentPathCombo->clear(); | 296 | currentPathCombo->clear(); |
299 | localDirPathStringList.prepend( currentPath ); | 297 | localDirPathStringList.prepend( currentPath ); |
300 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 298 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
301 | } | 299 | } |
302 | } else { | 300 | } else { |
303 | currentPathCombo->lineEdit()->setText( currentPath); | 301 | currentPathCombo->lineEdit()->setText( currentPath); |
304 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 302 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
305 | currentPathCombo->clear(); | 303 | currentPathCombo->clear(); |
306 | remoteDirPathStringList.prepend( currentPath ); | 304 | remoteDirPathStringList.prepend( currentPath ); |
307 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 305 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
308 | } | 306 | } |
309 | } | 307 | } |
310 | } | 308 | } |
311 | 309 | ||
312 | QStringList AdvancedFm::getPath() { | 310 | QStringList AdvancedFm::getPath() { |
313 | QStringList strList; | 311 | QStringList strList; |
314 | QListView *thisView=CurrentView(); | 312 | QListView *thisView=CurrentView(); |
315 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 313 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
316 | QListViewItemIterator it( thisView ); | 314 | QListViewItemIterator it( thisView ); |
317 | for ( ; it.current(); ++it ) { | 315 | for ( ; it.current(); ++it ) { |
318 | if ( it.current()->isSelected() ) { | 316 | if ( it.current()->isSelected() ) { |
319 | strList << it.current()->text(0); | 317 | strList << it.current()->text(0); |
320 | // odebug << it.current()->text(0) << oendl; | 318 | // odebug << it.current()->text(0) << oendl; |
321 | } | 319 | } |
322 | } | 320 | } |
323 | return strList; | 321 | return strList; |
324 | } | 322 | } |
325 | 323 | ||
326 | void AdvancedFm::changeTo(const QString dir) { | 324 | void AdvancedFm::changeTo(const QString &dir) { |
327 | chdir( dir.latin1()); | 325 | chdir( dir.latin1()); |
328 | CurrentDir()->cd(dir, TRUE); | 326 | CurrentDir()->cd(dir, TRUE); |
329 | populateView(); | 327 | populateView(); |
330 | update(); | 328 | update(); |
331 | } | 329 | } |
332 | 330 | ||
333 | void AdvancedFm::homeButtonPushed() { | 331 | void AdvancedFm::homeButtonPushed() { |
334 | changeTo(QDir::homeDirPath()); | 332 | changeTo(QDir::homeDirPath()); |
335 | } | 333 | } |
336 | 334 | ||
337 | void AdvancedFm::docButtonPushed() { | 335 | void AdvancedFm::docButtonPushed() { |
338 | changeTo(QPEApplication::documentDir()); | 336 | changeTo(QPEApplication::documentDir()); |
339 | } | 337 | } |
340 | 338 | ||
341 | void AdvancedFm::SDButtonPushed() { | 339 | void AdvancedFm::SDButtonPushed() { |
342 | Opie::Core::OStorageInfo info; | 340 | Opie::Core::OStorageInfo info; |
343 | changeTo(info.sdPath()); | 341 | changeTo(info.sdPath()); |
344 | } | 342 | } |
345 | 343 | ||
346 | void AdvancedFm::CFButtonPushed() { | 344 | void AdvancedFm::CFButtonPushed() { |
347 | Opie::Core::OStorageInfo info; | 345 | Opie::Core::OStorageInfo info; |
348 | changeTo(info.cfPath()); | 346 | changeTo(info.cfPath()); |
349 | } | 347 | } |
350 | 348 | ||
351 | void AdvancedFm::QPEButtonPushed() { | 349 | void AdvancedFm::QPEButtonPushed() { |
352 | changeTo(QPEApplication::qpeDir()); | 350 | changeTo(QPEApplication::qpeDir()); |
353 | } | 351 | } |
354 | 352 | ||
355 | void AdvancedFm::doAbout() { | 353 | void AdvancedFm::doAbout() { |
356 | QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); | 354 | QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); |
357 | } | 355 | } |
358 | 356 | ||
359 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { | 357 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { |
360 | Q_UNUSED(e); | 358 | Q_UNUSED(e); |
361 | } | 359 | } |
362 | 360 | ||
363 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | 361 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
364 | // if( CurrentView()->hasFocus() ) | 362 | // if( CurrentView()->hasFocus() ) |
365 | // e->ignore(); | 363 | // e->ignore(); |
366 | if( currentPathCombo->lineEdit()->hasFocus()) { | 364 | if( currentPathCombo->lineEdit()->hasFocus()) { |
367 | // qDebug("shout!"); | 365 | // qDebug("shout!"); |
368 | } | 366 | } |
369 | 367 | ||
370 | else if( e->key() == Key_Left ) | 368 | else if( e->key() == Key_Left ) |
371 | upDir(); | 369 | upDir(); |
372 | else if( e->key() == Key_Return || e->key() == Key_Enter) | 370 | else if( e->key() == Key_Return || e->key() == Key_Enter) |
373 | navigateToSelected(); | 371 | navigateToSelected(); |
374 | else if( e->key() == Key_Tab) | 372 | else if( e->key() == Key_Tab) |
375 | setOtherTabCurrent(); | 373 | setOtherTabCurrent(); |
376 | else if( e->key() == Key_Delete ) | 374 | else if( e->key() == Key_Delete ) |
377 | del(); | 375 | del(); |
378 | else if( e->key() == Key_A) | 376 | else if( e->key() == Key_A) |
379 | copyAs(); | 377 | copyAs(); |
380 | else if( e->key() == Key_C) | 378 | else if( e->key() == Key_C) |
381 | copy(); | 379 | copy(); |
382 | else if( e->key() == Key_E) | 380 | else if( e->key() == Key_E) |
383 | runThis(); | 381 | runThis(); |
384 | else if( e->key() == Key_G) | 382 | else if( e->key() == Key_G) |
385 | currentPathCombo->lineEdit()->setFocus(); | 383 | currentPathCombo->lineEdit()->setFocus(); |
386 | else if( e->key() == Key_H ) | 384 | else if( e->key() == Key_H ) |
387 | showHidden(); | 385 | showHidden(); |
388 | else if( e->key() == Key_I) | 386 | else if( e->key() == Key_I) |
389 | fileStatus(); | 387 | fileStatus(); |
390 | else if( e->key() == Key_M) | 388 | else if( e->key() == Key_M) |
391 | move(); | 389 | move(); |
392 | else if( e->key() == Key_N ) | 390 | else if( e->key() == Key_N ) |
393 | mkDir(); | 391 | mkDir(); |
394 | else if( e->key() == Key_P) | 392 | else if( e->key() == Key_P) |
395 | filePerms(); | 393 | filePerms(); |
396 | else if( e->key() == Key_R ) | 394 | else if( e->key() == Key_R ) |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index c25bce2..a4f2510 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -51,102 +51,102 @@ class QToolButton; | |||
51 | class Ir; | 51 | class Ir; |
52 | 52 | ||
53 | class AdvancedFm : public QMainWindow | 53 | class AdvancedFm : public QMainWindow |
54 | { | 54 | { |
55 | Q_OBJECT | 55 | Q_OBJECT |
56 | public: | 56 | public: |
57 | static QString appName() { return QString::fromLatin1("advancedfm"); } | 57 | static QString appName() { return QString::fromLatin1("advancedfm"); } |
58 | AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); | 58 | AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); |
59 | ~AdvancedFm(); | 59 | ~AdvancedFm(); |
60 | protected: | 60 | protected: |
61 | 61 | ||
62 | Opie::Ui::OSplitter *TabWidget; | 62 | Opie::Ui::OSplitter *TabWidget; |
63 | QCopChannel * channel; | 63 | QCopChannel * channel; |
64 | QPixmap unknownXpm; | 64 | QPixmap unknownXpm; |
65 | int whichTab; | 65 | int whichTab; |
66 | // QTabWidget *TabWidget; | 66 | // QTabWidget *TabWidget; |
67 | QWidget *tab, *tab_2, *tab_3; | 67 | QWidget *tab, *tab_2, *tab_3; |
68 | QListView *Local_View, *Remote_View; | 68 | QListView *Local_View, *Remote_View; |
69 | 69 | ||
70 | QLineEdit *currentPathEdit; | 70 | QLineEdit *currentPathEdit; |
71 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; | 71 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; |
72 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 72 | QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
73 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; | 73 | // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; |
74 | QDir currentDir, currentRemoteDir; | 74 | QDir currentDir, currentRemoteDir; |
75 | QComboBox *currentPathCombo; | 75 | QComboBox *currentPathCombo; |
76 | QString filterStr, s_addBookmark, s_removeBookmark; | 76 | QString filterStr, s_addBookmark, s_removeBookmark; |
77 | QListViewItem * item; | 77 | QListViewItem * item; |
78 | bool b; | 78 | bool b; |
79 | QStringList fileSystemTypeList, fsList; | 79 | QStringList fileSystemTypeList, fsList; |
80 | int currentServerConfig; | 80 | int currentServerConfig; |
81 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 81 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
82 | QStringList remoteDirPathStringList, localDirPathStringList; | 82 | QStringList remoteDirPathStringList, localDirPathStringList; |
83 | QLineEdit *renameBox; | 83 | QLineEdit *renameBox; |
84 | 84 | ||
85 | void init(); | 85 | void init(); |
86 | void initConnections(); | 86 | void initConnections(); |
87 | void keyReleaseEvent( QKeyEvent *); | 87 | void keyReleaseEvent( QKeyEvent *); |
88 | void keyPressEvent( QKeyEvent *); | 88 | void keyPressEvent( QKeyEvent *); |
89 | QString getFileSystemType(const QString &); | 89 | QString getFileSystemType(const QString &); |
90 | QString getDiskSpace(const QString &); | 90 | QString getDiskSpace(const QString &); |
91 | void parsetab(const QString &fileName); | 91 | void parsetab(const QString &fileName); |
92 | QString checkDiskSpace(const QString &); | 92 | QString checkDiskSpace(const QString &); |
93 | QString dealWithSymName(const QString &); | 93 | QString dealWithSymName(const QString &); |
94 | QDir *CurrentDir(); | 94 | QDir *CurrentDir(); |
95 | QDir *OtherDir(); | 95 | QDir *OtherDir(); |
96 | QListView *CurrentView(); | 96 | QListView *CurrentView(); |
97 | QListView *OtherView(); | 97 | QListView *OtherView(); |
98 | void setOtherTabCurrent(); | 98 | void setOtherTabCurrent(); |
99 | void changeTo(const QString dir); | ||
100 | 99 | ||
101 | //protected signals: | 100 | //protected signals: |
102 | // void newPath(QString); | 101 | // void newPath(QString); |
103 | 102 | ||
104 | protected slots: | 103 | protected slots: |
104 | void changeTo(const QString &); | ||
105 | void slotSwitchMenu(int); | 105 | void slotSwitchMenu(int); |
106 | void selectAll(); | 106 | void selectAll(); |
107 | void addToDocs(); | 107 | void addToDocs(); |
108 | void doDirChange(); | 108 | void doDirChange(); |
109 | void mkDir(); | 109 | void mkDir(); |
110 | void del(); | 110 | void del(); |
111 | void rn(); | 111 | void rn(); |
112 | void populateView(); | 112 | void populateView(); |
113 | void rePopulate(); | 113 | void rePopulate(); |
114 | void showHidden(); | 114 | void showHidden(); |
115 | void showMenuHidden(); | 115 | void showMenuHidden(); |
116 | void ListClicked(QListViewItem *); | 116 | void ListClicked(QListViewItem *); |
117 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 117 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
118 | void makeDir(); | 118 | void makeDir(); |
119 | void doDelete(); | 119 | void doDelete(); |
120 | void tabChanged(QWidget*); | 120 | void tabChanged(QWidget*); |
121 | void cleanUp(); | 121 | void cleanUp(); |
122 | void renameIt(); | 122 | void renameIt(); |
123 | void runThis(); | 123 | void runThis(); |
124 | void runText(); | 124 | void runText(); |
125 | void filePerms(); | 125 | void filePerms(); |
126 | void doProperties(); | 126 | void doProperties(); |
127 | void runCommand(); | 127 | void runCommand(); |
128 | void runCommandStd(); | 128 | void runCommandStd(); |
129 | QStringList getPath(); | 129 | QStringList getPath(); |
130 | void mkSym(); | 130 | void mkSym(); |
131 | void switchToLocalTab(); | 131 | void switchToLocalTab(); |
132 | void switchToRemoteTab(); | 132 | void switchToRemoteTab(); |
133 | void refreshCurrentTab(); | 133 | void refreshCurrentTab(); |
134 | 134 | ||
135 | void openSearch(); | 135 | void openSearch(); |
136 | void dirMenuSelected(int); | 136 | void dirMenuSelected(int); |
137 | void showFileMenu(); | 137 | void showFileMenu(); |
138 | void homeButtonPushed(); | 138 | void homeButtonPushed(); |
139 | void docButtonPushed(); | 139 | void docButtonPushed(); |
140 | void SDButtonPushed(); | 140 | void SDButtonPushed(); |
141 | void CFButtonPushed(); | 141 | void CFButtonPushed(); |
142 | void QPEButtonPushed(); | 142 | void QPEButtonPushed(); |
143 | void upDir(); | 143 | void upDir(); |
144 | void currentPathComboChanged(); | 144 | void currentPathComboChanged(); |
145 | 145 | ||
146 | void copy(); | 146 | void copy(); |
147 | void copyTimer(); | 147 | void copyTimer(); |
148 | void copyAs(); | 148 | void copyAs(); |
149 | void copyAsTimer(); | 149 | void copyAsTimer(); |
150 | void copySameDir(); | 150 | void copySameDir(); |
151 | void copySameDirTimer(); | 151 | void copySameDirTimer(); |
152 | void move(); | 152 | void move(); |
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index 713f61c..01ea8f4 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro | |||
@@ -1,15 +1,15 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qte warn_on quick-app | 2 | CONFIG += qte warn_on quick-app debug |
3 | HEADERS = advancedfm.h filePermissions.h output.h | 3 | HEADERS = advancedfm.h filePermissions.h output.h |
4 | SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp | 4 | SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp |
5 | TARGET = advancedfm | 5 | TARGET = advancedfm |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DEPENDPATH += $(OPIEDIR)/include | 7 | DEPENDPATH += $(OPIEDIR)/include |
8 | LIBS += -lqpe -lqte -lopiecore2 -lopieui2 | 8 | LIBS += -lqpe -lqte -lopiecore2 -lopieui2 |
9 | 9 | ||
10 | !contains(CONFIG,quick-app) { | 10 | !contains(CONFIG,quick-app) { |
11 | DESTDIR = $(OPIEDIR)/bin | 11 | DESTDIR = $(OPIEDIR)/bin |
12 | DEFINES += NOQUICKLAUNCH | 12 | DEFINES += NOQUICKLAUNCH |
13 | } | 13 | } |
14 | 14 | ||
15 | include ( $(OPIEDIR)/include.pro ) | 15 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 7b3dcf6..171e7c4 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -671,99 +671,98 @@ void AdvancedFm::mkSym() { | |||
671 | 671 | ||
672 | if( curFile.right(1) == "/") { | 672 | if( curFile.right(1) == "/") { |
673 | curFile = curFile.left( curFile.length() -1); | 673 | curFile = curFile.left( curFile.length() -1); |
674 | } | 674 | } |
675 | 675 | ||
676 | cmd = "ln -s "+curFile+" "+destName; | 676 | cmd = "ln -s "+curFile+" "+destName; |
677 | // odebug << cmd << oendl; | 677 | // odebug << cmd << oendl; |
678 | startProcess( (const QString)cmd ); | 678 | startProcess( (const QString)cmd ); |
679 | } | 679 | } |
680 | rePopulate(); | 680 | rePopulate(); |
681 | setOtherTabCurrent(); | 681 | setOtherTabCurrent(); |
682 | } | 682 | } |
683 | } | 683 | } |
684 | 684 | ||
685 | void AdvancedFm::doBeam() { | 685 | void AdvancedFm::doBeam() { |
686 | Ir ir; | 686 | Ir ir; |
687 | if(!ir.supported()) { | 687 | if(!ir.supported()) { |
688 | } else { | 688 | } else { |
689 | QStringList curFileList = getPath(); | 689 | QStringList curFileList = getPath(); |
690 | if( curFileList.count() > 0) { | 690 | if( curFileList.count() > 0) { |
691 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 691 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
692 | QString curFile = (*it); | 692 | QString curFile = (*it); |
693 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; | 693 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; |
694 | if( curFilePath.right(1) == "/") { | 694 | if( curFilePath.right(1) == "/") { |
695 | curFilePath = curFilePath.left( curFilePath.length() -1); | 695 | curFilePath = curFilePath.left( curFilePath.length() -1); |
696 | } | 696 | } |
697 | Ir *file = new Ir(this, "IR"); | 697 | Ir *file = new Ir(this, "IR"); |
698 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); | 698 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); |
699 | file->send( curFilePath, curFile ); | 699 | file->send( curFilePath, curFile ); |
700 | } | 700 | } |
701 | } | 701 | } |
702 | } | 702 | } |
703 | } | 703 | } |
704 | 704 | ||
705 | void AdvancedFm::fileBeamFinished( Ir *) { | 705 | void AdvancedFm::fileBeamFinished( Ir *) { |
706 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 706 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
707 | } | 707 | } |
708 | 708 | ||
709 | void AdvancedFm::selectAll() { | 709 | void AdvancedFm::selectAll() { |
710 | QListView *thisView = CurrentView(); | 710 | QListView *thisView = CurrentView(); |
711 | thisView->selectAll(true); | 711 | thisView->selectAll(true); |
712 | thisView->setSelected( thisView->firstChild(),false); | 712 | thisView->setSelected( thisView->firstChild(),false); |
713 | } | 713 | } |
714 | 714 | ||
715 | void AdvancedFm::startProcess(const QString & cmd) { | 715 | void AdvancedFm::startProcess(const QString & cmd) { |
716 | QStringList command; | 716 | QStringList command; |
717 | OProcess *process; | 717 | OProcess *process; |
718 | process = new OProcess(); | 718 | process = new OProcess(); |
719 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT( processEnded(Opie::Core::OProcess*))); | 719 | connect(process,SIGNAL(processExited(Opie::Core::OProcess*)),this,SLOT(processEnded(Opie::Core::OProcess*))); |
720 | 720 | connect(process,SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),this,SLOT(oprocessStderr(Opie::Core::OProcess*,char*,int))); | |
721 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); | ||
722 | 721 | ||
723 | command << "/bin/sh"; | 722 | command << "/bin/sh"; |
724 | command << "-c"; | 723 | command << "-c"; |
725 | command << cmd.latin1(); | 724 | command << cmd.latin1(); |
726 | *process << command; | 725 | *process << command; |
727 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) | 726 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) |
728 | odebug << "could not start process" << oendl; | 727 | odebug << "could not start process" << oendl; |
729 | } | 728 | } |
730 | 729 | ||
731 | void AdvancedFm::processEnded(OProcess *) { | 730 | void AdvancedFm::processEnded(OProcess *) { |
732 | rePopulate(); | 731 | rePopulate(); |
733 | } | 732 | } |
734 | 733 | ||
735 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { | 734 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { |
736 | // owarn << "received stderrt " << buflen << " bytes" << oendl; | 735 | // owarn << "received stderrt " << buflen << " bytes" << oendl; |
737 | 736 | ||
738 | QString lineStr = buffer; | 737 | QString lineStr = buffer; |
739 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); | 738 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); |
740 | } | 739 | } |
741 | 740 | ||
742 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | 741 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { |
743 | if ( o->inherits( "QLineEdit" ) ) { | 742 | if ( o->inherits( "QLineEdit" ) ) { |
744 | if ( e->type() == QEvent::KeyPress ) { | 743 | if ( e->type() == QEvent::KeyPress ) { |
745 | QKeyEvent *ke = (QKeyEvent*)e; | 744 | QKeyEvent *ke = (QKeyEvent*)e; |
746 | if ( ke->key() == Key_Return || | 745 | if ( ke->key() == Key_Return || |
747 | ke->key() == Key_Enter ) { | 746 | ke->key() == Key_Enter ) { |
748 | okRename(); | 747 | okRename(); |
749 | return true; | 748 | return true; |
750 | } | 749 | } |
751 | else if ( ke->key() == Key_Escape ) { | 750 | else if ( ke->key() == Key_Escape ) { |
752 | cancelRename(); | 751 | cancelRename(); |
753 | return true; | 752 | return true; |
754 | } | 753 | } |
755 | } | 754 | } |
756 | else if ( e->type() == QEvent::FocusOut ) { | 755 | else if ( e->type() == QEvent::FocusOut ) { |
757 | cancelRename(); | 756 | cancelRename(); |
758 | return true; | 757 | return true; |
759 | } | 758 | } |
760 | } | 759 | } |
761 | /* if ( o->inherits( "QListView" ) ) { | 760 | /* if ( o->inherits( "QListView" ) ) { |
762 | if ( e->type() == QEvent::FocusIn ) { | 761 | if ( e->type() == QEvent::FocusIn ) { |
763 | // if( o == Local_View) { //keep track of which view | 762 | // if( o == Local_View) { //keep track of which view |
764 | // qDebug("local view"); | 763 | // qDebug("local view"); |
765 | // whichTab = 1; | 764 | // whichTab = 1; |
766 | // } else { | 765 | // } else { |
767 | // whichTab = 2; | 766 | // whichTab = 2; |
768 | // qDebug("remote view"); | 767 | // qDebug("remote view"); |
769 | // } | 768 | // } |