summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-04-22 17:39:18 (UTC)
committer harlekin <harlekin>2003-04-22 17:39:18 (UTC)
commitb22d89883cd92bd9d858caf5ca90b6eef80598d4 (patch) (unidiff)
tree695ff1e42ca09098d8b0cba0b95f0f2f736e0fd2
parentab9387322c5802f75bc9b37b3bb334bd98dd5dd1 (diff)
downloadopie-b22d89883cd92bd9d858caf5ca90b6eef80598d4.zip
opie-b22d89883cd92bd9d858caf5ca90b6eef80598d4.tar.gz
opie-b22d89883cd92bd9d858caf5ca90b6eef80598d4.tar.bz2
- a lot of includes and gui cleanups
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp39
-rw-r--r--noncore/apps/advancedfm/advancedfm.h5
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp82
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp4
4 files changed, 47 insertions, 83 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 41e83c7..66353bb 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,145 +1,120 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#define DEVELOPERS_VERSION 12#define DEVELOPERS_VERSION
13#include "advancedfm.h" 13#include "advancedfm.h"
14 14
15#include <opie/otabwidget.h> 15
16// #include <opie/ofileselector.h> 16// #include <opie/ofileselector.h>
17// #include <opie/ofiledialog.h> 17// #include <opie/ofiledialog.h>
18 18
19#include <qpe/config.h> 19#include <opie/otabwidget.h>
20
20#include <qpe/filemanager.h> 21#include <qpe/filemanager.h>
21#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
22#include <qpe/qpemenubar.h>
23#include <qpe/qpetoolbar.h>
24#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
25#include <qpe/qcopenvelope_qws.h>
26#include <qpe/config.h> 24#include <qpe/config.h>
27#include <qpe/mimetype.h> 25#include <qpe/mimetype.h>
28#include <qpe/applnk.h> 26#include <qpe/applnk.h>
29#include <qpe/ir.h> 27#include <qpe/ir.h>
30#include <qpe/resource.h> 28#include <qpe/resource.h>
31#include <qpe/menubutton.h> 29#include <qpe/menubutton.h>
32 30
33
34#include <qwmatrix.h>
35#include <qregexp.h>
36#include <qtabwidget.h>
37#include <qtextstream.h>
38#include <qpushbutton.h>
39#include <qdatetime.h> 31#include <qdatetime.h>
40#include <qdir.h>
41#include <qfile.h> 32#include <qfile.h>
42#include <qstring.h>
43#include <qcombobox.h> 33#include <qcombobox.h>
44#include <qpopupmenu.h> 34#include <qpopupmenu.h>
45#include <qlistview.h> 35#include <qlistview.h>
46#include <qmainwindow.h>
47#include <qlabel.h> 36#include <qlabel.h>
48#include <qprogressbar.h>
49#include <qspinbox.h>
50#include <qwidget.h> 37#include <qwidget.h>
51#include <qlayout.h> 38#include <qlayout.h>
52#include <qimage.h> 39#include <qimage.h>
53#include <qpixmap.h>
54#include <qmessagebox.h> 40#include <qmessagebox.h>
55#include <qlineedit.h> 41#include <qlineedit.h>
56#include <qregexp.h>
57 42
58#include <unistd.h>
59#include <stdlib.h>
60#include <sys/stat.h> 43#include <sys/stat.h>
61#include <dirent.h>
62#include <stdio.h>
63#include <time.h> 44#include <time.h>
45#include <dirent.h>
64#include <fcntl.h> 46#include <fcntl.h>
65#include <mntent.h>
66#include <string.h>
67#include <errno.h>
68#include <sys/vfs.h> 47#include <sys/vfs.h>
69#include <mntent.h> 48#include <mntent.h>
70#include <sys/utsname.h>
71 49
72AdvancedFm::AdvancedFm( ) 50AdvancedFm::AdvancedFm( )
73 : QMainWindow( ) { 51 : QMainWindow( ) {
74 init(); 52 init();
75 renameBox = 0; 53 renameBox = 0;
76 54
77 QWMatrix matrix; 55 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
78 QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); 56
79 matrix.scale( .4, .4);
80 unknownXpm = pix.xForm(matrix);
81
82 initConnections(); 57 initConnections();
83 whichTab=1; 58 whichTab=1;
84 rePopulate(); 59 rePopulate();
85 currentPathCombo->setFocus(); 60 currentPathCombo->setFocus();
86} 61}
87 62
88AdvancedFm::~AdvancedFm() { 63AdvancedFm::~AdvancedFm() {
89} 64}
90 65
91 66
92void AdvancedFm::cleanUp() 67void AdvancedFm::cleanUp()
93{ 68{
94 QString sfile=QDir::homeDirPath(); 69 QString sfile=QDir::homeDirPath();
95 if(sfile.right(1) != "/") 70 if(sfile.right(1) != "/")
96 sfile+="/._temp"; 71 sfile+="/._temp";
97 else 72 else
98 sfile+="._temp"; 73 sfile+="._temp";
99 QFile file( sfile); 74 QFile file( sfile);
100 if(file.exists()) 75 if(file.exists())
101 file.remove(); 76 file.remove();
102} 77}
103 78
104void AdvancedFm::tabChanged(QWidget *w) 79void AdvancedFm::tabChanged(QWidget *w)
105{ 80{
106 if( w == tab) 81 if( w == tab)
107 whichTab = 1; 82 whichTab = 1;
108 else 83 else
109 whichTab = 2; 84 whichTab = 2;
110 85
111// qDebug("tab changed %d", whichTab ); 86// qDebug("tab changed %d", whichTab );
112 87
113 QString path = CurrentDir()->canonicalPath(); 88 QString path = CurrentDir()->canonicalPath();
114 currentPathCombo->lineEdit()->setText( path ); 89 currentPathCombo->lineEdit()->setText( path );
115 90
116 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); 91 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
117 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); 92 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
118 93
119 QString fs= getFileSystemType( (const QString &) path); 94 QString fs= getFileSystemType( (const QString &) path);
120 95
121 setCaption("AdvancedFm :: "+fs+" :: " 96 setCaption("AdvancedFm :: "+fs+" :: "
122 +checkDiskSpace( (const QString &) path )+ " kB free" ); 97 +checkDiskSpace( (const QString &) path )+ " kB free" );
123 chdir( path.latin1()); 98 chdir( path.latin1());
124} 99}
125 100
126 101
127void AdvancedFm::populateView() 102void AdvancedFm::populateView()
128{ 103{
129 QPixmap pm; 104 QPixmap pm;
130 QListView *thisView = CurrentView(); 105 QListView *thisView = CurrentView();
131 QDir *thisDir = CurrentDir(); 106 QDir *thisDir = CurrentDir();
132 QString path = thisDir->canonicalPath(); 107 QString path = thisDir->canonicalPath();
133 108
134 thisView->clear(); 109 thisView->clear();
135 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 110 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
136 thisDir->setMatchAllDirs(TRUE); 111 thisDir->setMatchAllDirs(TRUE);
137 thisDir->setNameFilter(filterStr); 112 thisDir->setNameFilter(filterStr);
138 QString fileL, fileS, fileDate; 113 QString fileL, fileS, fileDate;
139 QString fs= getFileSystemType((const QString &) path); 114 QString fs= getFileSystemType((const QString &) path);
140 setCaption("AdvancedFm :: "+fs+" :: " 115 setCaption("AdvancedFm :: "+fs+" :: "
141 +checkDiskSpace((const QString &) path)+" kB free" ); 116 +checkDiskSpace((const QString &) path)+" kB free" );
142 bool isDir=FALSE; 117 bool isDir=FALSE;
143 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 118 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
144 QFileInfoListIterator it(*list); 119 QFileInfoListIterator it(*list);
145 QFileInfo *fi; 120 QFileInfo *fi;
@@ -149,129 +124,129 @@ void AdvancedFm::populateView()
149 { 124 {
150 QString symLink=fi->readLink(); 125 QString symLink=fi->readLink();
151 QFileInfo sym( symLink); 126 QFileInfo sym( symLink);
152 fileS.sprintf( "%10i", sym.size() ); 127 fileS.sprintf( "%10i", sym.size() );
153 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); 128 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() );
154 fileDate = sym.lastModified().toString(); 129 fileDate = sym.lastModified().toString();
155 } 130 }
156 else 131 else
157 { 132 {
158 fileS.sprintf( "%10i", fi->size() ); 133 fileS.sprintf( "%10i", fi->size() );
159 fileL.sprintf( "%s",fi->fileName().data() ); 134 fileL.sprintf( "%s",fi->fileName().data() );
160 fileDate= fi->lastModified().toString(); 135 fileDate= fi->lastModified().toString();
161 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) 136 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() )
162 { 137 {
163 fileL+="/"; 138 fileL+="/";
164 isDir=TRUE; 139 isDir=TRUE;
165 } 140 }
166 } 141 }
167 142
168 QFileInfo fileInfo( path + "/" + fileL); 143 QFileInfo fileInfo( path + "/" + fileL);
169 144
170 if(fileL !="./" && fi->exists()) 145 if(fileL !="./" && fi->exists())
171 { 146 {
172 item= new QListViewItem( thisView, fileL, fileS , fileDate); 147 item= new QListViewItem( thisView, fileL, fileS , fileDate);
173 148
174 if(isDir || fileL.find("/",0,TRUE) != -1) 149 if(isDir || fileL.find("/",0,TRUE) != -1)
175 { 150 {
176 151
177 if( !QDir( fi->filePath() ).isReadable()) //is directory 152 if( !QDir( fi->filePath() ).isReadable()) //is directory
178 pm = Resource::loadPixmap( "lockedfolder" ); 153 pm = Resource::loadPixmap( "lockedfolder" );
179 else 154 else
180 pm= Resource::loadPixmap( "folder" ); 155 pm= Resource::loadPixmap( "folder" );
181 } 156 }
182 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) 157 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") )
183 { 158 {
184 pm = Resource::loadPixmap( "exec"); 159 pm = Resource::loadPixmap( "exec");
185 } 160 }
186 else if( (fileInfo.permission( QFileInfo::ExeUser) 161 else if( (fileInfo.permission( QFileInfo::ExeUser)
187 | fileInfo.permission( QFileInfo::ExeGroup) 162 | fileInfo.permission( QFileInfo::ExeGroup)
188 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) 163 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" )
189 { 164 {
190 pm = Resource::loadPixmap( "exec"); 165 pm = Resource::loadPixmap( "exec");
191 } 166 }
192 else if( !fi->isReadable() ) 167 else if( !fi->isReadable() )
193 { 168 {
194 pm = Resource::loadPixmap( "locked" ); 169 pm = Resource::loadPixmap( "locked" );
195 } 170 }
196 else { //everything else goes by mimetype 171 else { //everything else goes by mimetype
197 MimeType mt(fi->filePath()); 172 MimeType mt(fi->filePath());
198 pm=mt.pixmap(); //sets the correct pixmap for mimetype 173 pm=mt.pixmap(); //sets the correct pixmap for mimetype
199 if(pm.isNull()) { 174 if(pm.isNull()) {
200 pm = unknownXpm; 175 pm = unknownXpm;
201 } 176 }
202 } 177 }
203 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) 178 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1)
204 { 179 {
205 // overlay link image 180 // overlay link image
206 pm= Resource::loadPixmap( "folder" ); 181 pm= Resource::loadPixmap( "folder" );
207 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 182 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
208 QPainter painter( &pm ); 183 QPainter painter( &pm );
209 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 184 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
210 pm.setMask( pm.createHeuristicMask( FALSE ) ); 185 pm.setMask( pm.createHeuristicMask( FALSE ) );
211 } 186 }
212 item->setPixmap( 0,pm); 187 item->setPixmap( 0,pm);
213 188
214 } 189 }
215 isDir=FALSE; 190 isDir=FALSE;
216 ++it; 191 ++it;
217 } 192 }
218 193
219 if( path.find("dev",0,TRUE) != -1) 194 if( path.find("dev",0,TRUE) != -1)
220 { 195 {
221 struct stat buf; 196 struct stat buf;
222 dev_t devT; 197 dev_t devT;
223 DIR *dir; 198 DIR *dir;
224 struct dirent *mydirent; 199 struct dirent *mydirent;
225 200
226 if((dir = opendir( path.latin1())) != NULL) 201 if((dir = opendir( path.latin1())) != NULL)
227 while ((mydirent = readdir(dir)) != NULL) 202 while ((mydirent = readdir(dir)) != NULL)
228 { 203 {
229 lstat( mydirent->d_name, &buf); 204 lstat( mydirent->d_name, &buf);
230// qDebug(mydirent->d_name); 205// qDebug(mydirent->d_name);
231 fileL.sprintf("%s", mydirent->d_name); 206 fileL.sprintf("%s", mydirent->d_name);
232 devT = buf.st_dev; 207 devT = buf.st_dev;
233 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 208 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
234 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 209 fileDate.sprintf("%s", ctime( &buf.st_mtime));
235 if( fileL.find(".") == -1 ) 210 if( fileL.find(".") == -1 )
236 { 211 {
237 item= new QListViewItem( thisView, fileL, fileS, fileDate); 212 item= new QListViewItem( thisView, fileL, fileS, fileDate);
238 pm = unknownXpm; 213 pm = unknownXpm;
239 item->setPixmap( 0,pm); 214 item->setPixmap( 0,pm);
240 } 215 }
241 } 216 }
242 217
243 closedir(dir); 218 closedir(dir);
244 } 219 }
245 220
246 thisView->setSorting( 3,FALSE); 221 thisView->setSorting( 3,FALSE);
247 fillCombo( (const QString &) path ); 222 fillCombo( (const QString &) path );
248} 223}
249 224
250void AdvancedFm::rePopulate() 225void AdvancedFm::rePopulate()
251{ 226{
252 int tmpTab = whichTab; 227 int tmpTab = whichTab;
253 qDebug("%d", tmpTab); 228 qDebug("%d", tmpTab);
254 229
255 for(int i =1; i < 3; i++) 230 for(int i =1; i < 3; i++)
256 { 231 {
257 TabWidget->setCurrentTab(i - 1); 232 TabWidget->setCurrentTab(i - 1);
258 populateView(); 233 populateView();
259 } 234 }
260 TabWidget->setCurrentTab( tmpTab - 1); 235 TabWidget->setCurrentTab( tmpTab - 1);
261} 236}
262 237
263void AdvancedFm::ListClicked(QListViewItem *selectedItem) 238void AdvancedFm::ListClicked(QListViewItem *selectedItem)
264{ 239{
265 if(selectedItem) 240 if(selectedItem)
266 { 241 {
267 QString strItem=selectedItem->text(0); 242 QString strItem=selectedItem->text(0);
268 QString strSize=selectedItem->text(1); 243 QString strSize=selectedItem->text(1);
269 strSize=strSize.stripWhiteSpace(); 244 strSize=strSize.stripWhiteSpace();
270 bool isDirectory = false; 245 bool isDirectory = false;
271 QString strItem2; 246 QString strItem2;
272 247
273 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink 248 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink
274 { 249 {
275 strItem2 = dealWithSymName((const QString&)strItem); 250 strItem2 = dealWithSymName((const QString&)strItem);
276 if(QDir(strItem2).exists() ) 251 if(QDir(strItem2).exists() )
277 strItem = strItem2; 252 strItem = strItem2;
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index c30d8e0..4480051 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -1,121 +1,118 @@
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 <opie/otabwidget.h> 17//#include <opie/otabwidget.h>
18#include <opie/oprocess.h> 18#include <opie/oprocess.h>
19#include <qpe/ir.h> 19#include <qpe/ir.h>
20 20
21#include <qvariant.h> 21#include <qvariant.h>
22#include <qdialog.h> 22#include <qdialog.h>
23#include <qmainwindow.h> 23#include <qmainwindow.h>
24#include <qstringlist.h> 24#include <qstringlist.h>
25#include <qdir.h> 25#include <qdir.h>
26#include <qstring.h> 26#include <qstring.h>
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qpixmap.h> 29#include <qpixmap.h>
30 30
31class OTabWidget; 31class OTabWidget;
32class QVBoxLayout; 32class QVBoxLayout;
33class QHBoxLayout; 33class QHBoxLayout;
34class QGridLayout; 34class QGridLayout;
35class QComboBox; 35class QComboBox;
36class QListView; 36class QListView;
37class QListviewItem; 37class QListviewItem;
38class QLabel; 38class QLabel;
39class QProgressBar; 39class QProgressBar;
40class QSpinBox; 40class QSpinBox;
41class QTabWidget; 41class QTabWidget;
42class QWidget; 42class QWidget;
43class QPEToolBar;
44class QPEMenuBar;
45class QPopupMenu; 43class QPopupMenu;
46class QFile; 44class QFile;
47class QListViewItem; 45class QListViewItem;
48class QLineEdit; 46class QLineEdit;
49class MenuButton; 47class MenuButton;
50 48
51//class QPushButton;
52class QToolButton; 49class QToolButton;
53class Ir; 50class Ir;
54 51
55class AdvancedFm : public QMainWindow 52class AdvancedFm : public QMainWindow
56{ 53{
57 Q_OBJECT 54 Q_OBJECT
58public: 55public:
59 AdvancedFm(); 56 AdvancedFm();
60 ~AdvancedFm(); 57 ~AdvancedFm();
61protected slots: 58protected slots:
62 void selectAll(); 59 void selectAll();
63 void addToDocs(); 60 void addToDocs();
64 void doDirChange(); 61 void doDirChange();
65 void mkDir(); 62 void mkDir();
66 void del(); 63 void del();
67 void rn(); 64 void rn();
68 void populateView(); 65 void populateView();
69 void rePopulate(); 66 void rePopulate();
70 void showHidden(); 67 void showHidden();
71 void showMenuHidden(); 68 void showMenuHidden();
72 void writeConfig(); 69 void writeConfig();
73 void readConfig(); 70 void readConfig();
74 void ListClicked(QListViewItem *); 71 void ListClicked(QListViewItem *);
75 void ListPressed( int, QListViewItem *, const QPoint&, int); 72 void ListPressed( int, QListViewItem *, const QPoint&, int);
76 void makeDir(); 73 void makeDir();
77 void doDelete(); 74 void doDelete();
78 void tabChanged(QWidget*); 75 void tabChanged(QWidget*);
79 void cleanUp(); 76 void cleanUp();
80 void renameIt(); 77 void renameIt();
81 void runThis(); 78 void runThis();
82 void runText(); 79 void runText();
83 void filePerms(); 80 void filePerms();
84 void doProperties(); 81 void doProperties();
85 void runCommand(); 82 void runCommand();
86 void runCommandStd(); 83 void runCommandStd();
87 QStringList getPath(); 84 QStringList getPath();
88 void mkSym(); 85 void mkSym();
89 void switchToLocalTab(); 86 void switchToLocalTab();
90 void switchToRemoteTab(); 87 void switchToRemoteTab();
91 88
92protected: 89protected:
93 90
94 OTabWidget *TabWidget; 91 OTabWidget *TabWidget;
95 QPixmap unknownXpm; 92 QPixmap unknownXpm;
96 int whichTab; 93 int whichTab;
97// QTabWidget *TabWidget; 94// QTabWidget *TabWidget;
98 QWidget *tab, *tab_2, *tab_3; 95 QWidget *tab, *tab_2, *tab_3;
99 QListView *Local_View, *Remote_View; 96 QListView *Local_View, *Remote_View;
100 97
101 QLineEdit *currentPathEdit; 98 QLineEdit *currentPathEdit;
102 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; 99 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/;
103 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 100 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
104// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 101// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
105 QDir currentDir, currentRemoteDir; 102 QDir currentDir, currentRemoteDir;
106 QComboBox *currentPathCombo; 103 QComboBox *currentPathCombo;
107 QString filterStr, s_addBookmark, s_removeBookmark; 104 QString filterStr, s_addBookmark, s_removeBookmark;
108 QListViewItem * item; 105 QListViewItem * item;
109 bool b; 106 bool b;
110 QStringList fileSystemTypeList, fsList; 107 QStringList fileSystemTypeList, fsList;
111 int currentServerConfig; 108 int currentServerConfig;
112 bool zaurusDevice; 109 bool zaurusDevice;
113 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 110 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
114 QStringList remoteDirPathStringList, localDirPathStringList; 111 QStringList remoteDirPathStringList, localDirPathStringList;
115 QLineEdit *renameBox; 112 QLineEdit *renameBox;
116 113
117 void init(); 114 void init();
118 void initConnections(); 115 void initConnections();
119 void keyReleaseEvent( QKeyEvent *); 116 void keyReleaseEvent( QKeyEvent *);
120 void keyPressEvent( QKeyEvent *); 117 void keyPressEvent( QKeyEvent *);
121 QString getFileSystemType(const QString &); 118 QString getFileSystemType(const QString &);
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index 1a7a6d7..eb2bcd8 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -1,202 +1,196 @@
1/*************************************************************************** 1/***************************************************************************
2 advancedfmData.cpp 2 advancedfmData.cpp
3 ------------------- 3 -------------------
4** Created: Mon 09-23-2002 13:24:11 4** Created: Mon 09-23-2002 13:24:11
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#include "advancedfm.h" 12#include "advancedfm.h"
13 13
14#include <opie/otabwidget.h> 14#include <opie/otabwidget.h>
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/qpemenubar.h>
17#include <qpe/qpetoolbar.h>
18#include <qpe/resource.h> 16#include <qpe/resource.h>
19#include <qpe/menubutton.h> 17#include <qpe/menubutton.h>
20#include <qpe/config.h>
21 18
22#include <qlayout.h> 19#include <qlayout.h>
23#include <qpixmap.h> 20#include <qhbox.h>
21#include <qmenubar.h>
24#include <qcombobox.h> 22#include <qcombobox.h>
25#include <qpopupmenu.h>
26#include <qtabwidget.h>
27#include <qtoolbutton.h> 23#include <qtoolbutton.h>
28#include <qlineedit.h> 24#include <qlineedit.h>
29#include <qlistview.h> 25#include <qlistview.h>
30 26
31#include <sys/utsname.h> 27#include <sys/utsname.h>
32 28
33 29
34void AdvancedFm::init() { 30void AdvancedFm::init() {
35#if defined(QT_QWS_OPIE) 31#if defined(QT_QWS_OPIE)
36 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); 32 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!");
37#endif 33#endif
38 setCaption( tr( "AdvancedFm" ) ); 34 setCaption( tr( "AdvancedFm" ) );
39 35
40 QGridLayout *layout = new QGridLayout( this ); 36 QVBoxLayout *layout = new QVBoxLayout( this );
41 layout->setSpacing( 2); 37 layout->setSpacing( 2);
42 layout->setMargin( 2); 38 layout->setMargin( 2);
43 39
44 40
45 QPEMenuBar *menuBar = new QPEMenuBar(this); 41 QMenuBar *menuBar = new QMenuBar(this);
46 fileMenu = new QPopupMenu( this ); 42 fileMenu = new QPopupMenu( this );
47 viewMenu = new QPopupMenu( this ); 43 viewMenu = new QPopupMenu( this );
48// customDirMenu = new QPopupMenu( this ); 44// customDirMenu = new QPopupMenu( this );
49 45
50 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); 46 layout->addWidget( menuBar );
51 47
52 menuBar->insertItem( tr( "File" ), fileMenu); 48 menuBar->insertItem( tr( "File" ), fileMenu);
53 menuBar->insertItem( tr( "View" ), viewMenu); 49 menuBar->insertItem( tr( "View" ), viewMenu);
54// menuBar->insertItem( tr( "^" ), customDirMenu);
55 50
56 cdUpButton = new QToolButton( this,"cdUpButton"); 51 cdUpButton = new QToolButton( 0,"cdUpButton");
57 cdUpButton->setPixmap(Resource::loadPixmap("up")); 52 cdUpButton->setPixmap(Resource::loadPixmap("up"));
58 cdUpButton->setFixedSize( QSize( 20, 20 ) ); 53 cdUpButton->setAutoRaise( true );
59 layout->addMultiCellWidget( cdUpButton , 0, 0, 2, 2); 54 menuBar->insertItem( cdUpButton );
60 55
61 menuButton = new MenuButton(this);
62 menuButton->setFixedSize( QSize( 20, 20 ) );
63 layout->addMultiCellWidget( menuButton , 0, 0, 3, 3);
64 56
65 qpeDirButton= new QToolButton(this,"QPEButton"); 57 QHBox *lineBox = new QHBox( this );
58
59 qpeDirButton= new QToolButton( 0,"QPEButton");
66 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); 60 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
67 qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); 61 qpeDirButton->setAutoRaise( true );
68 layout->addMultiCellWidget( qpeDirButton , 0, 0, 4, 4); 62 menuBar->insertItem( qpeDirButton );
69 63
70 cfButton = new QToolButton( this,"CFButton"); 64 cfButton = new QToolButton( 0, "CFButton");
71 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 65 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
72 cfButton ->setFixedSize( QSize( 20, 20 ) ); 66 cfButton->setAutoRaise( true );
73 layout->addMultiCellWidget( cfButton , 0, 0, 5, 5); 67 menuBar->insertItem( cfButton );
74 68
75 sdButton = new QToolButton( this,"SDButton"); 69 sdButton = new QToolButton( 0, "SDButton");
76 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); 70 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
77 sdButton->setFixedSize( QSize( 20, 20 ) ); 71 sdButton->setAutoRaise( true );
78 layout->addMultiCellWidget( sdButton , 0, 0, 6, 6); 72 menuBar->insertItem( sdButton );
79
80 73
81 docButton = new QToolButton( this,"docsButton"); 74 docButton = new QToolButton( 0,"docsButton");
82 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 75 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
83 docButton->setFixedSize( QSize( 20, 20 ) ); 76 docButton->setAutoRaise( true );
84 layout->addMultiCellWidget( docButton, 0, 0, 7, 7); 77 menuBar->insertItem( docButton );
85 78
86 homeButton = new QToolButton( this,"homeButton"); 79 homeButton = new QToolButton( 0, "homeButton");
87 homeButton->setPixmap(Resource::loadPixmap("home")); 80 homeButton->setPixmap(Resource::loadPixmap("home"));
88 homeButton->setFixedSize( QSize( 20, 20 ) ); 81 homeButton->setAutoRaise( true );
89 layout->addMultiCellWidget( homeButton, 0, 0, 8, 8); 82 menuBar->insertItem( homeButton );
90 83
91 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); 84 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
92 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 85 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
93 fileMenu->insertSeparator(); 86 fileMenu->insertSeparator();
94 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 87 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
95 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 88 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
96 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 89 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
97 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 90 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
98 fileMenu->insertSeparator(); 91 fileMenu->insertSeparator();
99 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 92 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
100 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); 93 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ));
101 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 94 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
102 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 95 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
103 fileMenu->setCheckable(TRUE); 96 fileMenu->setCheckable(TRUE);
104 97
105 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 98 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
106 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 99 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
107// viewMenu->insertSeparator(); 100// viewMenu->insertSeparator();
108// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 101// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
109 viewMenu->setCheckable(TRUE); 102 viewMenu->setCheckable(TRUE);
110 103
111 s_addBookmark = tr("Bookmark Directory"); 104 s_addBookmark = tr("Bookmark Directory");
112 s_removeBookmark = tr("Remove Current Directory from Bookmarks"); 105 s_removeBookmark = tr("Remove Current Directory from Bookmarks");
113 106
114 menuButton->setUseLabel(false);
115 menuButton->insertItem( s_addBookmark);
116 menuButton->insertItem( s_removeBookmark);
117 menuButton->insertSeparator();
118// menuButton->insertItem(""); 107// menuButton->insertItem("");
119 108
120// customDirMenu->insertItem(tr("Add This Directory")); 109// customDirMenu->insertItem(tr("Add This Directory"));
121// customDirMenu->insertItem(tr("Remove This Directory")); 110// customDirMenu->insertItem(tr("Remove This Directory"));
122// customDirMenu->insertSeparator(); 111// customDirMenu->insertSeparator();
123 112
124 customDirsToMenu(); 113 customDirsToMenu();
125 114
126 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 115 menuButton = new MenuButton( lineBox );
127 currentPathCombo->setEditable(TRUE);
128 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8);
129 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
130 116
117 menuButton->setUseLabel(false);
118 menuButton->setMaximumWidth( 20 );
119 menuButton->insertItem( s_addBookmark);
120 menuButton->insertItem( s_removeBookmark);
121 menuButton->insertSeparator();
122
123 currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" );
124 currentPathCombo->setEditable(TRUE);
131 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 125 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
132 126
133 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8); 127 layout->addWidget( lineBox );
134 128
135 129
136 TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); 130 TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab);
137// TabWidget = new QTabWidget( this, "TabWidget" ); 131// TabWidget = new QTabWidget( this, "TabWidget" );
138 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 8); 132 layout->addWidget( TabWidget, 4 );
139 133
140 tab = new QWidget( TabWidget, "tab" ); 134 tab = new QWidget( TabWidget, "tab" );
141 tabLayout = new QGridLayout( tab ); 135 tabLayout = new QGridLayout( tab );
142 tabLayout->setSpacing( 2); 136 tabLayout->setSpacing( 2);
143 tabLayout->setMargin( 2); 137 tabLayout->setMargin( 2);
144 138
145 Local_View = new QListView( tab, "Local_View" ); 139 Local_View = new QListView( tab, "Local_View" );
146 Local_View->addColumn( tr("File"),130); 140 Local_View->addColumn( tr("File"),130);
147 Local_View->addColumn( tr("Size"),-1); 141 Local_View->addColumn( tr("Size"),-1);
148 Local_View->setColumnAlignment(1,QListView::AlignRight); 142 Local_View->setColumnAlignment(1,QListView::AlignRight);
149 Local_View->addColumn( tr("Date"),-1); 143 Local_View->addColumn( tr("Date"),-1);
150 Local_View->setColumnAlignment(2,QListView::AlignRight); 144 Local_View->setColumnAlignment(2,QListView::AlignRight);
151 Local_View->setAllColumnsShowFocus(TRUE); 145 Local_View->setAllColumnsShowFocus(TRUE);
152 Local_View->setMultiSelection( TRUE ); 146 Local_View->setMultiSelection( TRUE );
153 Local_View->setSelectionMode(QListView::Extended); 147 Local_View->setSelectionMode(QListView::Extended);
154 148
155 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 149 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
156 150
157 tabLayout->addWidget( Local_View, 0, 0 ); 151 tabLayout->addWidget( Local_View, 0, 0 );
158 152
159 TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); 153 TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1"));
160// TabWidget->insertTab( tab, tr("1")); 154// TabWidget->insertTab( tab, tr("1"));
161 155
162 tab_2 = new QWidget( TabWidget, "tab_2" ); 156 tab_2 = new QWidget( TabWidget, "tab_2" );
163 tabLayout_2 = new QGridLayout( tab_2 ); 157 tabLayout_2 = new QGridLayout( tab_2 );
164 tabLayout_2->setSpacing( 2); 158 tabLayout_2->setSpacing( 2);
165 tabLayout_2->setMargin( 2); 159 tabLayout_2->setMargin( 2);
166 160
167 Remote_View = new QListView( tab_2, "Remote_View" ); 161 Remote_View = new QListView( tab_2, "Remote_View" );
168 Remote_View->addColumn( tr("File"),130); 162 Remote_View->addColumn( tr("File"),130);
169 Remote_View->addColumn( tr("Size"),-1); 163 Remote_View->addColumn( tr("Size"),-1);
170 Remote_View->setColumnAlignment(1,QListView::AlignRight); 164 Remote_View->setColumnAlignment(1,QListView::AlignRight);
171 Remote_View->addColumn( tr("Date"),-1); 165 Remote_View->addColumn( tr("Date"),-1);
172 Remote_View->setColumnAlignment(2,QListView::AlignRight); 166 Remote_View->setColumnAlignment(2,QListView::AlignRight);
173 Remote_View->setAllColumnsShowFocus(TRUE); 167 Remote_View->setAllColumnsShowFocus(TRUE);
174 Remote_View->setMultiSelection( TRUE ); 168 Remote_View->setMultiSelection( TRUE );
175 Remote_View->setSelectionMode(QListView::Extended); 169 Remote_View->setSelectionMode(QListView::Extended);
176 170
177 171
178 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 172 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
179 173
180 tabLayout_2->addWidget( Remote_View, 0, 0 ); 174 tabLayout_2->addWidget( Remote_View, 0, 0 );
181 175
182 TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); 176 TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2"));
183// TabWidget->insertTab( tab_2, tr( "2")); 177// TabWidget->insertTab( tab_2, tr( "2"));
184 178
185 /* tab_3 = new QWidget( TabWidget, "tab_3" ); 179 /* tab_3 = new QWidget( TabWidget, "tab_3" );
186 tabLayout_3 = new QGridLayout( tab_3 ); 180 tabLayout_3 = new QGridLayout( tab_3 );
187 tabLayout_3->setSpacing( 2); 181 tabLayout_3->setSpacing( 2);
188 tabLayout_3->setMargin( 2); 182 tabLayout_3->setMargin( 2);
189 183
190 184
191 // OFileDialog fileDialog; 185 // OFileDialog fileDialog;
192 // fileDialog; 186 // fileDialog;
193 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 187 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
194 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 188 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
195 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 189 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
196 190
197 QListView *fileTree; 191 QListView *fileTree;
198 fileTree = new QListView( tab_3, "tree" ); 192 fileTree = new QListView( tab_3, "tree" );
199 193
200 194
201 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 195 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
202 196
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index eae86a4..575833a 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,86 +1,84 @@
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#include "advancedfm.h" 12#include "advancedfm.h"
13#include "output.h" 13#include "output.h"
14#include "filePermissions.h" 14#include "filePermissions.h"
15 15
16#include <opie/otabwidget.h> 16#include <opie/otabwidget.h>
17#include <opie/oprocess.h> 17#include <opie/oprocess.h>
18 18
19#include <qpe/lnkproperties.h> 19#include <qpe/lnkproperties.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/qpemenubar.h>
22#include <qpe/qpetoolbar.h>
23#include <qpe/resource.h> 21#include <qpe/resource.h>
24#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
25#include <qpe/applnk.h> 23#include <qpe/applnk.h>
26#include <qpe/ir.h> 24#include <qpe/ir.h>
27 25
28#include <qmessagebox.h> 26#include <qmessagebox.h>
29#include <qmultilineedit.h> 27#include <qmultilineedit.h>
30 28
31#include <qstring.h> 29#include <qstring.h>
32 30
33#include <qlayout.h> 31#include <qlayout.h>
34#include <qpixmap.h> 32#include <qpixmap.h>
35#include <qcombobox.h> 33#include <qcombobox.h>
36#include <qpopupmenu.h> 34#include <qpopupmenu.h>
37#include <qtabwidget.h> 35#include <qtabwidget.h>
38#include <qtoolbutton.h> 36#include <qtoolbutton.h>
39#include <qtabwidget.h> 37#include <qtabwidget.h>
40#include <qlineedit.h> 38#include <qlineedit.h>
41#include <qlistview.h> 39#include <qlistview.h>
42 40
43#include <stdlib.h> 41#include <stdlib.h>
44#include <unistd.h> 42#include <unistd.h>
45#include <sys/stat.h> 43#include <sys/stat.h>
46#include <dirent.h> 44#include <dirent.h>
47#include <sys/sendfile.h> 45#include <sys/sendfile.h>
48#include <fcntl.h> 46#include <fcntl.h>
49 47
50void AdvancedFm::doDirChange() 48void AdvancedFm::doDirChange()
51{ 49{
52 ListClicked( CurrentView()->currentItem()); 50 ListClicked( CurrentView()->currentItem());
53} 51}
54 52
55void AdvancedFm::showMenuHidden() 53void AdvancedFm::showMenuHidden()
56{ 54{
57 if (b) 55 if (b)
58 { 56 {
59 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 57 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
60 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 58 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
61 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 59 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
62// b=FALSE; 60// b=FALSE;
63 61
64 } 62 }
65 else 63 else
66 { 64 {
67 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 65 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
68 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 66 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
69 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 67 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
70// b=TRUE; 68// b=TRUE;
71 } 69 }
72 rePopulate(); 70 rePopulate();
73// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); 71// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true");
74 if(b) b = false; else b = true; 72 if(b) b = false; else b = true;
75} 73}
76 74
77void AdvancedFm::showHidden() 75void AdvancedFm::showHidden()
78{ 76{
79 if (b) 77 if (b)
80 { 78 {
81 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 79 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
82 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 80 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
83// fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 81// fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
84// b=FALSE; 82// b=FALSE;
85 83
86 } 84 }
@@ -713,129 +711,129 @@ void AdvancedFm::doBeam()
713 { 711 {
714 712
715 QString curFile = CurrentDir()->canonicalPath()+"/"+(*it); 713 QString curFile = CurrentDir()->canonicalPath()+"/"+(*it);
716 if( curFile.right(1) == "/") 714 if( curFile.right(1) == "/")
717 { 715 {
718 curFile = curFile.left( curFile.length() -1); 716 curFile = curFile.left( curFile.length() -1);
719 } 717 }
720 Ir *file = new Ir(this, "IR"); 718 Ir *file = new Ir(this, "IR");
721 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 719 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
722 file->send( curFile, curFile ); 720 file->send( curFile, curFile );
723 } 721 }
724 } 722 }
725 } 723 }
726 724
727} 725}
728 726
729void AdvancedFm::fileBeamFinished( Ir *) 727void AdvancedFm::fileBeamFinished( Ir *)
730{ 728{
731 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 729 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
732} 730}
733 731
734void AdvancedFm::selectAll() 732void AdvancedFm::selectAll()
735{ 733{
736// if (TabWidget->currentTab() == 0) { 734// if (TabWidget->currentTab() == 0) {
737 QListView *thisView = CurrentView(); 735 QListView *thisView = CurrentView();
738 thisView->selectAll(true); 736 thisView->selectAll(true);
739 thisView->setSelected( thisView->firstChild(),false); 737 thisView->setSelected( thisView->firstChild(),false);
740// } else { 738// } else {
741// Remote_View->selectAll(true); 739// Remote_View->selectAll(true);
742// Remote_View->setSelected( Remote_View->firstChild(),false); 740// Remote_View->setSelected( Remote_View->firstChild(),false);
743// } 741// }
744} 742}
745 743
746void AdvancedFm::startProcess(const QString & cmd) 744void AdvancedFm::startProcess(const QString & cmd)
747{ 745{
748 QStringList command; 746 QStringList command;
749 OProcess *process; 747 OProcess *process;
750 process = new OProcess(); 748 process = new OProcess();
751 connect(process, SIGNAL(processExited(OProcess *)), 749 connect(process, SIGNAL(processExited(OProcess *)),
752 this, SLOT( processEnded(OProcess *))); 750 this, SLOT( processEnded(OProcess *)));
753 751
754 connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), 752 connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)),
755 this, SLOT( oprocessStderr(OProcess *, char *, int))); 753 this, SLOT( oprocessStderr(OProcess *, char *, int)));
756 754
757 command << "/bin/sh"; 755 command << "/bin/sh";
758 command << "-c"; 756 command << "-c";
759 command << cmd.latin1(); 757 command << cmd.latin1();
760 *process << command; 758 *process << command;
761 if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) 759 if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
762 qDebug("could not start process"); 760 qDebug("could not start process");
763} 761}
764 762
765void AdvancedFm::processEnded(OProcess *) 763void AdvancedFm::processEnded(OProcess *)
766{ 764{
767// populateLocalView(); 765// populateLocalView();
768 populateView(); 766 populateView();
769} 767}
770 768
771void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int buflen) { 769void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int buflen) {
772 qWarning("received stderrt %d bytes", buflen); 770 qWarning("received stderrt %d bytes", buflen);
773 771
774 QString lineStr = buffer; 772 QString lineStr = buffer;
775// lineStr=lineStr.left(lineStr.length()-1); 773// lineStr=lineStr.left(lineStr.length()-1);
776 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); 774 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
777 775
778// OutputEdit->append(lineStr); 776// OutputEdit->append(lineStr);
779// OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 777// OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
780} 778}
781 779
782bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) 780bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
783{ 781{
784 if ( o->inherits( "QLineEdit" ) ) 782 if ( o->inherits( "QLineEdit" ) )
785 { 783 {
786 if ( e->type() == QEvent::KeyPress ) 784 if ( e->type() == QEvent::KeyPress )
787 { 785 {
788 QKeyEvent *ke = (QKeyEvent*)e; 786 QKeyEvent *ke = (QKeyEvent*)e;
789 if ( ke->key() == Key_Return || 787 if ( ke->key() == Key_Return ||
790 ke->key() == Key_Enter ) 788 ke->key() == Key_Enter )
791 { 789 {
792 okRename(); 790 okRename();
793 return true; 791 return true;
794 } 792 }
795 else if ( ke->key() == Key_Escape ) 793 else if ( ke->key() == Key_Escape )
796 { 794 {
797 cancelRename(); 795 cancelRename();
798 return true; 796 return true;
799 } 797 }
800 } 798 }
801 else if ( e->type() == QEvent::FocusOut ) 799 else if ( e->type() == QEvent::FocusOut )
802 { 800 {
803 cancelRename(); 801 cancelRename();
804 return true; 802 return true;
805 } 803 }
806 } 804 }
807 if ( o->inherits( "QListView" ) ) 805 if ( o->inherits( "QListView" ) )
808 { 806 {
809 if ( e->type() == QEvent::FocusOut ) 807 if ( e->type() == QEvent::FocusOut )
810 { 808 {
811 printf("focusIn\n"); 809 printf("focusIn\n");
812 810
813 } 811 }
814 } 812 }
815 813
816 return QWidget::eventFilter( o, e ); 814 return QWidget::eventFilter( o, e );
817} 815}
818 816
819 817
820void AdvancedFm::cancelRename() 818void AdvancedFm::cancelRename()
821{ 819{
822 qDebug("cancel rename"); 820 qDebug("cancel rename");
823 QListView * view; 821 QListView * view;
824 view = CurrentView(); 822 view = CurrentView();
825 823
826 bool resetFocus = view->viewport()->focusProxy() == renameBox; 824 bool resetFocus = view->viewport()->focusProxy() == renameBox;
827 delete renameBox; 825 delete renameBox;
828 renameBox = 0; 826 renameBox = 0;
829 if ( resetFocus ) 827 if ( resetFocus )
830 { 828 {
831 view->viewport()->setFocusProxy( view); 829 view->viewport()->setFocusProxy( view);
832 view->setFocus(); 830 view->setFocus();
833 } 831 }
834} 832}
835 833
836void AdvancedFm::doRename(QListView * view) 834void AdvancedFm::doRename(QListView * view)
837{ 835{
838 836
839 QRect r = view->itemRect( view->currentItem( )); 837 QRect r = view->itemRect( view->currentItem( ));
840 r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); 838 r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
841 r.setX( view->contentsX() ); 839 r.setX( view->contentsX() );