summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfm.cpp
authoralwin <alwin>2004-03-02 12:21:11 (UTC)
committer alwin <alwin>2004-03-02 12:21:11 (UTC)
commitb6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff)
treed3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/apps/advancedfm/advancedfm.cpp
parent0d59c780513da78033f4d9040475dee9db0256d4 (diff)
downloadopie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index c44d387..2ba3dca 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,149 +1,149 @@
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 <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/config.h> 16#include <qpe/config.h>
17#include <qpe/mimetype.h> 17#include <qpe/mimetype.h>
18#include <qpe/applnk.h> 18#include <qpe/applnk.h>
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20#include <qpe/menubutton.h> 20#include <qpe/menubutton.h>
21 21
22#include <qcombobox.h> 22#include <qcombobox.h>
23#include <qpopupmenu.h> 23#include <qpopupmenu.h>
24#include <qlistview.h> 24#include <qlistview.h>
25#include <qmessagebox.h> 25#include <qmessagebox.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27 27
28 28
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <time.h> 30#include <time.h>
31#include <dirent.h> 31#include <dirent.h>
32#include <fcntl.h> 32#include <fcntl.h>
33#include <sys/vfs.h> 33#include <sys/vfs.h>
34#include <mntent.h> 34#include <mntent.h>
35 35
36#ifdef NOQUICKLAUNCH 36#ifdef NOQUICKLAUNCH
37AdvancedFm::AdvancedFm( ) 37AdvancedFm::AdvancedFm( )
38#else 38#else
39AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) 39AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
40#endif 40#endif
41 : QMainWindow( ) { 41 : QMainWindow( ) {
42 init(); 42 init();
43 renameBox = 0; 43 renameBox = 0;
44 44
45 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 45 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
46 46
47 initConnections(); 47 initConnections();
48 whichTab=1; 48 whichTab=1;
49 rePopulate(); 49 rePopulate();
50 currentPathCombo->setFocus(); 50 currentPathCombo->setFocus();
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&)), 52 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
53 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); 53 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) );
54} 54}
55 55
56AdvancedFm::~AdvancedFm() { 56AdvancedFm::~AdvancedFm() {
57} 57}
58 58
59 59
60void AdvancedFm::cleanUp() { 60void 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
71void AdvancedFm::tabChanged(QWidget *) { 71void AdvancedFm::tabChanged(QWidget *) {
72// qWarning("tab changed"); 72// qWarning("tab changed");
73 QString path = CurrentDir()->canonicalPath(); 73 QString path = CurrentDir()->canonicalPath();
74 currentPathCombo->lineEdit()->setText( path ); 74 currentPathCombo->lineEdit()->setText( path );
75 75
76 if(whichTab == 1) { 76 if(whichTab == 1) {
77 viewMenu->setItemChecked(viewMenu->idAt(0), true); 77 viewMenu->setItemChecked(viewMenu->idAt(0), true);
78 viewMenu->setItemChecked(viewMenu->idAt(1), false); 78 viewMenu->setItemChecked(viewMenu->idAt(1), false);
79 } else { 79 } else {
80 viewMenu->setItemChecked(viewMenu->idAt(0), false); 80 viewMenu->setItemChecked(viewMenu->idAt(0), false);
81 viewMenu->setItemChecked(viewMenu->idAt(1), true); 81 viewMenu->setItemChecked(viewMenu->idAt(1), true);
82 } 82 }
83 83
84 QString fs= getFileSystemType( (const QString &) path); 84 QString fs= getFileSystemType( (const QString &) path);
85 85
86 setCaption(tr("AdvancedFm :: ")+fs+" :: " 86 setCaption(tr("AdvancedFm :: ")+fs+" :: "
87 +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); 87 +checkDiskSpace( (const QString &) path )+ tr(" kB free") );
88 chdir( path.latin1()); 88 chdir( path.latin1());
89} 89}
90 90
91 91
92void AdvancedFm::populateView() { 92void AdvancedFm::populateView() {
93 93
94// qWarning("PopulateView"); 94// qWarning("PopulateView");
95 QPixmap pm; 95 QPixmap pm;
96 QListView *thisView = CurrentView(); 96 QListView *thisView = CurrentView();
97 QDir *thisDir = CurrentDir(); 97 QDir *thisDir = CurrentDir();
98 QString path = thisDir->canonicalPath(); 98 QString path = thisDir->canonicalPath();
99 99
100//qWarning("path is "+path); 100//qWarning("path is "+path);
101 thisView->clear(); 101 thisView->clear();
102 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 102 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
103 thisDir->setMatchAllDirs(TRUE); 103 thisDir->setMatchAllDirs(TRUE);
104 thisDir->setNameFilter(filterStr); 104 thisDir->setNameFilter(filterStr);
105 QString fileL, fileS, fileDate; 105 QString fileL, fileS, fileDate;
106 QString fs= getFileSystemType((const QString &) path); 106 QString fs= getFileSystemType((const QString &) path);
107 setCaption(tr("AdvancedFm :: ")+fs+" :: " 107 setCaption(tr("AdvancedFm :: ")+fs+" :: "
108 +checkDiskSpace((const QString &) path)+ tr(" kB free") ); 108 +checkDiskSpace((const QString &) path)+ tr(" kB free") );
109 bool isDir=FALSE; 109 bool isDir=FALSE;
110 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 110 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
111 QFileInfoListIterator it(*list); 111 QFileInfoListIterator it(*list);
112 QFileInfo *fi; 112 QFileInfo *fi;
113 while ( (fi=it.current()) ) { 113 while ( (fi=it.current()) ) {
114 if (fi->isSymLink() ) { 114 if (fi->isSymLink() ) {
115 QString symLink=fi->readLink(); 115 QString symLink=fi->readLink();
116 QFileInfo sym( symLink); 116 QFileInfo sym( symLink);
117 fileS.sprintf( "%10i", sym.size() ); 117 fileS.sprintf( "%10i", sym.size() );
118 fileL = fi->fileName() +" -> " + sym.filePath().data(); 118 fileL = fi->fileName() +" -> " + sym.filePath().data();
119 fileDate = sym.lastModified().toString(); 119 fileDate = sym.lastModified().toString();
120 } else { 120 } else {
121 fileS.sprintf( "%10i", fi->size() ); 121 fileS.sprintf( "%10i", fi->size() );
122 fileL = fi->fileName(); 122 fileL = fi->fileName();
123 fileDate= fi->lastModified().toString(); 123 fileDate= fi->lastModified().toString();
124 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { 124 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
125// if(fileL == "..") 125// if(fileL == "..")
126 fileL += "/"; 126 fileL += "/";
127 isDir=TRUE; 127 isDir=TRUE;
128 } 128 }
129 } 129 }
130 QFileInfo fileInfo( path + "/" + fileL); 130 QFileInfo fileInfo( path + "/" + fileL);
131 131
132 if(fileL !="./" && fi->exists()) { 132 if(fileL !="./" && fi->exists()) {
133 item = new QListViewItem( thisView, fileL, fileS , fileDate); 133 item = new QListViewItem( thisView, fileL, fileS , fileDate);
134 134
135 if(isDir || fileL.find("/",0,TRUE) != -1) { 135 if(isDir || fileL.find("/",0,TRUE) != -1) {
136 136
137 if( !QDir( fi->filePath() ).isReadable()) //is directory 137 if( !QDir( fi->filePath() ).isReadable()) //is directory
138 pm = Resource::loadPixmap( "lockedfolder" ); 138 pm = Resource::loadPixmap( "lockedfolder" );
139 else 139 else
140 pm= Resource::loadPixmap( "folder" ); 140 pm= Resource::loadPixmap( "folder" );
141 } 141 }
142 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 142 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
143 pm = Resource::loadPixmap( "exec"); 143 pm = Resource::loadPixmap( "exec");
144 } 144 }
145 else if( (fileInfo.permission( QFileInfo::ExeUser) 145 else if( (fileInfo.permission( QFileInfo::ExeUser)
146 | fileInfo.permission( QFileInfo::ExeGroup) 146 | fileInfo.permission( QFileInfo::ExeGroup)
147 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 147 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
148 pm = Resource::loadPixmap( "exec"); 148 pm = Resource::loadPixmap( "exec");
149 } 149 }