summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp39
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
2 files changed, 29 insertions, 11 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 7ee78c0..0f2555d 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -51,48 +51,49 @@
51#include <qlabel.h> 51#include <qlabel.h>
52#include <qprogressbar.h> 52#include <qprogressbar.h>
53#include <qspinbox.h> 53#include <qspinbox.h>
54#include <qtabwidget.h> 54#include <qtabwidget.h>
55#include <qwidget.h> 55#include <qwidget.h>
56#include <qlayout.h> 56#include <qlayout.h>
57#include <qimage.h> 57#include <qimage.h>
58#include <qpixmap.h> 58#include <qpixmap.h>
59#include <qmessagebox.h> 59#include <qmessagebox.h>
60#include <qlineedit.h> 60#include <qlineedit.h>
61#include <qregexp.h> 61#include <qregexp.h>
62 62
63#include <unistd.h> 63#include <unistd.h>
64#include <stdlib.h> 64#include <stdlib.h>
65#include <sys/stat.h> 65#include <sys/stat.h>
66#include <dirent.h> 66#include <dirent.h>
67#include <stdio.h> 67#include <stdio.h>
68#include <time.h> 68#include <time.h>
69#include <fcntl.h> 69#include <fcntl.h>
70#include <mntent.h> 70#include <mntent.h>
71#include <string.h> 71#include <string.h>
72#include <errno.h> 72#include <errno.h>
73#include <sys/vfs.h> 73#include <sys/vfs.h>
74#include <mntent.h> 74#include <mntent.h>
75#include <sys/utsname.h>
75 76
76AdvancedFm::AdvancedFm( ) 77AdvancedFm::AdvancedFm( )
77 : QMainWindow( ) 78 : QMainWindow( )
78{ 79{
79 setCaption( tr( "AdvancedFm" ) ); 80 setCaption( tr( "AdvancedFm" ) );
80 81
81 QGridLayout *layout = new QGridLayout( this ); 82 QGridLayout *layout = new QGridLayout( this );
82 layout->setSpacing( 2); 83 layout->setSpacing( 2);
83 layout->setMargin( 2); 84 layout->setMargin( 2);
84 85
85 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 86 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
86 87
87 QPEMenuBar *menuBar = new QPEMenuBar(this); 88 QPEMenuBar *menuBar = new QPEMenuBar(this);
88 fileMenu = new QPopupMenu( this ); 89 fileMenu = new QPopupMenu( this );
89 viewMenu = new QPopupMenu( this ); 90 viewMenu = new QPopupMenu( this );
90 91
91 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); 92 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
92 93
93 menuBar->insertItem( tr( "File" ), fileMenu); 94 menuBar->insertItem( tr( "File" ), fileMenu);
94 menuBar->insertItem( tr( "View" ), viewMenu); 95 menuBar->insertItem( tr( "View" ), viewMenu);
95 96
96 qpeDirButton= new QToolButton(this,"QPEButton"); 97 qpeDirButton= new QToolButton(this,"QPEButton");
97 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); 98 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
98 qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); 99 qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
@@ -226,49 +227,60 @@ AdvancedFm::AdvancedFm( )
226 this,SLOT(tabChanged(QWidget*))); 227 this,SLOT(tabChanged(QWidget*)));
227 228
228 /* tab_3 = new QWidget( TabWidget, "tab_3" ); 229 /* tab_3 = new QWidget( TabWidget, "tab_3" );
229 tabLayout_3 = new QGridLayout( tab_3 ); 230 tabLayout_3 = new QGridLayout( tab_3 );
230 tabLayout_3->setSpacing( 2); 231 tabLayout_3->setSpacing( 2);
231 tabLayout_3->setMargin( 2); 232 tabLayout_3->setMargin( 2);
232 233
233 234
234 // OFileDialog fileDialog; 235 // OFileDialog fileDialog;
235 // fileDialog; 236 // fileDialog;
236 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 237 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
237 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 238 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
238 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 239 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
239 240
240 QListView *fileTree; 241 QListView *fileTree;
241 fileTree = new QListView( tab_3, "tree" ); 242 fileTree = new QListView( tab_3, "tree" );
242 243
243 244
244 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 245 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
245 246
246 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 247 TabWidget->insertTab( tab_3, tr( "Remote" ) );
247 */ 248 */
248 249
249 /////////////// 250 ///////////////
250 251
252 struct utsname name; /* check for embedix kernel running on the zaurus*/
253 if (uname(&name) != -1) {
254 QString release=name.release;
255 if(release.find("embedix",0,TRUE) !=-1) {
256 zaurusDevice=TRUE;
257 } else {
258 zaurusDevice=FALSE;
259 sdButton->hide();
260 }
261 }
262
251 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 263 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
252 currentDir.setPath( QDir::currentDirPath()); 264 currentDir.setPath( QDir::currentDirPath());
253 265
254 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 266 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
255 currentRemoteDir.setPath( QDir::currentDirPath()); 267 currentRemoteDir.setPath( QDir::currentDirPath());
256 268
257 b = TRUE; 269 b = TRUE;
258 270
259 filterStr="*"; 271 filterStr="*";
260 b=FALSE; 272 b=FALSE;
261 273
262 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); 274 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
263 275
264 populateLocalView(); 276 populateLocalView();
265 populateRemoteView(); 277 populateRemoteView();
266 currentPathCombo->setFocus(); 278 currentPathCombo->setFocus();
267} 279}
268 280
269AdvancedFm::~AdvancedFm() 281AdvancedFm::~AdvancedFm()
270{ 282{
271} 283}
272 284
273void AdvancedFm::cleanUp() 285void AdvancedFm::cleanUp()
274{ 286{
@@ -1041,58 +1053,63 @@ void AdvancedFm::docButtonPushed() {
1041 currentDir.cd( current, TRUE); 1053 currentDir.cd( current, TRUE);
1042 populateLocalView(); 1054 populateLocalView();
1043 } else { 1055 } else {
1044 currentRemoteDir.cd( current, TRUE); 1056 currentRemoteDir.cd( current, TRUE);
1045 populateRemoteView(); 1057 populateRemoteView();
1046 } 1058 }
1047 update(); 1059 update();
1048} 1060}
1049 1061
1050void AdvancedFm::SDButtonPushed() { 1062void AdvancedFm::SDButtonPushed() {
1051 QString current = "/mnt/card"; 1063 QString current = "/mnt/card";
1052 chdir( current.latin1() ); 1064 chdir( current.latin1() );
1053 if (TabWidget->currentPageIndex() == 0) { 1065 if (TabWidget->currentPageIndex() == 0) {
1054 currentDir.cd( current, TRUE); 1066 currentDir.cd( current, TRUE);
1055 populateLocalView(); 1067 populateLocalView();
1056 } else { 1068 } else {
1057 currentRemoteDir.cd( current, TRUE); 1069 currentRemoteDir.cd( current, TRUE);
1058 populateRemoteView(); 1070 populateRemoteView();
1059 } 1071 }
1060 update(); 1072 update();
1061 1073
1062} 1074}
1063 1075
1064void AdvancedFm::CFButtonPushed() { 1076void AdvancedFm::CFButtonPushed() {
1065 QString current = "/mnt/cf"; 1077 QString current;
1066 chdir( current.latin1() ); 1078 if(zaurusDevice)
1067 if (TabWidget->currentPageIndex() == 0) { 1079 current= "/mnt/cf";
1068 currentDir.cd( current, TRUE); 1080 else
1069 populateLocalView(); 1081 current = "/mnt/hda";
1070 } else { 1082
1071 currentRemoteDir.cd( current, TRUE); 1083 chdir( current.latin1() );
1072 populateRemoteView(); 1084 if (TabWidget->currentPageIndex() == 0) {
1073 } 1085 currentDir.cd( current, TRUE);
1074 update(); 1086 populateLocalView();
1087 } else {
1088 currentRemoteDir.cd( current, TRUE);
1089 populateRemoteView();
1090 }
1091 update();
1075 1092
1076} 1093}
1077 1094
1078 1095
1079void AdvancedFm::upDir() 1096void AdvancedFm::upDir()
1080{ 1097{
1081 if (TabWidget->currentPageIndex() == 0) { 1098 if (TabWidget->currentPageIndex() == 0) {
1082 QString current = currentDir.canonicalPath(); 1099 QString current = currentDir.canonicalPath();
1083 QDir dir(current); 1100 QDir dir(current);
1084 dir.cdUp(); 1101 dir.cdUp();
1085 current = dir.canonicalPath(); 1102 current = dir.canonicalPath();
1086 chdir( current.latin1() ); 1103 chdir( current.latin1() );
1087 currentDir.cd( current, TRUE); 1104 currentDir.cd( current, TRUE);
1088 populateLocalView(); 1105 populateLocalView();
1089 update(); 1106 update();
1090 } else { 1107 } else {
1091 QString current = currentRemoteDir.canonicalPath(); 1108 QString current = currentRemoteDir.canonicalPath();
1092 QDir dir(current); 1109 QDir dir(current);
1093 dir.cdUp(); 1110 dir.cdUp();
1094 current = dir.canonicalPath(); 1111 current = dir.canonicalPath();
1095 chdir( current.latin1() ); 1112 chdir( current.latin1() );
1096 currentRemoteDir.cd( current, TRUE); 1113 currentRemoteDir.cd( current, TRUE);
1097 populateRemoteView(); 1114 populateRemoteView();
1098 update(); 1115 update();
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 78f0bad..5b714ae 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -84,48 +84,49 @@ protected slots:
84 void localListPressed( int, QListViewItem *, const QPoint&, int); 84 void localListPressed( int, QListViewItem *, const QPoint&, int);
85 void remoteListPressed( int, QListViewItem *, const QPoint&, int); 85 void remoteListPressed( int, QListViewItem *, const QPoint&, int);
86 void localMakDir(); 86 void localMakDir();
87 void localDelete(); 87 void localDelete();
88 void remoteMakDir(); 88 void remoteMakDir();
89 void remoteDelete(); 89 void remoteDelete();
90/* bool remoteDirList(const QString &); */ 90/* bool remoteDirList(const QString &); */
91/* bool remoteChDir(const QString &); */ 91/* bool remoteChDir(const QString &); */
92 void tabChanged(QWidget*); 92 void tabChanged(QWidget*);
93 void cleanUp(); 93 void cleanUp();
94 void remoteRename(); 94 void remoteRename();
95 void localRename(); 95 void localRename();
96 void runThis(); 96 void runThis();
97 void runText(); 97 void runText();
98 void filePerms(); 98 void filePerms();
99 void doProperties(); 99 void doProperties();
100 void runCommand(); 100 void runCommand();
101 void runCommandStd(); 101 void runCommandStd();
102 QStringList getPath(); 102 QStringList getPath();
103 void mkSym(); 103 void mkSym();
104 void switchToLocalTab(); 104 void switchToLocalTab();
105 void switchToRemoteTab(); 105 void switchToRemoteTab();
106 106
107protected: 107protected:
108 bool zaurusDevice;
108 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 109 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
109 QStringList remoteDirPathStringList, localDirPathStringList; 110 QStringList remoteDirPathStringList, localDirPathStringList;
110 111
111 void keyReleaseEvent( QKeyEvent *); 112 void keyReleaseEvent( QKeyEvent *);
112 QString getFileSystemType(const QString &); 113 QString getFileSystemType(const QString &);
113 QString getDiskSpace(const QString &); 114 QString getDiskSpace(const QString &);
114 115
115 void parsetab(const QString &fileName); 116 void parsetab(const QString &fileName);
116QString checkDiskSpace(const QString &); 117QString checkDiskSpace(const QString &);
117protected slots: 118protected slots:
118 void showFileMenu(); 119 void showFileMenu();
119 void cancelMenuTimer(); 120 void cancelMenuTimer();
120 void homeButtonPushed(); 121 void homeButtonPushed();
121 void docButtonPushed(); 122 void docButtonPushed();
122 void SDButtonPushed(); 123 void SDButtonPushed();
123 void CFButtonPushed(); 124 void CFButtonPushed();
124 void QPEButtonPushed(); 125 void QPEButtonPushed();
125 void upDir(); 126 void upDir();
126 void currentPathComboChanged(); 127 void currentPathComboChanged();
127 void copy(); 128 void copy();
128 void copyAs(); 129 void copyAs();
129 void copySameDir(); 130 void copySameDir();
130 void currentPathComboActivated(const QString &); 131 void currentPathComboActivated(const QString &);
131 void fillCombo(const QString &); 132 void fillCombo(const QString &);