summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-25 18:15:30 (UTC)
committer llornkcor <llornkcor>2002-04-25 18:15:30 (UTC)
commit42cb3d115a46637f4c46f4b3f3821075a2c18f02 (patch) (unidiff)
treeb11a7aebc1c5282e463e211d89ba64cccf8dae29
parent1568872bbd1c92242d7110fe931da23226ca0c55 (diff)
downloadopie-42cb3d115a46637f4c46f4b3f3821075a2c18f02.zip
opie-42cb3d115a46637f4c46f4b3f3821075a2c18f02.tar.gz
opie-42cb3d115a46637f4c46f4b3f3821075a2c18f02.tar.bz2
fixed menu items
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp37
-rw-r--r--noncore/apps/advancedfm/advancedfm.h4
2 files changed, 34 insertions, 7 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 1083f23..4289fcf 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,1270 +1,1295 @@
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 <qpe/lnkproperties.h> 20#include <qpe/lnkproperties.h>
21#include <qpe/filemanager.h> 21#include <qpe/filemanager.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/qpemenubar.h> 23#include <qpe/qpemenubar.h>
24#include <qpe/qpetoolbar.h> 24#include <qpe/qpetoolbar.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qcopenvelope_qws.h> 27#include <qpe/qcopenvelope_qws.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29#include <qpe/mimetype.h> 29#include <qpe/mimetype.h>
30#include <qpe/applnk.h> 30#include <qpe/applnk.h>
31 31
32//#include <opie/ofileselector.h> 32//#include <opie/ofileselector.h>
33#include <qmultilineedit.h> 33#include <qmultilineedit.h>
34 34
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qpushbutton.h> 36#include <qpushbutton.h>
37#include <qtoolbutton.h> 37#include <qtoolbutton.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qdir.h> 39#include <qdir.h>
40#include <qfile.h> 40#include <qfile.h>
41#include <qstring.h> 41#include <qstring.h>
42#include <qcombobox.h> 42#include <qcombobox.h>
43#include <qpopupmenu.h> 43#include <qpopupmenu.h>
44#include <qlistview.h> 44#include <qlistview.h>
45#include <qmainwindow.h> 45#include <qmainwindow.h>
46#include <qlabel.h> 46#include <qlabel.h>
47#include <qprogressbar.h> 47#include <qprogressbar.h>
48#include <qspinbox.h> 48#include <qspinbox.h>
49#include <qtabwidget.h> 49#include <qtabwidget.h>
50#include <qwidget.h> 50#include <qwidget.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qimage.h> 52#include <qimage.h>
53#include <qpixmap.h> 53#include <qpixmap.h>
54#include <qmessagebox.h> 54#include <qmessagebox.h>
55#include <qlineedit.h> 55#include <qlineedit.h>
56#include <qregexp.h> 56#include <qregexp.h>
57 57
58#include <unistd.h> 58#include <unistd.h>
59#include <stdlib.h> 59#include <stdlib.h>
60#include <sys/stat.h> 60#include <sys/stat.h>
61#include <dirent.h> 61#include <dirent.h>
62#include <stdio.h> 62#include <stdio.h>
63#include <time.h> 63#include <time.h>
64#include <fcntl.h> 64#include <fcntl.h>
65 65
66AdvancedFm::AdvancedFm( ) 66AdvancedFm::AdvancedFm( )
67 : QMainWindow( ) 67 : QMainWindow( )
68{ 68{
69 setCaption( tr( "AdvancedFm" ) ); 69 setCaption( tr( "AdvancedFm" ) );
70 70
71 QGridLayout *layout = new QGridLayout( this ); 71 QGridLayout *layout = new QGridLayout( this );
72 layout->setSpacing( 2); 72 layout->setSpacing( 2);
73 layout->setMargin( 2); 73 layout->setMargin( 2);
74 74
75 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 75 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
76 76
77 QPEMenuBar *menuBar = new QPEMenuBar(this); 77 QPEMenuBar *menuBar = new QPEMenuBar(this);
78// fileMenu = new QPopupMenu( this ); 78// fileMenu = new QPopupMenu( this );
79 fileMenu = new QPopupMenu( this ); 79 fileMenu = new QPopupMenu( this );
80 viewMenu = new QPopupMenu( this ); 80 viewMenu = new QPopupMenu( this );
81 81
82 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); 82 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
83 83
84 menuBar->insertItem( tr( "File" ), fileMenu); 84 menuBar->insertItem( tr( "File" ), fileMenu);
85 menuBar->insertItem( tr( "View" ), viewMenu); 85 menuBar->insertItem( tr( "View" ), viewMenu);
86 86
87 cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); 87 cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton");
88 cfButton ->setFixedSize( QSize( 20, 20 ) ); 88 cfButton ->setFixedSize( QSize( 20, 20 ) );
89 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); 89 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
90 cfButton->setFlat(TRUE); 90 cfButton->setFlat(TRUE);
91 layout->addMultiCellWidget( cfButton , 0, 0, 2, 2); 91 layout->addMultiCellWidget( cfButton , 0, 0, 2, 2);
92 92
93 sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); 93 sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton");
94 sdButton->setFixedSize( QSize( 20, 20 ) ); 94 sdButton->setFixedSize( QSize( 20, 20 ) );
95 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); 95 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
96 sdButton->setFlat(TRUE); 96 sdButton->setFlat(TRUE);
97 layout->addMultiCellWidget( sdButton , 0, 0, 3, 3); 97 layout->addMultiCellWidget( sdButton , 0, 0, 3, 3);
98 98
99 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); 99 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
100 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 100 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
101 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 101 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
102 cdUpButton ->setFlat(TRUE); 102 cdUpButton ->setFlat(TRUE);
103 layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4); 103 layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4);
104 104
105 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 105 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
106 docButton->setFixedSize( QSize( 20, 20 ) ); 106 docButton->setFixedSize( QSize( 20, 20 ) );
107 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 107 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
108 docButton->setFlat(TRUE); 108 docButton->setFlat(TRUE);
109 layout->addMultiCellWidget( docButton, 0, 0, 5, 5); 109 layout->addMultiCellWidget( docButton, 0, 0, 5, 5);
110 110
111 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); 111 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
112 homeButton->setFixedSize( QSize( 20, 20 ) ); 112 homeButton->setFixedSize( QSize( 20, 20 ) );
113 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 113 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
114 homeButton->setFlat(TRUE); 114 homeButton->setFlat(TRUE);
115 layout->addMultiCellWidget( homeButton, 0, 0, 6, 6); 115 layout->addMultiCellWidget( homeButton, 0, 0, 6, 6);
116// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 116// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
117// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 117// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
118// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 118// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
119 119
120 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 120 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
121 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
121 fileMenu->insertSeparator(); 122 fileMenu->insertSeparator();
122 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 123 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
123 fileMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 124 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
124 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 125 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
125 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 126 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
126 fileMenu->insertSeparator(); 127 fileMenu->insertSeparator();
127 fileMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 128 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
128 fileMenu->setCheckable(TRUE); 129 fileMenu->setCheckable(TRUE);
129 130
130 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 131 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
131 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 132 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
132 viewMenu->insertSeparator(); 133 viewMenu->insertSeparator();
133 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 134 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
134 viewMenu->setCheckable(TRUE); 135 viewMenu->setCheckable(TRUE);
135 136
136 TabWidget = new QTabWidget( this, "TabWidget" ); 137 TabWidget = new QTabWidget( this, "TabWidget" );
137 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6); 138 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6);
138 139
139 tab = new QWidget( TabWidget, "tab" ); 140 tab = new QWidget( TabWidget, "tab" );
140 tabLayout = new QGridLayout( tab ); 141 tabLayout = new QGridLayout( tab );
141 tabLayout->setSpacing( 2); 142 tabLayout->setSpacing( 2);
142 tabLayout->setMargin( 2); 143 tabLayout->setMargin( 2);
143 144
144 Local_View = new QListView( tab, "Local_View" ); 145 Local_View = new QListView( tab, "Local_View" );
145// Local_View->setResizePolicy( QListView::AutoOneFit ); 146// Local_View->setResizePolicy( QListView::AutoOneFit );
146 Local_View->addColumn( tr("File"),130); 147 Local_View->addColumn( tr("File"),130);
147 Local_View->addColumn( tr("Size"),-1); 148 Local_View->addColumn( tr("Size"),-1);
148 Local_View->setColumnAlignment(1,QListView::AlignRight); 149 Local_View->setColumnAlignment(1,QListView::AlignRight);
149 Local_View->addColumn( tr("Date"),-1); 150 Local_View->addColumn( tr("Date"),-1);
150 Local_View->setColumnAlignment(2,QListView::AlignRight); 151 Local_View->setColumnAlignment(2,QListView::AlignRight);
151 Local_View->setAllColumnsShowFocus(TRUE); 152 Local_View->setAllColumnsShowFocus(TRUE);
152// Local_View->setMultiSelection( TRUE ); 153// Local_View->setMultiSelection( TRUE );
153// Local_View->setSelectionMode(QListView::Extended); 154// Local_View->setSelectionMode(QListView::Extended);
154 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 155 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
155 156
156 tabLayout->addWidget( Local_View, 0, 0 ); 157 tabLayout->addWidget( Local_View, 0, 0 );
157 158
158 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 159 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
159 this,SLOT( localListClicked(QListViewItem *)) ); 160 this,SLOT( localListClicked(QListViewItem *)) );
160 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 161 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
161 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); 162 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) );
162 163
163 TabWidget->insertTab( tab, tr("1")); 164 TabWidget->insertTab( tab, tr("1"));
164 165
165 tab_2 = new QWidget( TabWidget, "tab_2" ); 166 tab_2 = new QWidget( TabWidget, "tab_2" );
166 tabLayout_2 = new QGridLayout( tab_2 ); 167 tabLayout_2 = new QGridLayout( tab_2 );
167 tabLayout_2->setSpacing( 2); 168 tabLayout_2->setSpacing( 2);
168 tabLayout_2->setMargin( 2); 169 tabLayout_2->setMargin( 2);
169 170
170 Remote_View = new QListView( tab_2, "Remote_View" ); 171 Remote_View = new QListView( tab_2, "Remote_View" );
171 Remote_View->addColumn( tr("File"),130); 172 Remote_View->addColumn( tr("File"),130);
172 Remote_View->addColumn( tr("Size"),-1); 173 Remote_View->addColumn( tr("Size"),-1);
173 Remote_View->setColumnAlignment(1,QListView::AlignRight); 174 Remote_View->setColumnAlignment(1,QListView::AlignRight);
174 Remote_View->addColumn( tr("Date"),-1); 175 Remote_View->addColumn( tr("Date"),-1);
175 Remote_View->setColumnAlignment(2,QListView::AlignRight); 176 Remote_View->setColumnAlignment(2,QListView::AlignRight);
176 Remote_View->setAllColumnsShowFocus(TRUE); 177 Remote_View->setAllColumnsShowFocus(TRUE);
177// Remote_View->setMultiSelection( TRUE ); 178// Remote_View->setMultiSelection( TRUE );
178// Remote_View->setSelectionMode(QListView::Extended); 179// Remote_View->setSelectionMode(QListView::Extended);
179 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 180 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
180 181
181 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 182 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
182 this,SLOT( remoteListClicked(QListViewItem *)) ); 183 this,SLOT( remoteListClicked(QListViewItem *)) );
183 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 184 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
184 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 185 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) );
185 186
186 tabLayout_2->addWidget( Remote_View, 0, 0 ); 187 tabLayout_2->addWidget( Remote_View, 0, 0 );
187 188
188 TabWidget->insertTab( tab_2, tr( "2")); 189 TabWidget->insertTab( tab_2, tr( "2"));
189 190
190 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 191 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
191 this,SLOT(tabChanged(QWidget*))); 192 this,SLOT(tabChanged(QWidget*)));
192 193
193// tab_3 = new QWidget( TabWidget, "tab_3" ); 194// tab_3 = new QWidget( TabWidget, "tab_3" );
194// tabLayout_3 = new QGridLayout( tab_3 ); 195// tabLayout_3 = new QGridLayout( tab_3 );
195// tabLayout_3->setSpacing( 2); 196// tabLayout_3->setSpacing( 2);
196// tabLayout_3->setMargin( 2); 197// tabLayout_3->setMargin( 2);
197 198
198// OFileSelector *fileSelector; 199// OFileSelector *fileSelector;
199// fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); 200// fileSelector = new OFileSelector(tab_3,0,0,"/","","*");
200// tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); 201// tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 );
201 202
202// TabWidget->insertTab( tab_3, tr( "Files" ) ); 203// TabWidget->insertTab( tab_3, tr( "Files" ) );
203 204
204 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 205 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
205 currentDir.setPath( QDir::currentDirPath()); 206 currentDir.setPath( QDir::currentDirPath());
206 207
207 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 208 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
208 currentRemoteDir.setPath( QDir::currentDirPath()); 209 currentRemoteDir.setPath( QDir::currentDirPath());
209 210
210 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 211b = TRUE;
212 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
211 currentPathCombo->setEditable(TRUE); 213 currentPathCombo->setEditable(TRUE);
212 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); 214 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6);
213 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 215 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
214 216
215 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 217 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
216 this, SLOT( currentPathComboActivated( const QString & ) ) ); 218 this, SLOT( currentPathComboActivated( const QString & ) ) );
217 219
218 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 220 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
219 this,SLOT(currentPathComboChanged())); 221 this,SLOT(currentPathComboChanged()));
220 222
221 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 223 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
222 224
223 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); 225 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6);
224 226
225 filterStr="*"; 227 filterStr="*";
226 b=FALSE; 228 b=FALSE;
227 populateLocalView(); 229 populateLocalView();
228 populateRemoteView(); 230 populateRemoteView();
229} 231}
230 232
231AdvancedFm::~AdvancedFm() 233AdvancedFm::~AdvancedFm()
232{ 234{
233} 235}
234 236
235void AdvancedFm::cleanUp() 237void AdvancedFm::cleanUp()
236{ 238{
237 QString sfile=QDir::homeDirPath(); 239 QString sfile=QDir::homeDirPath();
238 if(sfile.right(1) != "/") 240 if(sfile.right(1) != "/")
239 sfile+="/._temp"; 241 sfile+="/._temp";
240 else 242 else
241 sfile+="._temp"; 243 sfile+="._temp";
242 QFile file( sfile); 244 QFile file( sfile);
243 if(file.exists()) 245 if(file.exists())
244 file.remove(); 246 file.remove();
245} 247}
246 248
247void AdvancedFm::tabChanged(QWidget *w) 249void AdvancedFm::tabChanged(QWidget *w)
248{ 250{
249 if (TabWidget->currentPageIndex() == 0) { 251 if (TabWidget->currentPageIndex() == 0) {
250 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 252 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
251 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); 253 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
252 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); 254 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
253 } 255 }
254 if (TabWidget->currentPageIndex() == 1) { 256 if (TabWidget->currentPageIndex() == 1) {
255 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); 257 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath());
256 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); 258 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE);
257 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); 259 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE);
258 } 260 }
259} 261}
260 262
261 263
262void AdvancedFm::populateLocalView() 264void AdvancedFm::populateLocalView()
263{ 265{
264// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 266// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
265// QListViewItemIterator it( Local_View ); 267// QListViewItemIterator it( Local_View );
266// for ( ; it.current(); ++it ) { 268// for ( ; it.current(); ++it ) {
267// if ( it.current()->isSelected() ) { 269// if ( it.current()->isSelected() ) {
268// QString strItem = it.current()->text(0); 270// QString strItem = it.current()->text(0);
269// QString localFile = currentDir.canonicalPath()+"/"+strItem; 271// QString localFile = currentDir.canonicalPath()+"/"+strItem;
270// QFileInfo fi(localFile); 272// QFileInfo fi(localFile);
271// } 273// }
272// } 274// }
273 QPixmap pm; 275 QPixmap pm;
274 Local_View->clear(); 276 Local_View->clear();
275 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 277 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
276 currentDir.setMatchAllDirs(TRUE); 278 currentDir.setMatchAllDirs(TRUE);
277 currentDir.setNameFilter(filterStr); 279 currentDir.setNameFilter(filterStr);
278 QString fileL, fileS, fileDate; 280 QString fileL, fileS, fileDate;
279// qDebug(currentDir.canonicalPath()); 281// qDebug(currentDir.canonicalPath());
280 282
281 bool isDir=FALSE; 283 bool isDir=FALSE;
282 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 284 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
283 QFileInfoListIterator it(*list); 285 QFileInfoListIterator it(*list);
284 QFileInfo *fi; 286 QFileInfo *fi;
285 while ( (fi=it.current()) ) { 287 while ( (fi=it.current()) ) {
286 if (fi->isSymLink() ) { 288 if (fi->isSymLink() ) {
287 QString symLink=fi->readLink(); 289 QString symLink=fi->readLink();
288// qDebug("Symlink detected "+symLink); 290// qDebug("Symlink detected "+symLink);
289 QFileInfo sym( symLink); 291 QFileInfo sym( symLink);
290 fileS.sprintf( "%10li", sym.size() ); 292 fileS.sprintf( "%10li", sym.size() );
291 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 293 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
292 fileDate = sym.lastModified().toString(); 294 fileDate = sym.lastModified().toString();
293 } else { 295 } else {
294 fileS.sprintf( "%10li", fi->size() ); 296 fileS.sprintf( "%10li", fi->size() );
295 fileL.sprintf( "%s",fi->fileName().data() ); 297 fileL.sprintf( "%s",fi->fileName().data() );
296 fileDate= fi->lastModified().toString(); 298 fileDate= fi->lastModified().toString();
297 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 299 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
298 fileL+="/"; 300 fileL+="/";
299 isDir=TRUE; 301 isDir=TRUE;
300// qDebug( fileL); 302// qDebug( fileL);
301 } 303 }
302 } 304 }
303 if(fileL !="./" && fi->exists()) { 305 if(fileL !="./" && fi->exists()) {
304 item= new QListViewItem( Local_View, fileL, fileS , fileDate); 306 item= new QListViewItem( Local_View, fileL, fileS , fileDate);
305 307
306 if(isDir || fileL.find("/",0,TRUE) != -1) { 308 if(isDir || fileL.find("/",0,TRUE) != -1) {
307 if( !QDir( fi->filePath() ).isReadable()) 309 if( !QDir( fi->filePath() ).isReadable())
308 pm = Resource::loadPixmap( "lockedfolder" ); 310 pm = Resource::loadPixmap( "lockedfolder" );
309 else 311 else
310 pm= Resource::loadPixmap( "folder" ); 312 pm= Resource::loadPixmap( "folder" );
311 item->setPixmap( 0,pm ); 313 item->setPixmap( 0,pm );
312 } else { 314 } else {
313 if( !fi->isReadable() ) 315 if( !fi->isReadable() )
314 pm = Resource::loadPixmap( "locked" ); 316 pm = Resource::loadPixmap( "locked" );
315 else { 317 else {
316 MimeType mt(fi->filePath()); 318 MimeType mt(fi->filePath());
317 pm=mt.pixmap(); //sets the correct pixmap for mimetype 319 pm=mt.pixmap(); //sets the correct pixmap for mimetype
318 if(pm.isNull()) 320 if(pm.isNull())
319 pm = Resource::loadPixmap( "UnknownDocument-14" ); 321 pm = Resource::loadPixmap( "UnknownDocument-14" );
320 item->setPixmap( 0,pm); 322 item->setPixmap( 0,pm);
321 } 323 }
322 } 324 }
323 if( fileL.find("->",0,TRUE) != -1) { 325 if( fileL.find("->",0,TRUE) != -1) {
324 // overlay link image 326 // overlay link image
325 pm= Resource::loadPixmap( "folder" ); 327 pm= Resource::loadPixmap( "folder" );
326 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 328 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
327 QPainter painter( &pm ); 329 QPainter painter( &pm );
328 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 330 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
329 pm.setMask( pm.createHeuristicMask( FALSE ) ); 331 pm.setMask( pm.createHeuristicMask( FALSE ) );
330 item->setPixmap( 0, pm); 332 item->setPixmap( 0, pm);
331 } 333 }
332 } isDir=FALSE; 334 } isDir=FALSE;
333 ++it; 335 ++it;
334 } 336 }
335 337
336 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { 338 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) {
337 struct stat buf; 339 struct stat buf;
338 struct stat st; 340 struct stat st;
339 dev_t devT; 341 dev_t devT;
340 mode_t mode; 342 mode_t mode;
341 DIR *dir; 343 DIR *dir;
342 int fd = 0; 344 int fd = 0;
343 struct dirent *mydirent; 345 struct dirent *mydirent;
344 int i = 1; 346 int i = 1;
345 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) 347 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
346 while ((mydirent = readdir(dir)) != NULL) { 348 while ((mydirent = readdir(dir)) != NULL) {
347 lstat( mydirent->d_name, &buf); 349 lstat( mydirent->d_name, &buf);
348 qDebug(mydirent->d_name); 350 qDebug(mydirent->d_name);
349// mode = buf.st_mode; 351// mode = buf.st_mode;
350 fileL.sprintf("%s", mydirent->d_name); 352 fileL.sprintf("%s", mydirent->d_name);
351// fileS.sprintf("%d, %d", ); //this isn't correct 353// fileS.sprintf("%d, %d", ); //this isn't correct
352 devT = buf.st_dev; 354 devT = buf.st_dev;
353 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 355 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
354// fileS.sprintf("%d,%d", devT, devT); 356// fileS.sprintf("%d,%d", devT, devT);
355 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 357 fileDate.sprintf("%s", ctime( &buf.st_mtime));
356 if( fileL.find(".") == -1 ){ 358 if( fileL.find(".") == -1 ){
357 item= new QListViewItem( Local_View, fileL, fileS, fileDate); 359 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
358 pm = Resource::loadPixmap( "UnknownDocument-14" ); 360 pm = Resource::loadPixmap( "UnknownDocument-14" );
359 item->setPixmap( 0,pm); 361 item->setPixmap( 0,pm);
360 } 362 }
361 } 363 }
362 364
363 closedir(dir); 365 closedir(dir);
364 } 366 }
365 367
366 Local_View->setSorting( 3,FALSE); 368 Local_View->setSorting( 3,FALSE);
367 fillCombo( (const QString &) currentDir.canonicalPath()); 369 fillCombo( (const QString &) currentDir.canonicalPath());
368} 370}
369 371
370void AdvancedFm::populateRemoteView() 372void AdvancedFm::populateRemoteView()
371{ 373{
372// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 374// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
373// QListViewItemIterator it( Remote_View ); 375// QListViewItemIterator it( Remote_View );
374// for ( ; it.current(); ++it ) { 376// for ( ; it.current(); ++it ) {
375// if ( it.current()->isSelected() ) { 377// if ( it.current()->isSelected() ) {
376// QString strItem = it.current()->text(0); 378// QString strItem = it.current()->text(0);
377// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; 379// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem;
378// QFileInfo fi(localFile); 380// QFileInfo fi(localFile);
379// } 381// }
380// } 382// }
381 QPixmap pm; 383 QPixmap pm;
382 Remote_View->clear(); 384 Remote_View->clear();
383 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 385 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
384 currentRemoteDir.setMatchAllDirs(TRUE); 386 currentRemoteDir.setMatchAllDirs(TRUE);
385 currentRemoteDir.setNameFilter(filterStr); 387 currentRemoteDir.setNameFilter(filterStr);
386 QString fileL, fileS, fileDate; 388 QString fileL, fileS, fileDate;
387 bool isDir=FALSE; 389 bool isDir=FALSE;
388 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 390 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
389 QFileInfoListIterator it(*list); 391 QFileInfoListIterator it(*list);
390 QFileInfo *fi; 392 QFileInfo *fi;
391 while ( (fi=it.current()) ) { 393 while ( (fi=it.current()) ) {
392 if (fi->isSymLink() ){ 394 if (fi->isSymLink() ){
393 QString symLink=fi->readLink(); 395 QString symLink=fi->readLink();
394// qDebug("Symlink detected "+symLink); 396// qDebug("Symlink detected "+symLink);
395 QFileInfo sym( symLink); 397 QFileInfo sym( symLink);
396 fileS.sprintf( "%10li", sym.size() ); 398 fileS.sprintf( "%10li", sym.size() );
397 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 399 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
398 fileDate = sym.lastModified().toString(); 400 fileDate = sym.lastModified().toString();
399 } else { 401 } else {
400// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 402// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
401 fileS.sprintf( "%10li", fi->size() ); 403 fileS.sprintf( "%10li", fi->size() );
402 fileL.sprintf( "%s",fi->fileName().data() ); 404 fileL.sprintf( "%s",fi->fileName().data() );
403 fileDate= fi->lastModified().toString(); 405 fileDate= fi->lastModified().toString();
404 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 406 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
405 fileL+="/"; 407 fileL+="/";
406 isDir=TRUE; 408 isDir=TRUE;
407// qDebug( fileL); 409// qDebug( fileL);
408 } 410 }
409 } 411 }
410 if(fileL !="./" && fi->exists()) { 412 if(fileL !="./" && fi->exists()) {
411 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 413 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
412 QPixmap pm; 414 QPixmap pm;
413 415
414 if(isDir || fileL.find("/",0,TRUE) != -1) { 416 if(isDir || fileL.find("/",0,TRUE) != -1) {
415 if( !QDir( fi->filePath() ).isReadable()) 417 if( !QDir( fi->filePath() ).isReadable())
416 pm = Resource::loadPixmap( "lockedfolder" ); 418 pm = Resource::loadPixmap( "lockedfolder" );
417 else 419 else
418 pm= Resource::loadPixmap( "folder" ); 420 pm= Resource::loadPixmap( "folder" );
419 item->setPixmap( 0,pm ); 421 item->setPixmap( 0,pm );
420 } else { 422 } else {
421 if( !fi->isReadable() ) 423 if( !fi->isReadable() )
422 pm = Resource::loadPixmap( "locked" ); 424 pm = Resource::loadPixmap( "locked" );
423 else { 425 else {
424 MimeType mt(fi->filePath()); 426 MimeType mt(fi->filePath());
425 pm=mt.pixmap(); //sets the correct pixmap for mimetype 427 pm=mt.pixmap(); //sets the correct pixmap for mimetype
426 if(pm.isNull()) 428 if(pm.isNull())
427 pm = Resource::loadPixmap( "UnknownDocument-14" ); 429 pm = Resource::loadPixmap( "UnknownDocument-14" );
428 item->setPixmap( 0,pm); 430 item->setPixmap( 0,pm);
429 } 431 }
430 } 432 }
431 if( fileL.find("->",0,TRUE) != -1) { 433 if( fileL.find("->",0,TRUE) != -1) {
432 // overlay link image 434 // overlay link image
433 pm= Resource::loadPixmap( "folder" ); 435 pm= Resource::loadPixmap( "folder" );
434 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 436 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
435 QPainter painter( &pm ); 437 QPainter painter( &pm );
436 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 438 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
437 pm.setMask( pm.createHeuristicMask( FALSE ) ); 439 pm.setMask( pm.createHeuristicMask( FALSE ) );
438 item->setPixmap( 0, pm); 440 item->setPixmap( 0, pm);
439 } 441 }
440 } isDir=FALSE; 442 } isDir=FALSE;
441 ++it; 443 ++it;
442 } 444 }
443 445
444 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { 446 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) {
445 struct stat buf; 447 struct stat buf;
446 struct stat st; 448 struct stat st;
447 mode_t mode; 449 mode_t mode;
448 DIR *dir; 450 DIR *dir;
449 int fd = 0; 451 int fd = 0;
450 struct dirent *mydirent; 452 struct dirent *mydirent;
451 int i = 1; 453 int i = 1;
452 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 454 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
453 while ((mydirent = readdir(dir)) != NULL) { 455 while ((mydirent = readdir(dir)) != NULL) {
454 lstat( mydirent->d_name, &buf); 456 lstat( mydirent->d_name, &buf);
455 qDebug(mydirent->d_name); 457 qDebug(mydirent->d_name);
456// mode = buf.st_mode; 458// mode = buf.st_mode;
457 fileL.sprintf("%s", mydirent->d_name); 459 fileL.sprintf("%s", mydirent->d_name);
458// fileS.sprintf("%d, %d", ); //this isn't correct 460// fileS.sprintf("%d, %d", ); //this isn't correct
459 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 461 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
460 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 462 fileDate.sprintf("%s", ctime( &buf.st_mtime));
461 if( fileL.find(".") == -1 ){ 463 if( fileL.find(".") == -1 ){
462 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 464 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
463 pm = Resource::loadPixmap( "UnknownDocument-14" ); 465 pm = Resource::loadPixmap( "UnknownDocument-14" );
464 item->setPixmap( 0,pm); 466 item->setPixmap( 0,pm);
465 } 467 }
466 } 468 }
467 469
468 closedir(dir); 470 closedir(dir);
469 } 471 }
470 472
471 Remote_View->setSorting( 3,FALSE); 473 Remote_View->setSorting( 3,FALSE);
472 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 474 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
473} 475}
474 476
475void AdvancedFm::localListClicked(QListViewItem *selectedItem) 477void AdvancedFm::localListClicked(QListViewItem *selectedItem)
476{ 478{
477 if(selectedItem) { 479 if(selectedItem) {
478 QString strItem=selectedItem->text(0); 480 QString strItem=selectedItem->text(0);
479 QString strSize=selectedItem->text(1); 481 QString strSize=selectedItem->text(1);
480 strSize=strSize.stripWhiteSpace(); 482 strSize=strSize.stripWhiteSpace();
481 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 483 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
482 // is symlink 484 // is symlink
483 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 485 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
484 if(QDir(strItem2).exists() ) { 486 if(QDir(strItem2).exists() ) {
485 currentDir.cd(strItem2, TRUE); 487 currentDir.cd(strItem2, TRUE);
486 populateLocalView(); 488 populateLocalView();
487 } 489 }
488 } else { // not a symlink 490 } else { // not a symlink
489 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 491 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
490 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 492 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
491 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 493 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
492 currentDir.cd(strItem,FALSE); 494 currentDir.cd(strItem,FALSE);
493 populateLocalView(); 495 populateLocalView();
494 } else { 496 } else {
495 currentDir.cdUp(); 497 currentDir.cdUp();
496 populateLocalView(); 498 populateLocalView();
497 } 499 }
498 if(QDir(strItem).exists()){ 500 if(QDir(strItem).exists()){
499 currentDir.cd(strItem, TRUE); 501 currentDir.cd(strItem, TRUE);
500 populateLocalView(); 502 populateLocalView();
501 } 503 }
502 } else { 504 } else {
503 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 505 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
504 if( QFile::exists(strItem ) ) { 506 if( QFile::exists(strItem ) ) {
505// qDebug("upload "+strItem); 507// qDebug("upload "+strItem);
506 } 508 }
507 } //end not symlink 509 } //end not symlink
508 chdir(strItem.latin1()); 510 chdir(strItem.latin1());
509 } 511 }
510 } 512 }
511} 513}
512 514
513void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) 515void AdvancedFm::remoteListClicked(QListViewItem *selectedItem)
514{ 516{
515 if(selectedItem) { 517 if(selectedItem) {
516 QString strItem=selectedItem->text(0); 518 QString strItem=selectedItem->text(0);
517 QString strSize=selectedItem->text(1); 519 QString strSize=selectedItem->text(1);
518 strSize=strSize.stripWhiteSpace(); 520 strSize=strSize.stripWhiteSpace();
519 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 521 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
520 // is symlink 522 // is symlink
521 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 523 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
522 if(QDir(strItem2).exists() ) { 524 if(QDir(strItem2).exists() ) {
523 currentRemoteDir.cd(strItem2, TRUE); 525 currentRemoteDir.cd(strItem2, TRUE);
524 populateRemoteView(); 526 populateRemoteView();
525 } 527 }
526 } else { // not a symlink 528 } else { // not a symlink
527 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 529 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
528 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { 530 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) {
529 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 531 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
530 currentRemoteDir.cd(strItem,FALSE); 532 currentRemoteDir.cd(strItem,FALSE);
531 populateRemoteView(); 533 populateRemoteView();
532 } else { 534 } else {
533 currentRemoteDir.cdUp(); 535 currentRemoteDir.cdUp();
534 populateRemoteView(); 536 populateRemoteView();
535 } 537 }
536 if(QDir(strItem).exists()){ 538 if(QDir(strItem).exists()){
537 currentRemoteDir.cd(strItem, TRUE); 539 currentRemoteDir.cd(strItem, TRUE);
538 populateRemoteView(); 540 populateRemoteView();
539 } 541 }
540 } else { 542 } else {
541 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 543 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
542 if( QFile::exists(strItem ) ) { 544 if( QFile::exists(strItem ) ) {
543// qDebug("upload "+strItem); 545// qDebug("upload "+strItem);
544 } 546 }
545 } //end not symlink 547 } //end not symlink
546 chdir(strItem.latin1()); 548 chdir(strItem.latin1());
547 } 549 }
548 } 550 }
549} 551}
550 552
551void AdvancedFm::doLocalCd() 553void AdvancedFm::doLocalCd()
552{ 554{
553 localListClicked( Local_View->currentItem()); 555 localListClicked( Local_View->currentItem());
554} 556}
555 557
556void AdvancedFm::doRemoteCd() 558void AdvancedFm::doRemoteCd()
557{ 559{
558 localListClicked( Remote_View->currentItem()); 560 localListClicked( Remote_View->currentItem());
559} 561}
560 562
561void AdvancedFm::showHidden() 563void AdvancedFm::showHidden()
562{ 564{
563 if (!b) { 565 if (!b) {
564 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 566 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
565// localMenu->setItemChecked(localMenu->idAt(0),TRUE); 567// localMenu->setItemChecked(localMenu->idAt(0),TRUE);
566// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 568// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
567 b=TRUE; 569 b=TRUE;
568 570
569 } else { 571 } else {
570 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 572 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
571// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 573// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
572// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 574// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
573 b=FALSE; 575 b=FALSE;
574 } 576 }
575 populateLocalView(); 577 populateLocalView();
576} 578}
577 579
578void AdvancedFm::showRemoteHidden() 580void AdvancedFm::showRemoteHidden()
579{ 581{
580 if (!b) { 582 if (!b) {
581 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 583 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
582// viewMenu->setItemChecked(localMenu->idAt(0),TRUE); 584// viewMenu->setItemChecked(localMenu->idAt(0),TRUE);
583// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 585// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
584 b=TRUE; 586 b=TRUE;
585 587
586 } else { 588 } else {
587 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 589 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
588// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 590// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
589// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 591// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
590 b=FALSE; 592 b=FALSE;
591 } 593 }
592 populateRemoteView(); 594 populateRemoteView();
593} 595}
594 596
595void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 597void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
596{ 598{
597 switch (mouse) { 599 switch (mouse) {
598 case 1: 600 case 1:
599 break; 601 break;
600 case 2: 602 case 2:
601 showLocalMenu(item); 603 showLocalMenu(item);
602 Local_View->clearSelection(); 604 Local_View->clearSelection();
603 break; 605 break;
604 }; 606 };
605} 607}
606 608
607void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 609void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
608{ 610{
609 switch (mouse) { 611 switch (mouse) {
610 case 1: 612 case 1:
611 break; 613 break;
612 case 2: 614 case 2:
613 showRemoteMenu(item); 615 showRemoteMenu(item);
614 Remote_View->clearSelection(); 616 Remote_View->clearSelection();
615 break; 617 break;
616 }; 618 };
617} 619}
618 620
619void AdvancedFm::showLocalMenu(QListViewItem * item) 621void AdvancedFm::showLocalMenu(QListViewItem * item)
620{ 622{
621 if(item) { 623 if(item) {
622 QPopupMenu m; 624 QPopupMenu m;
623 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 625 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
624 m.insertSeparator(); 626 m.insertSeparator();
625 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 627 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
626 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 628 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
627 else 629 else
628 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 630 m.insertItem( tr( "Open" ), this, SLOT( runThis() ));
629 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 631 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
630 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 632 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
631 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 633 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
632 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 634 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
633 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 635 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
634 m.insertItem( tr( "Move" ), this, SLOT( move() )); 636 m.insertItem( tr( "Move" ), this, SLOT( move() ));
635 m.insertSeparator(); 637 m.insertSeparator();
636 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 638 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
637 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 639 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
638 m.insertSeparator(); 640 m.insertSeparator();
639 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 641 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
640 m.insertSeparator(); 642 m.insertSeparator();
641 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 643 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
642 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 644 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
643 m.setCheckable(TRUE); 645 m.setCheckable(TRUE);
644 if (b) 646 if (b)
645 m.setItemChecked(m.idAt(0),TRUE); 647 m.setItemChecked(m.idAt(0),TRUE);
646 else 648 else
647 m.setItemChecked(m.idAt(0),FALSE); 649 m.setItemChecked(m.idAt(0),FALSE);
648 m.exec( QCursor::pos() ); 650 m.exec( QCursor::pos() );
649 } 651 }
650} 652}
651 653
652void AdvancedFm::showRemoteMenu(QListViewItem * item) 654void AdvancedFm::showRemoteMenu(QListViewItem * item)
653{ 655{
654 if(item) { 656 if(item) {
655 QPopupMenu m; 657 QPopupMenu m;
656 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); 658 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() ));
657 m.insertSeparator(); 659 m.insertSeparator();
658 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 660 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
659 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 661 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
660 else 662 else
661 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 663 m.insertItem( tr( "Open" ), this, SLOT( runThis() ));
662 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 664 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
663 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 665 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
664 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 666 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
665 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 667 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
666 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 668 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
667 m.insertItem( tr( "Move" ), this, SLOT( move() )); 669 m.insertItem( tr( "Move" ), this, SLOT( move() ));
668 m.insertSeparator(); 670 m.insertSeparator();
669 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 671 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
670 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 672 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
671 m.insertSeparator(); 673 m.insertSeparator();
672 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 674 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
673 m.insertSeparator(); 675 m.insertSeparator();
674 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 676 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
675 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 677 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
676 m.setCheckable(TRUE); 678 m.setCheckable(TRUE);
677 if (b) 679 if (b)
678 m.setItemChecked(m.idAt(0),TRUE); 680 m.setItemChecked(m.idAt(0),TRUE);
679 else 681 else
680 m.setItemChecked(m.idAt(0),FALSE); 682 m.setItemChecked(m.idAt(0),FALSE);
681 m.exec( QCursor::pos() ); 683 m.exec( QCursor::pos() );
682 } 684 }
683} 685}
684 686
685void AdvancedFm::runThis() { 687void AdvancedFm::runThis() {
686// QFileInfo *fi; 688// QFileInfo *fi;
687 if (TabWidget->currentPageIndex() == 0) { 689 if (TabWidget->currentPageIndex() == 0) {
688 QString curFile = Local_View->currentItem()->text(0); 690 QString curFile = Local_View->currentItem()->text(0);
689 curFile = currentDir.canonicalPath()+"/"+curFile; 691 curFile = currentDir.canonicalPath()+"/"+curFile;
690 DocLnk nf(curFile); 692 DocLnk nf(curFile);
691 QString execStr = nf.exec(); 693 QString execStr = nf.exec();
692 qDebug( execStr); 694 qDebug( execStr);
693 if( execStr.isEmpty() ) { 695 if( execStr.isEmpty() ) {
694 } else { 696 } else {
695 nf.execute(); 697 nf.execute();
696 } 698 }
697// MimeType mt( curFile); 699// MimeType mt( curFile);
698 } else { 700 } else {
699 QString curFile = Remote_View->currentItem()->text(0); 701 QString curFile = Remote_View->currentItem()->text(0);
700 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 702 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
701 DocLnk nf(curFile); 703 DocLnk nf(curFile);
702 QString execStr = nf.exec(); 704 QString execStr = nf.exec();
703 qDebug(execStr); 705 qDebug(execStr);
704 if( execStr.isEmpty() ) { 706 if( execStr.isEmpty() ) {
705 } else { 707 } else {
706 nf.execute(); 708 nf.execute();
707 } 709 }
708// MimeType mt( curFile); 710// MimeType mt( curFile);
709 } 711 }
710} 712}
711 713
712void AdvancedFm::runText() { 714void AdvancedFm::runText() {
713 if (TabWidget->currentPageIndex() == 0) { 715 if (TabWidget->currentPageIndex() == 0) {
714 QString curFile = Local_View->currentItem()->text(0); 716 QString curFile = Local_View->currentItem()->text(0);
715 curFile = currentDir.canonicalPath()+"/"+curFile; 717 curFile = currentDir.canonicalPath()+"/"+curFile;
716 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 718 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
717 e << curFile; 719 e << curFile;
718 } else { 720 } else {
719 QString curFile = Remote_View->currentItem()->text(0); 721 QString curFile = Remote_View->currentItem()->text(0);
720 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 722 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
721 DocLnk nf(curFile); 723 DocLnk nf(curFile);
722 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 724 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
723 e << curFile; 725 e << curFile;
724 } 726 }
725} 727}
726 728
727void AdvancedFm::localMakDir() 729void AdvancedFm::localMakDir()
728{ 730{
729 InputDialog *fileDlg; 731 InputDialog *fileDlg;
730 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 732 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
731 fileDlg->exec(); 733 fileDlg->exec();
732 if( fileDlg->result() == 1 ) { 734 if( fileDlg->result() == 1 ) {
733 QString filename = fileDlg->LineEdit1->text(); 735 QString filename = fileDlg->LineEdit1->text();
734 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 736 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
735 } 737 }
736 populateLocalView(); 738 populateLocalView();
737} 739}
738 740
739void AdvancedFm::remoteMakDir() 741void AdvancedFm::remoteMakDir()
740{ 742{
741 InputDialog *fileDlg; 743 InputDialog *fileDlg;
742 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 744 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
743 fileDlg->exec(); 745 fileDlg->exec();
744 if( fileDlg->result() == 1 ) { 746 if( fileDlg->result() == 1 ) {
745 QString filename = fileDlg->LineEdit1->text(); 747 QString filename = fileDlg->LineEdit1->text();
746 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); 748 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename);
747 } 749 }
748 populateRemoteView(); 750 populateRemoteView();
749} 751}
750 752
751void AdvancedFm::localDelete() 753void AdvancedFm::localDelete()
752{ 754{
753 QString f = Local_View->currentItem()->text(0); 755 QString f = Local_View->currentItem()->text(0);
754 if(QDir(f).exists() ) { 756 if(QDir(f).exists() ) {
755 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 757 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
756 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { 758 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
757 case 0: { 759 case 0: {
758 f=currentDir.canonicalPath()+"/"+f; 760 f=currentDir.canonicalPath()+"/"+f;
759 QString cmd="rmdir "+f; 761 QString cmd="rmdir "+f;
760 system( cmd.latin1()); 762 system( cmd.latin1());
761 populateLocalView(); 763 populateLocalView();
762 } 764 }
763 break; 765 break;
764 case 1: 766 case 1:
765 // exit 767 // exit
766 break; 768 break;
767 }; 769 };
768 770
769 } else { 771 } else {
770 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 772 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
771 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 773 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
772 case 0: { 774 case 0: {
773 f=currentDir.canonicalPath()+"/"+f; 775 f=currentDir.canonicalPath()+"/"+f;
774 QString cmd="rm "+f; 776 QString cmd="rm "+f;
775 system( cmd.latin1()); 777 system( cmd.latin1());
776 populateLocalView(); 778 populateLocalView();
777 } 779 }
778 break; 780 break;
779 case 1: 781 case 1:
780 // exit 782 // exit
781 break; 783 break;
782 }; 784 };
783 } 785 }
784} 786}
785 787
786void AdvancedFm::remoteDelete() 788void AdvancedFm::remoteDelete()
787{ 789{
788 QString f = Remote_View->currentItem()->text(0); 790 QString f = Remote_View->currentItem()->text(0);
789 if(QDir(f).exists() ) { 791 if(QDir(f).exists() ) {
790 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 792 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
791 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { 793 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
792 case 0: { 794 case 0: {
793 f = currentRemoteDir.canonicalPath()+"/"+f; 795 f = currentRemoteDir.canonicalPath()+"/"+f;
794 QString cmd="rmdir "+f; 796 QString cmd="rmdir "+f;
795 system( cmd.latin1()); 797 system( cmd.latin1());
796 populateRemoteView(); 798 populateRemoteView();
797 } 799 }
798 break; 800 break;
799 case 1: 801 case 1:
800 // exit 802 // exit
801 break; 803 break;
802 }; 804 };
803 805
804 } else { 806 } else {
805 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 807 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
806 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 808 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
807 case 0: { 809 case 0: {
808 f = currentRemoteDir.canonicalPath()+"/"+f; 810 f = currentRemoteDir.canonicalPath()+"/"+f;
809 QString cmd="rm "+f; 811 QString cmd="rm "+f;
810 system( cmd.latin1()); 812 system( cmd.latin1());
811 populateRemoteView(); 813 populateRemoteView();
812 } 814 }
813 break; 815 break;
814 case 1: 816 case 1:
815 // exit 817 // exit
816 break; 818 break;
817 }; 819 };
818 } 820 }
819} 821}
820 822
821void AdvancedFm::localRename() 823void AdvancedFm::localRename()
822{ 824{
823 QString curFile = Local_View->currentItem()->text(0); 825 QString curFile = Local_View->currentItem()->text(0);
824 InputDialog *fileDlg; 826 InputDialog *fileDlg;
825 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 827 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
826 fileDlg->setInputText((const QString &)curFile); 828 fileDlg->setInputText((const QString &)curFile);
827 fileDlg->exec(); 829 fileDlg->exec();
828 if( fileDlg->result() == 1 ) { 830 if( fileDlg->result() == 1 ) {
829 QString oldname = currentDir.canonicalPath() + "/" + curFile; 831 QString oldname = currentDir.canonicalPath() + "/" + curFile;
830 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 832 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
831 if( rename(oldname.latin1(), newName.latin1())== -1) 833 if( rename(oldname.latin1(), newName.latin1())== -1)
832 QMessageBox::message(tr("Note"),tr("Could not rename")); 834 QMessageBox::message(tr("Note"),tr("Could not rename"));
833 } 835 }
834 populateLocalView(); 836 populateLocalView();
835} 837}
836 838
837void AdvancedFm::remoteRename() 839void AdvancedFm::remoteRename()
838{ 840{
839 QString curFile = Local_View->currentItem()->text(0); 841 QString curFile = Local_View->currentItem()->text(0);
840 InputDialog *fileDlg; 842 InputDialog *fileDlg;
841 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 843 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
842 fileDlg->setInputText((const QString &)curFile); 844 fileDlg->setInputText((const QString &)curFile);
843 fileDlg->exec(); 845 fileDlg->exec();
844 if( fileDlg->result() == 1 ) { 846 if( fileDlg->result() == 1 ) {
845 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; 847 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile;
846 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 848 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
847 if( rename(oldname.latin1(), newName.latin1())== -1) 849 if( rename(oldname.latin1(), newName.latin1())== -1)
848 QMessageBox::message(tr("Note"),tr("Could not rename")); 850 QMessageBox::message(tr("Note"),tr("Could not rename"));
849 } 851 }
850 populateRemoteView(); 852 populateRemoteView();
851} 853}
852 854
853void AdvancedFm::switchToLocalTab() 855void AdvancedFm::switchToLocalTab()
854{ 856{
855 TabWidget->setCurrentPage(0); 857 TabWidget->setCurrentPage(0);
856} 858}
857 859
858void AdvancedFm::switchToRemoteTab() 860void AdvancedFm::switchToRemoteTab()
859{ 861{
860 TabWidget->setCurrentPage(1); 862 TabWidget->setCurrentPage(1);
861} 863}
862 864
863void AdvancedFm::readConfig() 865void AdvancedFm::readConfig()
864{ 866{
865 Config cfg("AdvancedFm"); 867 Config cfg("AdvancedFm");
866} 868}
867 869
868void AdvancedFm::writeConfig() 870void AdvancedFm::writeConfig()
869{ 871{
870 Config cfg("AdvancedFm"); 872 Config cfg("AdvancedFm");
871} 873}
872 874
873void AdvancedFm::currentPathComboChanged() 875void AdvancedFm::currentPathComboChanged()
874{ 876{
875 if (TabWidget->currentPageIndex() == 0) { 877 if (TabWidget->currentPageIndex() == 0) {
876 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 878 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
877 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 879 currentDir.setPath( currentPathCombo->lineEdit()->text() );
878 populateLocalView(); 880 populateLocalView();
879 } else { 881 } else {
880 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 882 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
881 } 883 }
882 } 884 }
883 if (TabWidget->currentPageIndex() == 0) { 885 if (TabWidget->currentPageIndex() == 0) {
884 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 886 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
885 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); 887 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
886 populateRemoteView(); 888 populateRemoteView();
887 } else { 889 } else {
888 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 890 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
889 } 891 }
890 } 892 }
891} 893}
892 894
893void AdvancedFm::fillCombo(const QString &currentPath) { 895void AdvancedFm::fillCombo(const QString &currentPath) {
894 896
895 if (TabWidget->currentPageIndex() == 0) { 897 if (TabWidget->currentPageIndex() == 0) {
896 currentPathCombo->lineEdit()->setText( currentPath); 898 currentPathCombo->lineEdit()->setText( currentPath);
897 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 899 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
898 currentPathCombo->clear(); 900 currentPathCombo->clear();
899 localDirPathStringList.prepend( currentPath ); 901 localDirPathStringList.prepend( currentPath );
900 currentPathCombo->insertStringList( localDirPathStringList,-1); 902 currentPathCombo->insertStringList( localDirPathStringList,-1);
901 } 903 }
902 } else { 904 } else {
903 currentPathCombo->lineEdit()->setText( currentPath); 905 currentPathCombo->lineEdit()->setText( currentPath);
904 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 906 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
905 currentPathCombo->clear(); 907 currentPathCombo->clear();
906 remoteDirPathStringList.prepend( currentPath ); 908 remoteDirPathStringList.prepend( currentPath );
907 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 909 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
908 } 910 }
909 } 911 }
910} 912}
911 913
912void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 914void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
913 if (TabWidget->currentPageIndex() == 0) { 915 if (TabWidget->currentPageIndex() == 0) {
914 chdir( currentPath.latin1() ); 916 chdir( currentPath.latin1() );
915 currentDir.cd( currentPath, TRUE); 917 currentDir.cd( currentPath, TRUE);
916 populateLocalView(); 918 populateLocalView();
917 update(); 919 update();
918 } else { 920 } else {
919 chdir( currentPath.latin1() ); 921 chdir( currentPath.latin1() );
920 currentRemoteDir.cd( currentPath, TRUE); 922 currentRemoteDir.cd( currentPath, TRUE);
921 populateRemoteView(); 923 populateRemoteView();
922 update(); 924 update();
923 } 925 }
924} 926}
925 927
926void AdvancedFm::filePerms() { 928void AdvancedFm::filePerms() {
927 QString curFile = getPath(); 929 QString curFile = getPath();
928 filePermissions *filePerm; 930 filePermissions *filePerm;
929 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(curFile)); 931 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(curFile));
930 filePerm->showMaximized(); 932 filePerm->showMaximized();
931 filePerm->exec(); 933 filePerm->exec();
932 if( filePerm) 934 if( filePerm)
933 delete filePerm; 935 delete filePerm;
934} 936}
935 937
936void AdvancedFm::doProperties() { 938void AdvancedFm::doProperties() {
937 939
938 DocLnk lnk( getPath()); 940 DocLnk lnk( getPath());
939 LnkProperties prop( &lnk ); 941 LnkProperties prop( &lnk );
940// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 942// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
941 prop.showMaximized(); 943 prop.showMaximized();
942 prop.exec(); 944 prop.exec();
943} 945}
944 946
945QString AdvancedFm::getPath() { 947QString AdvancedFm::getPath() {
946 if (TabWidget->currentPageIndex() == 0) { 948 if (TabWidget->currentPageIndex() == 0) {
947 return currentDir.canonicalPath()+"/"+ Local_View->currentItem()->text(0); 949 return currentDir.canonicalPath()+"/"+ Local_View->currentItem()->text(0);
948 } else { 950 } else {
949 return currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); 951 return currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
950 } 952 }
951} 953}
952 954
953void AdvancedFm::homeButtonPushed() { 955void AdvancedFm::homeButtonPushed() {
954 QString current = QDir::homeDirPath(); 956 QString current = QDir::homeDirPath();
955 chdir( current.latin1() ); 957 chdir( current.latin1() );
956 if (TabWidget->currentPageIndex() == 0) { 958 if (TabWidget->currentPageIndex() == 0) {
957 currentDir.cd( current, TRUE); 959 currentDir.cd( current, TRUE);
958 populateLocalView(); 960 populateLocalView();
959 } else { 961 } else {
960 currentRemoteDir.cd( current, TRUE); 962 currentRemoteDir.cd( current, TRUE);
961 populateRemoteView(); 963 populateRemoteView();
962 } 964 }
963 update(); 965 update();
964} 966}
965 967
966void AdvancedFm::docButtonPushed() { 968void AdvancedFm::docButtonPushed() {
967 QString current = QPEApplication::documentDir(); 969 QString current = QPEApplication::documentDir();
968 chdir( current.latin1() ); 970 chdir( current.latin1() );
969 if (TabWidget->currentPageIndex() == 0) { 971 if (TabWidget->currentPageIndex() == 0) {
970 currentDir.cd( current, TRUE); 972 currentDir.cd( current, TRUE);
971 populateLocalView(); 973 populateLocalView();
972 } else { 974 } else {
973 currentRemoteDir.cd( current, TRUE); 975 currentRemoteDir.cd( current, TRUE);
974 populateRemoteView(); 976 populateRemoteView();
975 } 977 }
976 update(); 978 update();
977} 979}
978 980
979void AdvancedFm::SDButtonPushed() { 981void AdvancedFm::SDButtonPushed() {
980 QString current = "/mnt/card"; 982 QString current = "/mnt/card";
981 chdir( current.latin1() ); 983 chdir( current.latin1() );
982 if (TabWidget->currentPageIndex() == 0) { 984 if (TabWidget->currentPageIndex() == 0) {
983 currentDir.cd( current, TRUE); 985 currentDir.cd( current, TRUE);
984 populateLocalView(); 986 populateLocalView();
985 } else { 987 } else {
986 currentRemoteDir.cd( current, TRUE); 988 currentRemoteDir.cd( current, TRUE);
987 populateRemoteView(); 989 populateRemoteView();
988 } 990 }
989 update(); 991 update();
990 992
991} 993}
992 994
993void AdvancedFm::CFButtonPushed() { 995void AdvancedFm::CFButtonPushed() {
994 QString current = "/mnt/cf"; 996 QString current = "/mnt/cf";
995 chdir( current.latin1() ); 997 chdir( current.latin1() );
996 if (TabWidget->currentPageIndex() == 0) { 998 if (TabWidget->currentPageIndex() == 0) {
997 currentDir.cd( current, TRUE); 999 currentDir.cd( current, TRUE);
998 populateLocalView(); 1000 populateLocalView();
999 } else { 1001 } else {
1000 currentRemoteDir.cd( current, TRUE); 1002 currentRemoteDir.cd( current, TRUE);
1001 populateRemoteView(); 1003 populateRemoteView();
1002 } 1004 }
1003 update(); 1005 update();
1004 1006
1005} 1007}
1006 1008
1007 1009
1008void AdvancedFm::upDir() 1010void AdvancedFm::upDir()
1009{ 1011{
1010 if (TabWidget->currentPageIndex() == 0) { 1012 if (TabWidget->currentPageIndex() == 0) {
1011 QString current = currentDir.canonicalPath(); 1013 QString current = currentDir.canonicalPath();
1012 QDir dir(current); 1014 QDir dir(current);
1013 dir.cdUp(); 1015 dir.cdUp();
1014 current = dir.canonicalPath(); 1016 current = dir.canonicalPath();
1015 chdir( current.latin1() ); 1017 chdir( current.latin1() );
1016 currentDir.cd( current, TRUE); 1018 currentDir.cd( current, TRUE);
1017 populateLocalView(); 1019 populateLocalView();
1018 update(); 1020 update();
1019 } else { 1021 } else {
1020 QString current = currentRemoteDir.canonicalPath(); 1022 QString current = currentRemoteDir.canonicalPath();
1021 QDir dir(current); 1023 QDir dir(current);
1022 dir.cdUp(); 1024 dir.cdUp();
1023 current = dir.canonicalPath(); 1025 current = dir.canonicalPath();
1024 chdir( current.latin1() ); 1026 chdir( current.latin1() );
1025 currentRemoteDir.cd( current, TRUE); 1027 currentRemoteDir.cd( current, TRUE);
1026 populateRemoteView(); 1028 populateRemoteView();
1027 update(); 1029 update();
1028 } 1030 }
1029} 1031}
1030 1032
1031void AdvancedFm::copy() 1033void AdvancedFm::copy()
1032{ 1034{
1033 QString curFile = getPath(); 1035 QString curFile = getPath();
1034 if (TabWidget->currentPageIndex() == 0) { 1036 if (TabWidget->currentPageIndex() == 0) {
1035 QString destFile = currentRemoteDir.canonicalPath()+"/"+Local_View->currentItem()->text(0); 1037 QString destFile = currentRemoteDir.canonicalPath()+"/"+Local_View->currentItem()->text(0);
1036 QFile f(destFile); 1038 QFile f(destFile);
1037 if( f.exists()) 1039 if( f.exists())
1038 f.remove(); 1040 f.remove();
1039 if(!copyFile(destFile, curFile) ) 1041 if(!copyFile(destFile, curFile) )
1040 qWarning("nothin doing"); 1042 qWarning("nothin doing");
1041 populateRemoteView(); 1043 populateRemoteView();
1042 TabWidget->setCurrentPage(1); 1044 TabWidget->setCurrentPage(1);
1043 } else { 1045 } else {
1044 QString destFile = currentDir.canonicalPath()+"/"+Remote_View->currentItem()->text(0); 1046 QString destFile = currentDir.canonicalPath()+"/"+Remote_View->currentItem()->text(0);
1045 QFile f(destFile); 1047 QFile f(destFile);
1046 if( f.exists()) 1048 if( f.exists())
1047 f.remove(); 1049 f.remove();
1048 if(!copyFile(destFile, curFile) ) 1050 if(!copyFile(destFile, curFile) )
1049 qWarning("nothin doing"); 1051 qWarning("nothin doing");
1050 populateLocalView(); 1052 populateLocalView();
1051 TabWidget->setCurrentPage(0); 1053 TabWidget->setCurrentPage(0);
1052 } 1054 }
1053} 1055}
1054 1056
1055void AdvancedFm::copyAs() 1057void AdvancedFm::copyAs()
1056{ 1058{
1057 QString curFile = getPath(); 1059 QString curFile = getPath();
1058 if (TabWidget->currentPageIndex() == 0) { 1060 if (TabWidget->currentPageIndex() == 0) {
1059 QString destFile = Local_View->currentItem()->text(0); 1061 QString destFile = Local_View->currentItem()->text(0);
1060 InputDialog *fileDlg; 1062 InputDialog *fileDlg;
1061 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1063 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1062 fileDlg->setInputText((const QString &) destFile ); 1064 fileDlg->setInputText((const QString &) destFile );
1063 fileDlg->exec(); 1065 fileDlg->exec();
1064 if( fileDlg->result() == 1 ) { 1066 if( fileDlg->result() == 1 ) {
1065 QString filename = fileDlg->LineEdit1->text(); 1067 QString filename = fileDlg->LineEdit1->text();
1066 destFile = currentRemoteDir.canonicalPath()+"/"+destFile; 1068 destFile = currentRemoteDir.canonicalPath()+"/"+destFile;
1067 1069
1068 QFile f(destFile); 1070 QFile f(destFile);
1069 if( f.exists()) 1071 if( f.exists())
1070 f.remove(); 1072 f.remove();
1071 if(!copyFile(destFile, curFile) ) 1073 if(!copyFile(destFile, curFile) )
1072 qWarning("nothin doing"); 1074 qWarning("nothin doing");
1073 } 1075 }
1074 populateRemoteView(); 1076 populateRemoteView();
1075 TabWidget->setCurrentPage(1); 1077 TabWidget->setCurrentPage(1);
1076 } else { 1078 } else {
1077 QString destFile = Remote_View->currentItem()->text(0); 1079 QString destFile = Remote_View->currentItem()->text(0);
1078 InputDialog *fileDlg; 1080 InputDialog *fileDlg;
1079 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1081 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1080 fileDlg->setInputText((const QString &) destFile); 1082 fileDlg->setInputText((const QString &) destFile);
1081 fileDlg->exec(); 1083 fileDlg->exec();
1082 if( fileDlg->result() == 1 ) { 1084 if( fileDlg->result() == 1 ) {
1083 QString filename = fileDlg->LineEdit1->text(); 1085 QString filename = fileDlg->LineEdit1->text();
1084 destFile = currentDir.canonicalPath()+"/"+destFile; 1086 destFile = currentDir.canonicalPath()+"/"+destFile;
1085 1087
1086 QFile f(destFile); 1088 QFile f(destFile);
1087 if( f.exists()) 1089 if( f.exists())
1088 f.remove(); 1090 f.remove();
1089 if(!copyFile(destFile, curFile) ) 1091 if(!copyFile(destFile, curFile) )
1090 qWarning("nothin doing"); 1092 qWarning("nothin doing");
1091 } 1093 }
1092 populateLocalView(); 1094 populateLocalView();
1093 TabWidget->setCurrentPage(0); 1095 TabWidget->setCurrentPage(0);
1094 } 1096 }
1095} 1097}
1096 1098
1097void AdvancedFm::move() { 1099void AdvancedFm::move() {
1098 QString curFile = getPath(); 1100 QString curFile = getPath();
1099// qDebug(curFile); 1101// qDebug(curFile);
1100 QString destFile; 1102 QString destFile;
1101 if (TabWidget->currentPageIndex() == 0) { 1103 if (TabWidget->currentPageIndex() == 0) {
1102 QString destFile = currentRemoteDir.canonicalPath() + "/" + Local_View->currentItem()->text(0); 1104 QString destFile = currentRemoteDir.canonicalPath() + "/" + Local_View->currentItem()->text(0);
1103 qDebug("Destination file is "+destFile); 1105 qDebug("Destination file is "+destFile);
1104 1106
1105 QFile f(destFile); 1107 QFile f(destFile);
1106 if( f.exists()) 1108 if( f.exists())
1107 f.remove(); 1109 f.remove();
1108 if(!copyFile( destFile, curFile) ) { 1110 if(!copyFile( destFile, curFile) ) {
1109 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); 1111 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
1110 return; 1112 return;
1111 } 1113 }
1112 QFile::remove(curFile); 1114 QFile::remove(curFile);
1113 TabWidget->setCurrentPage(1); 1115 TabWidget->setCurrentPage(1);
1114 } else { 1116 } else {
1115 QString destFile = currentDir.canonicalPath() + "/" + Remote_View->currentItem()->text(0); 1117 QString destFile = currentDir.canonicalPath() + "/" + Remote_View->currentItem()->text(0);
1116 qDebug("Destination file is "+destFile); 1118 qDebug("Destination file is "+destFile);
1117 1119
1118 QFile f(destFile); 1120 QFile f(destFile);
1119 if( f.exists()) 1121 if( f.exists())
1120 f.remove(); 1122 f.remove();
1121 if(!copyFile(destFile, curFile) ) { 1123 if(!copyFile(destFile, curFile) ) {
1122 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); 1124 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
1123 return; 1125 return;
1124 } 1126 }
1125 QFile::remove(curFile); 1127 QFile::remove(curFile);
1126 TabWidget->setCurrentPage(0); 1128 TabWidget->setCurrentPage(0);
1127 } 1129 }
1128 populateRemoteView(); 1130 populateRemoteView();
1129 populateLocalView(); 1131 populateLocalView();
1130} 1132}
1131 1133
1132bool AdvancedFm::copyFile( const QString & dest, const QString & src ) 1134bool AdvancedFm::copyFile( const QString & dest, const QString & src )
1133{ 1135{
1134 char bf[ 50000 ]; 1136 char bf[ 50000 ];
1135 int bytesRead; 1137 int bytesRead;
1136 bool success = TRUE; 1138 bool success = TRUE;
1137 struct stat status; 1139 struct stat status;
1138 1140
1139 QFile s( src ); 1141 QFile s( src );
1140 QFile d( dest ); 1142 QFile d( dest );
1141 1143
1142 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { 1144 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) {
1143 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { 1145 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) {
1144 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ 1146 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){
1145 success = FALSE; 1147 success = FALSE;
1146 break; 1148 break;
1147 } 1149 }
1148 } 1150 }
1149 if( success && (bytesRead > 0) ){ 1151 if( success && (bytesRead > 0) ){
1150 d.writeBlock( bf, bytesRead ); 1152 d.writeBlock( bf, bytesRead );
1151 } 1153 }
1152 } else { 1154 } else {
1153 success = FALSE; 1155 success = FALSE;
1154 } 1156 }
1155 1157
1156 // Set file permissions 1158 // Set file permissions
1157 if( stat( (const char *) src, &status ) == 0 ){ 1159 if( stat( (const char *) src, &status ) == 0 ){
1158 chmod( (const char *) dest, status.st_mode ); 1160 chmod( (const char *) dest, status.st_mode );
1159 } 1161 }
1160 1162
1161 return success; 1163 return success;
1162} 1164}
1163 1165
1164void AdvancedFm::runCommand() { 1166void AdvancedFm::runCommand() {
1165 QString curFile; 1167 QString curFile;
1166 if (TabWidget->currentPageIndex() == 0) { 1168 if (TabWidget->currentPageIndex() == 0) {
1167 if( Local_View->currentItem()) 1169 if( Local_View->currentItem())
1168 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); 1170 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0);
1169 } else { 1171 } else {
1170 if(Remote_View->currentItem()) 1172 if(Remote_View->currentItem())
1171 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); 1173 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0);
1172 } 1174 }
1173 1175
1174 InputDialog *fileDlg; 1176 InputDialog *fileDlg;
1175 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1177 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1176 fileDlg->setInputText(curFile); 1178 fileDlg->setInputText(curFile);
1177 fileDlg->exec(); 1179 fileDlg->exec();
1178 QString command; 1180 QString command;
1179 if( fileDlg->result() == 1 ) { 1181 if( fileDlg->result() == 1 ) {
1180 command = fileDlg->LineEdit1->text(); 1182 command = fileDlg->LineEdit1->text();
1181 1183
1182 int err=0; 1184 int err=0;
1183 Output *outDlg; 1185 Output *outDlg;
1184 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1186 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1185 outDlg->showMaximized(); 1187 outDlg->showMaximized();
1186 outDlg->show(); 1188 outDlg->show();
1187 qApp->processEvents(); 1189 qApp->processEvents();
1188 FILE *fp; 1190 FILE *fp;
1189 char line[130]; 1191 char line[130];
1190 sleep(1); 1192 sleep(1);
1191// if(command.find("2>",0,TRUE) != -1) 1193// if(command.find("2>",0,TRUE) != -1)
1192 command +=" 2>&1"; 1194 command +=" 2>&1";
1193 fp = popen( (const char *) command, "r"); 1195 fp = popen( (const char *) command, "r");
1194 if ( !fp ) { 1196 if ( !fp ) {
1195 qDebug("Could not execute '" + command + "'! err=%d", fp); 1197 qDebug("Could not execute '" + command + "'! err=%d", fp);
1196 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1198 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1197 pclose(fp); 1199 pclose(fp);
1198 return; 1200 return;
1199 } else { 1201 } else {
1200 while ( fgets( line, sizeof line, fp)) { 1202 while ( fgets( line, sizeof line, fp)) {
1201 QString lineStr = line; 1203 QString lineStr = line;
1202 lineStr=lineStr.left(lineStr.length()-1); 1204 lineStr=lineStr.left(lineStr.length()-1);
1203 outDlg->OutputEdit->append(lineStr); 1205 outDlg->OutputEdit->append(lineStr);
1204 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1206 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1205 } 1207 }
1206 } 1208 }
1207 } 1209 }
1208} 1210}
1209 1211
1210void AdvancedFm::runCommandStd() { 1212void AdvancedFm::runCommandStd() {
1211 QString curFile; 1213 QString curFile;
1212 if (TabWidget->currentPageIndex() == 0) { 1214 if (TabWidget->currentPageIndex() == 0) {
1213 if( Local_View->currentItem()) 1215 if( Local_View->currentItem())
1214 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); 1216 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0);
1215 } else { 1217 } else {
1216 if(Remote_View->currentItem()) 1218 if(Remote_View->currentItem())
1217 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); 1219 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0);
1218 } 1220 }
1219 1221
1220 InputDialog *fileDlg; 1222 InputDialog *fileDlg;
1221 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1223 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1222 fileDlg->setInputText(curFile); 1224 fileDlg->setInputText(curFile);
1223 fileDlg->exec(); 1225 fileDlg->exec();
1224 QString command; 1226 QString command;
1225 if( fileDlg->result() == 1 ) { 1227 if( fileDlg->result() == 1 ) {
1226 qApp->processEvents(); 1228 qApp->processEvents();
1227 command = fileDlg->LineEdit1->text() + " &"; 1229 command = fileDlg->LineEdit1->text() + " &";
1228 system(command.latin1()); 1230 system(command.latin1());
1229 } 1231 }
1230} 1232}
1231 1233
1232void AdvancedFm::fileStatus() { 1234void AdvancedFm::fileStatus() {
1233 QString curFile; 1235 QString curFile;
1234 if (TabWidget->currentPageIndex() == 0) { 1236 if (TabWidget->currentPageIndex() == 0) {
1235 curFile = Local_View->currentItem()->text(0); 1237 curFile = Local_View->currentItem()->text(0);
1236 } else { 1238 } else {
1237 curFile = Remote_View->currentItem()->text(0); 1239 curFile = Remote_View->currentItem()->text(0);
1238 } 1240 }
1239 QString command = " stat -l "+ curFile +" 2>&1"; 1241 QString command = " stat -l "+ curFile +" 2>&1";
1240 int err=0; 1242 int err=0;
1241 Output *outDlg; 1243 Output *outDlg;
1242 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1244 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1243 outDlg->showMaximized(); 1245 outDlg->showMaximized();
1244 outDlg->show(); 1246 outDlg->show();
1245 qApp->processEvents(); 1247 qApp->processEvents();
1246 FILE *fp; 1248 FILE *fp;
1247 char line[130]; 1249 char line[130];
1248 sleep(1); 1250 sleep(1);
1249 fp = popen( (const char *) command, "r"); 1251 fp = popen( (const char *) command, "r");
1250 if ( !fp ) { 1252 if ( !fp ) {
1251 qDebug("Could not execute '" + command + "'! err=%d", fp); 1253 qDebug("Could not execute '" + command + "'! err=%d", fp);
1252 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1254 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1253 pclose(fp); 1255 pclose(fp);
1254 return; 1256 return;
1255 } else { 1257 } else {
1256 while ( fgets( line, sizeof line, fp)) { 1258 while ( fgets( line, sizeof line, fp)) {
1257 outDlg->OutputEdit->append(line); 1259 outDlg->OutputEdit->append(line);
1258 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1260 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1259 1261
1260 } 1262 }
1261 1263
1262 } 1264 }
1263} 1265}
1264 1266
1267void AdvancedFm::mkDir() {
1268 if (TabWidget->currentPageIndex() == 0)
1269 localMakDir();
1270 else
1271 remoteMakDir();
1272
1273}
1274
1275void AdvancedFm::rn() {
1276 if (TabWidget->currentPageIndex() == 0)
1277 localRename();
1278 else
1279 remoteRename();
1280
1281}
1282
1283void AdvancedFm::del() {
1284 if (TabWidget->currentPageIndex() == 0)
1285 localDelete();
1286 else
1287 remoteDelete();
1288}
1289
1265void AdvancedFm::doAbout() { 1290void AdvancedFm::doAbout() {
1266 QMessageBox::message("AdvancedFm","Advanced FileManager\n" 1291 QMessageBox::message("AdvancedFm","Advanced FileManager\n"
1267 "is copyright 2002 by\n" 1292 "is copyright 2002 by\n"
1268 "L.J.Potter<llornkcor@handhelds.org>\n" 1293 "L.J.Potter<llornkcor@handhelds.org>\n"
1269 "and is licensed by the GPL"); 1294 "and is licensed by the GPL");
1270} 1295}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 30ff28c..a5f26a7 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -1,119 +1,121 @@
1/*************************************************************************** 1/***************************************************************************
2 opieftp.h 2 opieftp.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 14
15#include <qvariant.h> 15#include <qvariant.h>
16#include <qdialog.h> 16#include <qdialog.h>
17#include <qmainwindow.h> 17#include <qmainwindow.h>
18#include <qdir.h> 18#include <qdir.h>
19#include <qstring.h> 19#include <qstring.h>
20#include <qpoint.h> 20#include <qpoint.h>
21 21
22class QVBoxLayout; 22class QVBoxLayout;
23class QHBoxLayout; 23class QHBoxLayout;
24class QGridLayout; 24class QGridLayout;
25class QComboBox; 25class QComboBox;
26class QListView; 26class QListView;
27class QListviewItem; 27class QListviewItem;
28class QLabel; 28class QLabel;
29class QProgressBar; 29class QProgressBar;
30class QSpinBox; 30class QSpinBox;
31class QTabWidget; 31class QTabWidget;
32class QWidget; 32class QWidget;
33class QPEToolBar; 33class QPEToolBar;
34class QPEMenuBar; 34class QPEMenuBar;
35class QPopupMenu; 35class QPopupMenu;
36class QFile; 36class QFile;
37class QListViewItem; 37class QListViewItem;
38class QLineEdit; 38class QLineEdit;
39class QPushButton; 39class QPushButton;
40 40
41class AdvancedFm : public QMainWindow 41class AdvancedFm : public QMainWindow
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44public: 44public:
45 AdvancedFm(); 45 AdvancedFm();
46 ~AdvancedFm(); 46 ~AdvancedFm();
47 47
48 QTabWidget *TabWidget; 48 QTabWidget *TabWidget;
49 QWidget *tab, *tab_2, *tab_3; 49 QWidget *tab, *tab_2, *tab_3;
50 QListView *Local_View, *Remote_View; 50 QListView *Local_View, *Remote_View;
51 51
52 QLineEdit *currentPathEdit; 52 QLineEdit *currentPathEdit;
53 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; 53 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu;
54 QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton; 54 QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton;
55 QDir currentDir, currentRemoteDir; 55 QDir currentDir, currentRemoteDir;
56 QComboBox *currentPathCombo; 56 QComboBox *currentPathCombo;
57 QString filterStr; 57 QString filterStr;
58 QListViewItem * item; 58 QListViewItem * item;
59 bool b; 59 bool b;
60 int currentServerConfig; 60 int currentServerConfig;
61protected slots: 61protected slots:
62 void showLocalMenu( QListViewItem *); 62 void showLocalMenu( QListViewItem *);
63 void showRemoteMenu( QListViewItem *); 63 void showRemoteMenu( QListViewItem *);
64 void doLocalCd(); 64 void doLocalCd();
65 void doRemoteCd(); 65 void doRemoteCd();
66// void copy(); 66// void copy();
67 67 void mkDir();
68 void del();
69 void rn();
68 void populateLocalView(); 70 void populateLocalView();
69 void populateRemoteView(); 71 void populateRemoteView();
70 void showHidden(); 72 void showHidden();
71 void showRemoteHidden(); 73 void showRemoteHidden();
72 void writeConfig(); 74 void writeConfig();
73 void readConfig(); 75 void readConfig();
74 void localListClicked(QListViewItem *); 76 void localListClicked(QListViewItem *);
75 void remoteListClicked(QListViewItem *); 77 void remoteListClicked(QListViewItem *);
76 void localListPressed( int, QListViewItem *, const QPoint&, int); 78 void localListPressed( int, QListViewItem *, const QPoint&, int);
77 void remoteListPressed( int, QListViewItem *, const QPoint&, int); 79 void remoteListPressed( int, QListViewItem *, const QPoint&, int);
78 void localMakDir(); 80 void localMakDir();
79 void localDelete(); 81 void localDelete();
80 void remoteMakDir(); 82 void remoteMakDir();
81 void remoteDelete(); 83 void remoteDelete();
82/* bool remoteDirList(const QString &); */ 84/* bool remoteDirList(const QString &); */
83/* bool remoteChDir(const QString &); */ 85/* bool remoteChDir(const QString &); */
84 void tabChanged(QWidget*); 86 void tabChanged(QWidget*);
85 void cleanUp(); 87 void cleanUp();
86 void remoteRename(); 88 void remoteRename();
87 void localRename(); 89 void localRename();
88 void runThis(); 90 void runThis();
89 void runText(); 91 void runText();
90 void filePerms(); 92 void filePerms();
91 void doProperties(); 93 void doProperties();
92 void runCommand(); 94 void runCommand();
93 void runCommandStd(); 95 void runCommandStd();
94 QString getPath(); 96 QString getPath();
95 void switchToLocalTab(); 97 void switchToLocalTab();
96 void switchToRemoteTab(); 98 void switchToRemoteTab();
97 99
98protected: 100protected:
99 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 101 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
100 QStringList remoteDirPathStringList, localDirPathStringList; 102 QStringList remoteDirPathStringList, localDirPathStringList;
101 103
102protected slots: 104protected slots:
103 void homeButtonPushed(); 105 void homeButtonPushed();
104 void docButtonPushed(); 106 void docButtonPushed();
105 void SDButtonPushed(); 107 void SDButtonPushed();
106 void CFButtonPushed(); 108 void CFButtonPushed();
107 void upDir(); 109 void upDir();
108 void currentPathComboChanged(); 110 void currentPathComboChanged();
109 void copy(); 111 void copy();
110 void copyAs(); 112 void copyAs();
111 void currentPathComboActivated(const QString &); 113 void currentPathComboActivated(const QString &);
112 void fillCombo(const QString &); 114 void fillCombo(const QString &);
113 bool copyFile( const QString & , const QString & ); 115 bool copyFile( const QString & , const QString & );
114 void move(); 116 void move();
115 void fileStatus(); 117 void fileStatus();
116 void doAbout(); 118 void doAbout();
117}; 119};
118 120
119#endif // ADVANCEDFM_H 121#endif // ADVANCEDFM_H