author | llornkcor <llornkcor> | 2002-10-16 15:17:00 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-16 15:17:00 (UTC) |
commit | 61f2f6ef32685002710f197dc8990fd9e99d83a5 (patch) (unidiff) | |
tree | 5fa57efbff0e83a326f6e055c3c59be71d4328bd | |
parent | ee8da0d0b70318c24ee2417bbccd9b7cd6e1404e (diff) | |
download | opie-61f2f6ef32685002710f197dc8990fd9e99d83a5.zip opie-61f2f6ef32685002710f197dc8990fd9e99d83a5.tar.gz opie-61f2f6ef32685002710f197dc8990fd9e99d83a5.tar.bz2 |
fix for popup menu crash.. didnt like loading executable pixmap
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index d7bad51..b6e7a30 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,857 +1,860 @@ | |||
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 <opie/ofileselector.h> | 15 | // #include <opie/ofileselector.h> |
16 | // #include <opie/ofiledialog.h> | 16 | // #include <opie/ofiledialog.h> |
17 | 17 | ||
18 | #include <qpe/filemanager.h> | 18 | #include <qpe/filemanager.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 19 | #include <qpe/qcopenvelope_qws.h> |
20 | #include <qpe/qpemenubar.h> | 20 | #include <qpe/qpemenubar.h> |
21 | #include <qpe/qpetoolbar.h> | 21 | #include <qpe/qpetoolbar.h> |
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/qcopenvelope_qws.h> | 23 | #include <qpe/qcopenvelope_qws.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qpe/mimetype.h> | 25 | #include <qpe/mimetype.h> |
26 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
27 | #include <qpe/ir.h> | 27 | #include <qpe/ir.h> |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | 29 | ||
30 | #include <qtabwidget.h> | 30 | #include <qtabwidget.h> |
31 | #include <qtextstream.h> | 31 | #include <qtextstream.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | #include <qcombobox.h> | 37 | #include <qcombobox.h> |
38 | #include <qpopupmenu.h> | 38 | #include <qpopupmenu.h> |
39 | #include <qlistview.h> | 39 | #include <qlistview.h> |
40 | #include <qmainwindow.h> | 40 | #include <qmainwindow.h> |
41 | #include <qlabel.h> | 41 | #include <qlabel.h> |
42 | #include <qprogressbar.h> | 42 | #include <qprogressbar.h> |
43 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
44 | #include <qwidget.h> | 44 | #include <qwidget.h> |
45 | #include <qlayout.h> | 45 | #include <qlayout.h> |
46 | #include <qimage.h> | 46 | #include <qimage.h> |
47 | #include <qpixmap.h> | 47 | #include <qpixmap.h> |
48 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
49 | #include <qlineedit.h> | 49 | #include <qlineedit.h> |
50 | #include <qregexp.h> | 50 | #include <qregexp.h> |
51 | 51 | ||
52 | #include <unistd.h> | 52 | #include <unistd.h> |
53 | #include <stdlib.h> | 53 | #include <stdlib.h> |
54 | #include <sys/stat.h> | 54 | #include <sys/stat.h> |
55 | #include <dirent.h> | 55 | #include <dirent.h> |
56 | #include <stdio.h> | 56 | #include <stdio.h> |
57 | #include <time.h> | 57 | #include <time.h> |
58 | #include <fcntl.h> | 58 | #include <fcntl.h> |
59 | #include <mntent.h> | 59 | #include <mntent.h> |
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <errno.h> | 61 | #include <errno.h> |
62 | #include <sys/vfs.h> | 62 | #include <sys/vfs.h> |
63 | #include <mntent.h> | 63 | #include <mntent.h> |
64 | #include <sys/utsname.h> | 64 | #include <sys/utsname.h> |
65 | 65 | ||
66 | AdvancedFm::AdvancedFm( ) | 66 | AdvancedFm::AdvancedFm( ) |
67 | : QMainWindow( ) { | 67 | : QMainWindow( ) { |
68 | init(); | 68 | init(); |
69 | initConnections(); | 69 | initConnections(); |
70 | populateLocalView(); | 70 | populateLocalView(); |
71 | populateRemoteView(); | 71 | populateRemoteView(); |
72 | currentPathCombo->setFocus(); | 72 | currentPathCombo->setFocus(); |
73 | } | 73 | } |
74 | 74 | ||
75 | AdvancedFm::~AdvancedFm() { | 75 | AdvancedFm::~AdvancedFm() { |
76 | } | 76 | } |
77 | 77 | ||
78 | void AdvancedFm::cleanUp() { | 78 | void AdvancedFm::cleanUp() { |
79 | QString sfile=QDir::homeDirPath(); | 79 | QString sfile=QDir::homeDirPath(); |
80 | if(sfile.right(1) != "/") | 80 | if(sfile.right(1) != "/") |
81 | sfile+="/._temp"; | 81 | sfile+="/._temp"; |
82 | else | 82 | else |
83 | sfile+="._temp"; | 83 | sfile+="._temp"; |
84 | QFile file( sfile); | 84 | QFile file( sfile); |
85 | if(file.exists()) | 85 | if(file.exists()) |
86 | file.remove(); | 86 | file.remove(); |
87 | } | 87 | } |
88 | 88 | ||
89 | void AdvancedFm::tabChanged(QWidget *) { | 89 | void AdvancedFm::tabChanged(QWidget *) { |
90 | if (TabWidget->currentPageIndex() == 0) { | 90 | if (TabWidget->currentPageIndex() == 0) { |
91 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 91 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
92 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 92 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
93 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 93 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
94 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 94 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
95 | setCaption("AdvancedFm :: "+fs+" :: " | 95 | setCaption("AdvancedFm :: "+fs+" :: " |
96 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 96 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
97 | 97 | ||
98 | } | 98 | } |
99 | if (TabWidget->currentPageIndex() == 1) { | 99 | if (TabWidget->currentPageIndex() == 1) { |
100 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 100 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
101 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 101 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
102 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 102 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
103 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 103 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
104 | setCaption("AdvancedFm :: "+fs+" :: " | 104 | setCaption("AdvancedFm :: "+fs+" :: " |
105 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); | 105 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | void AdvancedFm::populateLocalView() { | 110 | void AdvancedFm::populateLocalView() { |
111 | QPixmap pm; | 111 | QPixmap pm; |
112 | Local_View->clear(); | 112 | Local_View->clear(); |
113 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 113 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
114 | currentDir.setMatchAllDirs(TRUE); | 114 | currentDir.setMatchAllDirs(TRUE); |
115 | currentDir.setNameFilter(filterStr); | 115 | currentDir.setNameFilter(filterStr); |
116 | QString fileL, fileS, fileDate; | 116 | QString fileL, fileS, fileDate; |
117 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 117 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
118 | setCaption("AdvancedFm :: "+fs+" :: " | 118 | setCaption("AdvancedFm :: "+fs+" :: " |
119 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 119 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
120 | bool isDir=FALSE; | 120 | bool isDir=FALSE; |
121 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 121 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
122 | QFileInfoListIterator it(*list); | 122 | QFileInfoListIterator it(*list); |
123 | QFileInfo *fi; | 123 | QFileInfo *fi; |
124 | while ( (fi=it.current()) ) { | 124 | while ( (fi=it.current()) ) { |
125 | if (fi->isSymLink() ) { | 125 | if (fi->isSymLink() ) { |
126 | QString symLink=fi->readLink(); | 126 | QString symLink=fi->readLink(); |
127 | QFileInfo sym( symLink); | 127 | QFileInfo sym( symLink); |
128 | fileS.sprintf( "%10i", sym.size() ); | 128 | fileS.sprintf( "%10i", sym.size() ); |
129 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); | 129 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); |
130 | fileDate = sym.lastModified().toString(); | 130 | fileDate = sym.lastModified().toString(); |
131 | } else { | 131 | } else { |
132 | fileS.sprintf( "%10i", fi->size() ); | 132 | fileS.sprintf( "%10i", fi->size() ); |
133 | fileL.sprintf( "%s",fi->fileName().data() ); | 133 | fileL.sprintf( "%s",fi->fileName().data() ); |
134 | fileDate= fi->lastModified().toString(); | 134 | fileDate= fi->lastModified().toString(); |
135 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 135 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
136 | fileL+="/"; | 136 | fileL+="/"; |
137 | isDir=TRUE; | 137 | isDir=TRUE; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 140 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
141 | if(fileL !="./" && fi->exists()) { | 141 | if(fileL !="./" && fi->exists()) { |
142 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 142 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
143 | 143 | ||
144 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 144 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
145 | 145 | ||
146 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 146 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
147 | pm = Resource::loadPixmap( "lockedfolder" ); | 147 | pm = Resource::loadPixmap( "lockedfolder" ); |
148 | else | 148 | else |
149 | pm= Resource::loadPixmap( "folder" ); | 149 | pm= Resource::loadPixmap( "folder" ); |
150 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 150 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
151 | pm = Resource::loadPixmap( "exec"); | 151 | pm = Resource::loadPixmap( "exec"); |
152 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 152 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
153 | | fileInfo.permission( QFileInfo::ExeGroup) | 153 | | fileInfo.permission( QFileInfo::ExeGroup) |
154 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 154 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
155 | pm = Resource::loadPixmap( "exec"); | 155 | pm = Resource::loadPixmap( "exec"); |
156 | } else if( !fi->isReadable() ) { | 156 | } else if( !fi->isReadable() ) { |
157 | pm = Resource::loadPixmap( "locked" ); | 157 | pm = Resource::loadPixmap( "locked" ); |
158 | } else { //everything else goes by mimetype | 158 | } else { //everything else goes by mimetype |
159 | MimeType mt(fi->filePath()); | 159 | MimeType mt(fi->filePath()); |
160 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 160 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
161 | if(pm.isNull()) | 161 | if(pm.isNull()) |
162 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 162 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
163 | } | 163 | } |
164 | item->setPixmap( 0,pm); | 164 | item->setPixmap( 0,pm); |
165 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 165 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
166 | // overlay link image | 166 | // overlay link image |
167 | pm= Resource::loadPixmap( "folder" ); | 167 | pm= Resource::loadPixmap( "folder" ); |
168 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 168 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
169 | QPainter painter( &pm ); | 169 | QPainter painter( &pm ); |
170 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 170 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
171 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 171 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
172 | item->setPixmap( 0, pm); | 172 | item->setPixmap( 0, pm); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | isDir=FALSE; | 175 | isDir=FALSE; |
176 | ++it; | 176 | ++it; |
177 | } | 177 | } |
178 | 178 | ||
179 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 179 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
180 | struct stat buf; | 180 | struct stat buf; |
181 | dev_t devT; | 181 | dev_t devT; |
182 | DIR *dir; | 182 | DIR *dir; |
183 | struct dirent *mydirent; | 183 | struct dirent *mydirent; |
184 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 184 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
185 | while ((mydirent = readdir(dir)) != NULL) { | 185 | while ((mydirent = readdir(dir)) != NULL) { |
186 | lstat( mydirent->d_name, &buf); | 186 | lstat( mydirent->d_name, &buf); |
187 | qDebug(mydirent->d_name); | 187 | qDebug(mydirent->d_name); |
188 | fileL.sprintf("%s", mydirent->d_name); | 188 | fileL.sprintf("%s", mydirent->d_name); |
189 | devT = buf.st_dev; | 189 | devT = buf.st_dev; |
190 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 190 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
191 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 191 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
192 | if( fileL.find(".") == -1 ){ | 192 | if( fileL.find(".") == -1 ){ |
193 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 193 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); |
194 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 194 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
195 | item->setPixmap( 0,pm); | 195 | item->setPixmap( 0,pm); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | closedir(dir); | 199 | closedir(dir); |
200 | } | 200 | } |
201 | 201 | ||
202 | Local_View->setSorting( 3,FALSE); | 202 | Local_View->setSorting( 3,FALSE); |
203 | fillCombo( (const QString &) currentDir.canonicalPath()); | 203 | fillCombo( (const QString &) currentDir.canonicalPath()); |
204 | } | 204 | } |
205 | 205 | ||
206 | 206 | ||
207 | void AdvancedFm::populateRemoteView() { | 207 | void AdvancedFm::populateRemoteView() { |
208 | QPixmap pm; | 208 | QPixmap pm; |
209 | Remote_View->clear(); | 209 | Remote_View->clear(); |
210 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 210 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
211 | currentRemoteDir.setMatchAllDirs(TRUE); | 211 | currentRemoteDir.setMatchAllDirs(TRUE); |
212 | currentRemoteDir.setNameFilter(filterStr); | 212 | currentRemoteDir.setNameFilter(filterStr); |
213 | QString fileL, fileS, fileDate; | 213 | QString fileL, fileS, fileDate; |
214 | 214 | ||
215 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 215 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
216 | setCaption("AdvancedFm :: "+fs+" :: " | 216 | setCaption("AdvancedFm :: "+fs+" :: " |
217 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); | 217 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
218 | bool isDir=FALSE; | 218 | bool isDir=FALSE; |
219 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 219 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
220 | QFileInfoListIterator it(*list); | 220 | QFileInfoListIterator it(*list); |
221 | QFileInfo *fi; | 221 | QFileInfo *fi; |
222 | while ( (fi=it.current()) ) { | 222 | while ( (fi=it.current()) ) { |
223 | if (fi->isSymLink() ){ | 223 | if (fi->isSymLink() ){ |
224 | QString symLink=fi->readLink(); | 224 | QString symLink=fi->readLink(); |
225 | // qDebug("Symlink detected "+symLink); | 225 | // qDebug("Symlink detected "+symLink); |
226 | QFileInfo sym( symLink); | 226 | QFileInfo sym( symLink); |
227 | fileS.sprintf( "%10i", sym.size() ); | 227 | fileS.sprintf( "%10i", sym.size() ); |
228 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); | 228 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); |
229 | fileDate = sym.lastModified().toString(); | 229 | fileDate = sym.lastModified().toString(); |
230 | } else { | 230 | } else { |
231 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 231 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
232 | fileS.sprintf( "%10i", fi->size() ); | 232 | fileS.sprintf( "%10i", fi->size() ); |
233 | fileL.sprintf( "%s",fi->fileName().data() ); | 233 | fileL.sprintf( "%s",fi->fileName().data() ); |
234 | fileDate= fi->lastModified().toString(); | 234 | fileDate= fi->lastModified().toString(); |
235 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 235 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
236 | fileL+="/"; | 236 | fileL+="/"; |
237 | isDir=TRUE; | 237 | isDir=TRUE; |
238 | // qDebug( fileL); | 238 | // qDebug( fileL); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); | 241 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); |
242 | if(fileL !="./" && fi->exists()) { | 242 | if(fileL !="./" && fi->exists()) { |
243 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 243 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
244 | QPixmap pm; | 244 | QPixmap pm; |
245 | 245 | ||
246 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 246 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
247 | if( !QDir( fi->filePath() ).isReadable()) | 247 | if( !QDir( fi->filePath() ).isReadable()) |
248 | pm = Resource::loadPixmap( "lockedfolder" ); | 248 | pm = Resource::loadPixmap( "lockedfolder" ); |
249 | else | 249 | else |
250 | pm= Resource::loadPixmap( "folder" ); | 250 | pm= Resource::loadPixmap( "folder" ); |
251 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 251 | } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
252 | pm = Resource::loadPixmap( "exec"); | 252 | pm = Resource::loadPixmap( "exec"); |
253 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 253 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
254 | | fileInfo.permission( QFileInfo::ExeGroup) | 254 | | fileInfo.permission( QFileInfo::ExeGroup) |
255 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { | 255 | | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { |
256 | pm = Resource::loadPixmap( "exec"); | 256 | pm = Resource::loadPixmap( "exec"); |
257 | } else if( !fi->isReadable() ) { | 257 | } else if( !fi->isReadable() ) { |
258 | pm = Resource::loadPixmap( "locked" ); | 258 | pm = Resource::loadPixmap( "locked" ); |
259 | } else { | 259 | } else { |
260 | MimeType mt(fi->filePath()); | 260 | MimeType mt(fi->filePath()); |
261 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 261 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
262 | if(pm.isNull()) | 262 | if(pm.isNull()) |
263 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 263 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
264 | } | 264 | } |
265 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 265 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
266 | // overlay link image | 266 | // overlay link image |
267 | pm= Resource::loadPixmap( "folder" ); | 267 | pm= Resource::loadPixmap( "folder" ); |
268 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 268 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
269 | QPainter painter( &pm ); | 269 | QPainter painter( &pm ); |
270 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 270 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
271 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 271 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
272 | } | 272 | } |
273 | item->setPixmap( 0, pm); | 273 | item->setPixmap( 0, pm); |
274 | } | 274 | } |
275 | isDir=FALSE; | 275 | isDir=FALSE; |
276 | ++it; | 276 | ++it; |
277 | } | 277 | } |
278 | 278 | ||
279 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 279 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
280 | struct stat buf; | 280 | struct stat buf; |
281 | DIR *dir; | 281 | DIR *dir; |
282 | struct dirent *mydirent; | 282 | struct dirent *mydirent; |
283 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 283 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
284 | while ((mydirent = readdir(dir)) != NULL) { | 284 | while ((mydirent = readdir(dir)) != NULL) { |
285 | lstat( mydirent->d_name, &buf); | 285 | lstat( mydirent->d_name, &buf); |
286 | qDebug(mydirent->d_name); | 286 | qDebug(mydirent->d_name); |
287 | fileL.sprintf("%s", mydirent->d_name); | 287 | fileL.sprintf("%s", mydirent->d_name); |
288 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 288 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
289 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 289 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
290 | if( fileL.find(".") == -1 ){ | 290 | if( fileL.find(".") == -1 ){ |
291 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 291 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
292 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 292 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
293 | item->setPixmap( 0,pm); | 293 | item->setPixmap( 0,pm); |
294 | } | 294 | } |
295 | } | 295 | } |
296 | 296 | ||
297 | closedir(dir); | 297 | closedir(dir); |
298 | } | 298 | } |
299 | 299 | ||
300 | Remote_View->setSorting( 3,FALSE); | 300 | Remote_View->setSorting( 3,FALSE); |
301 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 301 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
302 | } | 302 | } |
303 | 303 | ||
304 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) { | 304 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) { |
305 | if(selectedItem) { | 305 | if(selectedItem) { |
306 | QString strItem=selectedItem->text(0); | 306 | QString strItem=selectedItem->text(0); |
307 | QString strSize=selectedItem->text(1); | 307 | QString strSize=selectedItem->text(1); |
308 | strSize=strSize.stripWhiteSpace(); | 308 | strSize=strSize.stripWhiteSpace(); |
309 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 309 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
310 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 310 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
311 | if(QDir(strItem2).exists() ) { | 311 | if(QDir(strItem2).exists() ) { |
312 | currentDir.cd(strItem2, TRUE); | 312 | currentDir.cd(strItem2, TRUE); |
313 | populateLocalView(); | 313 | populateLocalView(); |
314 | 314 | ||
315 | } | 315 | } |
316 | } else { // not a symlink | 316 | } else { // not a symlink |
317 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 317 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
318 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 318 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
319 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 319 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
320 | currentDir.cd(strItem,FALSE); | 320 | currentDir.cd(strItem,FALSE); |
321 | populateLocalView(); | 321 | populateLocalView(); |
322 | Local_View->ensureItemVisible(Local_View->firstChild()); | 322 | Local_View->ensureItemVisible(Local_View->firstChild()); |
323 | 323 | ||
324 | } else { | 324 | } else { |
325 | currentDir.cdUp(); | 325 | currentDir.cdUp(); |
326 | populateLocalView(); | 326 | populateLocalView(); |
327 | Local_View->ensureItemVisible(Local_View->firstChild()); | 327 | Local_View->ensureItemVisible(Local_View->firstChild()); |
328 | } | 328 | } |
329 | if(QDir(strItem).exists()){ | 329 | if(QDir(strItem).exists()){ |
330 | currentDir.cd(strItem, TRUE); | 330 | currentDir.cd(strItem, TRUE); |
331 | Local_View->ensureItemVisible(Local_View->firstChild()); | 331 | Local_View->ensureItemVisible(Local_View->firstChild()); |
332 | populateLocalView(); | 332 | populateLocalView(); |
333 | } | 333 | } |
334 | } else { | 334 | } else { |
335 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 335 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
336 | if( QFile::exists(strItem ) ) { | 336 | if( QFile::exists(strItem ) ) { |
337 | // qDebug("clicked item "+strItem); | 337 | // qDebug("clicked item "+strItem); |
338 | // DocLnk doc( strItem, FALSE ); | 338 | // DocLnk doc( strItem, FALSE ); |
339 | // doc.execute(); | 339 | // doc.execute(); |
340 | // Local_View->clearSelection(); | 340 | // Local_View->clearSelection(); |
341 | } | 341 | } |
342 | } //end not symlink | 342 | } //end not symlink |
343 | chdir(strItem.latin1()); | 343 | chdir(strItem.latin1()); |
344 | } | 344 | } |
345 | 345 | ||
346 | } | 346 | } |
347 | } | 347 | } |
348 | 348 | ||
349 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { | 349 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { |
350 | 350 | ||
351 | if(selectedItem) { | 351 | if(selectedItem) { |
352 | QString strItem=selectedItem->text(0); | 352 | QString strItem=selectedItem->text(0); |
353 | QString strSize=selectedItem->text(1); | 353 | QString strSize=selectedItem->text(1); |
354 | strSize=strSize.stripWhiteSpace(); | 354 | strSize=strSize.stripWhiteSpace(); |
355 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 355 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
356 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 356 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
357 | currentRemoteDir.cd(strItem2, TRUE); | 357 | currentRemoteDir.cd(strItem2, TRUE); |
358 | populateRemoteView(); | 358 | populateRemoteView(); |
359 | } else { // not a symlink | 359 | } else { // not a symlink |
360 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 360 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
361 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 361 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
362 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 362 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
363 | currentRemoteDir.cd(strItem,FALSE); | 363 | currentRemoteDir.cd(strItem,FALSE); |
364 | populateRemoteView(); | 364 | populateRemoteView(); |
365 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 365 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
366 | } else { | 366 | } else { |
367 | currentRemoteDir.cdUp(); | 367 | currentRemoteDir.cdUp(); |
368 | populateRemoteView(); | 368 | populateRemoteView(); |
369 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 369 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
370 | } | 370 | } |
371 | if(QDir(strItem).exists()){ | 371 | if(QDir(strItem).exists()){ |
372 | currentRemoteDir.cd(strItem, TRUE); | 372 | currentRemoteDir.cd(strItem, TRUE); |
373 | populateRemoteView(); | 373 | populateRemoteView(); |
374 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 374 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
375 | } | 375 | } |
376 | } else { | 376 | } else { |
377 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 377 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
378 | if( QFile::exists(strItem ) ) { | 378 | if( QFile::exists(strItem ) ) { |
379 | // qDebug("clicked item "+strItem); | 379 | // qDebug("clicked item "+strItem); |
380 | // DocLnk doc( strItem, FALSE ); | 380 | // DocLnk doc( strItem, FALSE ); |
381 | // doc.execute(); | 381 | // doc.execute(); |
382 | // Remote_View->clearSelection(); | 382 | // Remote_View->clearSelection(); |
383 | } | 383 | } |
384 | } //end not symlink | 384 | } //end not symlink |
385 | chdir(strItem.latin1()); | 385 | chdir(strItem.latin1()); |
386 | } | 386 | } |
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
390 | 390 | ||
391 | void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 391 | void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
392 | // qDebug("list pressed"); | 392 | // qDebug("list pressed"); |
393 | switch (mouse) { | 393 | switch (mouse) { |
394 | case 1: | 394 | case 1: |
395 | break; | 395 | break; |
396 | case 2: | 396 | case 2: |
397 | menuTimer.start( 500, TRUE ); | 397 | menuTimer.start( 500, TRUE ); |
398 | qDebug("Start menu timer\n"); | 398 | qDebug("Start menu timer\n"); |
399 | break; | 399 | break; |
400 | }; | 400 | }; |
401 | } | 401 | } |
402 | 402 | ||
403 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { | 403 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { |
404 | 404 | ||
405 | switch (mouse) { | 405 | switch (mouse) { |
406 | case 1: | 406 | case 1: |
407 | break; | 407 | break; |
408 | case 2: | 408 | case 2: |
409 | menuTimer.start( 500, TRUE ); | 409 | menuTimer.start( 500, TRUE ); |
410 | qDebug("Start menu timer"); | 410 | qDebug("Start menu timer"); |
411 | break; | 411 | break; |
412 | }; | 412 | }; |
413 | } | 413 | } |
414 | 414 | ||
415 | 415 | ||
416 | void AdvancedFm::switchToLocalTab() { | 416 | void AdvancedFm::switchToLocalTab() { |
417 | TabWidget->setCurrentPage(0); | 417 | TabWidget->setCurrentPage(0); |
418 | Local_View->setFocus(); | 418 | Local_View->setFocus(); |
419 | } | 419 | } |
420 | 420 | ||
421 | void AdvancedFm::switchToRemoteTab() { | 421 | void AdvancedFm::switchToRemoteTab() { |
422 | TabWidget->setCurrentPage(1); | 422 | TabWidget->setCurrentPage(1); |
423 | Remote_View->setFocus(); | 423 | Remote_View->setFocus(); |
424 | } | 424 | } |
425 | 425 | ||
426 | void AdvancedFm::readConfig() { | 426 | void AdvancedFm::readConfig() { |
427 | Config cfg("AdvancedFm"); | 427 | Config cfg("AdvancedFm"); |
428 | } | 428 | } |
429 | 429 | ||
430 | void AdvancedFm::writeConfig() { | 430 | void AdvancedFm::writeConfig() { |
431 | Config cfg("AdvancedFm"); | 431 | Config cfg("AdvancedFm"); |
432 | } | 432 | } |
433 | 433 | ||
434 | void AdvancedFm::currentPathComboChanged() { | 434 | void AdvancedFm::currentPathComboChanged() { |
435 | if (TabWidget->currentPageIndex() == 0) { | 435 | if (TabWidget->currentPageIndex() == 0) { |
436 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 436 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
437 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 437 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
438 | populateLocalView(); | 438 | populateLocalView(); |
439 | } else { | 439 | } else { |
440 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 440 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
441 | } | 441 | } |
442 | } | 442 | } |
443 | if (TabWidget->currentPageIndex() == 0) { | 443 | if (TabWidget->currentPageIndex() == 0) { |
444 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 444 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
445 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 445 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
446 | populateRemoteView(); | 446 | populateRemoteView(); |
447 | } else { | 447 | } else { |
448 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 448 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
449 | } | 449 | } |
450 | } | 450 | } |
451 | } | 451 | } |
452 | 452 | ||
453 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 453 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
454 | 454 | ||
455 | if (TabWidget->currentPageIndex() == 0) { | 455 | if (TabWidget->currentPageIndex() == 0) { |
456 | currentPathCombo->lineEdit()->setText( currentPath); | 456 | currentPathCombo->lineEdit()->setText( currentPath); |
457 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 457 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
458 | currentPathCombo->clear(); | 458 | currentPathCombo->clear(); |
459 | localDirPathStringList.prepend( currentPath ); | 459 | localDirPathStringList.prepend( currentPath ); |
460 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 460 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
461 | } | 461 | } |
462 | } else { | 462 | } else { |
463 | currentPathCombo->lineEdit()->setText( currentPath); | 463 | currentPathCombo->lineEdit()->setText( currentPath); |
464 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 464 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
465 | currentPathCombo->clear(); | 465 | currentPathCombo->clear(); |
466 | remoteDirPathStringList.prepend( currentPath ); | 466 | remoteDirPathStringList.prepend( currentPath ); |
467 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 467 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
468 | } | 468 | } |
469 | } | 469 | } |
470 | } | 470 | } |
471 | 471 | ||
472 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 472 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
473 | if (TabWidget->currentPageIndex() == 0) { | 473 | if (TabWidget->currentPageIndex() == 0) { |
474 | chdir( currentPath.latin1() ); | 474 | chdir( currentPath.latin1() ); |
475 | currentDir.cd( currentPath, TRUE); | 475 | currentDir.cd( currentPath, TRUE); |
476 | populateLocalView(); | 476 | populateLocalView(); |
477 | update(); | 477 | update(); |
478 | } else { | 478 | } else { |
479 | chdir( currentPath.latin1() ); | 479 | chdir( currentPath.latin1() ); |
480 | currentRemoteDir.cd( currentPath, TRUE); | 480 | currentRemoteDir.cd( currentPath, TRUE); |
481 | populateRemoteView(); | 481 | populateRemoteView(); |
482 | update(); | 482 | update(); |
483 | } | 483 | } |
484 | } | 484 | } |
485 | 485 | ||
486 | QStringList AdvancedFm::getPath() { | 486 | QStringList AdvancedFm::getPath() { |
487 | QStringList strList; | 487 | QStringList strList; |
488 | if (TabWidget->currentPageIndex() == 0) { | 488 | if (TabWidget->currentPageIndex() == 0) { |
489 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 489 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
490 | QListViewItemIterator it( Local_View ); | 490 | QListViewItemIterator it( Local_View ); |
491 | for ( ; it.current(); ++it ) { | 491 | for ( ; it.current(); ++it ) { |
492 | if ( it.current()->isSelected() ) { | 492 | if ( it.current()->isSelected() ) { |
493 | strList << it.current()->text(0); | 493 | strList << it.current()->text(0); |
494 | qDebug(it.current()->text(0)); | 494 | qDebug(it.current()->text(0)); |
495 | } | 495 | } |
496 | } | 496 | } |
497 | return strList; | 497 | return strList; |
498 | } else { | 498 | } else { |
499 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 499 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
500 | QListViewItemIterator it( Remote_View ); | 500 | QListViewItemIterator it( Remote_View ); |
501 | for ( ; it.current(); ++it ) { | 501 | for ( ; it.current(); ++it ) { |
502 | if ( it.current()->isSelected() ) { | 502 | if ( it.current()->isSelected() ) { |
503 | strList << it.current()->text(0); | 503 | strList << it.current()->text(0); |
504 | qDebug(it.current()->text(0)); | 504 | qDebug(it.current()->text(0)); |
505 | } | 505 | } |
506 | } | 506 | } |
507 | return strList; | 507 | return strList; |
508 | } | 508 | } |
509 | return ""; | 509 | return ""; |
510 | } | 510 | } |
511 | 511 | ||
512 | void AdvancedFm::homeButtonPushed() { | 512 | void AdvancedFm::homeButtonPushed() { |
513 | QString current = QDir::homeDirPath(); | 513 | QString current = QDir::homeDirPath(); |
514 | chdir( current.latin1() ); | 514 | chdir( current.latin1() ); |
515 | if (TabWidget->currentPageIndex() == 0) { | 515 | if (TabWidget->currentPageIndex() == 0) { |
516 | currentDir.cd( current, TRUE); | 516 | currentDir.cd( current, TRUE); |
517 | populateLocalView(); | 517 | populateLocalView(); |
518 | } else { | 518 | } else { |
519 | currentRemoteDir.cd( current, TRUE); | 519 | currentRemoteDir.cd( current, TRUE); |
520 | populateRemoteView(); | 520 | populateRemoteView(); |
521 | } | 521 | } |
522 | update(); | 522 | update(); |
523 | } | 523 | } |
524 | 524 | ||
525 | void AdvancedFm::docButtonPushed() { | 525 | void AdvancedFm::docButtonPushed() { |
526 | QString current = QPEApplication::documentDir(); | 526 | QString current = QPEApplication::documentDir(); |
527 | chdir( current.latin1() ); | 527 | chdir( current.latin1() ); |
528 | if (TabWidget->currentPageIndex() == 0) { | 528 | if (TabWidget->currentPageIndex() == 0) { |
529 | currentDir.cd( current, TRUE); | 529 | currentDir.cd( current, TRUE); |
530 | populateLocalView(); | 530 | populateLocalView(); |
531 | } else { | 531 | } else { |
532 | currentRemoteDir.cd( current, TRUE); | 532 | currentRemoteDir.cd( current, TRUE); |
533 | populateRemoteView(); | 533 | populateRemoteView(); |
534 | } | 534 | } |
535 | update(); | 535 | update(); |
536 | } | 536 | } |
537 | 537 | ||
538 | void AdvancedFm::SDButtonPushed() { | 538 | void AdvancedFm::SDButtonPushed() { |
539 | QString current = "/mnt/card";// this can change so fix | 539 | QString current = "/mnt/card";// this can change so fix |
540 | chdir( current.latin1() ); | 540 | chdir( current.latin1() ); |
541 | if (TabWidget->currentPageIndex() == 0) { | 541 | if (TabWidget->currentPageIndex() == 0) { |
542 | currentDir.cd( current, TRUE); | 542 | currentDir.cd( current, TRUE); |
543 | populateLocalView(); | 543 | populateLocalView(); |
544 | } else { | 544 | } else { |
545 | currentRemoteDir.cd( current, TRUE); | 545 | currentRemoteDir.cd( current, TRUE); |
546 | populateRemoteView(); | 546 | populateRemoteView(); |
547 | } | 547 | } |
548 | update(); | 548 | update(); |
549 | 549 | ||
550 | } | 550 | } |
551 | 551 | ||
552 | void AdvancedFm::CFButtonPushed() { | 552 | void AdvancedFm::CFButtonPushed() { |
553 | QString current; | 553 | QString current; |
554 | if(zaurusDevice) | 554 | if(zaurusDevice) |
555 | current= "/mnt/cf"; //zaurus | 555 | current= "/mnt/cf"; //zaurus |
556 | else | 556 | else |
557 | current = "/mnt/hda"; //ipaq | 557 | current = "/mnt/hda"; //ipaq |
558 | 558 | ||
559 | chdir( current.latin1() ); | 559 | chdir( current.latin1() ); |
560 | if (TabWidget->currentPageIndex() == 0) { | 560 | if (TabWidget->currentPageIndex() == 0) { |
561 | currentDir.cd( current, TRUE); | 561 | currentDir.cd( current, TRUE); |
562 | populateLocalView(); | 562 | populateLocalView(); |
563 | } else { | 563 | } else { |
564 | currentRemoteDir.cd( current, TRUE); | 564 | currentRemoteDir.cd( current, TRUE); |
565 | populateRemoteView(); | 565 | populateRemoteView(); |
566 | } | 566 | } |
567 | update(); | 567 | update(); |
568 | } | 568 | } |
569 | 569 | ||
570 | 570 | ||
571 | 571 | ||
572 | void AdvancedFm::doAbout() { | 572 | void AdvancedFm::doAbout() { |
573 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" | 573 | QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" |
574 | "is copyright 2002 by\n" | 574 | "is copyright 2002 by\n" |
575 | "L.J.Potter<llornkcor@handhelds.org>\n" | 575 | "L.J.Potter<llornkcor@handhelds.org>\n" |
576 | "and is licensed by the GPL")); | 576 | "and is licensed by the GPL")); |
577 | } | 577 | } |
578 | 578 | ||
579 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | 579 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
580 | if( TabWidget->hasFocus()) | 580 | if( TabWidget->hasFocus()) |
581 | switch ( e->key() ) { | 581 | switch ( e->key() ) { |
582 | case Key_Delete: | 582 | case Key_Delete: |
583 | del(); | 583 | del(); |
584 | break; | 584 | break; |
585 | case Key_H: | 585 | case Key_H: |
586 | showHidden(); | 586 | showHidden(); |
587 | break; | 587 | break; |
588 | case Key_E: | 588 | case Key_E: |
589 | runThis(); | 589 | runThis(); |
590 | break; | 590 | break; |
591 | case Key_C: | 591 | case Key_C: |
592 | copy(); | 592 | copy(); |
593 | break; | 593 | break; |
594 | case Key_A: | 594 | case Key_A: |
595 | copyAs(); | 595 | copyAs(); |
596 | break; | 596 | break; |
597 | case Key_M: | 597 | case Key_M: |
598 | move(); | 598 | move(); |
599 | break; | 599 | break; |
600 | case Key_R: | 600 | case Key_R: |
601 | rn(); | 601 | rn(); |
602 | break; | 602 | break; |
603 | case Key_I: | 603 | case Key_I: |
604 | fileStatus(); | 604 | fileStatus(); |
605 | break; | 605 | break; |
606 | case Key_U: | 606 | case Key_U: |
607 | upDir(); | 607 | upDir(); |
608 | break; | 608 | break; |
609 | case Key_P: | 609 | case Key_P: |
610 | filePerms(); | 610 | filePerms(); |
611 | break; | 611 | break; |
612 | case Key_N: | 612 | case Key_N: |
613 | mkDir(); | 613 | mkDir(); |
614 | break; | 614 | break; |
615 | case Key_1: | 615 | case Key_1: |
616 | switchToLocalTab(); | 616 | switchToLocalTab(); |
617 | break; | 617 | break; |
618 | case Key_2: | 618 | case Key_2: |
619 | switchToRemoteTab(); | 619 | switchToRemoteTab(); |
620 | break; | 620 | break; |
621 | case Key_3: | 621 | case Key_3: |
622 | CFButtonPushed(); | 622 | CFButtonPushed(); |
623 | break; | 623 | break; |
624 | case Key_4: | 624 | case Key_4: |
625 | SDButtonPushed(); | 625 | SDButtonPushed(); |
626 | break; | 626 | break; |
627 | case Key_5: | 627 | case Key_5: |
628 | homeButtonPushed(); | 628 | homeButtonPushed(); |
629 | break; | 629 | break; |
630 | case Key_6: | 630 | case Key_6: |
631 | docButtonPushed(); | 631 | docButtonPushed(); |
632 | break; | 632 | break; |
633 | case Key_7: | 633 | case Key_7: |
634 | break; | 634 | break; |
635 | case Key_8: | 635 | case Key_8: |
636 | break; | 636 | break; |
637 | case Key_9: | 637 | case Key_9: |
638 | break; | 638 | break; |
639 | case Key_0: | 639 | case Key_0: |
640 | break; | 640 | break; |
641 | } | 641 | } |
642 | } | 642 | } |
643 | 643 | ||
644 | 644 | ||
645 | void AdvancedFm::QPEButtonPushed() { | 645 | void AdvancedFm::QPEButtonPushed() { |
646 | QString current = QPEApplication::qpeDir(); | 646 | QString current = QPEApplication::qpeDir(); |
647 | chdir( current.latin1() ); | 647 | chdir( current.latin1() ); |
648 | if (TabWidget->currentPageIndex() == 0) { | 648 | if (TabWidget->currentPageIndex() == 0) { |
649 | currentDir.cd( current, TRUE); | 649 | currentDir.cd( current, TRUE); |
650 | populateLocalView(); | 650 | populateLocalView(); |
651 | } else { | 651 | } else { |
652 | currentRemoteDir.cd( current, TRUE); | 652 | currentRemoteDir.cd( current, TRUE); |
653 | populateRemoteView(); | 653 | populateRemoteView(); |
654 | } | 654 | } |
655 | update(); | 655 | update(); |
656 | } | 656 | } |
657 | 657 | ||
658 | void AdvancedFm::parsetab(const QString &fileName) { | 658 | void AdvancedFm::parsetab(const QString &fileName) { |
659 | 659 | ||
660 | fileSystemTypeList.clear(); | 660 | fileSystemTypeList.clear(); |
661 | fsList.clear(); | 661 | fsList.clear(); |
662 | struct mntent *me; | 662 | struct mntent *me; |
663 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 663 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
664 | if ( mntfp ) { | 664 | if ( mntfp ) { |
665 | while ( (me = getmntent( mntfp )) != 0 ) { | 665 | while ( (me = getmntent( mntfp )) != 0 ) { |
666 | QString deviceName = me->mnt_fsname; | 666 | QString deviceName = me->mnt_fsname; |
667 | QString filesystemType = me->mnt_type; | 667 | QString filesystemType = me->mnt_type; |
668 | QString mountDir = me->mnt_dir; | 668 | QString mountDir = me->mnt_dir; |
669 | if(deviceName != "none") { | 669 | if(deviceName != "none") { |
670 | if( fsList.contains(filesystemType) == 0 | 670 | if( fsList.contains(filesystemType) == 0 |
671 | & filesystemType.find("proc",0,TRUE) == -1 | 671 | & filesystemType.find("proc",0,TRUE) == -1 |
672 | & filesystemType.find("cramfs",0,TRUE) == -1 | 672 | & filesystemType.find("cramfs",0,TRUE) == -1 |
673 | & filesystemType.find("auto",0,TRUE) == -1) | 673 | & filesystemType.find("auto",0,TRUE) == -1) |
674 | fsList << filesystemType; | 674 | fsList << filesystemType; |
675 | fileSystemTypeList << mountDir+"::"+filesystemType; | 675 | fileSystemTypeList << mountDir+"::"+filesystemType; |
676 | } | 676 | } |
677 | } | 677 | } |
678 | } | 678 | } |
679 | endmntent( mntfp ); | 679 | endmntent( mntfp ); |
680 | } | 680 | } |
681 | 681 | ||
682 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { | 682 | QString AdvancedFm::getFileSystemType(const QString ¤tText) { |
683 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 683 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
684 | QString current = currentText;//.right( currentText.length()-1); | 684 | QString current = currentText;//.right( currentText.length()-1); |
685 | QString baseFs; | 685 | QString baseFs; |
686 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 686 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { |
687 | QString temp = (*it); | 687 | QString temp = (*it); |
688 | QString path = temp.left(temp.find("::",0,TRUE) ); | 688 | QString path = temp.left(temp.find("::",0,TRUE) ); |
689 | path = path.right( path.length()-1); | 689 | path = path.right( path.length()-1); |
690 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 690 | if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
691 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { | 691 | if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { |
692 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 692 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
693 | } | 693 | } |
694 | } | 694 | } |
695 | return baseFs; | 695 | return baseFs; |
696 | } | 696 | } |
697 | 697 | ||
698 | QString AdvancedFm::getDiskSpace( const QString &path) { | 698 | QString AdvancedFm::getDiskSpace( const QString &path) { |
699 | struct statfs fss; | 699 | struct statfs fss; |
700 | if ( !statfs( path.latin1(), &fss ) ) { | 700 | if ( !statfs( path.latin1(), &fss ) ) { |
701 | int blkSize = fss.f_bsize; | 701 | int blkSize = fss.f_bsize; |
702 | // int totalBlks = fs.f_blocks; | 702 | // int totalBlks = fs.f_blocks; |
703 | int availBlks = fss.f_bavail; | 703 | int availBlks = fss.f_bavail; |
704 | 704 | ||
705 | long mult = blkSize / 1024; | 705 | long mult = blkSize / 1024; |
706 | long div = 1024 / blkSize; | 706 | long div = 1024 / blkSize; |
707 | if ( !mult ) mult = 1; | 707 | if ( !mult ) mult = 1; |
708 | if ( !div ) div = 1; | 708 | if ( !div ) div = 1; |
709 | 709 | ||
710 | return QString::number(availBlks * mult / div); | 710 | return QString::number(availBlks * mult / div); |
711 | } | 711 | } |
712 | return ""; | 712 | return ""; |
713 | } | 713 | } |
714 | 714 | ||
715 | 715 | ||
716 | void AdvancedFm::showFileMenu() { | 716 | void AdvancedFm::showFileMenu() { |
717 | 717 | ||
718 | QString curApp; | 718 | QString curApp; |
719 | bool isLocalView = false; | 719 | bool isLocalView = false; |
720 | if (TabWidget->currentPageIndex() == 0) { | 720 | if (TabWidget->currentPageIndex() == 0) { |
721 | isLocalView = TRUE; | 721 | isLocalView = TRUE; |
722 | curApp = Local_View->currentItem()->text(0); | 722 | curApp = Local_View->currentItem()->text(0); |
723 | } else { | 723 | } else { |
724 | curApp = Remote_View->currentItem()->text(0); | 724 | curApp = Remote_View->currentItem()->text(0); |
725 | } | 725 | } |
726 | 726 | ||
727 | MimeType mt( curApp ); | 727 | MimeType mt( curApp ); |
728 | const AppLnk* app = mt.application(); | ||
729 | QFile fi(curApp); | ||
730 | |||
731 | QPopupMenu *m = new QPopupMenu(0); | ||
732 | QPopupMenu *n = new QPopupMenu(0); | ||
733 | // QPopupMenu *o = new QPopupMenu(0); | ||
734 | |||
735 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | ||
736 | if ( !QFileInfo(fi).isDir() ) { | ||
737 | // m->insertSeparator(); | ||
738 | // m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | ||
739 | // } else { | ||
740 | |||
741 | if ( app ) | ||
742 | m->insertItem( app->pixmap(), tr( "Open in " | ||
743 | + app->name() ), this, SLOT( runThis() ) ); | ||
744 | else if( QFileInfo(fi).isExecutable() ) | ||
745 | m->insertItem( Resource::loadPixmap( app->name()), tr( "Execute" ), this, SLOT( runThis() ) ); | ||
746 | |||
747 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | ||
748 | } | ||
749 | 728 | ||
750 | m->insertItem(tr("Actions"),n); | 729 | const AppLnk* app = mt.application(); |
751 | if(isLocalView) | ||
752 | n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | ||
753 | else | ||
754 | n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | ||
755 | 730 | ||
756 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 731 | QFile fi(curApp); |
732 | |||
733 | QPopupMenu *m = new QPopupMenu(0); | ||
734 | QPopupMenu *n = new QPopupMenu(0); | ||
735 | // QPopupMenu *o = new QPopupMenu(0); | ||
736 | |||
737 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | ||
738 | |||
739 | if ( QFileInfo(fi).isDir() ) { | ||
740 | m->insertSeparator(); | ||
741 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | ||
742 | } else { | ||
743 | |||
744 | if ( app ) | ||
745 | m->insertItem( app->pixmap(), tr( "Open in " | ||
746 | + app->name() ), this, SLOT( runThis() ) ); | ||
747 | else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this | ||
748 | m->insertItem( /*Resource::loadPixmap( app->name()),*/ tr( "Execute" ), this, SLOT( runThis() ) ); | ||
749 | |||
750 | m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); | ||
751 | } | ||
752 | |||
753 | m->insertItem(tr("Actions"),n); | ||
754 | if(isLocalView) | ||
755 | n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | ||
756 | else | ||
757 | n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | ||
758 | |||
759 | n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | ||
757 | 760 | ||
758 | n->insertSeparator(); | 761 | n->insertSeparator(); |
759 | 762 | ||
760 | 763 | ||
761 | if(isLocalView) | 764 | if(isLocalView) |
762 | n->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 765 | n->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
763 | else | 766 | else |
764 | n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 767 | n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
765 | 768 | ||
766 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); | 769 | n->insertItem( tr( "Copy" ), this, SLOT( copy() )); |
767 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 770 | n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
768 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); | 771 | n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); |
769 | n->insertItem( tr( "Move" ), this, SLOT( move() )); | 772 | n->insertItem( tr( "Move" ), this, SLOT( move() )); |
770 | 773 | ||
771 | n->insertSeparator(); | 774 | n->insertSeparator(); |
772 | 775 | ||
773 | if(isLocalView) | 776 | if(isLocalView) |
774 | n->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 777 | n->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
775 | else | 778 | else |
776 | n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 779 | n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
777 | 780 | ||
778 | 781 | ||
779 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 782 | m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
780 | 783 | ||
781 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 784 | m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
782 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 785 | m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
783 | 786 | ||
784 | m->insertSeparator(); | 787 | m->insertSeparator(); |
785 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 788 | m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
786 | 789 | ||
787 | #if defined(QT_QWS_OPIE) | 790 | #if defined(QT_QWS_OPIE) |
788 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 791 | m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
789 | #endif | 792 | #endif |
790 | m->setCheckable(TRUE); | 793 | m->setCheckable(TRUE); |
791 | if (!b) | 794 | if (!b) |
792 | m->setItemChecked(m->idAt(0),TRUE); | 795 | m->setItemChecked(m->idAt(0),TRUE); |
793 | else | 796 | else |
794 | m->setItemChecked(m->idAt(0),FALSE); | 797 | m->setItemChecked(m->idAt(0),FALSE); |
795 | 798 | ||
796 | if(Ir::supported()) | 799 | if(Ir::supported()) |
797 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | 800 | m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); |
798 | m->setFocus(); | 801 | m->setFocus(); |
799 | m->exec( QCursor::pos() ); | 802 | m->exec( QCursor::pos() ); |
800 | sleep(1); | 803 | sleep(1); |
801 | if(m) delete m; | 804 | if(m) delete m; |
802 | } | 805 | } |
803 | 806 | ||
804 | 807 | ||
805 | void AdvancedFm::cancelMenuTimer() { | 808 | void AdvancedFm::cancelMenuTimer() { |
806 | 809 | ||
807 | // qDebug("selectionChanged: cancel menu timer"); | 810 | // qDebug("selectionChanged: cancel menu timer"); |
808 | if( menuTimer.isActive() ) | 811 | if( menuTimer.isActive() ) |
809 | menuTimer.stop(); | 812 | menuTimer.stop(); |
810 | } | 813 | } |
811 | 814 | ||
812 | QString AdvancedFm::checkDiskSpace(const QString &path) { | 815 | QString AdvancedFm::checkDiskSpace(const QString &path) { |
813 | struct statfs fss; | 816 | struct statfs fss; |
814 | if ( !statfs( path.latin1(), &fss ) ) { | 817 | if ( !statfs( path.latin1(), &fss ) ) { |
815 | int blkSize = fss.f_bsize; | 818 | int blkSize = fss.f_bsize; |
816 | // int totalBlks = fs.f_blocks; | 819 | // int totalBlks = fs.f_blocks; |
817 | int availBlks = fss.f_bavail; | 820 | int availBlks = fss.f_bavail; |
818 | 821 | ||
819 | long mult = blkSize / 1024; | 822 | long mult = blkSize / 1024; |
820 | long div = 1024 / blkSize; | 823 | long div = 1024 / blkSize; |
821 | if ( !mult ) mult = 1; | 824 | if ( !mult ) mult = 1; |
822 | if ( !div ) div = 1; | 825 | if ( !div ) div = 1; |
823 | 826 | ||
824 | 827 | ||
825 | return QString::number(availBlks * mult / div); | 828 | return QString::number(availBlks * mult / div); |
826 | } | 829 | } |
827 | return ""; | 830 | return ""; |
828 | } | 831 | } |
829 | 832 | ||
830 | void AdvancedFm::addToDocs() { | 833 | void AdvancedFm::addToDocs() { |
831 | QStringList strListPaths = getPath(); | 834 | QStringList strListPaths = getPath(); |
832 | if( strListPaths.count() > 0) { | 835 | if( strListPaths.count() > 0) { |
833 | QString curFile; | 836 | QString curFile; |
834 | if (TabWidget->currentPageIndex() == 0) { | 837 | if (TabWidget->currentPageIndex() == 0) { |
835 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | 838 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { |
836 | curFile = currentDir.canonicalPath()+"/"+(*it); | 839 | curFile = currentDir.canonicalPath()+"/"+(*it); |
837 | qDebug(curFile); | 840 | qDebug(curFile); |
838 | DocLnk f; | 841 | DocLnk f; |
839 | // curFile.replace(QRegExp("\\..*"),""); | 842 | // curFile.replace(QRegExp("\\..*"),""); |
840 | f.setName((*it)); | 843 | f.setName((*it)); |
841 | f.setFile( curFile); | 844 | f.setFile( curFile); |
842 | f.writeLink(); | 845 | f.writeLink(); |
843 | } | 846 | } |
844 | } else { | 847 | } else { |
845 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | 848 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { |
846 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 849 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
847 | qDebug(curFile); | 850 | qDebug(curFile); |
848 | 851 | ||
849 | DocLnk f; | 852 | DocLnk f; |
850 | // curFile.replace(QRegExp("\\..*"),""); | 853 | // curFile.replace(QRegExp("\\..*"),""); |
851 | f.setName((*it)); | 854 | f.setName((*it)); |
852 | f.setFile( curFile); | 855 | f.setFile( curFile); |
853 | f.writeLink(); | 856 | f.writeLink(); |
854 | } | 857 | } |
855 | } | 858 | } |
856 | } | 859 | } |
857 | } | 860 | } |