summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-07-08 01:46:00 (UTC)
committer llornkcor <llornkcor>2002-07-08 01:46:00 (UTC)
commit6162155d2b146c7b2e713f56e215618d116cef3b (patch) (unidiff)
tree65dd173dc3035f7198a99c3065203fabc08dde1b
parent923a6290c8cc93914d54e583f1d79a6bae638fab (diff)
downloadopie-6162155d2b146c7b2e713f56e215618d116cef3b.zip
opie-6162155d2b146c7b2e713f56e215618d116cef3b.tar.gz
opie-6162155d2b146c7b2e713f56e215618d116cef3b.tar.bz2
changed qpushbutton to qtoolbutton because icons aren't centered on qushbutton
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp36
-rw-r--r--noncore/apps/advancedfm/advancedfm.h6
2 files changed, 28 insertions, 14 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 1287c57..9e38d14 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,641 +1,653 @@
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 QToolButton(this,"QPEButton");
97 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
98// qpeDirButton= new QPushButton(Resource::loadIconSet("launcher/opielogo16x16"),"",this,"QPEButton");
97 qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); 99 qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
98 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); 100 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) );
99 qpeDirButton->setFlat(TRUE); 101 //qpeDirButton->setFlat(TRUE);
100 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); 102 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2);
101 103
102 cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); 104 cfButton = new QToolButton( this,"CFButton");
105 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
106// cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton");
103 cfButton ->setFixedSize( QSize( 20, 20 ) ); 107 cfButton ->setFixedSize( QSize( 20, 20 ) );
104 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); 108 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
105 cfButton->setFlat(TRUE); 109 //cfButton->setFlat(TRUE);
106 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); 110 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3);
107 111
108 sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); 112 sdButton = new QToolButton( this,"SDButton");
113 sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard"));
114// sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton");
109 sdButton->setFixedSize( QSize( 20, 20 ) ); 115 sdButton->setFixedSize( QSize( 20, 20 ) );
110 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); 116 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
111 sdButton->setFlat(TRUE); 117// sdButton->setFlat(TRUE);
112 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); 118 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4);
113 119
114 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); 120 cdUpButton = new QToolButton( this,"cdUpButton");
121 cdUpButton->setPixmap(Resource::loadPixmap("up"));
122// cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
115 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 123 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
116 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 124 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
117 cdUpButton ->setFlat(TRUE); 125 //cdUpButton ->setFlat(TRUE);
118 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); 126 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5);
119 127
120 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 128 docButton = new QToolButton( this,"docsButton");
129 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
130// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
121 docButton->setFixedSize( QSize( 20, 20 ) ); 131 docButton->setFixedSize( QSize( 20, 20 ) );
122 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 132 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
123 docButton->setFlat(TRUE); 133// docButton->setFlat(TRUE);
124 layout->addMultiCellWidget( docButton, 0, 0, 6, 6); 134 layout->addMultiCellWidget( docButton, 0, 0, 6, 6);
125 135
126 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); 136 homeButton = new QToolButton( this,"homeButton");
137 homeButton->setPixmap(Resource::loadPixmap("home"));
138// homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
127 homeButton->setFixedSize( QSize( 20, 20 ) ); 139 homeButton->setFixedSize( QSize( 20, 20 ) );
128 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 140 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
129 homeButton->setFlat(TRUE); 141// homeButton->setFlat(TRUE);
130 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); 142 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7);
131// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 143// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
132// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 144// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
133// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 145// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
134 146
135 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 147 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
136 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 148 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
137 fileMenu->insertSeparator(); 149 fileMenu->insertSeparator();
138 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 150 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
139 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 151 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
140 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 152 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
141 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 153 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
142 fileMenu->insertSeparator(); 154 fileMenu->insertSeparator();
143 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 155 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
144 fileMenu->setCheckable(TRUE); 156 fileMenu->setCheckable(TRUE);
145 157
146 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 158 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
147 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 159 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
148 viewMenu->insertSeparator(); 160 viewMenu->insertSeparator();
149 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 161 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
150 viewMenu->setCheckable(TRUE); 162 viewMenu->setCheckable(TRUE);
151 163
152 164
153 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 165 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
154 currentPathCombo->setEditable(TRUE); 166 currentPathCombo->setEditable(TRUE);
155 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); 167 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
156 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 168 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
157 169
158 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 170 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
159 this, SLOT( currentPathComboActivated( const QString & ) ) ); 171 this, SLOT( currentPathComboActivated( const QString & ) ) );
160 172
161 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 173 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
162 this,SLOT(currentPathComboChanged())); 174 this,SLOT(currentPathComboChanged()));
163 175
164 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 176 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
165 177
166 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); 178 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
167 179
168 180
169 TabWidget = new QTabWidget( this, "TabWidget" ); 181 TabWidget = new QTabWidget( this, "TabWidget" );
170 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); 182 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7);
171 183
172 tab = new QWidget( TabWidget, "tab" ); 184 tab = new QWidget( TabWidget, "tab" );
173 tabLayout = new QGridLayout( tab ); 185 tabLayout = new QGridLayout( tab );
174 tabLayout->setSpacing( 2); 186 tabLayout->setSpacing( 2);
175 tabLayout->setMargin( 2); 187 tabLayout->setMargin( 2);
176 188
177 Local_View = new QListView( tab, "Local_View" ); 189 Local_View = new QListView( tab, "Local_View" );
178// Local_View->setResizePolicy( QListView::AutoOneFit ); 190// Local_View->setResizePolicy( QListView::AutoOneFit );
179 Local_View->addColumn( tr("File"),130); 191 Local_View->addColumn( tr("File"),130);
180 Local_View->addColumn( tr("Size"),-1); 192 Local_View->addColumn( tr("Size"),-1);
181 Local_View->setColumnAlignment(1,QListView::AlignRight); 193 Local_View->setColumnAlignment(1,QListView::AlignRight);
182 Local_View->addColumn( tr("Date"),-1); 194 Local_View->addColumn( tr("Date"),-1);
183 Local_View->setColumnAlignment(2,QListView::AlignRight); 195 Local_View->setColumnAlignment(2,QListView::AlignRight);
184 Local_View->setAllColumnsShowFocus(TRUE); 196 Local_View->setAllColumnsShowFocus(TRUE);
185 Local_View->setMultiSelection( TRUE ); 197 Local_View->setMultiSelection( TRUE );
186 Local_View->setSelectionMode(QListView::Extended); 198 Local_View->setSelectionMode(QListView::Extended);
187 199
188 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 200 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
189 201
190 202
191 203
192 tabLayout->addWidget( Local_View, 0, 0 ); 204 tabLayout->addWidget( Local_View, 0, 0 );
193 205
194 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 206 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
195 this,SLOT( localListClicked(QListViewItem *)) ); 207 this,SLOT( localListClicked(QListViewItem *)) );
196 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 208 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
197 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); 209 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) );
198 210
199 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); 211 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
200 212
201 TabWidget->insertTab( tab, tr("1")); 213 TabWidget->insertTab( tab, tr("1"));
202 214
203 tab_2 = new QWidget( TabWidget, "tab_2" ); 215 tab_2 = new QWidget( TabWidget, "tab_2" );
204 tabLayout_2 = new QGridLayout( tab_2 ); 216 tabLayout_2 = new QGridLayout( tab_2 );
205 tabLayout_2->setSpacing( 2); 217 tabLayout_2->setSpacing( 2);
206 tabLayout_2->setMargin( 2); 218 tabLayout_2->setMargin( 2);
207 219
208 Remote_View = new QListView( tab_2, "Remote_View" ); 220 Remote_View = new QListView( tab_2, "Remote_View" );
209 Remote_View->addColumn( tr("File"),130); 221 Remote_View->addColumn( tr("File"),130);
210 Remote_View->addColumn( tr("Size"),-1); 222 Remote_View->addColumn( tr("Size"),-1);
211 Remote_View->setColumnAlignment(1,QListView::AlignRight); 223 Remote_View->setColumnAlignment(1,QListView::AlignRight);
212 Remote_View->addColumn( tr("Date"),-1); 224 Remote_View->addColumn( tr("Date"),-1);
213 Remote_View->setColumnAlignment(2,QListView::AlignRight); 225 Remote_View->setColumnAlignment(2,QListView::AlignRight);
214 Remote_View->setAllColumnsShowFocus(TRUE); 226 Remote_View->setAllColumnsShowFocus(TRUE);
215 Remote_View->setMultiSelection( TRUE ); 227 Remote_View->setMultiSelection( TRUE );
216 Remote_View->setSelectionMode(QListView::Extended); 228 Remote_View->setSelectionMode(QListView::Extended);
217 229
218 230
219 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 231 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
220 232
221 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 233 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
222 this,SLOT( remoteListClicked(QListViewItem *)) ); 234 this,SLOT( remoteListClicked(QListViewItem *)) );
223 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 235 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
224 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 236 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) );
225// connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); 237// connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
226 238
227 tabLayout_2->addWidget( Remote_View, 0, 0 ); 239 tabLayout_2->addWidget( Remote_View, 0, 0 );
228 240
229 241
230 TabWidget->insertTab( tab_2, tr( "2")); 242 TabWidget->insertTab( tab_2, tr( "2"));
231 243
232 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 244 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
233 this,SLOT(tabChanged(QWidget*))); 245 this,SLOT(tabChanged(QWidget*)));
234 246
235 /* tab_3 = new QWidget( TabWidget, "tab_3" ); 247 /* tab_3 = new QWidget( TabWidget, "tab_3" );
236 tabLayout_3 = new QGridLayout( tab_3 ); 248 tabLayout_3 = new QGridLayout( tab_3 );
237 tabLayout_3->setSpacing( 2); 249 tabLayout_3->setSpacing( 2);
238 tabLayout_3->setMargin( 2); 250 tabLayout_3->setMargin( 2);
239 251
240 252
241// OFileDialog fileDialog; 253// OFileDialog fileDialog;
242// fileDialog; 254// fileDialog;
243// fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 255// fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
244// fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 256// fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
245// OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 257// OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
246 258
247QListView *fileTree; 259QListView *fileTree;
248 fileTree = new QListView( tab_3, "tree" ); 260 fileTree = new QListView( tab_3, "tree" );
249 261
250 262
251 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 263 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
252 264
253 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 265 TabWidget->insertTab( tab_3, tr( "Remote" ) );
254 */ 266 */
255 267
256/////////////// 268///////////////
257 269
258//////////////////// 270////////////////////
259 271
260 272
261 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 273 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
262 currentDir.setPath( QDir::currentDirPath()); 274 currentDir.setPath( QDir::currentDirPath());
263 275
264 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 276 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
265 currentRemoteDir.setPath( QDir::currentDirPath()); 277 currentRemoteDir.setPath( QDir::currentDirPath());
266 278
267 b = TRUE; 279 b = TRUE;
268 280
269 filterStr="*"; 281 filterStr="*";
270 b=FALSE; 282 b=FALSE;
271 283
272 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); 284 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
273 285
274 populateLocalView(); 286 populateLocalView();
275 populateRemoteView(); 287 populateRemoteView();
276 currentPathCombo->setFocus(); 288 currentPathCombo->setFocus();
277} 289}
278 290
279AdvancedFm::~AdvancedFm() 291AdvancedFm::~AdvancedFm()
280{ 292{
281} 293}
282 294
283void AdvancedFm::cleanUp() 295void AdvancedFm::cleanUp()
284{ 296{
285 QString sfile=QDir::homeDirPath(); 297 QString sfile=QDir::homeDirPath();
286 if(sfile.right(1) != "/") 298 if(sfile.right(1) != "/")
287 sfile+="/._temp"; 299 sfile+="/._temp";
288 else 300 else
289 sfile+="._temp"; 301 sfile+="._temp";
290 QFile file( sfile); 302 QFile file( sfile);
291 if(file.exists()) 303 if(file.exists())
292 file.remove(); 304 file.remove();
293} 305}
294 306
295void AdvancedFm::tabChanged(QWidget *w) 307void AdvancedFm::tabChanged(QWidget *w)
296{ 308{
297 if (TabWidget->currentPageIndex() == 0) { 309 if (TabWidget->currentPageIndex() == 0) {
298 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 310 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
299 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); 311 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
300 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); 312 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
301 } 313 }
302 if (TabWidget->currentPageIndex() == 1) { 314 if (TabWidget->currentPageIndex() == 1) {
303 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); 315 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath());
304 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); 316 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE);
305 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); 317 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE);
306 } 318 }
307} 319}
308 320
309 321
310void AdvancedFm::populateLocalView() 322void AdvancedFm::populateLocalView()
311{ 323{
312 QPixmap pm; 324 QPixmap pm;
313 Local_View->clear(); 325 Local_View->clear();
314 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 326 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
315 currentDir.setMatchAllDirs(TRUE); 327 currentDir.setMatchAllDirs(TRUE);
316 currentDir.setNameFilter(filterStr); 328 currentDir.setNameFilter(filterStr);
317 QString fileL, fileS, fileDate; 329 QString fileL, fileS, fileDate;
318// qDebug(currentDir.canonicalPath()); 330// qDebug(currentDir.canonicalPath());
319// struct stat buf; 331// struct stat buf;
320// mode_t mode; 332// mode_t mode;
321 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 333 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
322 setCaption("AdvancedFm :: "+fs); 334 setCaption("AdvancedFm :: "+fs);
323 bool isDir=FALSE; 335 bool isDir=FALSE;
324 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 336 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
325 QFileInfoListIterator it(*list); 337 QFileInfoListIterator it(*list);
326 QFileInfo *fi; 338 QFileInfo *fi;
327 while ( (fi=it.current()) ) { 339 while ( (fi=it.current()) ) {
328 if (fi->isSymLink() ) { 340 if (fi->isSymLink() ) {
329 QString symLink=fi->readLink(); 341 QString symLink=fi->readLink();
330// qDebug("Symlink detected "+symLink); 342// qDebug("Symlink detected "+symLink);
331 QFileInfo sym( symLink); 343 QFileInfo sym( symLink);
332 fileS.sprintf( "%10li", sym.size() ); 344 fileS.sprintf( "%10li", sym.size() );
333 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 345 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
334 fileDate = sym.lastModified().toString(); 346 fileDate = sym.lastModified().toString();
335 } else { 347 } else {
336 fileS.sprintf( "%10li", fi->size() ); 348 fileS.sprintf( "%10li", fi->size() );
337 fileL.sprintf( "%s",fi->fileName().data() ); 349 fileL.sprintf( "%s",fi->fileName().data() );
338 fileDate= fi->lastModified().toString(); 350 fileDate= fi->lastModified().toString();
339 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { 351 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) {
340 fileL+="/"; 352 fileL+="/";
341 isDir=TRUE; 353 isDir=TRUE;
342// qDebug( fileL); 354// qDebug( fileL);
343 } 355 }
344 } 356 }
345 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); 357 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL);
346 if(fileL !="./" && fi->exists()) { 358 if(fileL !="./" && fi->exists()) {
347 item= new QListViewItem( Local_View, fileL, fileS , fileDate); 359 item= new QListViewItem( Local_View, fileL, fileS , fileDate);
348 360
349 if(isDir || fileL.find("/",0,TRUE) != -1) { 361 if(isDir || fileL.find("/",0,TRUE) != -1) {
350 362
351 if( !QDir( fi->filePath() ).isReadable()) //is directory 363 if( !QDir( fi->filePath() ).isReadable()) //is directory
352 pm = Resource::loadPixmap( "lockedfolder" ); 364 pm = Resource::loadPixmap( "lockedfolder" );
353 else 365 else
354 pm= Resource::loadPixmap( "folder" ); 366 pm= Resource::loadPixmap( "folder" );
355// item->setPixmap( 0,pm ); 367// item->setPixmap( 0,pm );
356 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 368 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
357 pm = Resource::loadPixmap( "exec"); 369 pm = Resource::loadPixmap( "exec");
358 } else if( (fileInfo.permission( QFileInfo::ExeUser) 370 } else if( (fileInfo.permission( QFileInfo::ExeUser)
359 | fileInfo.permission( QFileInfo::ExeGroup) 371 | fileInfo.permission( QFileInfo::ExeGroup)
360 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 372 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
361 pm = Resource::loadPixmap( "exec"); 373 pm = Resource::loadPixmap( "exec");
362// else { //is exec 374// else { //is exec
363// pm = Resource::loadPixmap( "exec"); 375// pm = Resource::loadPixmap( "exec");
364// } 376// }
365// // item->setPixmap( 0,pm); 377// // item->setPixmap( 0,pm);
366 } else if( !fi->isReadable() ) { 378 } else if( !fi->isReadable() ) {
367 pm = Resource::loadPixmap( "locked" ); 379 pm = Resource::loadPixmap( "locked" );
368// item->setPixmap( 0,pm); 380// item->setPixmap( 0,pm);
369 } else { //everything else goes by mimetype 381 } else { //everything else goes by mimetype
370 MimeType mt(fi->filePath()); 382 MimeType mt(fi->filePath());
371 pm=mt.pixmap(); //sets the correct pixmap for mimetype 383 pm=mt.pixmap(); //sets the correct pixmap for mimetype
372 if(pm.isNull()) 384 if(pm.isNull())
373 pm = Resource::loadPixmap( "UnknownDocument-14" ); 385 pm = Resource::loadPixmap( "UnknownDocument-14" );
374// item->setPixmap( 0,pm); 386// item->setPixmap( 0,pm);
375 } 387 }
376 item->setPixmap( 0,pm); 388 item->setPixmap( 0,pm);
377 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 389 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
378 // overlay link image 390 // overlay link image
379 pm= Resource::loadPixmap( "folder" ); 391 pm= Resource::loadPixmap( "folder" );
380 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 392 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
381 QPainter painter( &pm ); 393 QPainter painter( &pm );
382 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 394 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
383 pm.setMask( pm.createHeuristicMask( FALSE ) ); 395 pm.setMask( pm.createHeuristicMask( FALSE ) );
384 item->setPixmap( 0, pm); 396 item->setPixmap( 0, pm);
385 } 397 }
386 } 398 }
387 isDir=FALSE; 399 isDir=FALSE;
388 ++it; 400 ++it;
389 } 401 }
390 402
391 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { 403 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) {
392 struct stat buf; 404 struct stat buf;
393// struct stat st; 405// struct stat st;
394 dev_t devT; 406 dev_t devT;
395// mode_t mode; 407// mode_t mode;
396 DIR *dir; 408 DIR *dir;
397// int fd = 0; 409// int fd = 0;
398 struct dirent *mydirent; 410 struct dirent *mydirent;
399// int i = 1; 411// int i = 1;
400 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) 412 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
401 while ((mydirent = readdir(dir)) != NULL) { 413 while ((mydirent = readdir(dir)) != NULL) {
402 lstat( mydirent->d_name, &buf); 414 lstat( mydirent->d_name, &buf);
403 qDebug(mydirent->d_name); 415 qDebug(mydirent->d_name);
404// mode = buf.st_mode; 416// mode = buf.st_mode;
405 fileL.sprintf("%s", mydirent->d_name); 417 fileL.sprintf("%s", mydirent->d_name);
406// fileS.sprintf("%d, %d", ); //this isn't correct 418// fileS.sprintf("%d, %d", ); //this isn't correct
407 devT = buf.st_dev; 419 devT = buf.st_dev;
408 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 420 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
409// fileS.sprintf("%d,%d", devT, devT); 421// fileS.sprintf("%d,%d", devT, devT);
410 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 422 fileDate.sprintf("%s", ctime( &buf.st_mtime));
411 if( fileL.find(".") == -1 ){ 423 if( fileL.find(".") == -1 ){
412 item= new QListViewItem( Local_View, fileL, fileS, fileDate); 424 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
413 pm = Resource::loadPixmap( "UnknownDocument-14" ); 425 pm = Resource::loadPixmap( "UnknownDocument-14" );
414 item->setPixmap( 0,pm); 426 item->setPixmap( 0,pm);
415 } 427 }
416 } 428 }
417 429
418 closedir(dir); 430 closedir(dir);
419 } 431 }
420 432
421 Local_View->setSorting( 3,FALSE); 433 Local_View->setSorting( 3,FALSE);
422 fillCombo( (const QString &) currentDir.canonicalPath()); 434 fillCombo( (const QString &) currentDir.canonicalPath());
423} 435}
424 436
425 437
426void AdvancedFm::populateRemoteView() 438void AdvancedFm::populateRemoteView()
427{ 439{
428// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 440// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
429// QListViewItemIterator it( Remote_View ); 441// QListViewItemIterator it( Remote_View );
430// for ( ; it.current(); ++it ) { 442// for ( ; it.current(); ++it ) {
431// if ( it.current()->isSelected() ) { 443// if ( it.current()->isSelected() ) {
432// QString strItem = it.current()->text(0); 444// QString strItem = it.current()->text(0);
433// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; 445// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem;
434// QFileInfo fi(localFile); 446// QFileInfo fi(localFile);
435// } 447// }
436// } 448// }
437 QPixmap pm; 449 QPixmap pm;
438 Remote_View->clear(); 450 Remote_View->clear();
439 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 451 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
440 currentRemoteDir.setMatchAllDirs(TRUE); 452 currentRemoteDir.setMatchAllDirs(TRUE);
441 currentRemoteDir.setNameFilter(filterStr); 453 currentRemoteDir.setNameFilter(filterStr);
442 QString fileL, fileS, fileDate; 454 QString fileL, fileS, fileDate;
443 455
444 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 456 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
445 setCaption("AdvancedFm :: "+fs); 457 setCaption("AdvancedFm :: "+fs);
446 bool isDir=FALSE; 458 bool isDir=FALSE;
447 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 459 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
448 QFileInfoListIterator it(*list); 460 QFileInfoListIterator it(*list);
449 QFileInfo *fi; 461 QFileInfo *fi;
450 while ( (fi=it.current()) ) { 462 while ( (fi=it.current()) ) {
451 if (fi->isSymLink() ){ 463 if (fi->isSymLink() ){
452 QString symLink=fi->readLink(); 464 QString symLink=fi->readLink();
453// qDebug("Symlink detected "+symLink); 465// qDebug("Symlink detected "+symLink);
454 QFileInfo sym( symLink); 466 QFileInfo sym( symLink);
455 fileS.sprintf( "%10li", sym.size() ); 467 fileS.sprintf( "%10li", sym.size() );
456 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 468 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
457 fileDate = sym.lastModified().toString(); 469 fileDate = sym.lastModified().toString();
458 } else { 470 } else {
459// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 471// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
460 fileS.sprintf( "%10li", fi->size() ); 472 fileS.sprintf( "%10li", fi->size() );
461 fileL.sprintf( "%s",fi->fileName().data() ); 473 fileL.sprintf( "%s",fi->fileName().data() );
462 fileDate= fi->lastModified().toString(); 474 fileDate= fi->lastModified().toString();
463 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 475 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
464 fileL+="/"; 476 fileL+="/";
465 isDir=TRUE; 477 isDir=TRUE;
466// qDebug( fileL); 478// qDebug( fileL);
467 } 479 }
468 } 480 }
469 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); 481 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL);
470 if(fileL !="./" && fi->exists()) { 482 if(fileL !="./" && fi->exists()) {
471 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 483 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
472 QPixmap pm; 484 QPixmap pm;
473 485
474 if(isDir || fileL.find("/",0,TRUE) != -1) { 486 if(isDir || fileL.find("/",0,TRUE) != -1) {
475 if( !QDir( fi->filePath() ).isReadable()) 487 if( !QDir( fi->filePath() ).isReadable())
476 pm = Resource::loadPixmap( "lockedfolder" ); 488 pm = Resource::loadPixmap( "lockedfolder" );
477 else 489 else
478 pm= Resource::loadPixmap( "folder" ); 490 pm= Resource::loadPixmap( "folder" );
479// item->setPixmap( 0,pm ); 491// item->setPixmap( 0,pm );
480 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 492 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
481 pm = Resource::loadPixmap( "exec"); 493 pm = Resource::loadPixmap( "exec");
482 } else if( (fileInfo.permission( QFileInfo::ExeUser) 494 } else if( (fileInfo.permission( QFileInfo::ExeUser)
483 | fileInfo.permission( QFileInfo::ExeGroup) 495 | fileInfo.permission( QFileInfo::ExeGroup)
484 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 496 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
485 pm = Resource::loadPixmap( "exec"); 497 pm = Resource::loadPixmap( "exec");
486// item->setPixmap( 0,pm); 498// item->setPixmap( 0,pm);
487 } else if( !fi->isReadable() ) { 499 } else if( !fi->isReadable() ) {
488 pm = Resource::loadPixmap( "locked" ); 500 pm = Resource::loadPixmap( "locked" );
489// item->setPixmap( 0,pm); 501// item->setPixmap( 0,pm);
490 } else { 502 } else {
491 MimeType mt(fi->filePath()); 503 MimeType mt(fi->filePath());
492 pm=mt.pixmap(); //sets the correct pixmap for mimetype 504 pm=mt.pixmap(); //sets the correct pixmap for mimetype
493 if(pm.isNull()) 505 if(pm.isNull())
494 pm = Resource::loadPixmap( "UnknownDocument-14" ); 506 pm = Resource::loadPixmap( "UnknownDocument-14" );
495// item->setPixmap( 0,pm); 507// item->setPixmap( 0,pm);
496 } 508 }
497 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 509 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
498 // overlay link image 510 // overlay link image
499 pm= Resource::loadPixmap( "folder" ); 511 pm= Resource::loadPixmap( "folder" );
500 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 512 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
501 QPainter painter( &pm ); 513 QPainter painter( &pm );
502 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 514 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
503 pm.setMask( pm.createHeuristicMask( FALSE ) ); 515 pm.setMask( pm.createHeuristicMask( FALSE ) );
504// item->setPixmap( 0, pm); 516// item->setPixmap( 0, pm);
505 } 517 }
506 item->setPixmap( 0, pm); 518 item->setPixmap( 0, pm);
507 } 519 }
508 isDir=FALSE; 520 isDir=FALSE;
509 ++it; 521 ++it;
510 } 522 }
511 523
512 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { 524 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) {
513 struct stat buf; 525 struct stat buf;
514// struct stat st; 526// struct stat st;
515// mode_t mode; 527// mode_t mode;
516 DIR *dir; 528 DIR *dir;
517// int fd = 0; 529// int fd = 0;
518 struct dirent *mydirent; 530 struct dirent *mydirent;
519// int i = 1; 531// int i = 1;
520 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 532 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
521 while ((mydirent = readdir(dir)) != NULL) { 533 while ((mydirent = readdir(dir)) != NULL) {
522 lstat( mydirent->d_name, &buf); 534 lstat( mydirent->d_name, &buf);
523 qDebug(mydirent->d_name); 535 qDebug(mydirent->d_name);
524// mode = buf.st_mode; 536// mode = buf.st_mode;
525 fileL.sprintf("%s", mydirent->d_name); 537 fileL.sprintf("%s", mydirent->d_name);
526// fileS.sprintf("%d, %d", ); //this isn't correct 538// fileS.sprintf("%d, %d", ); //this isn't correct
527 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 539 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
528 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 540 fileDate.sprintf("%s", ctime( &buf.st_mtime));
529 if( fileL.find(".") == -1 ){ 541 if( fileL.find(".") == -1 ){
530 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 542 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
531 pm = Resource::loadPixmap( "UnknownDocument-14" ); 543 pm = Resource::loadPixmap( "UnknownDocument-14" );
532 item->setPixmap( 0,pm); 544 item->setPixmap( 0,pm);
533 } 545 }
534 } 546 }
535 547
536 closedir(dir); 548 closedir(dir);
537 } 549 }
538 550
539 Remote_View->setSorting( 3,FALSE); 551 Remote_View->setSorting( 3,FALSE);
540 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 552 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
541} 553}
542 554
543void AdvancedFm::localListClicked(QListViewItem *selectedItem) 555void AdvancedFm::localListClicked(QListViewItem *selectedItem)
544{ 556{
545 if(selectedItem) { 557 if(selectedItem) {
546 QString strItem=selectedItem->text(0); 558 QString strItem=selectedItem->text(0);
547 QString strSize=selectedItem->text(1); 559 QString strSize=selectedItem->text(1);
548 strSize=strSize.stripWhiteSpace(); 560 strSize=strSize.stripWhiteSpace();
549 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 561 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
550 // is symlink 562 // is symlink
551 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 563 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
552 if(QDir(strItem2).exists() ) { 564 if(QDir(strItem2).exists() ) {
553 currentDir.cd(strItem2, TRUE); 565 currentDir.cd(strItem2, TRUE);
554 populateLocalView(); 566 populateLocalView();
555 } 567 }
556 } else { // not a symlink 568 } else { // not a symlink
557 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 569 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
558 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 570 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
559 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 571 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
560 currentDir.cd(strItem,FALSE); 572 currentDir.cd(strItem,FALSE);
561 populateLocalView(); 573 populateLocalView();
562 } else { 574 } else {
563 currentDir.cdUp(); 575 currentDir.cdUp();
564 populateLocalView(); 576 populateLocalView();
565 } 577 }
566 if(QDir(strItem).exists()){ 578 if(QDir(strItem).exists()){
567 currentDir.cd(strItem, TRUE); 579 currentDir.cd(strItem, TRUE);
568 populateLocalView(); 580 populateLocalView();
569 } 581 }
570 } else { 582 } else {
571 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 583 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
572 if( QFile::exists(strItem ) ) { 584 if( QFile::exists(strItem ) ) {
573// qDebug("clicked item "+strItem); 585// qDebug("clicked item "+strItem);
574// DocLnk doc( strItem, FALSE ); 586// DocLnk doc( strItem, FALSE );
575// doc.execute(); 587// doc.execute();
576 // Local_View->clearSelection(); 588 // Local_View->clearSelection();
577 } 589 }
578 } //end not symlink 590 } //end not symlink
579 chdir(strItem.latin1()); 591 chdir(strItem.latin1());
580 } 592 }
581 } 593 }
582} 594}
583 595
584void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) 596void AdvancedFm::remoteListClicked(QListViewItem *selectedItem)
585{ 597{
586 if(selectedItem) { 598 if(selectedItem) {
587 QString strItem=selectedItem->text(0); 599 QString strItem=selectedItem->text(0);
588 QString strSize=selectedItem->text(1); 600 QString strSize=selectedItem->text(1);
589 strSize=strSize.stripWhiteSpace(); 601 strSize=strSize.stripWhiteSpace();
590 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 602 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
591 // is symlink 603 // is symlink
592 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 604 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
593 if(QDir(strItem2).exists() ) { 605 if(QDir(strItem2).exists() ) {
594 currentRemoteDir.cd(strItem2, TRUE); 606 currentRemoteDir.cd(strItem2, TRUE);
595 populateRemoteView(); 607 populateRemoteView();
596 } 608 }
597 } else { // not a symlink 609 } else { // not a symlink
598 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 610 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
599 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { 611 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) {
600 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 612 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
601 currentRemoteDir.cd(strItem,FALSE); 613 currentRemoteDir.cd(strItem,FALSE);
602 populateRemoteView(); 614 populateRemoteView();
603 } else { 615 } else {
604 currentRemoteDir.cdUp(); 616 currentRemoteDir.cdUp();
605 populateRemoteView(); 617 populateRemoteView();
606 } 618 }
607 if(QDir(strItem).exists()){ 619 if(QDir(strItem).exists()){
608 currentRemoteDir.cd(strItem, TRUE); 620 currentRemoteDir.cd(strItem, TRUE);
609 populateRemoteView(); 621 populateRemoteView();
610 } 622 }
611 } else { 623 } else {
612 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 624 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
613 if( QFile::exists(strItem ) ) { 625 if( QFile::exists(strItem ) ) {
614// qDebug("clicked item "+strItem); 626// qDebug("clicked item "+strItem);
615// DocLnk doc( strItem, FALSE ); 627// DocLnk doc( strItem, FALSE );
616// doc.execute(); 628// doc.execute();
617 // Remote_View->clearSelection(); 629 // Remote_View->clearSelection();
618 } 630 }
619 } //end not symlink 631 } //end not symlink
620 chdir(strItem.latin1()); 632 chdir(strItem.latin1());
621 } 633 }
622 } 634 }
623} 635}
624 636
625void AdvancedFm::doLocalCd() 637void AdvancedFm::doLocalCd()
626{ 638{
627 localListClicked( Local_View->currentItem()); 639 localListClicked( Local_View->currentItem());
628} 640}
629 641
630void AdvancedFm::doRemoteCd() 642void AdvancedFm::doRemoteCd()
631{ 643{
632 localListClicked( Remote_View->currentItem()); 644 localListClicked( Remote_View->currentItem());
633} 645}
634 646
635void AdvancedFm::showHidden() 647void AdvancedFm::showHidden()
636{ 648{
637 if (b) { 649 if (b) {
638 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 650 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
639 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 651 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
640// localMenu->setItemChecked(localMenu->idAt(0),TRUE); 652// localMenu->setItemChecked(localMenu->idAt(0),TRUE);
641// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 653// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 0cf94c6..7335773 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -1,137 +1,139 @@
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 <qpe/ir.h> 15#include <qpe/ir.h>
16 16
17#include <qvariant.h> 17#include <qvariant.h>
18#include <qdialog.h> 18#include <qdialog.h>
19#include <qmainwindow.h> 19#include <qmainwindow.h>
20#include <qstringlist.h> 20#include <qstringlist.h>
21#include <qdir.h> 21#include <qdir.h>
22#include <qstring.h> 22#include <qstring.h>
23#include <qpoint.h> 23#include <qpoint.h>
24#include <qtimer.h> 24#include <qtimer.h>
25 25
26class QVBoxLayout; 26class QVBoxLayout;
27class QHBoxLayout; 27class QHBoxLayout;
28class QGridLayout; 28class QGridLayout;
29class QComboBox; 29class QComboBox;
30class QListView; 30class QListView;
31class QListviewItem; 31class QListviewItem;
32class QLabel; 32class QLabel;
33class QProgressBar; 33class QProgressBar;
34class QSpinBox; 34class QSpinBox;
35class QTabWidget; 35class QTabWidget;
36class QWidget; 36class QWidget;
37class QPEToolBar; 37class QPEToolBar;
38class QPEMenuBar; 38class QPEMenuBar;
39class QPopupMenu; 39class QPopupMenu;
40class QFile; 40class QFile;
41class QListViewItem; 41class QListViewItem;
42class QLineEdit; 42class QLineEdit;
43class QPushButton; 43//class QPushButton;
44class QToolButton;
44class Ir; 45class Ir;
45 46
46class AdvancedFm : public QMainWindow 47class AdvancedFm : public QMainWindow
47{ 48{
48 Q_OBJECT 49 Q_OBJECT
49public: 50public:
50 AdvancedFm(); 51 AdvancedFm();
51 ~AdvancedFm(); 52 ~AdvancedFm();
52 53
53 QTabWidget *TabWidget; 54 QTabWidget *TabWidget;
54 QWidget *tab, *tab_2, *tab_3; 55 QWidget *tab, *tab_2, *tab_3;
55 QListView *Local_View, *Remote_View; 56 QListView *Local_View, *Remote_View;
56 57
57 QLineEdit *currentPathEdit; 58 QLineEdit *currentPathEdit;
58 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; 59 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu;
59 QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 60 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
61// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
60 QDir currentDir, currentRemoteDir; 62 QDir currentDir, currentRemoteDir;
61 QComboBox *currentPathCombo; 63 QComboBox *currentPathCombo;
62 QString filterStr; 64 QString filterStr;
63 QListViewItem * item; 65 QListViewItem * item;
64 bool b; 66 bool b;
65 QStringList fileSystemTypeList, fsList; 67 QStringList fileSystemTypeList, fsList;
66 int currentServerConfig; 68 int currentServerConfig;
67protected slots: 69protected slots:
68 void doLocalCd(); 70 void doLocalCd();
69 void doRemoteCd(); 71 void doRemoteCd();
70// void copy(); 72// void copy();
71 void mkDir(); 73 void mkDir();
72 void del(); 74 void del();
73 void rn(); 75 void rn();
74 void populateLocalView(); 76 void populateLocalView();
75 void populateRemoteView(); 77 void populateRemoteView();
76 void showHidden(); 78 void showHidden();
77 void showRemoteHidden(); 79 void showRemoteHidden();
78 void writeConfig(); 80 void writeConfig();
79 void readConfig(); 81 void readConfig();
80 void localListClicked(QListViewItem *); 82 void localListClicked(QListViewItem *);
81 void remoteListClicked(QListViewItem *); 83 void remoteListClicked(QListViewItem *);
82 void localListPressed( int, QListViewItem *, const QPoint&, int); 84 void localListPressed( int, QListViewItem *, const QPoint&, int);
83 void remoteListPressed( int, QListViewItem *, const QPoint&, int); 85 void remoteListPressed( int, QListViewItem *, const QPoint&, int);
84 void localMakDir(); 86 void localMakDir();
85 void localDelete(); 87 void localDelete();
86 void remoteMakDir(); 88 void remoteMakDir();
87 void remoteDelete(); 89 void remoteDelete();
88/* bool remoteDirList(const QString &); */ 90/* bool remoteDirList(const QString &); */
89/* bool remoteChDir(const QString &); */ 91/* bool remoteChDir(const QString &); */
90 void tabChanged(QWidget*); 92 void tabChanged(QWidget*);
91 void cleanUp(); 93 void cleanUp();
92 void remoteRename(); 94 void remoteRename();
93 void localRename(); 95 void localRename();
94 void runThis(); 96 void runThis();
95 void runText(); 97 void runText();
96 void filePerms(); 98 void filePerms();
97 void doProperties(); 99 void doProperties();
98 void runCommand(); 100 void runCommand();
99 void runCommandStd(); 101 void runCommandStd();
100 QStringList getPath(); 102 QStringList getPath();
101 void mkSym(); 103 void mkSym();
102 void switchToLocalTab(); 104 void switchToLocalTab();
103 void switchToRemoteTab(); 105 void switchToRemoteTab();
104 106
105protected: 107protected:
106 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 108 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
107 QStringList remoteDirPathStringList, localDirPathStringList; 109 QStringList remoteDirPathStringList, localDirPathStringList;
108 110
109 void keyReleaseEvent( QKeyEvent *); 111 void keyReleaseEvent( QKeyEvent *);
110 QString getFileSystemType(const QString &); 112 QString getFileSystemType(const QString &);
111 void parsetab(const QString &fileName); 113 void parsetab(const QString &fileName);
112 114
113protected slots: 115protected slots:
114 void showFileMenu(); 116 void showFileMenu();
115 void cancelMenuTimer(); 117 void cancelMenuTimer();
116 void homeButtonPushed(); 118 void homeButtonPushed();
117 void docButtonPushed(); 119 void docButtonPushed();
118 void SDButtonPushed(); 120 void SDButtonPushed();
119 void CFButtonPushed(); 121 void CFButtonPushed();
120 void QPEButtonPushed(); 122 void QPEButtonPushed();
121 void upDir(); 123 void upDir();
122 void currentPathComboChanged(); 124 void currentPathComboChanged();
123 void copy(); 125 void copy();
124 void copyAs(); 126 void copyAs();
125 void currentPathComboActivated(const QString &); 127 void currentPathComboActivated(const QString &);
126 void fillCombo(const QString &); 128 void fillCombo(const QString &);
127 bool copyFile( const QString & , const QString & ); 129 bool copyFile( const QString & , const QString & );
128 void move(); 130 void move();
129 void fileStatus(); 131 void fileStatus();
130 void doAbout(); 132 void doAbout();
131 void doBeam(); 133 void doBeam();
132 void fileBeamFinished( Ir *); 134 void fileBeamFinished( Ir *);
133private: 135private:
134 QTimer menuTimer; 136 QTimer menuTimer;
135}; 137};
136 138
137#endif // ADVANCEDFM_H 139#endif // ADVANCEDFM_H