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