author | llornkcor <llornkcor> | 2003-02-24 04:08:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-24 04:08:24 (UTC) |
commit | d5746c625ebf540711179ef01a7bb99bc3b2c3d6 (patch) (unidiff) | |
tree | 6fc93d296422f38e1beb27828b5b0b1dc3cf497c /noncore/apps/advancedfm/advancedfm.cpp | |
parent | 009b85e8daa341d4a2fc62404f4a58715e775b86 (diff) | |
download | opie-d5746c625ebf540711179ef01a7bb99bc3b2c3d6.zip opie-d5746c625ebf540711179ef01a7bb99bc3b2c3d6.tar.gz opie-d5746c625ebf540711179ef01a7bb99bc3b2c3d6.tar.bz2 |
fix hidden again
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index d56e746..bb7f346 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -53,92 +53,89 @@ | |||
53 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
54 | #include <qlineedit.h> | 54 | #include <qlineedit.h> |
55 | #include <qregexp.h> | 55 | #include <qregexp.h> |
56 | 56 | ||
57 | #include <unistd.h> | 57 | #include <unistd.h> |
58 | #include <stdlib.h> | 58 | #include <stdlib.h> |
59 | #include <sys/stat.h> | 59 | #include <sys/stat.h> |
60 | #include <dirent.h> | 60 | #include <dirent.h> |
61 | #include <stdio.h> | 61 | #include <stdio.h> |
62 | #include <time.h> | 62 | #include <time.h> |
63 | #include <fcntl.h> | 63 | #include <fcntl.h> |
64 | #include <mntent.h> | 64 | #include <mntent.h> |
65 | #include <string.h> | 65 | #include <string.h> |
66 | #include <errno.h> | 66 | #include <errno.h> |
67 | #include <sys/vfs.h> | 67 | #include <sys/vfs.h> |
68 | #include <mntent.h> | 68 | #include <mntent.h> |
69 | #include <sys/utsname.h> | 69 | #include <sys/utsname.h> |
70 | 70 | ||
71 | AdvancedFm::AdvancedFm( ) | 71 | AdvancedFm::AdvancedFm( ) |
72 | : QMainWindow( ) { | 72 | : QMainWindow( ) { |
73 | init(); | 73 | init(); |
74 | renameBox = 0; | 74 | renameBox = 0; |
75 | 75 | ||
76 | initConnections(); | 76 | initConnections(); |
77 | TabWidget->setCurrentTab(1); | 77 | whichTab=1; |
78 | populateView(); | 78 | rePopulate(); |
79 | TabWidget->setCurrentTab(0); | ||
80 | populateView(); | ||
81 | currentPathCombo->setFocus(); | 79 | currentPathCombo->setFocus(); |
82 | } | 80 | } |
83 | 81 | ||
84 | AdvancedFm::~AdvancedFm() { | 82 | AdvancedFm::~AdvancedFm() { |
85 | } | 83 | } |
86 | 84 | ||
87 | 85 | ||
88 | void AdvancedFm::cleanUp() | 86 | void AdvancedFm::cleanUp() |
89 | { | 87 | { |
90 | QString sfile=QDir::homeDirPath(); | 88 | QString sfile=QDir::homeDirPath(); |
91 | if(sfile.right(1) != "/") | 89 | if(sfile.right(1) != "/") |
92 | sfile+="/._temp"; | 90 | sfile+="/._temp"; |
93 | else | 91 | else |
94 | sfile+="._temp"; | 92 | sfile+="._temp"; |
95 | QFile file( sfile); | 93 | QFile file( sfile); |
96 | if(file.exists()) | 94 | if(file.exists()) |
97 | file.remove(); | 95 | file.remove(); |
98 | } | 96 | } |
99 | 97 | ||
100 | void AdvancedFm::tabChanged(QWidget *w) | 98 | void AdvancedFm::tabChanged(QWidget *w) |
101 | { | 99 | { |
102 | if( w == tab) | 100 | if( w == tab) |
103 | whichTab = 1; | 101 | whichTab = 1; |
104 | else | 102 | else |
105 | whichTab = 2; | 103 | whichTab = 2; |
106 | 104 | ||
107 | //qDebug("tab changed %d", whichTab ); | 105 | //qDebug("tab changed %d", whichTab ); |
108 | 106 | ||
109 | QString path = CurrentDir()->canonicalPath(); | 107 | QString path = CurrentDir()->canonicalPath(); |
110 | currentPathCombo->lineEdit()->setText( path ); | 108 | currentPathCombo->lineEdit()->setText( path ); |
111 | 109 | ||
112 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 110 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
113 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 111 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
114 | 112 | ||
115 | QString fs= getFileSystemType( (const QString &) path); | 113 | QString fs= getFileSystemType( (const QString &) path); |
116 | 114 | ||
117 | setCaption("AdvancedFm :: "+fs+" :: " | 115 | setCaption("AdvancedFm :: "+fs+" :: " |
118 | +checkDiskSpace( (const QString &) path )+ " kB free" ); | 116 | +checkDiskSpace( (const QString &) path )+ " kB free" ); |
119 | chdir( path.latin1()); | 117 | chdir( path.latin1()); |
120 | //2populateView(); | ||
121 | } | 118 | } |
122 | 119 | ||
123 | 120 | ||
124 | void AdvancedFm::populateView() | 121 | void AdvancedFm::populateView() |
125 | { | 122 | { |
126 | QPixmap pm; | 123 | QPixmap pm; |
127 | QListView *thisView = CurrentView(); | 124 | QListView *thisView = CurrentView(); |
128 | QDir *thisDir = CurrentDir(); | 125 | QDir *thisDir = CurrentDir(); |
129 | QString path = thisDir->canonicalPath(); | 126 | QString path = thisDir->canonicalPath(); |
130 | 127 | ||
131 | thisView->clear(); | 128 | thisView->clear(); |
132 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 129 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
133 | thisDir->setMatchAllDirs(TRUE); | 130 | thisDir->setMatchAllDirs(TRUE); |
134 | thisDir->setNameFilter(filterStr); | 131 | thisDir->setNameFilter(filterStr); |
135 | QString fileL, fileS, fileDate; | 132 | QString fileL, fileS, fileDate; |
136 | QString fs= getFileSystemType((const QString &) path); | 133 | QString fs= getFileSystemType((const QString &) path); |
137 | setCaption("AdvancedFm :: "+fs+" :: " | 134 | setCaption("AdvancedFm :: "+fs+" :: " |
138 | +checkDiskSpace((const QString &) path)+" kB free" ); | 135 | +checkDiskSpace((const QString &) path)+" kB free" ); |
139 | bool isDir=FALSE; | 136 | bool isDir=FALSE; |
140 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 137 | const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
141 | QFileInfoListIterator it(*list); | 138 | QFileInfoListIterator it(*list); |
142 | QFileInfo *fi; | 139 | QFileInfo *fi; |
143 | while ( (fi=it.current()) ) | 140 | while ( (fi=it.current()) ) |
144 | { | 141 | { |
@@ -222,48 +219,60 @@ void AdvancedFm::populateView() | |||
222 | if((dir = opendir( path.latin1())) != NULL) | 219 | if((dir = opendir( path.latin1())) != NULL) |
223 | while ((mydirent = readdir(dir)) != NULL) | 220 | while ((mydirent = readdir(dir)) != NULL) |
224 | { | 221 | { |
225 | lstat( mydirent->d_name, &buf); | 222 | lstat( mydirent->d_name, &buf); |
226 | // qDebug(mydirent->d_name); | 223 | // qDebug(mydirent->d_name); |
227 | fileL.sprintf("%s", mydirent->d_name); | 224 | fileL.sprintf("%s", mydirent->d_name); |
228 | devT = buf.st_dev; | 225 | devT = buf.st_dev; |
229 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 226 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
230 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 227 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
231 | if( fileL.find(".") == -1 ) | 228 | if( fileL.find(".") == -1 ) |
232 | { | 229 | { |
233 | item= new QListViewItem( thisView, fileL, fileS, fileDate); | 230 | item= new QListViewItem( thisView, fileL, fileS, fileDate); |
234 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 231 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
235 | item->setPixmap( 0,pm); | 232 | item->setPixmap( 0,pm); |
236 | } | 233 | } |
237 | } | 234 | } |
238 | 235 | ||
239 | closedir(dir); | 236 | closedir(dir); |
240 | } | 237 | } |
241 | 238 | ||
242 | thisView->setSorting( 3,FALSE); | 239 | thisView->setSorting( 3,FALSE); |
243 | fillCombo( (const QString &) path ); | 240 | fillCombo( (const QString &) path ); |
244 | } | 241 | } |
245 | 242 | ||
243 | void AdvancedFm::rePopulate() | ||
244 | { | ||
245 | int tmpTab = whichTab; | ||
246 | qDebug("%d", tmpTab); | ||
247 | |||
248 | for(int i =1; i < 3; i++) | ||
249 | { | ||
250 | TabWidget->setCurrentTab(i - 1); | ||
251 | populateView(); | ||
252 | } | ||
253 | TabWidget->setCurrentTab( tmpTab - 1); | ||
254 | } | ||
246 | 255 | ||
247 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) | 256 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) |
248 | { | 257 | { |
249 | if(selectedItem) | 258 | if(selectedItem) |
250 | { | 259 | { |
251 | QString strItem=selectedItem->text(0); | 260 | QString strItem=selectedItem->text(0); |
252 | QString strSize=selectedItem->text(1); | 261 | QString strSize=selectedItem->text(1); |
253 | strSize=strSize.stripWhiteSpace(); | 262 | strSize=strSize.stripWhiteSpace(); |
254 | bool isDirectory = false; | 263 | bool isDirectory = false; |
255 | QString strItem2; | 264 | QString strItem2; |
256 | 265 | ||
257 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink | 266 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink |
258 | { | 267 | { |
259 | strItem2 = dealWithSymName((const QString&)strItem); | 268 | strItem2 = dealWithSymName((const QString&)strItem); |
260 | if(QDir(strItem2).exists() ) | 269 | if(QDir(strItem2).exists() ) |
261 | strItem = strItem2; | 270 | strItem = strItem2; |
262 | } | 271 | } |
263 | 272 | ||
264 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) | 273 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) |
265 | { | 274 | { |
266 | 275 | ||
267 | if(QDir(strItem).exists()) | 276 | if(QDir(strItem).exists()) |
268 | isDirectory = true; | 277 | isDirectory = true; |
269 | } | 278 | } |