summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-01 14:05:40 (UTC)
committer alwin <alwin>2004-03-01 14:05:40 (UTC)
commit0f3d8aba2d2de77b1366ece1685cb720ea9b841f (patch) (unidiff)
tree31a105cc9dca06e4a3339e1c684be773e497b3f5
parentaa4539e4ccc23c47f720819e23c9a6faf53a4df8 (diff)
downloadopie-0f3d8aba2d2de77b1366ece1685cb720ea9b841f.zip
opie-0f3d8aba2d2de77b1366ece1685cb720ea9b841f.tar.gz
opie-0f3d8aba2d2de77b1366ece1685cb720ea9b841f.tar.bz2
just modified this way, that it not longer crashes when just startet.
but completly unusable. Who will maintain this stuff? If no one will do it, we should remove this app in next opie release 'cause this moment it makes no sense.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 2b29d83..24da195 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -9,168 +9,176 @@
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 13
14#include "opieftp.h" 14#include "opieftp.h"
15 15
16extern "C" { 16extern "C" {
17#include "../ftplib/ftplib.h" 17#include "../ftplib/ftplib.h"
18} 18}
19 19
20#include "inputDialog.h" 20#include "inputDialog.h"
21 21
22#include <qmenubar.h> 22#include <qmenubar.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qpe/mimetype.h> 26#include <qpe/mimetype.h>
27 27
28#include <qtextstream.h> 28#include <qtextstream.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qtoolbutton.h> 30#include <qtoolbutton.h>
31#include <qcombobox.h> 31#include <qcombobox.h>
32#include <qlistview.h> 32#include <qlistview.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qprogressbar.h> 34#include <qprogressbar.h>
35#include <qspinbox.h> 35#include <qspinbox.h>
36#include <qtabwidget.h> 36#include <qtabwidget.h>
37#include <qlayout.h> 37#include <qlayout.h>
38#include <qmessagebox.h> 38#include <qmessagebox.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qlistbox.h> 40#include <qlistbox.h>
41#include <qvbox.h>
41 42
42#include <unistd.h> 43#include <unistd.h>
43#include <stdlib.h> 44#include <stdlib.h>
44 45
45 46
46QProgressBar *ProgressBar; 47QProgressBar *ProgressBar;
47static netbuf *conn=NULL; 48static netbuf *conn=NULL;
48 49
49static int log_progress(netbuf *, int xfered, void *) 50static int log_progress(netbuf *, int xfered, void *)
50{ 51{
51// int fsz = *(int *)arg; 52// int fsz = *(int *)arg;
52// int pct = (xfered * 100) / fsz; 53// int pct = (xfered * 100) / fsz;
53// printf("%3d%%\r", pct); 54// printf("%3d%%\r", pct);
54// fflush(stdout); 55// fflush(stdout);
55 ProgressBar->setProgress(xfered); 56 ProgressBar->setProgress(xfered);
56 qApp->processEvents(); 57 qApp->processEvents();
57 return 1; 58 return 1;
58} 59}
59 60
60OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) 61OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
61 : QMainWindow( parent, name, fl ) 62 : QMainWindow( parent, name, fl )
62{ 63{
64 qDebug("OpieFtp constructor");
63 setCaption( tr( "OpieFtp" ) ); 65 setCaption( tr( "OpieFtp" ) );
64 fuckeduphack=FALSE; 66 fuckeduphack=FALSE;
65 QGridLayout *layout = new QGridLayout( this ); 67
68 QVBox* wrapperBox = new QVBox( this );
69 setCentralWidget( wrapperBox );
70
71 QWidget *view = new QWidget( wrapperBox );
72
73 QGridLayout *layout = new QGridLayout( view );
66 layout->setSpacing( 2); 74 layout->setSpacing( 2);
67 layout->setMargin( 2); 75 layout->setMargin( 2);
68
69 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 76 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
70 77
71 QMenuBar *menuBar = new QMenuBar(this); 78 QMenuBar *menuBar = new QMenuBar(this);
72// QToolBar *menuBar = new QToolBar(this); 79// QToolBar *menuBar = new QToolBar(this);
73// menuBar->setHorizontalStretchable( TRUE ); 80// menuBar->setHorizontalStretchable( TRUE );
74 81
75 QWMatrix matrix; 82 QWMatrix matrix;
76 QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); 83 QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
77 matrix.scale( .4, .4); 84 matrix.scale( .4, .4);
78 unknownXpm = pix.xForm(matrix); 85 unknownXpm = pix.xForm(matrix);
79 86
80 connectionMenu = new QPopupMenu( this ); 87 connectionMenu = new QPopupMenu( this );
81 localMenu = new QPopupMenu( this ); 88 localMenu = new QPopupMenu( this );
82 remoteMenu = new QPopupMenu( this ); 89 remoteMenu = new QPopupMenu( this );
83 tabMenu = new QPopupMenu( this ); 90 tabMenu = new QPopupMenu( this );
84 91
92#if 0
85 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); 93 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
94#endif
86 95
87 menuBar->insertItem( tr( "Connection" ), connectionMenu); 96 menuBar->insertItem( tr( "Connection" ), connectionMenu);
88// menuBar->insertItem( tr( "Local" ), localMenu); 97// menuBar->insertItem( tr( "Local" ), localMenu);
89// menuBar->insertItem( tr( "Remote" ), remoteMenu); 98// menuBar->insertItem( tr( "Remote" ), remoteMenu);
90 menuBar->insertItem( tr( "View" ), tabMenu); 99 menuBar->insertItem( tr( "View" ), tabMenu);
91 100
92 tabMenu->insertItem( tr( "Local" ), localMenu); 101 tabMenu->insertItem( tr( "Local" ), localMenu);
93 tabMenu->insertItem( tr( "Remote" ), remoteMenu); 102 tabMenu->insertItem( tr( "Remote" ), remoteMenu);
94 103
95 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 104 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
96 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 105 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
97 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 106 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
98 107
99 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 108 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
100 localMenu->insertSeparator(); 109 localMenu->insertSeparator();
101 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 110 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
102 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 111 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
103 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 112 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
104 localMenu->insertSeparator(); 113 localMenu->insertSeparator();
105 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 114 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
106 localMenu->setCheckable(TRUE); 115 localMenu->setCheckable(TRUE);
107 116
108 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 117 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
109 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 118 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
110 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 119 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
111 remoteMenu->insertSeparator(); 120 remoteMenu->insertSeparator();
112 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 121 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
113 122
114 tabMenu->insertSeparator(); 123 tabMenu->insertSeparator();
115 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 124 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
116 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 125 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
117 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); 126 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
118 tabMenu->insertSeparator(); 127 tabMenu->insertSeparator();
119// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 128// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
120 tabMenu->setCheckable(TRUE); 129 tabMenu->setCheckable(TRUE);
121 130
122 131
123 132 cdUpButton = new QToolButton( view,"cdUpButton");
124 cdUpButton = new QToolButton( this,"cdUpButton");
125 cdUpButton->setPixmap(Resource::loadPixmap("up")); 133 cdUpButton->setPixmap(Resource::loadPixmap("up"));
126 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 134 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
127 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 135 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
128 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); 136 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
129 cdUpButton->hide(); 137 cdUpButton->hide();
130 138
131// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 139// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton");
132// docButton->setFixedSize( QSize( 20, 20 ) ); 140// docButton->setFixedSize( QSize( 20, 20 ) );
133// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 141// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
134// docButton->setFlat(TRUE); 142// docButton->setFlat(TRUE);
135// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 143// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
136 144
137 homeButton = new QToolButton(this,"homeButton"); 145 homeButton = new QToolButton(view,"homeButton");
138 homeButton->setPixmap( Resource::loadPixmap("home")); 146 homeButton->setPixmap( Resource::loadPixmap("home"));
139 homeButton->setFixedSize( QSize( 20, 20 ) ); 147 homeButton->setFixedSize( QSize( 20, 20 ) );
140 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 148 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
141 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); 149 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
142 homeButton->hide(); 150 homeButton->hide();
143 151
144 TabWidget = new QTabWidget( this, "TabWidget" ); 152 TabWidget = new QTabWidget( view, "TabWidget" );
145 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); 153 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
146 154
147// TabWidget->setTabShape(QTabWidget::Triangular); 155// TabWidget->setTabShape(QTabWidget::Triangular);
148 156
149 tab = new QWidget( TabWidget, "tab" ); 157 tab = new QWidget( TabWidget, "tab" );
150 tabLayout = new QGridLayout( tab ); 158 tabLayout = new QGridLayout( tab );
151 tabLayout->setSpacing( 2); 159 tabLayout->setSpacing( 2);
152 tabLayout->setMargin( 2); 160 tabLayout->setMargin( 2);
153 161
154 Local_View = new QListView( tab, "Local_View" ); 162 Local_View = new QListView( tab, "Local_View" );
155// Local_View->setResizePolicy( QListView::AutoOneFit ); 163// Local_View->setResizePolicy( QListView::AutoOneFit );
156 Local_View->addColumn( tr("File"),150); 164 Local_View->addColumn( tr("File"),150);
157 Local_View->addColumn( tr("Date"),-1); 165 Local_View->addColumn( tr("Date"),-1);
158 Local_View->setColumnAlignment(1,QListView::AlignRight); 166 Local_View->setColumnAlignment(1,QListView::AlignRight);
159 Local_View->addColumn( tr("Size"),-1); 167 Local_View->addColumn( tr("Size"),-1);
160 Local_View->setColumnAlignment(2,QListView::AlignRight); 168 Local_View->setColumnAlignment(2,QListView::AlignRight);
161 Local_View->setAllColumnsShowFocus(TRUE); 169 Local_View->setAllColumnsShowFocus(TRUE);
162 170
163 Local_View->setMultiSelection( TRUE); 171 Local_View->setMultiSelection( TRUE);
164 Local_View->setSelectionMode(QListView::Extended); 172 Local_View->setSelectionMode(QListView::Extended);
165 Local_View->setFocusPolicy(QWidget::ClickFocus); 173 Local_View->setFocusPolicy(QWidget::ClickFocus);
166 174
167 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 175 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
168 176
169 tabLayout->addWidget( Local_View, 0, 0 ); 177 tabLayout->addWidget( Local_View, 0, 0 );
170 178
171 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 179 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
172 this,SLOT( localListClicked(QListViewItem *)) ); 180 this,SLOT( localListClicked(QListViewItem *)) );
173// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), 181// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)),
174// this,SLOT( localListClicked(QListViewItem *)) ); 182// this,SLOT( localListClicked(QListViewItem *)) );
175 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 183 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
176 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 184 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
@@ -262,94 +270,100 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
262 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 270 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
263 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 271 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
264 PortSpinBox->setMaxValue(32786); 272 PortSpinBox->setMaxValue(32786);
265 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 273 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
266 274
267 serverListView = new QListBox( tab_3, "ServerListView" ); 275 serverListView = new QListBox( tab_3, "ServerListView" );
268 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); 276 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5);
269 277
270 connect( serverListView, SIGNAL( highlighted( const QString &)), 278 connect( serverListView, SIGNAL( highlighted( const QString &)),
271 this,SLOT( serverListClicked( const QString &) ) ); 279 this,SLOT( serverListClicked( const QString &) ) );
272 280
273 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); 281 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" );
274 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); 282 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1);
275 connectServerBtn->setToggleButton(TRUE); 283 connectServerBtn->setToggleButton(TRUE);
276 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); 284 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) ));
277 285
278 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); 286 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" );
279 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); 287 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2);
280 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); 288 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() ));
281 289
282 QPushButton *deleteServerBtn; 290 QPushButton *deleteServerBtn;
283 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); 291 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" );
284 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); 292 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3);
285 293
286 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); 294 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
287 295
288 296
289 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 297 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
290 tabLayout_3->addItem( spacer, 5, 0 ); 298 tabLayout_3->addItem( spacer, 5, 0 );
291 299
292 TabWidget->insertTab( tab_3, tr( "Config" ) ); 300 TabWidget->insertTab( tab_3, tr( "Config" ) );
293 301
302#if 0
294 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 303 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
295 this,SLOT(tabChanged(QWidget*))); 304 this,SLOT(tabChanged(QWidget*)));
305#endif
296 306
297 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 307 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
298 currentDir.setPath( QDir::currentDirPath()); 308 currentDir.setPath( QDir::currentDirPath());
299// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 309// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
300 310
301 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 311 currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" );
302 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); 312 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
303 currentPathCombo ->setFixedWidth(220); 313 currentPathCombo ->setFixedWidth(220);
304 currentPathCombo->setEditable(TRUE); 314 currentPathCombo->setEditable(TRUE);
305 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 315 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
306 316
317#if 0
307 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 318 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
308 this, SLOT( currentPathComboActivated( const QString & ) ) ); 319 this, SLOT( currentPathComboActivated( const QString & ) ) );
309 320
310 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 321 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
311 this,SLOT(currentPathComboChanged())); 322 this,SLOT(currentPathComboChanged()));
312 323#endif
313 ProgressBar = new QProgressBar( this, "ProgressBar" ); 324 ProgressBar = new QProgressBar( view, "ProgressBar" );
314 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); 325 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
315 ProgressBar->setMaximumHeight(10); 326 ProgressBar->setMaximumHeight(10);
316 filterStr="*"; 327 filterStr="*";
317 b=FALSE; 328 b=FALSE;
329#if 0
318 populateLocalView(); 330 populateLocalView();
331#endif
319 readConfig(); 332 readConfig();
320 333
321// ServerComboBox->setCurrentItem(currentServerConfig); 334// ServerComboBox->setCurrentItem(currentServerConfig);
322 335
323 TabWidget->setCurrentPage(2); 336 TabWidget->setCurrentPage(2);
337 qDebug("Constructor done");
324} 338}
325 339
326OpieFtp::~OpieFtp() 340OpieFtp::~OpieFtp()
327{ 341{
328} 342}
329 343
330void OpieFtp::cleanUp() 344void OpieFtp::cleanUp()
331{ 345{
332 if(conn) 346 if(conn)
333 FtpQuit(conn); 347 FtpQuit(conn);
334 QString sfile=QDir::homeDirPath(); 348 QString sfile=QDir::homeDirPath();
335 if(sfile.right(1) != "/") 349 if(sfile.right(1) != "/")
336 sfile+="/._temp"; 350 sfile+="/._temp";
337 else 351 else
338 sfile+="._temp"; 352 sfile+="._temp";
339 QFile file( sfile); 353 QFile file( sfile);
340 if(file.exists()) 354 if(file.exists())
341 file.remove(); 355 file.remove();
342 Config cfg("opieftp"); 356 Config cfg("opieftp");
343 cfg.setGroup("Server"); 357 cfg.setGroup("Server");
344 cfg.writeEntry("currentServer", currentServerConfig); 358 cfg.writeEntry("currentServer", currentServerConfig);
345 359
346 exit(0); 360 exit(0);
347} 361}
348 362
349void OpieFtp::tabChanged(QWidget *) 363void OpieFtp::tabChanged(QWidget *)
350{ 364{
351 if (TabWidget->currentPageIndex() == 0) { 365 if (TabWidget->currentPageIndex() == 0) {
352 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 366 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
353 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 367 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
354 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 368 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
355 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 369 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
@@ -621,78 +635,78 @@ bool OpieFtp::remoteDirList(const QString &dir)
621} 635}
622 636
623bool OpieFtp::remoteChDir(const QString &dir) 637bool OpieFtp::remoteChDir(const QString &dir)
624{ 638{
625// QCopEnvelope ( "QPE/System", "busy()" ); 639// QCopEnvelope ( "QPE/System", "busy()" );
626 if (!FtpChdir( dir.latin1(), conn )) { 640 if (!FtpChdir( dir.latin1(), conn )) {
627 QString msg; 641 QString msg;
628 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); 642 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
629 msg.replace(QRegExp(":"),"\n"); 643 msg.replace(QRegExp(":"),"\n");
630 QMessageBox::message(tr("Note"),msg); 644 QMessageBox::message(tr("Note"),msg);
631// qDebug(msg); 645// qDebug(msg);
632// QCopEnvelope ( "QPE/System", "notBusy()" ); 646// QCopEnvelope ( "QPE/System", "notBusy()" );
633 return FALSE; 647 return FALSE;
634 } 648 }
635// QCopEnvelope ( "QPE/System", "notBusy()" ); 649// QCopEnvelope ( "QPE/System", "notBusy()" );
636 return TRUE; 650 return TRUE;
637} 651}
638 652
639void OpieFtp::populateLocalView() 653void OpieFtp::populateLocalView()
640{ 654{
641 Local_View->clear(); 655 Local_View->clear();
642 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 656 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
643 currentDir.setMatchAllDirs(TRUE); 657 currentDir.setMatchAllDirs(TRUE);
644 currentDir.setNameFilter(filterStr); 658 currentDir.setNameFilter(filterStr);
645 QString fileL, fileS, fileDate; 659 QString fileL, fileS, fileDate;
646 bool isDir=FALSE; 660 bool isDir=FALSE;
647 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 661 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
648 QFileInfoListIterator it(*list); 662 QFileInfoListIterator it(*list);
649 QFileInfo *fi; 663 QFileInfo *fi;
650 while ( (fi=it.current()) ) { 664 while ( (fi=it.current()) ) {
651 if (fi->isSymLink() ){ 665 if (fi->isSymLink() ){
652 QString symLink=fi->readLink(); 666 QString symLink=fi->readLink();
653// qDebug("Symlink detected "+symLink); 667 qDebug("Symlink detected "+symLink);
654 QFileInfo sym( symLink); 668 QFileInfo sym( symLink);
655 fileS.sprintf( "%10i", sym.size() ); 669 fileS.sprintf( "%10i", sym.size() );
656 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 670 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
657 fileDate = sym.lastModified().toString(); 671 fileDate = sym.lastModified().toString();
658 } else { 672 } else {
659// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 673 qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
660 fileS.sprintf( "%10i", fi->size() ); 674 fileS.sprintf( "%10i", fi->size() );
661 fileL.sprintf( "%s",fi->fileName().data() ); 675 fileL.sprintf( "%s",fi->fileName().data() );
662 fileDate= fi->lastModified().toString(); 676 fileDate= fi->lastModified().toString();
663 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 677 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
664 fileL+="/"; 678 fileL+="/";
665 isDir=TRUE; 679 isDir=TRUE;
666// qDebug( fileL); 680 qDebug( fileL);
667 } 681 }
668 } 682 }
669 if(fileL !="./" && fi->exists()) { 683 if(fileL !="./" && fi->exists()) {
670 item = new QListViewItem( Local_View,fileL, fileDate, fileS ); 684 item = new QListViewItem( Local_View,fileL, fileDate, fileS );
671 QPixmap pm; 685 QPixmap pm;
672 686
673 if(isDir || fileL.find("/",0,TRUE) != -1) { 687 if(isDir || fileL.find("/",0,TRUE) != -1) {
674 if( !QDir( fi->filePath() ).isReadable()) 688 if( !QDir( fi->filePath() ).isReadable())
675 pm = Resource::loadPixmap( "lockedfolder" ); 689 pm = Resource::loadPixmap( "lockedfolder" );
676 else 690 else
677 pm= Resource::loadPixmap( "folder" ); 691 pm= Resource::loadPixmap( "folder" );
678 item->setPixmap( 0,pm ); 692 item->setPixmap( 0,pm );
679 } else { 693 } else {
680 if( !fi->isReadable() ) 694 if( !fi->isReadable() )
681 pm = Resource::loadPixmap( "locked" ); 695 pm = Resource::loadPixmap( "locked" );
682 else { 696 else {
683 MimeType mt(fi->filePath()); 697 MimeType mt(fi->filePath());
684 pm=mt.pixmap(); //sets the correct pixmap for mimetype 698 pm=mt.pixmap(); //sets the correct pixmap for mimetype
685 if(pm.isNull()) 699 if(pm.isNull())
686 pm = unknownXpm; 700 pm = unknownXpm;
687 } 701 }
688 } 702 }
689 if( fileL.find("->",0,TRUE) != -1) { 703 if( fileL.find("->",0,TRUE) != -1) {
690 // overlay link image 704 // overlay link image
691 pm= Resource::loadPixmap( "folder" ); 705 pm= Resource::loadPixmap( "folder" );
692 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 706 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
693 QPainter painter( &pm ); 707 QPainter painter( &pm );
694 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 708 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
695 pm.setMask( pm.createHeuristicMask( FALSE ) ); 709 pm.setMask( pm.createHeuristicMask( FALSE ) );
696 } 710 }
697 item->setPixmap( 0,pm); 711 item->setPixmap( 0,pm);
698 } 712 }