summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfm.cpp
authordrw <drw>2004-02-23 18:27:31 (UTC)
committer drw <drw>2004-02-23 18:27:31 (UTC)
commitbce2a9995fa423f9fc796b46c548e47a45c9d247 (patch) (unidiff)
treed6af972e78fa2ca9721172a14ce2d83bae35c2bd /noncore/apps/advancedfm/advancedfm.cpp
parent398c7d54acfc203ec90644d6c63e5b200391e906 (diff)
downloadopie-bce2a9995fa423f9fc796b46c548e47a45c9d247.zip
opie-bce2a9995fa423f9fc796b46c548e47a45c9d247.tar.gz
opie-bce2a9995fa423f9fc796b46c548e47a45c9d247.tar.bz2
AdvancedFM: libopie->libopie2
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp206
1 files changed, 100 insertions, 106 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 9c13e53..5148172 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -12,12 +12,6 @@
12#define DEVELOPERS_VERSION 12#define DEVELOPERS_VERSION
13#include "advancedfm.h" 13#include "advancedfm.h"
14 14
15
16// #include <opie/ofileselector.h>
17// #include <opie/ofiledialog.h>
18
19#include <opie/osplitter.h>
20
21#include <qpe/filemanager.h> 15#include <qpe/filemanager.h>
22#include <qpe/qcopenvelope_qws.h> 16#include <qpe/qcopenvelope_qws.h>
23#include <qpe/qpeapplication.h> 17#include <qpe/qpeapplication.h>
@@ -108,113 +102,113 @@ void AdvancedFm::tabChanged(QWidget *) {
108void AdvancedFm::populateView() { 102void AdvancedFm::populateView() {
109 103
110// qWarning("PopulateView"); 104// qWarning("PopulateView");
111 QPixmap pm; 105 QPixmap pm;
112 QListView *thisView = CurrentView(); 106 QListView *thisView = CurrentView();
113 QDir *thisDir = CurrentDir(); 107 QDir *thisDir = CurrentDir();
114 QString path = thisDir->canonicalPath(); 108 QString path = thisDir->canonicalPath();
115 109
116//qWarning("path is "+path); 110//qWarning("path is "+path);
117 thisView->clear(); 111 thisView->clear();
118 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 112 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
119 thisDir->setMatchAllDirs(TRUE); 113 thisDir->setMatchAllDirs(TRUE);
120 thisDir->setNameFilter(filterStr); 114 thisDir->setNameFilter(filterStr);
121 QString fileL, fileS, fileDate; 115 QString fileL, fileS, fileDate;
122 QString fs= getFileSystemType((const QString &) path); 116 QString fs= getFileSystemType((const QString &) path);
123 setCaption(tr("AdvancedFm :: ")+fs+" :: " 117 setCaption(tr("AdvancedFm :: ")+fs+" :: "
124 +checkDiskSpace((const QString &) path)+ tr(" kB free") ); 118 +checkDiskSpace((const QString &) path)+ tr(" kB free") );
125 bool isDir=FALSE; 119 bool isDir=FALSE;
126 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 120 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
127 QFileInfoListIterator it(*list); 121 QFileInfoListIterator it(*list);
128 QFileInfo *fi; 122 QFileInfo *fi;
129 while ( (fi=it.current()) ) { 123 while ( (fi=it.current()) ) {
130 if (fi->isSymLink() ) { 124 if (fi->isSymLink() ) {
131 QString symLink=fi->readLink(); 125 QString symLink=fi->readLink();
132 QFileInfo sym( symLink); 126 QFileInfo sym( symLink);
133 fileS.sprintf( "%10i", sym.size() ); 127 fileS.sprintf( "%10i", sym.size() );
134 fileL = fi->fileName() +" -> " + sym.filePath().data(); 128 fileL = fi->fileName() +" -> " + sym.filePath().data();
135 fileDate = sym.lastModified().toString(); 129 fileDate = sym.lastModified().toString();
136 } else { 130 } else {
137 fileS.sprintf( "%10i", fi->size() ); 131 fileS.sprintf( "%10i", fi->size() );
138 fileL = fi->fileName(); 132 fileL = fi->fileName();
139 fileDate= fi->lastModified().toString(); 133 fileDate= fi->lastModified().toString();
140 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { 134 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
141// if(fileL == "..") 135// if(fileL == "..")
142 fileL += "/"; 136 fileL += "/";
143 isDir=TRUE; 137 isDir=TRUE;
144 } 138 }
145 } 139 }
146 QFileInfo fileInfo( path + "/" + fileL); 140 QFileInfo fileInfo( path + "/" + fileL);
147 141
148 if(fileL !="./" && fi->exists()) { 142 if(fileL !="./" && fi->exists()) {
149 item = new QListViewItem( thisView, fileL, fileS , fileDate); 143 item = new QListViewItem( thisView, fileL, fileS , fileDate);
150 144
151 if(isDir || fileL.find("/",0,TRUE) != -1) { 145 if(isDir || fileL.find("/",0,TRUE) != -1) {
152 146
153 if( !QDir( fi->filePath() ).isReadable()) //is directory 147 if( !QDir( fi->filePath() ).isReadable()) //is directory
154 pm = Resource::loadPixmap( "lockedfolder" ); 148 pm = Resource::loadPixmap( "lockedfolder" );
155 else 149 else
156 pm= Resource::loadPixmap( "folder" ); 150 pm= Resource::loadPixmap( "folder" );
157 } 151 }
158 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 152 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
159 pm = Resource::loadPixmap( "exec"); 153 pm = Resource::loadPixmap( "exec");
160 } 154 }
161 else if( (fileInfo.permission( QFileInfo::ExeUser) 155 else if( (fileInfo.permission( QFileInfo::ExeUser)
162 | fileInfo.permission( QFileInfo::ExeGroup) 156 | fileInfo.permission( QFileInfo::ExeGroup)
163 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 157 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
164 pm = Resource::loadPixmap( "exec"); 158 pm = Resource::loadPixmap( "exec");
165 } 159 }
166 else if( !fi->isReadable() ) { 160 else if( !fi->isReadable() ) {
167 pm = Resource::loadPixmap( "locked" ); 161 pm = Resource::loadPixmap( "locked" );
168 } 162 }
169 else { //everything else goes by mimetype 163 else { //everything else goes by mimetype
170 MimeType mt(fi->filePath()); 164 MimeType mt(fi->filePath());
171 pm=mt.pixmap(); //sets the correct pixmap for mimetype 165 pm=mt.pixmap(); //sets the correct pixmap for mimetype
172 if(pm.isNull()) { 166 if(pm.isNull()) {
173 pm = unknownXpm; 167 pm = unknownXpm;
174 } 168 }
175 } 169 }
176 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { 170 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
177 // qDebug(" overlay link image"); 171 // qDebug(" overlay link image");
178 pm= Resource::loadPixmap( "advancedfm/symlink" ); 172 pm= Resource::loadPixmap( "advancedfm/symlink" );
179 // pm= Resource::loadPixmap( "folder" ); 173 // pm= Resource::loadPixmap( "folder" );
180// QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 174// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
181// QPainter painter( &pm ); 175// QPainter painter( &pm );
182// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 176// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
183// pm.setMask( pm.createHeuristicMask( FALSE ) ); 177// pm.setMask( pm.createHeuristicMask( FALSE ) );
184 } 178 }
185 item->setPixmap( 0,pm); 179 item->setPixmap( 0,pm);
186 180
187 } 181 }
188 isDir=FALSE; 182 isDir=FALSE;
189 ++it; 183 ++it;
190 } 184 }
191 185
192 if( path.find("dev",0,TRUE) != -1) { 186 if( path.find("dev",0,TRUE) != -1) {
193 struct stat buf; 187 struct stat buf;
194 dev_t devT; 188 dev_t devT;
195 DIR *dir; 189 DIR *dir;
196 struct dirent *mydirent; 190 struct dirent *mydirent;
197 191
198 if((dir = opendir( path.latin1())) != NULL) 192 if((dir = opendir( path.latin1())) != NULL)
199 while ((mydirent = readdir(dir)) != NULL) { 193 while ((mydirent = readdir(dir)) != NULL) {
200 lstat( mydirent->d_name, &buf); 194 lstat( mydirent->d_name, &buf);
201// qDebug(mydirent->d_name); 195// qDebug(mydirent->d_name);
202 fileL.sprintf("%s", mydirent->d_name); 196 fileL.sprintf("%s", mydirent->d_name);
203 devT = buf.st_dev; 197 devT = buf.st_dev;
204 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 198 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
205 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 199 fileDate.sprintf("%s", ctime( &buf.st_mtime));
206 if( fileL.find(".") == -1 ) { 200 if( fileL.find(".") == -1 ) {
207 item= new QListViewItem( thisView, fileL, fileS, fileDate); 201 item= new QListViewItem( thisView, fileL, fileS, fileDate);
208 pm = unknownXpm; 202 pm = unknownXpm;
209 item->setPixmap( 0,pm); 203 item->setPixmap( 0,pm);
210 } 204 }
211 } 205 }
212 206
213 closedir(dir); 207 closedir(dir);
214 } 208 }
215 209
216 thisView->setSorting( 3,FALSE); 210 thisView->setSorting( 3,FALSE);
217 fillCombo( (const QString &) path ); 211 fillCombo( (const QString &) path );
218} 212}
219 213
220void AdvancedFm::rePopulate() { 214void AdvancedFm::rePopulate() {
@@ -783,7 +777,7 @@ void AdvancedFm::gotoCustomDir(const QString &dir) {
783} 777}
784 778
785QDir *AdvancedFm::CurrentDir() { 779QDir *AdvancedFm::CurrentDir() {
786 780
787 if ( whichTab == 1) { 781 if ( whichTab == 1) {
788 return &currentDir; 782 return &currentDir;
789 } else { 783 } else {
@@ -824,7 +818,7 @@ void AdvancedFm::setOtherTabCurrent() {
824 TabWidget->setCurrentWidget(0); 818 TabWidget->setCurrentWidget(0);
825 } 819 }
826 OtherView()->setFocus(); 820 OtherView()->setFocus();
827 OtherView()->setSelected( CurrentView()->firstChild(), true); 821 OtherView()->setSelected( CurrentView()->firstChild(), true);
828} 822}
829 823
830void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 824void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
@@ -864,7 +858,7 @@ void AdvancedFm::gotoDirectory(const QString &file) {
864 } 858 }
865 findFile(file); 859 findFile(file);
866 } 860 }
867 861
868} 862}
869 863
870void AdvancedFm::findFile(const QString &fileName) { 864void AdvancedFm::findFile(const QString &fileName) {