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