summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-21 00:55:02 (UTC)
committer llornkcor <llornkcor>2002-06-21 00:55:02 (UTC)
commit2a7407325b1607c9ee40ed3558c8549672a36ad4 (patch) (unidiff)
tree4e00e892bd2e9ced90bc7f78b43f995e13f4d636
parentb5951d300371cbe78fa94163aa882419e3d08d4b (diff)
downloadopie-2a7407325b1607c9ee40ed3558c8549672a36ad4.zip
opie-2a7407325b1607c9ee40ed3558c8549672a36ad4.tar.gz
opie-2a7407325b1607c9ee40ed3558c8549672a36ad4.tar.bz2
ipkg-build needs Package: , please consult maintainer before making changes. Various changes in cpp
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp9
-rw-r--r--noncore/apps/advancedfm/opie-advancedfm.control1
2 files changed, 8 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index ebd7fc3..1287c57 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,507 +1,511 @@
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#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties 13#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties
14 14
15#include "advancedfm.h" 15#include "advancedfm.h"
16#include "inputDialog.h" 16#include "inputDialog.h"
17#include "filePermissions.h" 17#include "filePermissions.h"
18#include "output.h" 18#include "output.h"
19 19
20#include <opie/ofileselector.h> 20#include <opie/ofileselector.h>
21#include <opie/ofiledialog.h> 21#include <opie/ofiledialog.h>
22 22
23 23
24#include <qpe/lnkproperties.h> 24#include <qpe/lnkproperties.h>
25#include <qpe/filemanager.h> 25#include <qpe/filemanager.h>
26#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
27#include <qpe/qpemenubar.h> 27#include <qpe/qpemenubar.h>
28#include <qpe/qpetoolbar.h> 28#include <qpe/qpetoolbar.h>
29#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31#include <qpe/qcopenvelope_qws.h> 31#include <qpe/qcopenvelope_qws.h>
32#include <qpe/config.h> 32#include <qpe/config.h>
33#include <qpe/mimetype.h> 33#include <qpe/mimetype.h>
34#include <qpe/applnk.h> 34#include <qpe/applnk.h>
35#include <qpe/ir.h> 35#include <qpe/ir.h>
36 36
37//#include <opie/ofileselector.h> 37//#include <opie/ofileselector.h>
38#include <qmultilineedit.h> 38#include <qmultilineedit.h>
39 39
40#include <qtextstream.h> 40#include <qtextstream.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qtoolbutton.h> 42#include <qtoolbutton.h>
43#include <qdatetime.h> 43#include <qdatetime.h>
44#include <qdir.h> 44#include <qdir.h>
45#include <qfile.h> 45#include <qfile.h>
46#include <qstring.h> 46#include <qstring.h>
47#include <qcombobox.h> 47#include <qcombobox.h>
48#include <qpopupmenu.h> 48#include <qpopupmenu.h>
49#include <qlistview.h> 49#include <qlistview.h>
50#include <qmainwindow.h> 50#include <qmainwindow.h>
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 73
74AdvancedFm::AdvancedFm( ) 74AdvancedFm::AdvancedFm( )
75 : QMainWindow( ) 75 : QMainWindow( )
76{ 76{
77 setCaption( tr( "AdvancedFm" ) ); 77 setCaption( tr( "AdvancedFm" ) );
78// menuTimer( this ); 78// menuTimer( this );
79 79
80 QGridLayout *layout = new QGridLayout( this ); 80 QGridLayout *layout = new QGridLayout( this );
81 layout->setSpacing( 2); 81 layout->setSpacing( 2);
82 layout->setMargin( 2); 82 layout->setMargin( 2);
83 83
84 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 84 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
85 85
86 QPEMenuBar *menuBar = new QPEMenuBar(this); 86 QPEMenuBar *menuBar = new QPEMenuBar(this);
87// fileMenu = new QPopupMenu( this ); 87// fileMenu = new QPopupMenu( this );
88 fileMenu = new QPopupMenu( this ); 88 fileMenu = new QPopupMenu( this );
89 viewMenu = new QPopupMenu( this ); 89 viewMenu = new QPopupMenu( this );
90 90
91 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); 91 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
92 92
93 menuBar->insertItem( tr( "File" ), fileMenu); 93 menuBar->insertItem( tr( "File" ), fileMenu);
94 menuBar->insertItem( tr( "View" ), viewMenu); 94 menuBar->insertItem( tr( "View" ), viewMenu);
95 95
96 qpeDirButton= new QPushButton(Resource::loadIconSet("launcher/opielogo16x16"),"",this,"QPEButton"); 96 qpeDirButton= new QPushButton(Resource::loadIconSet("launcher/opielogo16x16"),"",this,"QPEButton");
97 qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); 97 qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
98 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); 98 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) );
99 qpeDirButton->setFlat(TRUE); 99 qpeDirButton->setFlat(TRUE);
100 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); 100 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2);
101 101
102 cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); 102 cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton");
103 cfButton ->setFixedSize( QSize( 20, 20 ) ); 103 cfButton ->setFixedSize( QSize( 20, 20 ) );
104 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); 104 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
105 cfButton->setFlat(TRUE); 105 cfButton->setFlat(TRUE);
106 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); 106 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3);
107 107
108 sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); 108 sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton");
109 sdButton->setFixedSize( QSize( 20, 20 ) ); 109 sdButton->setFixedSize( QSize( 20, 20 ) );
110 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); 110 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
111 sdButton->setFlat(TRUE); 111 sdButton->setFlat(TRUE);
112 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); 112 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4);
113 113
114 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); 114 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
115 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 115 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
116 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 116 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
117 cdUpButton ->setFlat(TRUE); 117 cdUpButton ->setFlat(TRUE);
118 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); 118 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5);
119 119
120 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 120 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
121 docButton->setFixedSize( QSize( 20, 20 ) ); 121 docButton->setFixedSize( QSize( 20, 20 ) );
122 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 122 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
123 docButton->setFlat(TRUE); 123 docButton->setFlat(TRUE);
124 layout->addMultiCellWidget( docButton, 0, 0, 6, 6); 124 layout->addMultiCellWidget( docButton, 0, 0, 6, 6);
125 125
126 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); 126 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
127 homeButton->setFixedSize( QSize( 20, 20 ) ); 127 homeButton->setFixedSize( QSize( 20, 20 ) );
128 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 128 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
129 homeButton->setFlat(TRUE); 129 homeButton->setFlat(TRUE);
130 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); 130 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7);
131// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 131// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
132// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 132// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
133// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 133// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
134 134
135 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 135 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
136 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 136 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
137 fileMenu->insertSeparator(); 137 fileMenu->insertSeparator();
138 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 138 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
139 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 139 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
140 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 140 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
141 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 141 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
142 fileMenu->insertSeparator(); 142 fileMenu->insertSeparator();
143 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 143 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
144 fileMenu->setCheckable(TRUE); 144 fileMenu->setCheckable(TRUE);
145 145
146 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 146 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
147 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 147 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
148 viewMenu->insertSeparator(); 148 viewMenu->insertSeparator();
149 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 149 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
150 viewMenu->setCheckable(TRUE); 150 viewMenu->setCheckable(TRUE);
151 151
152 152
153 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 153 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
154 currentPathCombo->setEditable(TRUE); 154 currentPathCombo->setEditable(TRUE);
155 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); 155 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
156 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 156 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
157 157
158 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 158 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
159 this, SLOT( currentPathComboActivated( const QString & ) ) ); 159 this, SLOT( currentPathComboActivated( const QString & ) ) );
160 160
161 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 161 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
162 this,SLOT(currentPathComboChanged())); 162 this,SLOT(currentPathComboChanged()));
163 163
164 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 164 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
165 165
166 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); 166 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
167 167
168 168
169 TabWidget = new QTabWidget( this, "TabWidget" ); 169 TabWidget = new QTabWidget( this, "TabWidget" );
170 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); 170 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7);
171 171
172 tab = new QWidget( TabWidget, "tab" ); 172 tab = new QWidget( TabWidget, "tab" );
173 tabLayout = new QGridLayout( tab ); 173 tabLayout = new QGridLayout( tab );
174 tabLayout->setSpacing( 2); 174 tabLayout->setSpacing( 2);
175 tabLayout->setMargin( 2); 175 tabLayout->setMargin( 2);
176 176
177 Local_View = new QListView( tab, "Local_View" ); 177 Local_View = new QListView( tab, "Local_View" );
178// Local_View->setResizePolicy( QListView::AutoOneFit ); 178// Local_View->setResizePolicy( QListView::AutoOneFit );
179 Local_View->addColumn( tr("File"),130); 179 Local_View->addColumn( tr("File"),130);
180 Local_View->addColumn( tr("Size"),-1); 180 Local_View->addColumn( tr("Size"),-1);
181 Local_View->setColumnAlignment(1,QListView::AlignRight); 181 Local_View->setColumnAlignment(1,QListView::AlignRight);
182 Local_View->addColumn( tr("Date"),-1); 182 Local_View->addColumn( tr("Date"),-1);
183 Local_View->setColumnAlignment(2,QListView::AlignRight); 183 Local_View->setColumnAlignment(2,QListView::AlignRight);
184 Local_View->setAllColumnsShowFocus(TRUE); 184 Local_View->setAllColumnsShowFocus(TRUE);
185 Local_View->setMultiSelection( TRUE ); 185 Local_View->setMultiSelection( TRUE );
186 Local_View->setSelectionMode(QListView::Extended); 186 Local_View->setSelectionMode(QListView::Extended);
187 187
188 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 188 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
189 189
190 190
191 191
192 tabLayout->addWidget( Local_View, 0, 0 ); 192 tabLayout->addWidget( Local_View, 0, 0 );
193 193
194 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 194 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
195 this,SLOT( localListClicked(QListViewItem *)) ); 195 this,SLOT( localListClicked(QListViewItem *)) );
196 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 196 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
197 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); 197 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) );
198 198
199 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); 199 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
200 200
201 TabWidget->insertTab( tab, tr("1")); 201 TabWidget->insertTab( tab, tr("1"));
202 202
203 tab_2 = new QWidget( TabWidget, "tab_2" ); 203 tab_2 = new QWidget( TabWidget, "tab_2" );
204 tabLayout_2 = new QGridLayout( tab_2 ); 204 tabLayout_2 = new QGridLayout( tab_2 );
205 tabLayout_2->setSpacing( 2); 205 tabLayout_2->setSpacing( 2);
206 tabLayout_2->setMargin( 2); 206 tabLayout_2->setMargin( 2);
207 207
208 Remote_View = new QListView( tab_2, "Remote_View" ); 208 Remote_View = new QListView( tab_2, "Remote_View" );
209 Remote_View->addColumn( tr("File"),130); 209 Remote_View->addColumn( tr("File"),130);
210 Remote_View->addColumn( tr("Size"),-1); 210 Remote_View->addColumn( tr("Size"),-1);
211 Remote_View->setColumnAlignment(1,QListView::AlignRight); 211 Remote_View->setColumnAlignment(1,QListView::AlignRight);
212 Remote_View->addColumn( tr("Date"),-1); 212 Remote_View->addColumn( tr("Date"),-1);
213 Remote_View->setColumnAlignment(2,QListView::AlignRight); 213 Remote_View->setColumnAlignment(2,QListView::AlignRight);
214 Remote_View->setAllColumnsShowFocus(TRUE); 214 Remote_View->setAllColumnsShowFocus(TRUE);
215 Remote_View->setMultiSelection( TRUE ); 215 Remote_View->setMultiSelection( TRUE );
216 Remote_View->setSelectionMode(QListView::Extended); 216 Remote_View->setSelectionMode(QListView::Extended);
217 217
218
218 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 219 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
219 220
220 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 221 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
221 this,SLOT( remoteListClicked(QListViewItem *)) ); 222 this,SLOT( remoteListClicked(QListViewItem *)) );
222 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 223 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
223 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 224 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) );
224// connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); 225// connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
225 226
226 tabLayout_2->addWidget( Remote_View, 0, 0 ); 227 tabLayout_2->addWidget( Remote_View, 0, 0 );
227 228
229
228 TabWidget->insertTab( tab_2, tr( "2")); 230 TabWidget->insertTab( tab_2, tr( "2"));
229 231
230 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 232 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
231 this,SLOT(tabChanged(QWidget*))); 233 this,SLOT(tabChanged(QWidget*)));
232 234
233 tab_3 = new QWidget( TabWidget, "tab_3" ); 235 /* tab_3 = new QWidget( TabWidget, "tab_3" );
234 tabLayout_3 = new QGridLayout( tab_3 ); 236 tabLayout_3 = new QGridLayout( tab_3 );
235 tabLayout_3->setSpacing( 2); 237 tabLayout_3->setSpacing( 2);
236 tabLayout_3->setMargin( 2); 238 tabLayout_3->setMargin( 2);
237 239
238 240
239// OFileDialog fileDialog; 241// OFileDialog fileDialog;
240// fileDialog; 242// fileDialog;
241// fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 243// fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
242// fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 244// fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
243// OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 245// OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
244 246
245QListView *fileTree; 247QListView *fileTree;
246 fileTree = new QListView( tab_3, "tree" ); 248 fileTree = new QListView( tab_3, "tree" );
247 249
248 250
249 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 251 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
250 252
251 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 253 TabWidget->insertTab( tab_3, tr( "Remote" ) );
254 */
255
252/////////////// 256///////////////
253 257
254//////////////////// 258////////////////////
255 259
256 260
257 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 261 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
258 currentDir.setPath( QDir::currentDirPath()); 262 currentDir.setPath( QDir::currentDirPath());
259 263
260 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 264 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
261 currentRemoteDir.setPath( QDir::currentDirPath()); 265 currentRemoteDir.setPath( QDir::currentDirPath());
262 266
263 b = TRUE; 267 b = TRUE;
264 268
265 filterStr="*"; 269 filterStr="*";
266 b=FALSE; 270 b=FALSE;
267 271
268 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); 272 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
269 273
270 populateLocalView(); 274 populateLocalView();
271 populateRemoteView(); 275 populateRemoteView();
272 currentPathCombo->setFocus(); 276 currentPathCombo->setFocus();
273} 277}
274 278
275AdvancedFm::~AdvancedFm() 279AdvancedFm::~AdvancedFm()
276{ 280{
277} 281}
278 282
279void AdvancedFm::cleanUp() 283void AdvancedFm::cleanUp()
280{ 284{
281 QString sfile=QDir::homeDirPath(); 285 QString sfile=QDir::homeDirPath();
282 if(sfile.right(1) != "/") 286 if(sfile.right(1) != "/")
283 sfile+="/._temp"; 287 sfile+="/._temp";
284 else 288 else
285 sfile+="._temp"; 289 sfile+="._temp";
286 QFile file( sfile); 290 QFile file( sfile);
287 if(file.exists()) 291 if(file.exists())
288 file.remove(); 292 file.remove();
289} 293}
290 294
291void AdvancedFm::tabChanged(QWidget *w) 295void AdvancedFm::tabChanged(QWidget *w)
292{ 296{
293 if (TabWidget->currentPageIndex() == 0) { 297 if (TabWidget->currentPageIndex() == 0) {
294 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 298 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
295 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); 299 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
296 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); 300 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
297 } 301 }
298 if (TabWidget->currentPageIndex() == 1) { 302 if (TabWidget->currentPageIndex() == 1) {
299 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); 303 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath());
300 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); 304 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE);
301 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); 305 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE);
302 } 306 }
303} 307}
304 308
305 309
306void AdvancedFm::populateLocalView() 310void AdvancedFm::populateLocalView()
307{ 311{
308 QPixmap pm; 312 QPixmap pm;
309 Local_View->clear(); 313 Local_View->clear();
310 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 314 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
311 currentDir.setMatchAllDirs(TRUE); 315 currentDir.setMatchAllDirs(TRUE);
312 currentDir.setNameFilter(filterStr); 316 currentDir.setNameFilter(filterStr);
313 QString fileL, fileS, fileDate; 317 QString fileL, fileS, fileDate;
314// qDebug(currentDir.canonicalPath()); 318// qDebug(currentDir.canonicalPath());
315// struct stat buf; 319// struct stat buf;
316// mode_t mode; 320// mode_t mode;
317 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 321 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
318 setCaption("AdvancedFm :: "+fs); 322 setCaption("AdvancedFm :: "+fs);
319 bool isDir=FALSE; 323 bool isDir=FALSE;
320 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 324 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
321 QFileInfoListIterator it(*list); 325 QFileInfoListIterator it(*list);
322 QFileInfo *fi; 326 QFileInfo *fi;
323 while ( (fi=it.current()) ) { 327 while ( (fi=it.current()) ) {
324 if (fi->isSymLink() ) { 328 if (fi->isSymLink() ) {
325 QString symLink=fi->readLink(); 329 QString symLink=fi->readLink();
326// qDebug("Symlink detected "+symLink); 330// qDebug("Symlink detected "+symLink);
327 QFileInfo sym( symLink); 331 QFileInfo sym( symLink);
328 fileS.sprintf( "%10li", sym.size() ); 332 fileS.sprintf( "%10li", sym.size() );
329 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 333 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
330 fileDate = sym.lastModified().toString(); 334 fileDate = sym.lastModified().toString();
331 } else { 335 } else {
332 fileS.sprintf( "%10li", fi->size() ); 336 fileS.sprintf( "%10li", fi->size() );
333 fileL.sprintf( "%s",fi->fileName().data() ); 337 fileL.sprintf( "%s",fi->fileName().data() );
334 fileDate= fi->lastModified().toString(); 338 fileDate= fi->lastModified().toString();
335 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { 339 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) {
336 fileL+="/"; 340 fileL+="/";
337 isDir=TRUE; 341 isDir=TRUE;
338// qDebug( fileL); 342// qDebug( fileL);
339 } 343 }
340 } 344 }
341 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); 345 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL);
342 if(fileL !="./" && fi->exists()) { 346 if(fileL !="./" && fi->exists()) {
343 item= new QListViewItem( Local_View, fileL, fileS , fileDate); 347 item= new QListViewItem( Local_View, fileL, fileS , fileDate);
344 348
345 if(isDir || fileL.find("/",0,TRUE) != -1) { 349 if(isDir || fileL.find("/",0,TRUE) != -1) {
346 350
347 if( !QDir( fi->filePath() ).isReadable()) //is directory 351 if( !QDir( fi->filePath() ).isReadable()) //is directory
348 pm = Resource::loadPixmap( "lockedfolder" ); 352 pm = Resource::loadPixmap( "lockedfolder" );
349 else 353 else
350 pm= Resource::loadPixmap( "folder" ); 354 pm= Resource::loadPixmap( "folder" );
351// item->setPixmap( 0,pm ); 355// item->setPixmap( 0,pm );
352 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 356 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
353 pm = Resource::loadPixmap( "exec"); 357 pm = Resource::loadPixmap( "exec");
354 } else if( (fileInfo.permission( QFileInfo::ExeUser) 358 } else if( (fileInfo.permission( QFileInfo::ExeUser)
355 | fileInfo.permission( QFileInfo::ExeGroup) 359 | fileInfo.permission( QFileInfo::ExeGroup)
356 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 360 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
357 pm = Resource::loadPixmap( "exec"); 361 pm = Resource::loadPixmap( "exec");
358// else { //is exec 362// else { //is exec
359// pm = Resource::loadPixmap( "exec"); 363// pm = Resource::loadPixmap( "exec");
360// } 364// }
361// // item->setPixmap( 0,pm); 365// // item->setPixmap( 0,pm);
362 } else if( !fi->isReadable() ) { 366 } else if( !fi->isReadable() ) {
363 pm = Resource::loadPixmap( "locked" ); 367 pm = Resource::loadPixmap( "locked" );
364// item->setPixmap( 0,pm); 368// item->setPixmap( 0,pm);
365 } else { //everything else goes by mimetype 369 } else { //everything else goes by mimetype
366 MimeType mt(fi->filePath()); 370 MimeType mt(fi->filePath());
367 pm=mt.pixmap(); //sets the correct pixmap for mimetype 371 pm=mt.pixmap(); //sets the correct pixmap for mimetype
368 if(pm.isNull()) 372 if(pm.isNull())
369 pm = Resource::loadPixmap( "UnknownDocument-14" ); 373 pm = Resource::loadPixmap( "UnknownDocument-14" );
370// item->setPixmap( 0,pm); 374// item->setPixmap( 0,pm);
371 } 375 }
372 item->setPixmap( 0,pm); 376 item->setPixmap( 0,pm);
373 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 377 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
374 // overlay link image 378 // overlay link image
375 pm= Resource::loadPixmap( "folder" ); 379 pm= Resource::loadPixmap( "folder" );
376 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 380 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
377 QPainter painter( &pm ); 381 QPainter painter( &pm );
378 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 382 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
379 pm.setMask( pm.createHeuristicMask( FALSE ) ); 383 pm.setMask( pm.createHeuristicMask( FALSE ) );
380 item->setPixmap( 0, pm); 384 item->setPixmap( 0, pm);
381 } 385 }
382 } 386 }
383 isDir=FALSE; 387 isDir=FALSE;
384 ++it; 388 ++it;
385 } 389 }
386 390
387 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { 391 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) {
388 struct stat buf; 392 struct stat buf;
389// struct stat st; 393// struct stat st;
390 dev_t devT; 394 dev_t devT;
391// mode_t mode; 395// mode_t mode;
392 DIR *dir; 396 DIR *dir;
393// int fd = 0; 397// int fd = 0;
394 struct dirent *mydirent; 398 struct dirent *mydirent;
395// int i = 1; 399// int i = 1;
396 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) 400 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
397 while ((mydirent = readdir(dir)) != NULL) { 401 while ((mydirent = readdir(dir)) != NULL) {
398 lstat( mydirent->d_name, &buf); 402 lstat( mydirent->d_name, &buf);
399 qDebug(mydirent->d_name); 403 qDebug(mydirent->d_name);
400// mode = buf.st_mode; 404// mode = buf.st_mode;
401 fileL.sprintf("%s", mydirent->d_name); 405 fileL.sprintf("%s", mydirent->d_name);
402// fileS.sprintf("%d, %d", ); //this isn't correct 406// fileS.sprintf("%d, %d", ); //this isn't correct
403 devT = buf.st_dev; 407 devT = buf.st_dev;
404 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 408 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
405// fileS.sprintf("%d,%d", devT, devT); 409// fileS.sprintf("%d,%d", devT, devT);
406 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 410 fileDate.sprintf("%s", ctime( &buf.st_mtime));
407 if( fileL.find(".") == -1 ){ 411 if( fileL.find(".") == -1 ){
408 item= new QListViewItem( Local_View, fileL, fileS, fileDate); 412 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
409 pm = Resource::loadPixmap( "UnknownDocument-14" ); 413 pm = Resource::loadPixmap( "UnknownDocument-14" );
410 item->setPixmap( 0,pm); 414 item->setPixmap( 0,pm);
411 } 415 }
412 } 416 }
413 417
414 closedir(dir); 418 closedir(dir);
415 } 419 }
416 420
417 Local_View->setSorting( 3,FALSE); 421 Local_View->setSorting( 3,FALSE);
418 fillCombo( (const QString &) currentDir.canonicalPath()); 422 fillCombo( (const QString &) currentDir.canonicalPath());
419} 423}
420 424
421 425
422void AdvancedFm::populateRemoteView() 426void AdvancedFm::populateRemoteView()
423{ 427{
424// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 428// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
425// QListViewItemIterator it( Remote_View ); 429// QListViewItemIterator it( Remote_View );
426// for ( ; it.current(); ++it ) { 430// for ( ; it.current(); ++it ) {
427// if ( it.current()->isSelected() ) { 431// if ( it.current()->isSelected() ) {
428// QString strItem = it.current()->text(0); 432// QString strItem = it.current()->text(0);
429// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; 433// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem;
430// QFileInfo fi(localFile); 434// QFileInfo fi(localFile);
431// } 435// }
432// } 436// }
433 QPixmap pm; 437 QPixmap pm;
434 Remote_View->clear(); 438 Remote_View->clear();
435 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 439 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
436 currentRemoteDir.setMatchAllDirs(TRUE); 440 currentRemoteDir.setMatchAllDirs(TRUE);
437 currentRemoteDir.setNameFilter(filterStr); 441 currentRemoteDir.setNameFilter(filterStr);
438 QString fileL, fileS, fileDate; 442 QString fileL, fileS, fileDate;
439 443
440 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 444 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
441 setCaption("AdvancedFm :: "+fs); 445 setCaption("AdvancedFm :: "+fs);
442 bool isDir=FALSE; 446 bool isDir=FALSE;
443 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 447 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
444 QFileInfoListIterator it(*list); 448 QFileInfoListIterator it(*list);
445 QFileInfo *fi; 449 QFileInfo *fi;
446 while ( (fi=it.current()) ) { 450 while ( (fi=it.current()) ) {
447 if (fi->isSymLink() ){ 451 if (fi->isSymLink() ){
448 QString symLink=fi->readLink(); 452 QString symLink=fi->readLink();
449// qDebug("Symlink detected "+symLink); 453// qDebug("Symlink detected "+symLink);
450 QFileInfo sym( symLink); 454 QFileInfo sym( symLink);
451 fileS.sprintf( "%10li", sym.size() ); 455 fileS.sprintf( "%10li", sym.size() );
452 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 456 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
453 fileDate = sym.lastModified().toString(); 457 fileDate = sym.lastModified().toString();
454 } else { 458 } else {
455// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 459// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
456 fileS.sprintf( "%10li", fi->size() ); 460 fileS.sprintf( "%10li", fi->size() );
457 fileL.sprintf( "%s",fi->fileName().data() ); 461 fileL.sprintf( "%s",fi->fileName().data() );
458 fileDate= fi->lastModified().toString(); 462 fileDate= fi->lastModified().toString();
459 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 463 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
460 fileL+="/"; 464 fileL+="/";
461 isDir=TRUE; 465 isDir=TRUE;
462// qDebug( fileL); 466// qDebug( fileL);
463 } 467 }
464 } 468 }
465 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); 469 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL);
466 if(fileL !="./" && fi->exists()) { 470 if(fileL !="./" && fi->exists()) {
467 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 471 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
468 QPixmap pm; 472 QPixmap pm;
469 473
470 if(isDir || fileL.find("/",0,TRUE) != -1) { 474 if(isDir || fileL.find("/",0,TRUE) != -1) {
471 if( !QDir( fi->filePath() ).isReadable()) 475 if( !QDir( fi->filePath() ).isReadable())
472 pm = Resource::loadPixmap( "lockedfolder" ); 476 pm = Resource::loadPixmap( "lockedfolder" );
473 else 477 else
474 pm= Resource::loadPixmap( "folder" ); 478 pm= Resource::loadPixmap( "folder" );
475// item->setPixmap( 0,pm ); 479// item->setPixmap( 0,pm );
476 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 480 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
477 pm = Resource::loadPixmap( "exec"); 481 pm = Resource::loadPixmap( "exec");
478 } else if( (fileInfo.permission( QFileInfo::ExeUser) 482 } else if( (fileInfo.permission( QFileInfo::ExeUser)
479 | fileInfo.permission( QFileInfo::ExeGroup) 483 | fileInfo.permission( QFileInfo::ExeGroup)
480 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 484 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
481 pm = Resource::loadPixmap( "exec"); 485 pm = Resource::loadPixmap( "exec");
482// item->setPixmap( 0,pm); 486// item->setPixmap( 0,pm);
483 } else if( !fi->isReadable() ) { 487 } else if( !fi->isReadable() ) {
484 pm = Resource::loadPixmap( "locked" ); 488 pm = Resource::loadPixmap( "locked" );
485// item->setPixmap( 0,pm); 489// item->setPixmap( 0,pm);
486 } else { 490 } else {
487 MimeType mt(fi->filePath()); 491 MimeType mt(fi->filePath());
488 pm=mt.pixmap(); //sets the correct pixmap for mimetype 492 pm=mt.pixmap(); //sets the correct pixmap for mimetype
489 if(pm.isNull()) 493 if(pm.isNull())
490 pm = Resource::loadPixmap( "UnknownDocument-14" ); 494 pm = Resource::loadPixmap( "UnknownDocument-14" );
491// item->setPixmap( 0,pm); 495// item->setPixmap( 0,pm);
492 } 496 }
493 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 497 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
494 // overlay link image 498 // overlay link image
495 pm= Resource::loadPixmap( "folder" ); 499 pm= Resource::loadPixmap( "folder" );
496 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 500 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
497 QPainter painter( &pm ); 501 QPainter painter( &pm );
498 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 502 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
499 pm.setMask( pm.createHeuristicMask( FALSE ) ); 503 pm.setMask( pm.createHeuristicMask( FALSE ) );
500// item->setPixmap( 0, pm); 504// item->setPixmap( 0, pm);
501 } 505 }
502 item->setPixmap( 0, pm); 506 item->setPixmap( 0, pm);
503 } 507 }
504 isDir=FALSE; 508 isDir=FALSE;
505 ++it; 509 ++it;
506 } 510 }
507 511
@@ -1516,267 +1520,268 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e)
1516 filePerms(); 1520 filePerms();
1517 break; 1521 break;
1518 case Key_N: 1522 case Key_N:
1519 mkDir(); 1523 mkDir();
1520 break; 1524 break;
1521 case Key_1: 1525 case Key_1:
1522 switchToLocalTab(); 1526 switchToLocalTab();
1523 break; 1527 break;
1524 case Key_2: 1528 case Key_2:
1525 switchToRemoteTab(); 1529 switchToRemoteTab();
1526 break; 1530 break;
1527 case Key_3: 1531 case Key_3:
1528 CFButtonPushed(); 1532 CFButtonPushed();
1529 break; 1533 break;
1530 case Key_4: 1534 case Key_4:
1531 SDButtonPushed(); 1535 SDButtonPushed();
1532 break; 1536 break;
1533 case Key_5: 1537 case Key_5:
1534 homeButtonPushed(); 1538 homeButtonPushed();
1535 break; 1539 break;
1536 case Key_6: 1540 case Key_6:
1537 docButtonPushed(); 1541 docButtonPushed();
1538 break; 1542 break;
1539 case Key_7: 1543 case Key_7:
1540 break; 1544 break;
1541 case Key_8: 1545 case Key_8:
1542 break; 1546 break;
1543 case Key_9: 1547 case Key_9:
1544 break; 1548 break;
1545 case Key_0: 1549 case Key_0:
1546 break; 1550 break;
1547 } 1551 }
1548} 1552}
1549 1553
1550void AdvancedFm::mkSym() { 1554void AdvancedFm::mkSym() {
1551 QString cmd; 1555 QString cmd;
1552 QStringList curFileList = getPath(); 1556 QStringList curFileList = getPath();
1553 if( curFileList.count() > 0) { 1557 if( curFileList.count() > 0) {
1554 1558
1555 if (TabWidget->currentPageIndex() == 0) { 1559 if (TabWidget->currentPageIndex() == 0) {
1556 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1560 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1557 1561
1558 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); 1562 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it);
1559 if(destName.right(1) == "/") destName = destName.left( destName.length() -1); 1563 if(destName.right(1) == "/") destName = destName.left( destName.length() -1);
1560 QString curFile = currentDir.canonicalPath()+"/"+(*it); 1564 QString curFile = currentDir.canonicalPath()+"/"+(*it);
1561 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1565 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1562 cmd = "ln -s "+curFile+" "+destName; 1566 cmd = "ln -s "+curFile+" "+destName;
1563 qDebug(cmd); 1567 qDebug(cmd);
1564 system(cmd.latin1() ); 1568 system(cmd.latin1() );
1565 } 1569 }
1566 populateRemoteView(); 1570 populateRemoteView();
1567 TabWidget->setCurrentPage(1); 1571 TabWidget->setCurrentPage(1);
1568 } else { 1572 } else {
1569 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1573 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1570 1574
1571 QString destName = currentDir.canonicalPath()+"/"+(*it); 1575 QString destName = currentDir.canonicalPath()+"/"+(*it);
1572 if(destName.right(1) == "/") destName = destName.left( destName.length() -1); 1576 if(destName.right(1) == "/") destName = destName.left( destName.length() -1);
1573 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1577 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1574 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1578 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1575 1579
1576 cmd = "ln -s "+curFile+" "+destName; 1580 cmd = "ln -s "+curFile+" "+destName;
1577 qDebug(cmd); 1581 qDebug(cmd);
1578 system(cmd.latin1() ); 1582 system(cmd.latin1() );
1579 } 1583 }
1580 populateLocalView(); 1584 populateLocalView();
1581 TabWidget->setCurrentPage(0); 1585 TabWidget->setCurrentPage(0);
1582 } 1586 }
1583} 1587}
1584} 1588}
1585 1589
1586void AdvancedFm::QPEButtonPushed() { 1590void AdvancedFm::QPEButtonPushed() {
1587 QString current = QPEApplication::qpeDir(); 1591 QString current = QPEApplication::qpeDir();
1588 chdir( current.latin1() ); 1592 chdir( current.latin1() );
1589 if (TabWidget->currentPageIndex() == 0) { 1593 if (TabWidget->currentPageIndex() == 0) {
1590 currentDir.cd( current, TRUE); 1594 currentDir.cd( current, TRUE);
1591 populateLocalView(); 1595 populateLocalView();
1592 } else { 1596 } else {
1593 currentRemoteDir.cd( current, TRUE); 1597 currentRemoteDir.cd( current, TRUE);
1594 populateRemoteView(); 1598 populateRemoteView();
1595 } 1599 }
1596 update(); 1600 update();
1597} 1601}
1598 1602
1599void AdvancedFm::parsetab(const QString &fileName) { 1603void AdvancedFm::parsetab(const QString &fileName) {
1600 1604
1601 fileSystemTypeList.clear(); 1605 fileSystemTypeList.clear();
1602 fsList.clear(); 1606 fsList.clear();
1603 struct mntent *me; 1607 struct mntent *me;
1604// if(fileName == "/etc/mtab") { 1608// if(fileName == "/etc/mtab") {
1605 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 1609 FILE *mntfp = setmntent( fileName.latin1(), "r" );
1606 if ( mntfp ) { 1610 if ( mntfp ) {
1607 while ( (me = getmntent( mntfp )) != 0 ) { 1611 while ( (me = getmntent( mntfp )) != 0 ) {
1608 QString deviceName = me->mnt_fsname; 1612 QString deviceName = me->mnt_fsname;
1609 QString filesystemType = me->mnt_type; 1613 QString filesystemType = me->mnt_type;
1610 QString mountDir = me->mnt_dir; 1614 QString mountDir = me->mnt_dir;
1611 if(deviceName != "none") { 1615 if(deviceName != "none") {
1612 if( fsList.contains(filesystemType) == 0 1616 if( fsList.contains(filesystemType) == 0
1613 & filesystemType.find("proc",0,TRUE) == -1 1617 & filesystemType.find("proc",0,TRUE) == -1
1614 & filesystemType.find("cramfs",0,TRUE) == -1 1618 & filesystemType.find("cramfs",0,TRUE) == -1
1615 & filesystemType.find("auto",0,TRUE) == -1) 1619 & filesystemType.find("auto",0,TRUE) == -1)
1616 fsList << filesystemType; 1620 fsList << filesystemType;
1617// deviceList << deviceName; 1621// deviceList << deviceName;
1618// qDebug(mountDir+"::"+filesystemType); 1622// qDebug(mountDir+"::"+filesystemType);
1619 fileSystemTypeList << mountDir+"::"+filesystemType; 1623 fileSystemTypeList << mountDir+"::"+filesystemType;
1620 } 1624 }
1621 } 1625 }
1622 } 1626 }
1623 endmntent( mntfp ); 1627 endmntent( mntfp );
1624} 1628}
1625 1629
1626QString AdvancedFm::getFileSystemType(const QString &currentText) { 1630QString AdvancedFm::getFileSystemType(const QString &currentText) {
1627 parsetab("/etc/mtab"); //why did TT forget filesystem type? 1631 parsetab("/etc/mtab"); //why did TT forget filesystem type?
1628 QString current = currentText;//.right( currentText.length()-1); 1632 QString current = currentText;//.right( currentText.length()-1);
1629 QString baseFs; 1633 QString baseFs;
1630 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 1634 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
1631 QString temp = (*it); 1635 QString temp = (*it);
1632 QString path = temp.left(temp.find("::",0,TRUE) ); 1636 QString path = temp.left(temp.find("::",0,TRUE) );
1633 path = path.right( path.length()-1); 1637 path = path.right( path.length()-1);
1634 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1638 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1635 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 1639 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
1636 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1640 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1637 } 1641 }
1638 } 1642 }
1639 return baseFs; 1643 return baseFs;
1640} 1644}
1641 1645
1642 1646
1643void AdvancedFm::doBeam() { 1647void AdvancedFm::doBeam() {
1644 Ir ir; 1648 Ir ir;
1645 if(!ir.supported()){ 1649 if(!ir.supported()){
1646 } else { 1650 } else {
1647 1651
1648 QStringList curFileList = getPath(); 1652 QStringList curFileList = getPath();
1649 if( curFileList.count() > 0) { 1653 if( curFileList.count() > 0) {
1650 1654
1651 if (TabWidget->currentPageIndex() == 0) { 1655 if (TabWidget->currentPageIndex() == 0) {
1652 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1656 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1653 1657
1654 QString curFile = currentDir.canonicalPath()+"/"+(*it); 1658 QString curFile = currentDir.canonicalPath()+"/"+(*it);
1655 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1659 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1656 Ir *file = new Ir(this, "IR"); 1660 Ir *file = new Ir(this, "IR");
1657 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 1661 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
1658 file->send( curFile, curFile ); 1662 file->send( curFile, curFile );
1659 } 1663 }
1660 1664
1661 } else { 1665 } else {
1662 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1666 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1663 1667
1664 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1668 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1665 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1669 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1666 Ir *file = new Ir(this, "IR"); 1670 Ir *file = new Ir(this, "IR");
1667 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 1671 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
1668 file->send( curFile, curFile ); 1672 file->send( curFile, curFile );
1669 1673
1670 } 1674 }
1671 } 1675 }
1672 } 1676 }
1673} 1677}
1674 1678
1675} 1679}
1676 1680
1677void AdvancedFm::fileBeamFinished( Ir *ir) { 1681void AdvancedFm::fileBeamFinished( Ir *ir) {
1678 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 1682 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
1679 1683
1680} 1684}
1681 1685
1682 1686
1683// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 1687// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
1684// QListViewItemIterator it( Local_View ); 1688// QListViewItemIterator it( Local_View );
1685// for ( ; it.current(); ++it ) { 1689// for ( ; it.current(); ++it ) {
1686// if ( it.current()->isSelected() ) { 1690// if ( it.current()->isSelected() ) {
1687// QString strItem = it.current()->text(0); 1691// QString strItem = it.current()->text(0);
1688// QString localFile = currentDir.canonicalPath()+"/"+strItem; 1692// QString localFile = currentDir.canonicalPath()+"/"+strItem;
1689// QFileInfo fi(localFile); 1693// QFileInfo fi(localFile);
1690// } 1694// }
1691// } 1695// }
1692 1696
1693void AdvancedFm::showFileMenu() { 1697void AdvancedFm::showFileMenu() {
1694 1698
1695 QString curApp; 1699 QString curApp;
1696 bool isLocalView = false; 1700 bool isLocalView = false;
1697 if (TabWidget->currentPageIndex() == 0) { 1701 if (TabWidget->currentPageIndex() == 0) {
1698 isLocalView = TRUE; 1702 isLocalView = TRUE;
1699 curApp = Local_View->currentItem()->text(0); 1703 curApp = Local_View->currentItem()->text(0);
1700 } else { 1704 } else {
1701 curApp = Remote_View->currentItem()->text(0); 1705 curApp = Remote_View->currentItem()->text(0);
1702 } 1706 }
1703 1707
1704 MimeType mt( curApp ); 1708 MimeType mt( curApp );
1705 const AppLnk* app = mt.application(); 1709 const AppLnk* app = mt.application();
1706 QFile fi(curApp); 1710 QFile fi(curApp);
1707 1711
1708// QPopupMenu m; 1712// QPopupMenu m;
1709 QPopupMenu *m = new QPopupMenu(0); 1713 QPopupMenu *m = new QPopupMenu(0);
1710 1714
1711 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 1715 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
1712 m->insertSeparator(); 1716 m->insertSeparator();
1713 if ( QFileInfo(fi).isDir() ) { 1717 if ( QFileInfo(fi).isDir() ) {
1714 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 1718 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
1715 } else { 1719 } else {
1716 1720
1717 if ( app ) 1721 if ( app )
1718 m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); 1722 m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) );
1719 else if( QFileInfo(fi).isExecutable() ) 1723 else if( QFileInfo(fi).isExecutable() )
1720 m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); 1724 m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) );
1721 1725
1722 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); 1726 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
1723 } 1727 }
1724 m->insertSeparator(); 1728 m->insertSeparator();
1725 1729
1726 1730
1727 if(isLocalView) 1731 if(isLocalView)
1728 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 1732 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
1729 else 1733 else
1730 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 1734 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
1731 1735
1732 m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 1736 m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
1733 m->insertSeparator(); 1737 m->insertSeparator();
1734 1738
1735 if(isLocalView) 1739 if(isLocalView)
1736 m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 1740 m->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
1737 else 1741 else
1738 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 1742 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
1739 1743
1740 m->insertItem( tr( "Copy" ), this, SLOT( copy() )); 1744 m->insertItem( tr( "Copy" ), this, SLOT( copy() ));
1741 m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 1745 m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
1742 m->insertItem( tr( "Move" ), this, SLOT( move() )); 1746 m->insertItem( tr( "Move" ), this, SLOT( move() ));
1743 m->insertSeparator(); 1747 m->insertSeparator();
1744 1748
1745 if(isLocalView) 1749 if(isLocalView)
1746 m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); 1750 m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
1747 else 1751 else
1748 m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); 1752 m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
1749 1753
1750 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 1754 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
1751 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 1755 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
1752 m->insertSeparator(); 1756 m->insertSeparator();
1753 1757
1754 if(isLocalView) 1758 if(isLocalView)
1755 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 1759 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
1756 else 1760 else
1757 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 1761 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
1758 1762
1759 m->insertSeparator(); 1763 m->insertSeparator();
1760 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 1764 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
1761 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings 1765 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings
1762 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 1766 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
1763 m->setCheckable(TRUE); 1767 m->setCheckable(TRUE);
1764 if (!b) 1768 if (!b)
1765 m->setItemChecked(m->idAt(0),TRUE); 1769 m->setItemChecked(m->idAt(0),TRUE);
1766 else 1770 else
1767 m->setItemChecked(m->idAt(0),FALSE); 1771 m->setItemChecked(m->idAt(0),FALSE);
1768 if(Ir::supported()) 1772 if(Ir::supported())
1769 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); 1773 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
1770 m->setFocus(); 1774 m->setFocus();
1771 m->exec( QCursor::pos() ); 1775 m->exec( QCursor::pos() );
1776 sleep(1);
1772 if(m) delete m; 1777 if(m) delete m;
1773} 1778}
1774 1779
1775 1780
1776void AdvancedFm::cancelMenuTimer() 1781void AdvancedFm::cancelMenuTimer()
1777{ 1782{
1778 1783
1779 qDebug("selectionChanged: cancel menu timer"); 1784 qDebug("selectionChanged: cancel menu timer");
1780 if( menuTimer.isActive() ) 1785 if( menuTimer.isActive() )
1781 menuTimer.stop(); 1786 menuTimer.stop();
1782} 1787}
diff --git a/noncore/apps/advancedfm/opie-advancedfm.control b/noncore/apps/advancedfm/opie-advancedfm.control
index bda8543..957a584 100644
--- a/noncore/apps/advancedfm/opie-advancedfm.control
+++ b/noncore/apps/advancedfm/opie-advancedfm.control
@@ -1,9 +1,10 @@
1Files: bin/advancedfm apps/Applications/advancedfm.desktop 1Files: bin/advancedfm apps/Applications/advancedfm.desktop
2Priority: optional 2Priority: optional
3Package: opie-advancedfm
3Section: opie/applications 4Section: opie/applications
4Maintainer: L.J. Potter <ljp@llornkcor.com> 5Maintainer: L.J. Potter <ljp@llornkcor.com>
5Architecture: arm 6Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 7Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION) 8Depends: opie-base ($QPE_VERSION)
8Description: Advanced File Manager 9Description: Advanced File Manager
9 The advanced file manager for the Opie environment. 10 The advanced file manager for the Opie environment.