summaryrefslogtreecommitdiff
path: root/noncore/net/opieftp
Unidiff
Diffstat (limited to 'noncore/net/opieftp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/config.in2
-rw-r--r--noncore/net/opieftp/filePermissions.cpp2
-rw-r--r--noncore/net/opieftp/opieftp.cpp77
-rw-r--r--noncore/net/opieftp/opieftp.pro11
4 files changed, 47 insertions, 45 deletions
diff --git a/noncore/net/opieftp/config.in b/noncore/net/opieftp/config.in
index 96e8b27..95cf73c 100644
--- a/noncore/net/opieftp/config.in
+++ b/noncore/net/opieftp/config.in
@@ -1,4 +1,4 @@
1 config OPIEFTP 1 config OPIEFTP
2 boolean "opie-ftp (ftp client for Opie)" 2 boolean "opie-ftp (ftp client for Opie)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && FTPLIB 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && FTPLIB
diff --git a/noncore/net/opieftp/filePermissions.cpp b/noncore/net/opieftp/filePermissions.cpp
index f545c1f..991fcd5 100644
--- a/noncore/net/opieftp/filePermissions.cpp
+++ b/noncore/net/opieftp/filePermissions.cpp
@@ -1,131 +1,131 @@
1/**************************************************************************** 1/****************************************************************************
2** copyright 2002 ljp ljp@llornkcor.com 2** copyright 2002 ljp ljp@llornkcor.com
3** Created: Sat Feb 23 19:44:40 2002 L.J. Potter 3** Created: Sat Feb 23 19:44:40 2002 L.J. Potter
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13****************************************************************************/ 13****************************************************************************/
14#include "filePermissions.h" 14#include "filePermissions.h"
15 15
16#include <qfileinfo.h> 16#include <qfileinfo.h>
17 17
18#include <qcheckbox.h> 18#include <qcheckbox.h>
19#include <qlabel.h> 19#include <qlabel.h>
20#include <qlineedit.h> 20#include <qlineedit.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22 22
23#include <unistd.h> 23#include <unistd.h>
24#include <sys/stat.h> 24#include <sys/stat.h>
25#include <stdlib.h> 25#include <stdlib.h>
26#include <sys/types.h> 26#include <sys/types.h>
27#include <pwd.h> 27#include <pwd.h>
28#include <grp.h> 28#include <grp.h>
29 29
30filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName, bool useRemote ) 30filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName, bool useRemote )
31 : QDialog( parent, name, modal, fl ) 31 : QDialog( parent, name, modal, fl )
32{ 32{
33 if ( !name ) 33 if ( !name )
34 setName( tr("filePermissions") ); 34 setName( tr("filePermissions") );
35// qDebug("FilePermissions "+fileName); 35// odebug << "FilePermissions "+fileName << oendl;
36 resize( 236, 210 ); 36 resize( 236, 210 );
37 isRemote=useRemote; 37 isRemote=useRemote;
38 setMaximumSize( QSize( 236, 210 ) ); 38 setMaximumSize( QSize( 236, 210 ) );
39 setCaption( tr( "Set File Permissions" ) ); 39 setCaption( tr( "Set File Permissions" ) );
40 40
41 TextLabel1 = new QLabel( this, "TextLabel1" ); 41 TextLabel1 = new QLabel( this, "TextLabel1" );
42 TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); 42 TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) );
43 TextLabel1->setText( tr( "Set file permissions for:" ) ); 43 TextLabel1->setText( tr( "Set file permissions for:" ) );
44 44
45 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 45 LineEdit1 = new QLineEdit( this, "LineEdit1" );
46 LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) ); 46 LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) );
47 LineEdit1->setReadOnly(true); 47 LineEdit1->setReadOnly(true);
48 48
49 TextLabel4 = new QLabel( this, "TextLabel4" ); 49 TextLabel4 = new QLabel( this, "TextLabel4" );
50 TextLabel4->setGeometry( QRect( 5, 85, 50, 15 ) ); 50 TextLabel4->setGeometry( QRect( 5, 85, 50, 15 ) );
51 TextLabel4->setText( tr( "owner" ) ); 51 TextLabel4->setText( tr( "owner" ) );
52 52
53 TextLabel4_2 = new QLabel( this, "TextLabel4_2" ); 53 TextLabel4_2 = new QLabel( this, "TextLabel4_2" );
54 TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) ); 54 TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) );
55 TextLabel4_2->setText( tr( "group" ) ); 55 TextLabel4_2->setText( tr( "group" ) );
56 56
57 TextLabel4_3 = new QLabel( this, "TextLabel4_3" ); 57 TextLabel4_3 = new QLabel( this, "TextLabel4_3" );
58 TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) ); 58 TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) );
59 TextLabel4_3->setText( tr( "others" ) ); 59 TextLabel4_3->setText( tr( "others" ) );
60 60
61 CheckBox1 = new QCheckBox( this, "CheckBox1" ); 61 CheckBox1 = new QCheckBox( this, "CheckBox1" );
62 CheckBox1->setGeometry( QRect( 75, 85, 20, 16 ) ); 62 CheckBox1->setGeometry( QRect( 75, 85, 20, 16 ) );
63 connect(CheckBox1, SIGNAL(released()),this,SLOT(ownReadCheck())); 63 connect(CheckBox1, SIGNAL(released()),this,SLOT(ownReadCheck()));
64 64
65 CheckBox1_2 = new QCheckBox( this, "CheckBox1_2" ); 65 CheckBox1_2 = new QCheckBox( this, "CheckBox1_2" );
66 CheckBox1_2->setGeometry( QRect( 135, 85, 20, 16 ) ); 66 CheckBox1_2->setGeometry( QRect( 135, 85, 20, 16 ) );
67 connect(CheckBox1_2, SIGNAL(released()),this,SLOT(ownWriteCheck())); 67 connect(CheckBox1_2, SIGNAL(released()),this,SLOT(ownWriteCheck()));
68 68
69 CheckBox1_3 = new QCheckBox( this, "CheckBox1_3" ); 69 CheckBox1_3 = new QCheckBox( this, "CheckBox1_3" );
70 CheckBox1_3->setGeometry( QRect( 195, 85, 20, 16 ) ); 70 CheckBox1_3->setGeometry( QRect( 195, 85, 20, 16 ) );
71 connect(CheckBox1_3, SIGNAL(released()),this,SLOT(ownExeCheck())); 71 connect(CheckBox1_3, SIGNAL(released()),this,SLOT(ownExeCheck()));
72 72
73 CheckBox1_4 = new QCheckBox( this, "CheckBox1_4" ); 73 CheckBox1_4 = new QCheckBox( this, "CheckBox1_4" );
74 CheckBox1_4->setGeometry( QRect( 75, 105, 20, 16 ) ); 74 CheckBox1_4->setGeometry( QRect( 75, 105, 20, 16 ) );
75 connect(CheckBox1_4, SIGNAL(released()),this,SLOT(grpReadCheck())); 75 connect(CheckBox1_4, SIGNAL(released()),this,SLOT(grpReadCheck()));
76 76
77 CheckBox1_5 = new QCheckBox( this, "CheckBox1_5" ); 77 CheckBox1_5 = new QCheckBox( this, "CheckBox1_5" );
78 CheckBox1_5->setGeometry( QRect( 135, 105, 20, 16 ) ); 78 CheckBox1_5->setGeometry( QRect( 135, 105, 20, 16 ) );
79 connect(CheckBox1_5, SIGNAL(released()),this,SLOT(grpWriteCheck())); 79 connect(CheckBox1_5, SIGNAL(released()),this,SLOT(grpWriteCheck()));
80 80
81 CheckBox1_6 = new QCheckBox( this, "CheckBox1_6" ); 81 CheckBox1_6 = new QCheckBox( this, "CheckBox1_6" );
82 CheckBox1_6->setGeometry( QRect( 195, 105, 20, 16 ) ); 82 CheckBox1_6->setGeometry( QRect( 195, 105, 20, 16 ) );
83 connect(CheckBox1_6, SIGNAL(released()),this,SLOT(grpExeCheck())); 83 connect(CheckBox1_6, SIGNAL(released()),this,SLOT(grpExeCheck()));
84 84
85 CheckBox1_7 = new QCheckBox( this, "CheckBox1_7" ); 85 CheckBox1_7 = new QCheckBox( this, "CheckBox1_7" );
86 CheckBox1_7->setGeometry( QRect( 75, 125, 16, 16 ) ); 86 CheckBox1_7->setGeometry( QRect( 75, 125, 16, 16 ) );
87 connect(CheckBox1_7, SIGNAL(released()),this,SLOT(wrldReadCheck())); 87 connect(CheckBox1_7, SIGNAL(released()),this,SLOT(wrldReadCheck()));
88 88
89 CheckBox1_8 = new QCheckBox( this, "CheckBox1_8" ); 89 CheckBox1_8 = new QCheckBox( this, "CheckBox1_8" );
90 CheckBox1_8->setGeometry( QRect( 135, 125, 20, 16 ) ); 90 CheckBox1_8->setGeometry( QRect( 135, 125, 20, 16 ) );
91 connect(CheckBox1_8, SIGNAL(released()),this,SLOT(wrldWriteCheck())); 91 connect(CheckBox1_8, SIGNAL(released()),this,SLOT(wrldWriteCheck()));
92 92
93 CheckBox1_8_2 = new QCheckBox( this, "CheckBox1_8_2" ); 93 CheckBox1_8_2 = new QCheckBox( this, "CheckBox1_8_2" );
94 CheckBox1_8_2->setGeometry( QRect( 195, 125, 20, 16 ) ); 94 CheckBox1_8_2->setGeometry( QRect( 195, 125, 20, 16 ) );
95 connect(CheckBox1_8_2, SIGNAL(released()),this,SLOT(wrldExeCheck())); 95 connect(CheckBox1_8_2, SIGNAL(released()),this,SLOT(wrldExeCheck()));
96 96
97 GroupLineEdit = new QLineEdit( this, "GroupLineEdit" ); 97 GroupLineEdit = new QLineEdit( this, "GroupLineEdit" );
98 GroupLineEdit->setGeometry( QRect( 125, 155, 106, 22 ) ); 98 GroupLineEdit->setGeometry( QRect( 125, 155, 106, 22 ) );
99 99
100 OwnerLineEdit = new QLineEdit( this, "OwnerLineEdit" ); 100 OwnerLineEdit = new QLineEdit( this, "OwnerLineEdit" );
101 OwnerLineEdit->setGeometry( QRect( 10, 155, 106, 22 ) ); 101 OwnerLineEdit->setGeometry( QRect( 10, 155, 106, 22 ) );
102 102
103 TextLabel5 = new QLabel( this, "TextLabel5" ); 103 TextLabel5 = new QLabel( this, "TextLabel5" );
104 TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) ); 104 TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) );
105 TextLabel5->setText( tr( "Owner" ) ); 105 TextLabel5->setText( tr( "Owner" ) );
106 106
107 TextLabel5_2 = new QLabel( this, "TextLabel5_2" ); 107 TextLabel5_2 = new QLabel( this, "TextLabel5_2" );
108 TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) ); 108 TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) );
109 TextLabel5_2->setText( tr( "Group" ) ); 109 TextLabel5_2->setText( tr( "Group" ) );
110 110
111 ModeLine = new QLineEdit( this, "TextLabelMode" ); 111 ModeLine = new QLineEdit( this, "TextLabelMode" );
112 ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) ); 112 ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) );
113 113
114 TextLabel3_2 = new QLabel( this, "TextLabel3_2" ); 114 TextLabel3_2 = new QLabel( this, "TextLabel3_2" );
115 TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) ); 115 TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) );
116 TextLabel3_2->setText( tr( "read" ) ); 116 TextLabel3_2->setText( tr( "read" ) );
117 TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); 117 TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
118 118
119 TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" ); 119 TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" );
120 TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) ); 120 TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) );
121 TextLabel3_2_2->setText( tr( "write" ) ); 121 TextLabel3_2_2->setText( tr( "write" ) );
122 TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); 122 TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
123 123
124 TextLabel3 = new QLabel( this, "TextLabel3" ); 124 TextLabel3 = new QLabel( this, "TextLabel3" );
125 TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) ); 125 TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) );
126 TextLabel3->setText( tr( "execute" ) ); 126 TextLabel3->setText( tr( "execute" ) );
127 TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); 127 TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) );
128 128
129 struct stat buf; 129 struct stat buf;
130 mode_t mode; 130 mode_t mode;
131 file = fileName; 131 file = fileName;
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 4c39569..fe96103 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -1,160 +1,163 @@
1/*************************************************************************** 1/***************************************************************************
2 opieftp.cpp 2 opieftp.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 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/* OPIE */
23#include <opie2/odebug.h>
23#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
24#include <qpe/resource.h> 25#include <qpe/resource.h>
25#include <qpe/config.h> 26#include <qpe/config.h>
26#include <qpe/mimetype.h> 27#include <qpe/mimetype.h>
28using namespace Opie::Core;
27 29
28#include <qtextstream.h> 30#include <qtextstream.h>
29#include <qpushbutton.h> 31#include <qpushbutton.h>
30#include <qtoolbutton.h> 32#include <qtoolbutton.h>
31#include <qcombobox.h> 33#include <qcombobox.h>
32#include <qlistview.h> 34#include <qlistview.h>
33#include <qlabel.h> 35#include <qlabel.h>
34#include <qprogressbar.h> 36#include <qprogressbar.h>
35#include <qspinbox.h> 37#include <qspinbox.h>
36#include <qtabwidget.h> 38#include <qtabwidget.h>
37#include <qlayout.h> 39#include <qlayout.h>
38#include <qmessagebox.h> 40#include <qmessagebox.h>
41#include <qmenubar.h>
39#include <qlineedit.h> 42#include <qlineedit.h>
40#include <qlistbox.h> 43#include <qlistbox.h>
41#include <qvbox.h> 44#include <qvbox.h>
42 45
46/* STD */
43#include <unistd.h> 47#include <unistd.h>
44#include <stdlib.h> 48#include <stdlib.h>
45 49
46
47QProgressBar *ProgressBar; 50QProgressBar *ProgressBar;
48static netbuf *conn=NULL; 51static netbuf *conn=NULL;
49 52
50static int log_progress(netbuf *, int xfered, void *) 53static int log_progress(netbuf *, int xfered, void *)
51{ 54{
52// int fsz = *(int *)arg; 55// int fsz = *(int *)arg;
53// int pct = (xfered * 100) / fsz; 56// int pct = (xfered * 100) / fsz;
54// printf("%3d%%\r", pct); 57// printf("%3d%%\r", pct);
55// fflush(stdout); 58// fflush(stdout);
56 ProgressBar->setProgress(xfered); 59 ProgressBar->setProgress(xfered);
57 qApp->processEvents(); 60 qApp->processEvents();
58 return 1; 61 return 1;
59} 62}
60 63
61OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) 64OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
62 : QMainWindow( parent, name, fl ) 65 : QMainWindow( parent, name, fl )
63{ 66{
64 qDebug("OpieFtp constructor"); 67 odebug << "OpieFtp constructor" << oendl;
65 setCaption( tr( "OpieFtp" ) ); 68 setCaption( tr( "OpieFtp" ) );
66 fuckeduphack=FALSE; 69 fuckeduphack=FALSE;
67 70
68 QVBox* wrapperBox = new QVBox( this ); 71 QVBox* wrapperBox = new QVBox( this );
69 setCentralWidget( wrapperBox ); 72 setCentralWidget( wrapperBox );
70 73
71 QWidget *view = new QWidget( wrapperBox ); 74 QWidget *view = new QWidget( wrapperBox );
72 75
73 QGridLayout *layout = new QGridLayout( view ); 76 QGridLayout *layout = new QGridLayout( view );
74 layout->setSpacing( 2); 77 layout->setSpacing( 2);
75 layout->setMargin( 2); 78 layout->setMargin( 2);
76 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 79 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
77 80
78 QMenuBar *menuBar = new QMenuBar(this); 81 QMenuBar *menuBar = new QMenuBar(this);
79// QToolBar *menuBar = new QToolBar(this); 82// QToolBar *menuBar = new QToolBar(this);
80// menuBar->setHorizontalStretchable( TRUE ); 83// menuBar->setHorizontalStretchable( TRUE );
81 84
82 QWMatrix matrix; 85 QWMatrix matrix;
83 QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); 86 QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
84 matrix.scale( .4, .4); 87 matrix.scale( .4, .4);
85 unknownXpm = pix.xForm(matrix); 88 unknownXpm = pix.xForm(matrix);
86 89
87 connectionMenu = new QPopupMenu( this ); 90 connectionMenu = new QPopupMenu( this );
88 localMenu = new QPopupMenu( this ); 91 localMenu = new QPopupMenu( this );
89 remoteMenu = new QPopupMenu( this ); 92 remoteMenu = new QPopupMenu( this );
90 tabMenu = new QPopupMenu( this ); 93 tabMenu = new QPopupMenu( this );
91 94
92//#if 0 95//#if 0
93 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); 96 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
94//#endif 97//#endif
95 98
96 menuBar->insertItem( tr( "Connection" ), connectionMenu); 99 menuBar->insertItem( tr( "Connection" ), connectionMenu);
97// menuBar->insertItem( tr( "Local" ), localMenu); 100// menuBar->insertItem( tr( "Local" ), localMenu);
98// menuBar->insertItem( tr( "Remote" ), remoteMenu); 101// menuBar->insertItem( tr( "Remote" ), remoteMenu);
99 menuBar->insertItem( tr( "View" ), tabMenu); 102 menuBar->insertItem( tr( "View" ), tabMenu);
100 103
101 tabMenu->insertItem( tr( "Local" ), localMenu); 104 tabMenu->insertItem( tr( "Local" ), localMenu);
102 tabMenu->insertItem( tr( "Remote" ), remoteMenu); 105 tabMenu->insertItem( tr( "Remote" ), remoteMenu);
103 106
104 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 107 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
105 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 108 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
106 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 109 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
107 110
108 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 111 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
109 localMenu->insertSeparator(); 112 localMenu->insertSeparator();
110 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 113 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
111 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 114 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
112 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 115 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
113 localMenu->insertSeparator(); 116 localMenu->insertSeparator();
114 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 117 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
115 localMenu->setCheckable(TRUE); 118 localMenu->setCheckable(TRUE);
116 119
117 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 120 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
118 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 121 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
119 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 122 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
120 remoteMenu->insertSeparator(); 123 remoteMenu->insertSeparator();
121 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 124 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
122 125
123 tabMenu->insertSeparator(); 126 tabMenu->insertSeparator();
124 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 127 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
125 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 128 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
126 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); 129 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
127 tabMenu->insertSeparator(); 130 tabMenu->insertSeparator();
128// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 131// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
129 tabMenu->setCheckable(TRUE); 132 tabMenu->setCheckable(TRUE);
130 133
131 134
132 cdUpButton = new QToolButton( view,"cdUpButton"); 135 cdUpButton = new QToolButton( view,"cdUpButton");
133 cdUpButton->setPixmap(Resource::loadPixmap("up")); 136 cdUpButton->setPixmap(Resource::loadPixmap("up"));
134 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 137 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
135 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 138 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
136 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); 139 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
137 cdUpButton->hide(); 140 cdUpButton->hide();
138 141
139// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton"); 142// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton");
140// docButton->setFixedSize( QSize( 20, 20 ) ); 143// docButton->setFixedSize( QSize( 20, 20 ) );
141// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 144// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
142// docButton->setFlat(TRUE); 145// docButton->setFlat(TRUE);
143// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 146// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
144 147
145 homeButton = new QToolButton(view,"homeButton"); 148 homeButton = new QToolButton(view,"homeButton");
146 homeButton->setPixmap( Resource::loadPixmap("home")); 149 homeButton->setPixmap( Resource::loadPixmap("home"));
147 homeButton->setFixedSize( QSize( 20, 20 ) ); 150 homeButton->setFixedSize( QSize( 20, 20 ) );
148 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 151 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
149 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); 152 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
150 homeButton->hide(); 153 homeButton->hide();
151 154
152 TabWidget = new QTabWidget( view, "TabWidget" ); 155 TabWidget = new QTabWidget( view, "TabWidget" );
153 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); 156 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
154 157
155// TabWidget->setTabShape(QTabWidget::Triangular); 158// TabWidget->setTabShape(QTabWidget::Triangular);
156 159
157 tab = new QWidget( TabWidget, "tab" ); 160 tab = new QWidget( TabWidget, "tab" );
158 tabLayout = new QGridLayout( tab ); 161 tabLayout = new QGridLayout( tab );
159 tabLayout->setSpacing( 2); 162 tabLayout->setSpacing( 2);
160 tabLayout->setMargin( 2); 163 tabLayout->setMargin( 2);
@@ -241,725 +244,725 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
241 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); 244 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
242 245
243 connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this, 246 connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this,
244 SLOT( PasswordEditEdited(const QString&) )); 247 SLOT( PasswordEditEdited(const QString&) ));
245 248
246//PasswordEdit->setFixedWidth(85); 249//PasswordEdit->setFixedWidth(85);
247 TextLabel3 = new QLabel( tab_3, "TextLabel3" ); 250 TextLabel3 = new QLabel( tab_3, "TextLabel3" );
248 TextLabel3->setText( tr( "Remote server" ) ); 251 TextLabel3->setText( tr( "Remote server" ) );
249 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); 252 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
250 253
251 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); 254 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
252 ServerComboBox->setEditable(TRUE); 255 ServerComboBox->setEditable(TRUE);
253 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); 256 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
254 257
255 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) )); 258 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) ));
256 connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this, 259 connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this,
257 SLOT(serverComboEdited(const QString&) )); 260 SLOT(serverComboEdited(const QString&) ));
258 261
259 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 262 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
260 TextLabel5->setText( tr( "Remote path" ) ); 263 TextLabel5->setText( tr( "Remote path" ) );
261 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); 264 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
262 265
263 266
264 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 267 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
265 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); 268 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
266 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 269 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
267 TextLabel4->setText( tr( "Port" ) ); 270 TextLabel4->setText( tr( "Port" ) );
268 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 271 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
269 272
270 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 273 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
271 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 274 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
272 PortSpinBox->setMaxValue(32786); 275 PortSpinBox->setMaxValue(32786);
273 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 276 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
274 277
275 serverListView = new QListBox( tab_3, "ServerListView" ); 278 serverListView = new QListBox( tab_3, "ServerListView" );
276 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); 279 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5);
277 280
278 connect( serverListView, SIGNAL( highlighted(const QString&)), 281 connect( serverListView, SIGNAL( highlighted(const QString&)),
279 this,SLOT( serverListClicked(const QString&) ) ); 282 this,SLOT( serverListClicked(const QString&) ) );
280 283
281 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); 284 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" );
282 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); 285 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1);
283 connectServerBtn->setToggleButton(TRUE); 286 connectServerBtn->setToggleButton(TRUE);
284 connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) )); 287 connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) ));
285 288
286 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); 289 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" );
287 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); 290 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2);
288 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); 291 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() ));
289 292
290 QPushButton *deleteServerBtn; 293 QPushButton *deleteServerBtn;
291 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); 294 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" );
292 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); 295 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3);
293 296
294 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); 297 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
295 298
296 299
297 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 300 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
298 tabLayout_3->addItem( spacer, 5, 0 ); 301 tabLayout_3->addItem( spacer, 5, 0 );
299 302
300 TabWidget->insertTab( tab_3, tr( "Config" ) ); 303 TabWidget->insertTab( tab_3, tr( "Config" ) );
301 304
302#if 0 305#if 0
303 connect(TabWidget,SIGNAL(currentChanged(QWidget*)), 306 connect(TabWidget,SIGNAL(currentChanged(QWidget*)),
304 this,SLOT(tabChanged(QWidget*))); 307 this,SLOT(tabChanged(QWidget*)));
305#endif 308#endif
306 309
307 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 310 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
308 currentDir.setPath( QDir::currentDirPath()); 311 currentDir.setPath( QDir::currentDirPath());
309// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 312// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
310 313
311 currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); 314 currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" );
312 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); 315 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
313 currentPathCombo ->setFixedWidth(220); 316 currentPathCombo ->setFixedWidth(220);
314 currentPathCombo->setEditable(TRUE); 317 currentPathCombo->setEditable(TRUE);
315 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 318 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
316 319
317#if 0 320#if 0
318 connect( currentPathCombo, SIGNAL( activated(const QString&) ), 321 connect( currentPathCombo, SIGNAL( activated(const QString&) ),
319 this, SLOT( currentPathComboActivated(const QString&) ) ); 322 this, SLOT( currentPathComboActivated(const QString&) ) );
320 323
321 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 324 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
322 this,SLOT(currentPathComboChanged())); 325 this,SLOT(currentPathComboChanged()));
323#endif 326#endif
324 ProgressBar = new QProgressBar( view, "ProgressBar" ); 327 ProgressBar = new QProgressBar( view, "ProgressBar" );
325 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); 328 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
326 ProgressBar->setMaximumHeight(10); 329 ProgressBar->setMaximumHeight(10);
327 filterStr="*"; 330 filterStr="*";
328 b=FALSE; 331 b=FALSE;
329#if 0 332#if 0
330 populateLocalView(); 333 populateLocalView();
331#endif 334#endif
332 readConfig(); 335 readConfig();
333 336
334// ServerComboBox->setCurrentItem(currentServerConfig); 337// ServerComboBox->setCurrentItem(currentServerConfig);
335 338
336 TabWidget->setCurrentPage(2); 339 TabWidget->setCurrentPage(2);
337 qDebug("Constructor done"); 340 odebug << "Constructor done" << oendl;
338} 341}
339 342
340OpieFtp::~OpieFtp() 343OpieFtp::~OpieFtp()
341{ 344{
342} 345}
343 346
344void OpieFtp::cleanUp() 347void OpieFtp::cleanUp()
345{ 348{
346 if(conn) 349 if(conn)
347 FtpQuit(conn); 350 FtpQuit(conn);
348 QString sfile=QDir::homeDirPath(); 351 QString sfile=QDir::homeDirPath();
349 if(sfile.right(1) != "/") 352 if(sfile.right(1) != "/")
350 sfile+="/._temp"; 353 sfile+="/._temp";
351 else 354 else
352 sfile+="._temp"; 355 sfile+="._temp";
353 QFile file( sfile); 356 QFile file( sfile);
354 if(file.exists()) 357 if(file.exists())
355 file.remove(); 358 file.remove();
356 Config cfg("opieftp"); 359 Config cfg("opieftp");
357 cfg.setGroup("Server"); 360 cfg.setGroup("Server");
358 cfg.writeEntry("currentServer", currentServerConfig); 361 cfg.writeEntry("currentServer", currentServerConfig);
359 362
360 exit(0); 363 exit(0);
361} 364}
362 365
363void OpieFtp::tabChanged(QWidget *) 366void OpieFtp::tabChanged(QWidget *)
364{ 367{
365 if (TabWidget->currentPageIndex() == 0) { 368 if (TabWidget->currentPageIndex() == 0) {
366 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 369 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
367 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 370 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
368 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 371 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
369 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 372 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
370 if(cdUpButton->isHidden()) 373 if(cdUpButton->isHidden())
371 cdUpButton->show(); 374 cdUpButton->show();
372 if(homeButton->isHidden()) 375 if(homeButton->isHidden())
373 homeButton->show(); 376 homeButton->show();
374 377
375 } 378 }
376 if (TabWidget->currentPageIndex() == 1) { 379 if (TabWidget->currentPageIndex() == 1) {
377 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 380 currentPathCombo->lineEdit()->setText( currentRemoteDir );
378 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); 381 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
379 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 382 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
380 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 383 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
381 if(cdUpButton->isHidden()) 384 if(cdUpButton->isHidden())
382 cdUpButton->show(); 385 cdUpButton->show();
383 homeButton->hide(); 386 homeButton->hide();
384 387
385 } 388 }
386 if (TabWidget->currentPageIndex() == 2) { 389 if (TabWidget->currentPageIndex() == 2) {
387 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); 390 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
388 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 391 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
389 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 392 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
390 cdUpButton->hide(); 393 cdUpButton->hide();
391 homeButton->hide(); 394 homeButton->hide();
392 } 395 }
393} 396}
394 397
395void OpieFtp::newConnection() 398void OpieFtp::newConnection()
396{ 399{
397 UsernameComboBox->lineEdit()->setText(""); 400 UsernameComboBox->lineEdit()->setText("");
398 PasswordEdit->setText( "" ); 401 PasswordEdit->setText( "" );
399 ServerComboBox->lineEdit()->setText( ""); 402 ServerComboBox->lineEdit()->setText( "");
400 remotePath->setText( currentRemoteDir = "/"); 403 remotePath->setText( currentRemoteDir = "/");
401 PortSpinBox->setValue( 21); 404 PortSpinBox->setValue( 21);
402 TabWidget->setCurrentPage(2); 405 TabWidget->setCurrentPage(2);
403} 406}
404 407
405void OpieFtp::serverComboEdited(const QString & ) 408void OpieFtp::serverComboEdited(const QString & )
406{ 409{
407// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { 410// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) {
408// qDebug("ServerComboEdited"); 411// odebug << "ServerComboEdited" << oendl;
409// // currentServerConfig = -1; 412// // currentServerConfig = -1;
410// } 413// }
411} 414}
412 415
413void OpieFtp::UsernameComboBoxEdited(const QString &) { 416void OpieFtp::UsernameComboBoxEdited(const QString &) {
414// currentServerConfig = -1; 417// currentServerConfig = -1;
415} 418}
416 419
417void OpieFtp::PasswordEditEdited(const QString & ) { 420void OpieFtp::PasswordEditEdited(const QString & ) {
418// currentServerConfig = -1; 421// currentServerConfig = -1;
419} 422}
420 423
421void OpieFtp::connectorBtnToggled(bool On) 424void OpieFtp::connectorBtnToggled(bool On)
422{ 425{
423 if(On) { 426 if(On) {
424 connector(); 427 connector();
425 } else { 428 } else {
426 disConnector(); 429 disConnector();
427 } 430 }
428 431
429} 432}
430 433
431void OpieFtp::connector() 434void OpieFtp::connector()
432{ 435{
433// QCopEnvelope ( "QPE/System", "busy()" ); 436// QCopEnvelope ( "QPE/System", "busy()" );
434// qApp->processEvents(); 437// qApp->processEvents();
435 currentRemoteDir=remotePath->text(); 438 currentRemoteDir=remotePath->text();
436 439
437 if( ServerComboBox->currentText().isEmpty()) { 440 if( ServerComboBox->currentText().isEmpty()) {
438 441
439 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); 442 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0);
440 TabWidget->setCurrentPage(2); 443 TabWidget->setCurrentPage(2);
441 ServerComboBox->setFocus(); 444 ServerComboBox->setFocus();
442 connectServerBtn->setOn(FALSE); 445 connectServerBtn->setOn(FALSE);
443 connectServerBtn->setText( tr("Connect")); 446 connectServerBtn->setText( tr("Connect"));
444 return; 447 return;
445 } 448 }
446 449
447 FtpInit(); 450 FtpInit();
448 451
449 TabWidget->setCurrentPage(1); 452 TabWidget->setCurrentPage(1);
450 QString ftp_host = ServerComboBox->currentText(); 453 QString ftp_host = ServerComboBox->currentText();
451 QString ftp_user = UsernameComboBox->currentText(); 454 QString ftp_user = UsernameComboBox->currentText();
452 QString ftp_pass = PasswordEdit->text(); 455 QString ftp_pass = PasswordEdit->text();
453 QString port=PortSpinBox->cleanText(); 456 QString port=PortSpinBox->cleanText();
454 port.stripWhiteSpace(); 457 port.stripWhiteSpace();
455 458
456 Config cfg("opieftp"); 459 Config cfg("opieftp");
457 cfg.setGroup("Server"); 460 cfg.setGroup("Server");
458// int current=cfg.readNumEntry("currentServer", 1); 461// int current=cfg.readNumEntry("currentServer", 1);
459 462
460// if(ftp_host!= cfg.readEntry(QString::number( current))) 463// if(ftp_host!= cfg.readEntry(QString::number( current)))
461// currentServerConfig=-1; 464// currentServerConfig=-1;
462// cfg.setGroup(QString::number(current)); 465// cfg.setGroup(QString::number(current));
463// if( ftp_user != cfg.readEntry("Username")) 466// if( ftp_user != cfg.readEntry("Username"))
464// currentServerConfig=-1; 467// currentServerConfig=-1;
465// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) 468// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username")))
466// currentServerConfig=-1; 469// currentServerConfig=-1;
467 470
468 471
469 if(ftp_host.find("ftp://",0, TRUE) != -1 ) 472 if(ftp_host.find("ftp://",0, TRUE) != -1 )
470 ftp_host=ftp_host.right(ftp_host.length()-6); 473 ftp_host=ftp_host.right(ftp_host.length()-6);
471 ftp_host+=":"+port; 474 ftp_host+=":"+port;
472 475
473 if (!FtpConnect( ftp_host.latin1(), &conn)) { 476 if (!FtpConnect( ftp_host.latin1(), &conn)) {
474 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); 477 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host);
475 connectServerBtn->setOn(FALSE); 478 connectServerBtn->setOn(FALSE);
476 connectServerBtn->setText( tr("Connect")); 479 connectServerBtn->setText( tr("Connect"));
477 return ; 480 return ;
478 } 481 }
479 482
480 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { 483 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
481 QString msg; 484 QString msg;
482 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); 485 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn));
483 msg.replace(QRegExp(":"),"\n"); 486 msg.replace(QRegExp(":"),"\n");
484 QMessageBox::message(tr("Note"),msg); 487 QMessageBox::message(tr("Note"),msg);
485 if(conn) 488 if(conn)
486 FtpQuit(conn); 489 FtpQuit(conn);
487 connectServerBtn->setOn(FALSE); 490 connectServerBtn->setOn(FALSE);
488 connectServerBtn->setText( tr("Connect")); 491 connectServerBtn->setText( tr("Connect"));
489 return ; 492 return ;
490 } 493 }
491 494
492 remoteDirList("/") ; 495 remoteDirList("/") ;
493 setCaption(ftp_host); 496 setCaption(ftp_host);
494 if( currentServerConfig == -1) 497 if( currentServerConfig == -1)
495 writeConfig(); 498 writeConfig();
496 connectServerBtn->setText( tr("Disconnect")); 499 connectServerBtn->setText( tr("Disconnect"));
497// QCopEnvelope ( "QPE/System", "notBusy()" ); 500// QCopEnvelope ( "QPE/System", "notBusy()" );
498} 501}
499 502
500void OpieFtp::disConnector() 503void OpieFtp::disConnector()
501{ 504{
502 if(conn) 505 if(conn)
503 FtpQuit(conn); 506 FtpQuit(conn);
504 setCaption("OpieFtp"); 507 setCaption("OpieFtp");
505 currentRemoteDir="/"; 508 currentRemoteDir="/";
506 Remote_View->clear(); 509 Remote_View->clear();
507 connectServerBtn->setText( tr("Connect")); 510 connectServerBtn->setText( tr("Connect"));
508 connectServerBtn->setOn(FALSE); 511 connectServerBtn->setOn(FALSE);
509 setCaption("OpieFtp"); 512 setCaption("OpieFtp");
510} 513}
511 514
512void OpieFtp::localUpload() 515void OpieFtp::localUpload()
513{ 516{
514 int fsz; 517 int fsz;
515// QCopEnvelope ( "QPE/System", "busy()" ); 518// QCopEnvelope ( "QPE/System", "busy()" );
516// qApp->processEvents(); 519// qApp->processEvents();
517 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 520 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
518 QListViewItemIterator it( Local_View ); 521 QListViewItemIterator it( Local_View );
519 for ( ; it.current(); ++it ) { 522 for ( ; it.current(); ++it ) {
520 if ( it.current()->isSelected() ) { 523 if ( it.current()->isSelected() ) {
521 QString strItem = it.current()->text(0); 524 QString strItem = it.current()->text(0);
522 QString localFile = currentDir.canonicalPath()+"/"+strItem; 525 QString localFile = currentDir.canonicalPath()+"/"+strItem;
523 QString remoteFile= currentRemoteDir+strItem; 526 QString remoteFile= currentRemoteDir+strItem;
524 QFileInfo fi(localFile); 527 QFileInfo fi(localFile);
525 if( !fi.isDir()) { 528 if( !fi.isDir()) {
526 fsz=fi.size(); 529 fsz=fi.size();
527 ProgressBar->setTotalSteps(fsz); 530 ProgressBar->setTotalSteps(fsz);
528 531
529 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 532 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
530 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 533 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
531 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 534 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
532 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 535 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
533 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); 536 odebug << "Put: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl;
534 537
535 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 538 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
536 QString msg; 539 QString msg;
537 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); 540 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
538 msg.replace(QRegExp(":"),"\n"); 541 msg.replace(QRegExp(":"),"\n");
539 QMessageBox::message(tr("Note"),msg); 542 QMessageBox::message(tr("Note"),msg);
540 } 543 }
541 } else { 544 } else {
542 QMessageBox::message(tr("Note"),tr("Cannot upload directories")); 545 QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
543 } 546 }
544 ProgressBar->reset(); 547 ProgressBar->reset();
545 nullifyCallBack(); 548 nullifyCallBack();
546 it.current()->setSelected(FALSE); 549 it.current()->setSelected(FALSE);
547 } //end currentSelected 550 } //end currentSelected
548 } 551 }
549 for ( ; it.current(); ++it ) { 552 for ( ; it.current(); ++it ) {
550 Local_View->clearSelection(); 553 Local_View->clearSelection();
551 } 554 }
552 Local_View->clearFocus(); 555 Local_View->clearFocus();
553 TabWidget->setCurrentPage(1); 556 TabWidget->setCurrentPage(1);
554 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 557 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
555// QCopEnvelope ( "QPE/System", "notBusy()" ); 558// QCopEnvelope ( "QPE/System", "notBusy()" );
556} 559}
557 560
558void OpieFtp::nullifyCallBack() 561void OpieFtp::nullifyCallBack()
559{ 562{
560 FtpOptions(FTPLIB_CALLBACK, 0, conn); 563 FtpOptions(FTPLIB_CALLBACK, 0, conn);
561 FtpOptions(FTPLIB_IDLETIME, 0, conn); 564 FtpOptions(FTPLIB_IDLETIME, 0, conn);
562 FtpOptions(FTPLIB_CALLBACKARG, 0, conn); 565 FtpOptions(FTPLIB_CALLBACKARG, 0, conn);
563 FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn); 566 FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn);
564} 567}
565 568
566void OpieFtp::remoteDownload() 569void OpieFtp::remoteDownload()
567{ 570{
568// qApp->processEvents(); 571// qApp->processEvents();
569 int fsz; 572 int fsz;
570// QCopEnvelope ( "QPE/System", "busy()" ); 573// QCopEnvelope ( "QPE/System", "busy()" );
571 574
572 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 575 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
573 QListViewItemIterator it( Remote_View ); 576 QListViewItemIterator it( Remote_View );
574 for ( ; it.current(); ++it ) { 577 for ( ; it.current(); ++it ) {
575 if ( it.current()->isSelected() ) { 578 if ( it.current()->isSelected() ) {
576 QString strItem = it.current()->text(0); 579 QString strItem = it.current()->text(0);
577// strItem=strItem.right(strItem.length()-1); 580// strItem=strItem.right(strItem.length()-1);
578 QString localFile = currentDir.canonicalPath(); 581 QString localFile = currentDir.canonicalPath();
579 if(localFile.right(1).find("/",0,TRUE) == -1) 582 if(localFile.right(1).find("/",0,TRUE) == -1)
580 localFile += "/"; 583 localFile += "/";
581 localFile += strItem; 584 localFile += strItem;
582// QString localFile = currentDir.canonicalPath()+"/"+strItem; 585// QString localFile = currentDir.canonicalPath()+"/"+strItem;
583 QString remoteFile= currentRemoteDir+strItem; 586 QString remoteFile= currentRemoteDir+strItem;
584 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) 587 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
585 fsz = 0; 588 fsz = 0;
586 QString temp; 589 QString temp;
587 temp.sprintf( remoteFile+" "+" %dkb", fsz); 590 temp.sprintf( remoteFile+" "+" %dkb", fsz);
588 591
589 ProgressBar->setTotalSteps(fsz); 592 ProgressBar->setTotalSteps(fsz);
590 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 593 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
591 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 594 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
592 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 595 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
593 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 596 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
594 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); 597 odebug << "Get: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl;
595 598
596 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 599 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
597 QString msg; 600 QString msg;
598 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); 601 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
599 msg.replace(QRegExp(":"),"\n"); 602 msg.replace(QRegExp(":"),"\n");
600 QMessageBox::message(tr("Note"),msg); 603 QMessageBox::message(tr("Note"),msg);
601 } 604 }
602 ProgressBar->reset(); 605 ProgressBar->reset();
603 nullifyCallBack(); 606 nullifyCallBack();
604 it.current()->setSelected(FALSE); 607 it.current()->setSelected(FALSE);
605 } 608 }
606 } 609 }
607 for ( ; it.current(); ++it ) { 610 for ( ; it.current(); ++it ) {
608 Remote_View->clearSelection(); 611 Remote_View->clearSelection();
609 } 612 }
610 Remote_View->setFocus(); 613 Remote_View->setFocus();
611 TabWidget->setCurrentPage(0); 614 TabWidget->setCurrentPage(0);
612 populateLocalView(); 615 populateLocalView();
613// QCopEnvelope ( "QPE/System", "notBusy()" ); 616// QCopEnvelope ( "QPE/System", "notBusy()" );
614} 617}
615 618
616bool OpieFtp::remoteDirList(const QString &dir) 619bool OpieFtp::remoteDirList(const QString &dir)
617{ 620{
618 QString tmp = QDir::homeDirPath(); 621 QString tmp = QDir::homeDirPath();
619 if(tmp.right(1) != "/") 622 if(tmp.right(1) != "/")
620 tmp+="/._temp"; 623 tmp+="/._temp";
621 else 624 else
622 tmp+="._temp"; 625 tmp+="._temp";
623// qDebug("Listing remote dir "+tmp); 626// odebug << "Listing remote dir "+tmp << oendl;
624// QCopEnvelope ( "QPE/System", "busy()" ); 627// QCopEnvelope ( "QPE/System", "busy()" );
625 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 628 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
626 QString msg; 629 QString msg;
627 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); 630 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
628 msg.replace(QRegExp(":"),"\n"); 631 msg.replace(QRegExp(":"),"\n");
629 QMessageBox::message(tr("Note"),msg); 632 QMessageBox::message(tr("Note"),msg);
630 return false; 633 return false;
631 } 634 }
632 populateRemoteView() ; 635 populateRemoteView() ;
633// QCopEnvelope ( "QPE/System", "notBusy()" ); 636// QCopEnvelope ( "QPE/System", "notBusy()" );
634 return true; 637 return true;
635} 638}
636 639
637bool OpieFtp::remoteChDir(const QString &dir) 640bool OpieFtp::remoteChDir(const QString &dir)
638{ 641{
639// QCopEnvelope ( "QPE/System", "busy()" ); 642// QCopEnvelope ( "QPE/System", "busy()" );
640 if (!FtpChdir( dir.latin1(), conn )) { 643 if (!FtpChdir( dir.latin1(), conn )) {
641 QString msg; 644 QString msg;
642 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); 645 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
643 msg.replace(QRegExp(":"),"\n"); 646 msg.replace(QRegExp(":"),"\n");
644 QMessageBox::message(tr("Note"),msg); 647 QMessageBox::message(tr("Note"),msg);
645// qDebug(msg); 648// odebug << msg << oendl;
646// QCopEnvelope ( "QPE/System", "notBusy()" ); 649// QCopEnvelope ( "QPE/System", "notBusy()" );
647 return FALSE; 650 return FALSE;
648 } 651 }
649// QCopEnvelope ( "QPE/System", "notBusy()" ); 652// QCopEnvelope ( "QPE/System", "notBusy()" );
650 return TRUE; 653 return TRUE;
651} 654}
652 655
653void OpieFtp::populateLocalView() 656void OpieFtp::populateLocalView()
654{ 657{
655 Local_View->clear(); 658 Local_View->clear();
656 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 659 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
657 currentDir.setMatchAllDirs(TRUE); 660 currentDir.setMatchAllDirs(TRUE);
658 currentDir.setNameFilter(filterStr); 661 currentDir.setNameFilter(filterStr);
659 QString fileL, fileS, fileDate; 662 QString fileL, fileS, fileDate;
660 bool isDir=FALSE; 663 bool isDir=FALSE;
661 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 664 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
662 QFileInfoListIterator it(*list); 665 QFileInfoListIterator it(*list);
663 QFileInfo *fi; 666 QFileInfo *fi;
664 while ( (fi=it.current()) ) { 667 while ( (fi=it.current()) ) {
665 if (fi->isSymLink() ){ 668 if (fi->isSymLink() ){
666 QString symLink=fi->readLink(); 669 QString symLink=fi->readLink();
667 qDebug("Symlink detected "+symLink); 670 odebug << "Symlink detected "+symLink << oendl;
668 QFileInfo sym( symLink); 671 QFileInfo sym( symLink);
669 fileS.sprintf( "%10i", sym.size() ); 672 fileS.sprintf( "%10i", sym.size() );
670 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 673 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
671 fileDate = sym.lastModified().toString(); 674 fileDate = sym.lastModified().toString();
672 } else { 675 } else {
673 qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 676 odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl;
674 fileS.sprintf( "%10i", fi->size() ); 677 fileS.sprintf( "%10i", fi->size() );
675 fileL.sprintf( "%s",fi->fileName().data() ); 678 fileL.sprintf( "%s",fi->fileName().data() );
676 fileDate= fi->lastModified().toString(); 679 fileDate= fi->lastModified().toString();
677 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 680 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
678 fileL+="/"; 681 fileL+="/";
679 isDir=TRUE; 682 isDir=TRUE;
680 qDebug( fileL); 683 odebug << fileL << oendl;
681 } 684 }
682 } 685 }
683 if(fileL !="./" && fi->exists()) { 686 if(fileL !="./" && fi->exists()) {
684 item = new QListViewItem( Local_View,fileL, fileDate, fileS ); 687 item = new QListViewItem( Local_View,fileL, fileDate, fileS );
685 QPixmap pm; 688 QPixmap pm;
686 689
687 if(isDir || fileL.find("/",0,TRUE) != -1) { 690 if(isDir || fileL.find("/",0,TRUE) != -1) {
688 if( !QDir( fi->filePath() ).isReadable()) 691 if( !QDir( fi->filePath() ).isReadable())
689 pm = Resource::loadPixmap( "lockedfolder" ); 692 pm = Resource::loadPixmap( "lockedfolder" );
690 else 693 else
691 pm= Resource::loadPixmap( "folder" ); 694 pm= Resource::loadPixmap( "folder" );
692 item->setPixmap( 0,pm ); 695 item->setPixmap( 0,pm );
693 } else { 696 } else {
694 if( !fi->isReadable() ) 697 if( !fi->isReadable() )
695 pm = Resource::loadPixmap( "locked" ); 698 pm = Resource::loadPixmap( "locked" );
696 else { 699 else {
697 MimeType mt(fi->filePath()); 700 MimeType mt(fi->filePath());
698 pm=mt.pixmap(); //sets the correct pixmap for mimetype 701 pm=mt.pixmap(); //sets the correct pixmap for mimetype
699 if(pm.isNull()) 702 if(pm.isNull())
700 pm = unknownXpm; 703 pm = unknownXpm;
701 } 704 }
702 } 705 }
703 if( fileL.find("->",0,TRUE) != -1) { 706 if( fileL.find("->",0,TRUE) != -1) {
704 // overlay link image 707 // overlay link image
705 pm= Resource::loadPixmap( "folder" ); 708 pm= Resource::loadPixmap( "folder" );
706 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 709 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
707 QPainter painter( &pm ); 710 QPainter painter( &pm );
708 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 711 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
709 pm.setMask( pm.createHeuristicMask( FALSE ) ); 712 pm.setMask( pm.createHeuristicMask( FALSE ) );
710 } 713 }
711 item->setPixmap( 0,pm); 714 item->setPixmap( 0,pm);
712 } 715 }
713 isDir=FALSE; 716 isDir=FALSE;
714 ++it; 717 ++it;
715 } 718 }
716 Local_View->setSorting( 3,FALSE); 719 Local_View->setSorting( 3,FALSE);
717 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); 720 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
718 fillCombo( (const QString &)currentDir); 721 fillCombo( (const QString &)currentDir);
719} 722}
720 723
721bool OpieFtp::populateRemoteView( ) 724bool OpieFtp::populateRemoteView( )
722{ 725{
723// qDebug("populate remoteview"); 726// odebug << "populate remoteview" << oendl;
724 QString sfile=QDir::homeDirPath(); 727 QString sfile=QDir::homeDirPath();
725 if(sfile.right(1) != "/") 728 if(sfile.right(1) != "/")
726 sfile+="/._temp"; 729 sfile+="/._temp";
727 else 730 else
728 sfile+="._temp"; 731 sfile+="._temp";
729 QFile file( sfile); 732 QFile file( sfile);
730 Remote_View->clear(); 733 Remote_View->clear();
731 QString s, File_Name; 734 QString s, File_Name;
732 QListViewItem *itemDir=NULL, *itemFile=NULL; 735 QListViewItem *itemDir=NULL, *itemFile=NULL;
733 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); 736 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] ");
734 QString fileL, fileS, fileDate; 737 QString fileL, fileS, fileDate;
735 if ( file.open(IO_ReadOnly)) { 738 if ( file.open(IO_ReadOnly)) {
736 QTextStream t( &file ); // use a text stream 739 QTextStream t( &file ); // use a text stream
737 while ( !t.eof()) { 740 while ( !t.eof()) {
738 s = t.readLine(); 741 s = t.readLine();
739 742
740 if(s.find("total",0,TRUE) == 0) 743 if(s.find("total",0,TRUE) == 0)
741 continue; 744 continue;
742 745
743 int len, month = monthRe.match(s, 0, &len); 746 int len, month = monthRe.match(s, 0, &len);
744 fileDate = s.mid(month + 1, len - 2); // minus spaces 747 fileDate = s.mid(month + 1, len - 2); // minus spaces
745 fileL = s.right(s.length() - month - len); 748 fileL = s.right(s.length() - month - len);
746 if(s.left(1) == "d") 749 if(s.left(1) == "d")
747 fileL = fileL+"/"; 750 fileL = fileL+"/";
748 fileS = s.mid(month - 8, 8); // FIXME 751 fileS = s.mid(month - 8, 8); // FIXME
749 fileS = fileS.stripWhiteSpace(); 752 fileS = fileS.stripWhiteSpace();
750 753
751 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { 754 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
752 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); 755 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d");
753 item->setPixmap( 0, Resource::loadPixmap( "folder" )); 756 item->setPixmap( 0, Resource::loadPixmap( "folder" ));
754// if(itemDir) 757// if(itemDir)
755 item->moveItem(itemDir); 758 item->moveItem(itemDir);
756 itemDir=item; 759 itemDir=item;
757 } else { 760 } else {
758 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); 761 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f");
759 item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); 762 item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
760// if(itemFile) 763// if(itemFile)
761 item->moveItem(itemDir); 764 item->moveItem(itemDir);
762 item->moveItem(itemFile); 765 item->moveItem(itemFile);
763 itemFile=item; 766 itemFile=item;
764 } 767 }
765 } 768 }
766 QListViewItem * item1 = new QListViewItem( Remote_View, "../"); 769 QListViewItem * item1 = new QListViewItem( Remote_View, "../");
767 item1->setPixmap( 0, Resource::loadPixmap( "folder" )); 770 item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
768 file.close(); 771 file.close();
769 if( file.exists()) 772 if( file.exists())
770 file. remove(); 773 file. remove();
771 } else 774 } else
772 qDebug("temp file not opened successfully "+sfile); 775 odebug << "temp file not opened successfully "+sfile << oendl;
773 Remote_View->setSorting( 4,TRUE); 776 Remote_View->setSorting( 4,TRUE);
774 return true; 777 return true;
775} 778}
776 779
777void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 780void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
778{ 781{
779 if( selectedItem) { 782 if( selectedItem) {
780 // if(selectedItem!= NULL) { 783 // if(selectedItem!= NULL) {
781// QCopEnvelope ( "QPE/System", "busy()" ); 784// QCopEnvelope ( "QPE/System", "busy()" );
782 QString oldRemoteCurrentDir = currentRemoteDir; 785 QString oldRemoteCurrentDir = currentRemoteDir;
783 QString strItem=selectedItem->text(0); 786 QString strItem=selectedItem->text(0);
784 strItem=strItem.simplifyWhiteSpace(); 787 strItem=strItem.simplifyWhiteSpace();
785 if(strItem == "../") { // the user wants to go ^ 788 if(strItem == "../") { // the user wants to go ^
786 if( FtpCDUp( conn) == 0) { 789 if( FtpCDUp( conn) == 0) {
787 QString msg; 790 QString msg;
788 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 791 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
789 msg.replace(QRegExp(":"),"\n"); 792 msg.replace(QRegExp(":"),"\n");
790 QMessageBox::message(tr("Note"),msg); 793 QMessageBox::message(tr("Note"),msg);
791// qDebug(msg); 794// odebug << msg << oendl;
792 } 795 }
793 char path[256]; 796 char path[256];
794 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 797 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
795 QString msg; 798 QString msg;
796 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 799 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
797 msg.replace(QRegExp(":"),"\n"); 800 msg.replace(QRegExp(":"),"\n");
798 QMessageBox::message(tr("Note"),msg); 801 QMessageBox::message(tr("Note"),msg);
799// qDebug(msg); 802// odebug << msg << oendl;
800 } 803 }
801 currentRemoteDir=path; 804 currentRemoteDir=path;
802 } else { 805 } else {
803 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers 806 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
804 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); 807 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
805 strItem = strItem.stripWhiteSpace(); 808 strItem = strItem.stripWhiteSpace();
806 currentRemoteDir = strItem; 809 currentRemoteDir = strItem;
807 if( !remoteChDir( (const QString &)strItem)) { 810 if( !remoteChDir( (const QString &)strItem)) {
808 currentRemoteDir = oldRemoteCurrentDir; 811 currentRemoteDir = oldRemoteCurrentDir;
809 strItem=""; 812 strItem="";
810// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 813// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl;
811 } 814 }
812 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory 815 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
813 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { 816 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
814 currentRemoteDir = oldRemoteCurrentDir; 817 currentRemoteDir = oldRemoteCurrentDir;
815 strItem=""; 818 strItem="";
816// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 819// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl;
817 820
818 } else { 821 } else {
819 currentRemoteDir = currentRemoteDir+strItem; 822 currentRemoteDir = currentRemoteDir+strItem;
820 } 823 }
821 } else { 824 } else {
822// QCopEnvelope ( "QPE/System", "notBusy()" ); 825// QCopEnvelope ( "QPE/System", "notBusy()" );
823 return; 826 return;
824 } 827 }
825 } 828 }
826 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 829 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
827 if(currentRemoteDir.right(1) !="/") 830 if(currentRemoteDir.right(1) !="/")
828 currentRemoteDir +="/"; 831 currentRemoteDir +="/";
829 currentPathCombo->lineEdit()->setText( currentRemoteDir); 832 currentPathCombo->lineEdit()->setText( currentRemoteDir);
830 fillRemoteCombo( (const QString &)currentRemoteDir); 833 fillRemoteCombo( (const QString &)currentRemoteDir);
831// QCopEnvelope ( "QPE/System", "notBusy()" ); 834// QCopEnvelope ( "QPE/System", "notBusy()" );
832 Remote_View->ensureItemVisible(Remote_View->firstChild()); 835 Remote_View->ensureItemVisible(Remote_View->firstChild());
833 836
834 } 837 }
835} 838}
836 839
837void OpieFtp::localListClicked(QListViewItem *selectedItem) 840void OpieFtp::localListClicked(QListViewItem *selectedItem)
838{ 841{
839 if(selectedItem!= NULL) { 842 if(selectedItem!= NULL) {
840 843
841 QString strItem=selectedItem->text(0); 844 QString strItem=selectedItem->text(0);
842 QString strSize=selectedItem->text(1); 845 QString strSize=selectedItem->text(1);
843 strSize=strSize.stripWhiteSpace(); 846 strSize=strSize.stripWhiteSpace();
844 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 847 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
845 // is symlink 848 // is symlink
846 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 849 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
847 if(QDir(strItem2).exists() ) { 850 if(QDir(strItem2).exists() ) {
848 currentDir.cd(strItem2, TRUE); 851 currentDir.cd(strItem2, TRUE);
849 populateLocalView(); 852 populateLocalView();
850 } 853 }
851 } else { // not a symlink 854 } else { // not a symlink
852 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 855 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
853 856
854 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 857 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
855 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 858 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
856 currentDir.cd(strItem,FALSE); 859 currentDir.cd(strItem,FALSE);
857 populateLocalView(); 860 populateLocalView();
858 } else { 861 } else {
859 currentDir.cdUp(); 862 currentDir.cdUp();
860 populateLocalView(); 863 populateLocalView();
861 } 864 }
862 if(QDir(strItem).exists()){ 865 if(QDir(strItem).exists()){
863 currentDir.cd(strItem, TRUE); 866 currentDir.cd(strItem, TRUE);
864 populateLocalView(); 867 populateLocalView();
865 } 868 }
866 } else { 869 } else {
867 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 870 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
868 if( QFile::exists(strItem ) ) { 871 if( QFile::exists(strItem ) ) {
869 // qDebug("upload "+strItem); 872 // odebug << "upload "+strItem << oendl;
870 return; 873 return;
871 } 874 }
872 } //end not symlink 875 } //end not symlink
873 chdir(strItem.latin1()); 876 chdir(strItem.latin1());
874 } 877 }
875 Local_View->ensureItemVisible(Local_View->firstChild()); 878 Local_View->ensureItemVisible(Local_View->firstChild());
876 } 879 }
877} 880}
878 881
879void OpieFtp::doLocalCd() 882void OpieFtp::doLocalCd()
880{ 883{
881 localListClicked( Local_View->currentItem()); 884 localListClicked( Local_View->currentItem());
882} 885}
883 886
884void OpieFtp:: doRemoteCd() 887void OpieFtp:: doRemoteCd()
885{ 888{
886 remoteListClicked( Remote_View->currentItem()); 889 remoteListClicked( Remote_View->currentItem());
887 890
888} 891}
889 892
890void OpieFtp::showHidden() 893void OpieFtp::showHidden()
891{ 894{
892 if (!b) { 895 if (!b) {
893 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 896 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
894 localMenu->setItemChecked(localMenu->idAt(0),TRUE); 897 localMenu->setItemChecked(localMenu->idAt(0),TRUE);
895// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 898// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
896 b=TRUE; 899 b=TRUE;
897 900
898 } else { 901 } else {
899 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 902 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
900 localMenu->setItemChecked(localMenu->idAt(0),FALSE); 903 localMenu->setItemChecked(localMenu->idAt(0),FALSE);
901// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 904// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
902 b=FALSE; 905 b=FALSE;
903 } 906 }
904 populateLocalView(); 907 populateLocalView();
905} 908}
906 909
907void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &, int) 910void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &, int)
908{ 911{
909// if(item) 912// if(item)
910 if (mouse == 2) { 913 if (mouse == 2) {
911 showLocalMenu(item); 914 showLocalMenu(item);
912 } 915 }
913} 916}
914 917
915void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &, int ) 918void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &, int )
916{ 919{
917 if(mouse == 2) { 920 if(mouse == 2) {
918 showRemoteMenu(item); 921 showRemoteMenu(item);
919 } 922 }
920} 923}
921 924
922void OpieFtp::showRemoteMenu(QListViewItem * item) 925void OpieFtp::showRemoteMenu(QListViewItem * item)
923{ 926{
924 QPopupMenu * m;// = new QPopupMenu( Local_View ); 927 QPopupMenu * m;// = new QPopupMenu( Local_View );
925 m = new QPopupMenu(this); 928 m = new QPopupMenu(this);
926 if(item != NULL ) { 929 if(item != NULL ) {
927 if( item->text(0).find("/",0,TRUE) != -1) 930 if( item->text(0).find("/",0,TRUE) != -1)
928 m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 931 m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
929 else 932 else
930 m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 933 m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
931 } 934 }
932 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 935 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
933 m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() )); 936 m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() ));
934 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 937 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
935 m->insertSeparator(); 938 m->insertSeparator();
936 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 939 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
937 m->exec( QCursor::pos() ); 940 m->exec( QCursor::pos() );
938 delete m; 941 delete m;
939} 942}
940 943
941void OpieFtp::showLocalMenu(QListViewItem * item) 944void OpieFtp::showLocalMenu(QListViewItem * item)
942{ 945{
943 946
944 QPopupMenu *m; 947 QPopupMenu *m;
945 m = new QPopupMenu( this); 948 m = new QPopupMenu( this);
946 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 949 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
947 m->insertSeparator(); 950 m->insertSeparator();
948 if(item != NULL ) { 951 if(item != NULL ) {
949 if( item->text(0).find("/",0,TRUE) !=-1) 952 if( item->text(0).find("/",0,TRUE) !=-1)
950 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 953 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
951 else 954 else
952 m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 955 m->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
953 } 956 }
954 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 957 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
955 m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() )); 958 m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() ));
956 m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 959 m->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
957 m->insertSeparator(); 960 m->insertSeparator();
958 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 961 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
959 m->setCheckable(TRUE); 962 m->setCheckable(TRUE);
960 if (b) 963 if (b)
961 m->setItemChecked(m->idAt(0),TRUE); 964 m->setItemChecked(m->idAt(0),TRUE);
962 else 965 else
963 m->setItemChecked(m->idAt(0),FALSE); 966 m->setItemChecked(m->idAt(0),FALSE);
964 967
965 m->exec( QCursor::pos() ); 968 m->exec( QCursor::pos() );
@@ -1077,453 +1080,453 @@ void OpieFtp::remoteDelete()
1077 msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); 1080 msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn));
1078 msg.replace(QRegExp(":"),"\n"); 1081 msg.replace(QRegExp(":"),"\n");
1079 QMessageBox::message(tr("Note"),msg); 1082 QMessageBox::message(tr("Note"),msg);
1080 } 1083 }
1081 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1084 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1082 } 1085 }
1083 break; 1086 break;
1084 }; 1087 };
1085 } 1088 }
1086 } 1089 }
1087 } 1090 }
1088// QCopEnvelope ( "QPE/System", "notBusy()" ); 1091// QCopEnvelope ( "QPE/System", "notBusy()" );
1089} 1092}
1090 1093
1091void OpieFtp::remoteRename() 1094void OpieFtp::remoteRename()
1092{ 1095{
1093 QString curFile = Remote_View->currentItem()->text(0); 1096 QString curFile = Remote_View->currentItem()->text(0);
1094 InputDialog *fileDlg; 1097 InputDialog *fileDlg;
1095 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 1098 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
1096 fileDlg->setTextEdit((const QString &)curFile); 1099 fileDlg->setTextEdit((const QString &)curFile);
1097 fileDlg->exec(); 1100 fileDlg->exec();
1098 if( fileDlg->result() == 1 ) { 1101 if( fileDlg->result() == 1 ) {
1099 QString oldName = currentRemoteDir +"/"+ curFile; 1102 QString oldName = currentRemoteDir +"/"+ curFile;
1100 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; 1103 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist";
1101// QCopEnvelope ( "QPE/System", "busy()" ); 1104// QCopEnvelope ( "QPE/System", "busy()" );
1102 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { 1105 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) {
1103 QString msg; 1106 QString msg;
1104 msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); 1107 msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn));
1105 msg.replace(QRegExp(":"),"\n"); 1108 msg.replace(QRegExp(":"),"\n");
1106 QMessageBox::message(tr("Note"),msg); 1109 QMessageBox::message(tr("Note"),msg);
1107 } 1110 }
1108// QCopEnvelope ( "QPE/System", "notBusy()" ); 1111// QCopEnvelope ( "QPE/System", "notBusy()" );
1109 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1112 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1110 } 1113 }
1111} 1114}
1112 1115
1113void OpieFtp::localRename() 1116void OpieFtp::localRename()
1114{ 1117{
1115 QString curFile = Local_View->currentItem()->text(0); 1118 QString curFile = Local_View->currentItem()->text(0);
1116 InputDialog *fileDlg; 1119 InputDialog *fileDlg;
1117 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 1120 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
1118 fileDlg->setTextEdit((const QString &)curFile); 1121 fileDlg->setTextEdit((const QString &)curFile);
1119 fileDlg->exec(); 1122 fileDlg->exec();
1120 if( fileDlg->result() == 1 ) { 1123 if( fileDlg->result() == 1 ) {
1121 QString oldname = currentDir.canonicalPath() + "/" + curFile; 1124 QString oldname = currentDir.canonicalPath() + "/" + curFile;
1122 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 1125 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
1123 if( rename(oldname.latin1(), newName.latin1())== -1) 1126 if( rename(oldname.latin1(), newName.latin1())== -1)
1124 QMessageBox::message(tr("Note"),tr("Could not rename")); 1127 QMessageBox::message(tr("Note"),tr("Could not rename"));
1125 } 1128 }
1126 populateLocalView(); 1129 populateLocalView();
1127} 1130}
1128 1131
1129void OpieFtp::currentPathComboActivated(const QString & currentPath) { 1132void OpieFtp::currentPathComboActivated(const QString & currentPath) {
1130 if (TabWidget->currentPageIndex() == 0) { 1133 if (TabWidget->currentPageIndex() == 0) {
1131 chdir( currentPath.latin1() ); 1134 chdir( currentPath.latin1() );
1132 currentDir.cd( currentPath, TRUE); 1135 currentDir.cd( currentPath, TRUE);
1133 populateLocalView(); 1136 populateLocalView();
1134 update(); 1137 update();
1135 } else { 1138 } else {
1136// chdir( currentPath.latin1() ); 1139// chdir( currentPath.latin1() );
1137// currentDir.cd( currentPath, TRUE); 1140// currentDir.cd( currentPath, TRUE);
1138// populateList(); 1141// populateList();
1139// update(); 1142// update();
1140 1143
1141 } 1144 }
1142} 1145}
1143 1146
1144void OpieFtp::fillCombo(const QString &currentPath) { 1147void OpieFtp::fillCombo(const QString &currentPath) {
1145 1148
1146 currentPathCombo->lineEdit()->setText(currentPath); 1149 currentPathCombo->lineEdit()->setText(currentPath);
1147 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1150 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1148 currentPathCombo->clear(); 1151 currentPathCombo->clear();
1149 localDirPathStringList.prepend(currentPath ); 1152 localDirPathStringList.prepend(currentPath );
1150 currentPathCombo->insertStringList( localDirPathStringList,-1); 1153 currentPathCombo->insertStringList( localDirPathStringList,-1);
1151 } 1154 }
1152 currentPathCombo->lineEdit()->setText(currentPath); 1155 currentPathCombo->lineEdit()->setText(currentPath);
1153 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1156 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1154 currentPathCombo->clear(); 1157 currentPathCombo->clear();
1155 remoteDirPathStringList.prepend(currentPath ); 1158 remoteDirPathStringList.prepend(currentPath );
1156 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1159 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1157 } 1160 }
1158} 1161}
1159 1162
1160void OpieFtp::fillRemoteCombo(const QString &currentPath) { 1163void OpieFtp::fillRemoteCombo(const QString &currentPath) {
1161 1164
1162 currentPathCombo->lineEdit()->setText(currentPath); 1165 currentPathCombo->lineEdit()->setText(currentPath);
1163 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1166 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1164 currentPathCombo->clear(); 1167 currentPathCombo->clear();
1165 remoteDirPathStringList.prepend(currentPath ); 1168 remoteDirPathStringList.prepend(currentPath );
1166 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1169 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1167 } 1170 }
1168} 1171}
1169 1172
1170void OpieFtp::currentPathComboChanged() 1173void OpieFtp::currentPathComboChanged()
1171{ 1174{
1172 QString oldRemoteCurrentDir = currentRemoteDir; 1175 QString oldRemoteCurrentDir = currentRemoteDir;
1173// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); 1176// odebug << "oldRemoteCurrentDir "+oldRemoteCurrentDir << oendl;
1174 if (TabWidget->currentPageIndex() == 0) { 1177 if (TabWidget->currentPageIndex() == 0) {
1175 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 1178 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
1176 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 1179 currentDir.setPath( currentPathCombo->lineEdit()->text() );
1177 populateLocalView(); 1180 populateLocalView();
1178 } else { 1181 } else {
1179 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 1182 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
1180 } 1183 }
1181 } 1184 }
1182 if (TabWidget->currentPageIndex() == 1) { 1185 if (TabWidget->currentPageIndex() == 1) {
1183 currentRemoteDir = currentPathCombo->lineEdit()->text(); 1186 currentRemoteDir = currentPathCombo->lineEdit()->text();
1184 if(currentRemoteDir.right(1) !="/") { 1187 if(currentRemoteDir.right(1) !="/") {
1185 currentRemoteDir = currentRemoteDir +"/"; 1188 currentRemoteDir = currentRemoteDir +"/";
1186 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 1189 currentPathCombo->lineEdit()->setText( currentRemoteDir );
1187 } 1190 }
1188 if( !remoteChDir( (const QString &)currentRemoteDir) ) { 1191 if( !remoteChDir( (const QString &)currentRemoteDir) ) {
1189 currentRemoteDir = oldRemoteCurrentDir; 1192 currentRemoteDir = oldRemoteCurrentDir;
1190 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 1193 currentPathCombo->lineEdit()->setText( currentRemoteDir );
1191 } 1194 }
1192 1195
1193 remoteDirList( (const QString &)currentRemoteDir); 1196 remoteDirList( (const QString &)currentRemoteDir);
1194 } 1197 }
1195} 1198}
1196 1199
1197void OpieFtp::switchToLocalTab() 1200void OpieFtp::switchToLocalTab()
1198{ 1201{
1199 TabWidget->setCurrentPage(0); 1202 TabWidget->setCurrentPage(0);
1200} 1203}
1201 1204
1202void OpieFtp::switchToRemoteTab() 1205void OpieFtp::switchToRemoteTab()
1203{ 1206{
1204 TabWidget->setCurrentPage(1); 1207 TabWidget->setCurrentPage(1);
1205} 1208}
1206 1209
1207void OpieFtp::switchToConfigTab() 1210void OpieFtp::switchToConfigTab()
1208{ 1211{
1209 TabWidget->setCurrentPage(2); 1212 TabWidget->setCurrentPage(2);
1210} 1213}
1211 1214
1212void OpieFtp::readConfig() 1215void OpieFtp::readConfig()
1213{ 1216{
1214 fillCombos(); 1217 fillCombos();
1215 Config cfg("opieftp"); 1218 Config cfg("opieftp");
1216 cfg.setGroup("Server"); 1219 cfg.setGroup("Server");
1217 currentServerConfig = cfg.readNumEntry("currentServer", -1); 1220 currentServerConfig = cfg.readNumEntry("currentServer", -1);
1218 1221
1219// qDebug("Reading %d", currentServerConfig); 1222// odebug << "Reading " << currentServerConfig << "" << oendl;
1220 serverComboSelected( currentServerConfig-1); 1223 serverComboSelected( currentServerConfig-1);
1221 1224
1222} 1225}
1223 1226
1224void OpieFtp::writeConfig() 1227void OpieFtp::writeConfig()
1225{ 1228{
1226 qDebug("write config"); 1229 odebug << "write config" << oendl;
1227 Config cfg("opieftp"); 1230 Config cfg("opieftp");
1228 cfg.setGroup("Server"); 1231 cfg.setGroup("Server");
1229 1232
1230 QString username, remoteServerStr, remotePathStr, password, port, temp; 1233 QString username, remoteServerStr, remotePathStr, password, port, temp;
1231 1234
1232 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1235 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1233 1236
1234 if( currentServerConfig == -1) { 1237 if( currentServerConfig == -1) {
1235 1238
1236 for (int i = 1; i <= numberOfEntries; i++) { 1239 for (int i = 1; i <= numberOfEntries; i++) {
1237 temp.setNum(i); 1240 temp.setNum(i);
1238 cfg.setGroup("Server"); 1241 cfg.setGroup("Server");
1239 QString tempStr = cfg.readEntry( temp,""); 1242 QString tempStr = cfg.readEntry( temp,"");
1240 } 1243 }
1241 1244
1242 temp.setNum( numberOfEntries + 1); 1245 temp.setNum( numberOfEntries + 1);
1243 cfg.setGroup("Server"); 1246 cfg.setGroup("Server");
1244 1247
1245 remoteServerStr = cfg.readEntry( temp,""); 1248 remoteServerStr = cfg.readEntry( temp,"");
1246 1249
1247 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1250 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1248 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1251 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1249 1252
1250 temp.setNum(numberOfEntries+1); 1253 temp.setNum(numberOfEntries+1);
1251 cfg.setGroup("Server"); 1254 cfg.setGroup("Server");
1252 1255
1253 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); 1256 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() );
1254 cfg.writeEntry("currentServer", numberOfEntries+1); 1257 cfg.writeEntry("currentServer", numberOfEntries+1);
1255 1258
1256 currentServerConfig = numberOfEntries+1; 1259 currentServerConfig = numberOfEntries+1;
1257 qDebug("setting currentserverconfig to %d", currentServerConfig); 1260 odebug << "setting currentserverconfig to " << currentServerConfig << "" << oendl;
1258 1261
1259 cfg.setGroup(temp); 1262 cfg.setGroup(temp);
1260 if(!newServerName.isEmpty()) 1263 if(!newServerName.isEmpty())
1261 cfg.writeEntry("ServerName", newServerName); 1264 cfg.writeEntry("ServerName", newServerName);
1262 1265
1263 cfg.writeEntry("RemotePath", remotePath->text()); 1266 cfg.writeEntry("RemotePath", remotePath->text());
1264 1267
1265 cfg.writeEntry("Username", UsernameComboBox->currentText()); 1268 cfg.writeEntry("Username", UsernameComboBox->currentText());
1266 1269
1267 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); 1270 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text());
1268 cfg.setGroup("Server"); 1271 cfg.setGroup("Server");
1269 1272
1270 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); 1273 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 ));
1271 1274
1272 } 1275 }
1273} 1276}
1274 1277
1275void OpieFtp::clearCombos() { 1278void OpieFtp::clearCombos() {
1276 qDebug("clearing"); 1279 odebug << "clearing" << oendl;
1277 ServerComboBox->clear(); 1280 ServerComboBox->clear();
1278 UsernameComboBox->clear(); 1281 UsernameComboBox->clear();
1279 PasswordEdit->clear(); 1282 PasswordEdit->clear();
1280 serverListView->clear(); 1283 serverListView->clear();
1281} 1284}
1282 1285
1283 1286
1284void OpieFtp::fillCombos() 1287void OpieFtp::fillCombos()
1285{ 1288{
1286 clearCombos(); 1289 clearCombos();
1287 1290
1288 Config cfg("opieftp"); 1291 Config cfg("opieftp");
1289 cfg.setGroup("Server"); 1292 cfg.setGroup("Server");
1290 QString username, remoteServerStr, remotePathStr, password, port, temp; 1293 QString username, remoteServerStr, remotePathStr, password, port, temp;
1291 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1294 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1292 1295
1293 for (int i = 1; i <= numberOfEntries; i++) { 1296 for (int i = 1; i <= numberOfEntries; i++) {
1294 temp.setNum(i); 1297 temp.setNum(i);
1295 qDebug(temp); 1298 odebug << temp << oendl;
1296 cfg.setGroup("Server"); 1299 cfg.setGroup("Server");
1297 remoteServerStr = cfg.readEntry( temp,""); 1300 remoteServerStr = cfg.readEntry( temp,"");
1298 qDebug( remoteServerStr); 1301 odebug << remoteServerStr << oendl;
1299 1302
1300 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1303 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1301 port = remoteServerStr.right( divider - 1); 1304 port = remoteServerStr.right( divider - 1);
1302 bool ok; 1305 bool ok;
1303 PortSpinBox->setValue( port.toInt(&ok,10)); 1306 PortSpinBox->setValue( port.toInt(&ok,10));
1304 1307
1305 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1308 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1306 qDebug( "remote server string "+remoteServerStr); 1309 odebug << "remote server string "+remoteServerStr << oendl;
1307 ServerComboBox->insertItem( remoteServerStr ); 1310 ServerComboBox->insertItem( remoteServerStr );
1308 1311
1309 cfg.setGroup(temp); 1312 cfg.setGroup(temp);
1310 1313
1311 username = cfg.readEntry(temp); 1314 username = cfg.readEntry(temp);
1312 UsernameComboBox->insertItem(username); 1315 UsernameComboBox->insertItem(username);
1313 password = cfg.readEntryCrypt(username,""); 1316 password = cfg.readEntryCrypt(username,"");
1314 PasswordEdit->setText(password); 1317 PasswordEdit->setText(password);
1315 1318
1316 serverListView->insertItem( cfg.readEntry("ServerName")); 1319 serverListView->insertItem( cfg.readEntry("ServerName"));
1317 } 1320 }
1318} 1321}
1319 1322
1320 1323
1321void OpieFtp::serverComboSelected(int index) 1324void OpieFtp::serverComboSelected(int index)
1322{ 1325{
1323 currentServerConfig = index+1; 1326 currentServerConfig = index+1;
1324 qDebug("server combo selected %d", index+1); 1327 odebug << "server combo selected " << index+1 << "" << oendl;
1325 QString username, remoteServerStr, remotePathStr, password, port, temp; 1328 QString username, remoteServerStr, remotePathStr, password, port, temp;
1326// remoteServerStr = ServerComboBox->text(index); 1329// remoteServerStr = ServerComboBox->text(index);
1327 1330
1328 Config cfg("opieftp"); 1331 Config cfg("opieftp");
1329 cfg.setGroup("Server"); 1332 cfg.setGroup("Server");
1330// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1333// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1331 1334
1332 temp.setNum(index+1); 1335 temp.setNum(index+1);
1333 remoteServerStr = cfg.readEntry( temp,""); 1336 remoteServerStr = cfg.readEntry( temp,"");
1334 1337
1335 qDebug("Group" +temp); 1338 odebug << "Group" +temp << oendl;
1336 cfg.setGroup(temp); 1339 cfg.setGroup(temp);
1337// qDebug(temp); 1340// odebug << temp << oendl;
1338 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1341 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1339 port = remoteServerStr.right( divider - 1); 1342 port = remoteServerStr.right( divider - 1);
1340 bool ok; 1343 bool ok;
1341 int portInt = port.toInt(&ok,10); 1344 int portInt = port.toInt(&ok,10);
1342 if( portInt == 0) portInt = 21; 1345 if( portInt == 0) portInt = 21;
1343 1346
1344 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); 1347 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE)));
1345 1348
1346 PortSpinBox->setValue( portInt); 1349 PortSpinBox->setValue( portInt);
1347 1350
1348 remotePath->setText(cfg.readEntry("RemotePath", "/")); 1351 remotePath->setText(cfg.readEntry("RemotePath", "/"));
1349 1352
1350 username = cfg.readEntry("Username", "anonymous"); 1353 username = cfg.readEntry("Username", "anonymous");
1351 UsernameComboBox->lineEdit()->setText(username); 1354 UsernameComboBox->lineEdit()->setText(username);
1352 qDebug(username); 1355 odebug << username << oendl;
1353// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); 1356// odebug << "Password is "+cfg.readEntryCrypt(username << oendl;
1354 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); 1357 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
1355// UsernameComboBox 1358// UsernameComboBox
1356// PasswordEdit 1359// PasswordEdit
1357 1360
1358 cfg.setGroup("Server"); 1361 cfg.setGroup("Server");
1359 temp.sprintf("%d",currentServerConfig); 1362 temp.sprintf("%d",currentServerConfig);
1360 cfg.writeEntry("currentServer", temp); 1363 cfg.writeEntry("currentServer", temp);
1361 1364
1362 fuckeduphack = TRUE; 1365 fuckeduphack = TRUE;
1363 serverListView->setCurrentItem( index); 1366 serverListView->setCurrentItem( index);
1364 fuckeduphack=FALSE; 1367 fuckeduphack=FALSE;
1365 qDebug("server list set selected %d",index); 1368 odebug << "server list set selected " << index << "" << oendl;
1366 update(); 1369 update();
1367} 1370}
1368 1371
1369void OpieFtp::deleteServer() 1372void OpieFtp::deleteServer()
1370{ 1373{
1371 QString username, remoteServerStr, remotePathStr, password, port, temp, servername; 1374 QString username, remoteServerStr, remotePathStr, password, port, temp, servername;
1372 remoteServerStr = ServerComboBox->currentText( ); 1375 remoteServerStr = ServerComboBox->currentText( );
1373 username = UsernameComboBox->currentText(); 1376 username = UsernameComboBox->currentText();
1374 servername=serverListView->currentText(); 1377 servername=serverListView->currentText();
1375 1378
1376 Config cfg("opieftp"); 1379 Config cfg("opieftp");
1377 cfg.setGroup("Server"); 1380 cfg.setGroup("Server");
1378 QString tempname; 1381 QString tempname;
1379 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1382 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1380 1383
1381 for (int i = 1; i <= numberOfEntries; i++) { 1384 for (int i = 1; i <= numberOfEntries; i++) {
1382 temp.setNum(i); 1385 temp.setNum(i);
1383// cfg.setGroup("Server"); 1386// cfg.setGroup("Server");
1384 cfg.setGroup(QString::number(i)); 1387 cfg.setGroup(QString::number(i));
1385 tempname=cfg.readEntry( "ServerName",""); 1388 tempname=cfg.readEntry( "ServerName","");
1386 1389
1387 if( tempname.find( servername,0,TRUE) != -1 ) { 1390 if( tempname.find( servername,0,TRUE) != -1 ) {
1388// servername.find( cfg.readEntry("ServerName")) != -1 && 1391// servername.find( cfg.readEntry("ServerName")) != -1 &&
1389// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && 1392// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 &&
1390// username.find( cfg.readEntry("Username")) != -1) { 1393// username.find( cfg.readEntry("Username")) != -1) {
1391 1394
1392 serverListView->removeItem(i); 1395 serverListView->removeItem(i);
1393 1396
1394 qDebug("OK DELETE "+tempname); 1397 odebug << "OK DELETE "+tempname << oendl;
1395 cfg.removeEntry(QString::number(i)); 1398 cfg.removeEntry(QString::number(i));
1396 for ( ; i <= numberOfEntries; i++) { 1399 for ( ; i <= numberOfEntries; i++) {
1397 cfg.setGroup("Server"); 1400 cfg.setGroup("Server");
1398 cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); 1401 cfg.writeEntry("Server", QString::number(numberOfEntries + 1 ));
1399 1402
1400 cfg.setGroup(QString::number(i+1)); //get next server config 1403 cfg.setGroup(QString::number(i+1)); //get next server config
1401 servername=cfg.readEntry("ServerName"); 1404 servername=cfg.readEntry("ServerName");
1402 remoteServerStr=cfg.readEntry("RemotePath"); 1405 remoteServerStr=cfg.readEntry("RemotePath");
1403 username=cfg.readEntry("Username"); 1406 username=cfg.readEntry("Username");
1404 password=cfg.readEntryCrypt( username); 1407 password=cfg.readEntryCrypt( username);
1405 1408
1406 cfg.setGroup(QString::number(i)); 1409 cfg.setGroup(QString::number(i));
1407 1410
1408 cfg.writeEntry("RemotePath", remoteServerStr); 1411 cfg.writeEntry("RemotePath", remoteServerStr);
1409 cfg.writeEntry("ServerName", servername); 1412 cfg.writeEntry("ServerName", servername);
1410 cfg.writeEntry("Username", username); 1413 cfg.writeEntry("Username", username);
1411 cfg.writeEntryCrypt( username, password); 1414 cfg.writeEntryCrypt( username, password);
1412 1415
1413 } 1416 }
1414 cfg.setGroup("Server"); 1417 cfg.setGroup("Server");
1415 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries - 1 )); 1418 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries - 1 ));
1416 } 1419 }
1417 } 1420 }
1418 cfg.setGroup(QString::number(numberOfEntries)); 1421 cfg.setGroup(QString::number(numberOfEntries));
1419 cfg.removeEntry("Server"); 1422 cfg.removeEntry("Server");
1420 cfg.removeEntry("RemotePath"); 1423 cfg.removeEntry("RemotePath");
1421 cfg.removeEntry("ServerName"); 1424 cfg.removeEntry("ServerName");
1422 username=cfg.readEntry("Username"); 1425 username=cfg.readEntry("Username");
1423 cfg.removeEntry("Username"); 1426 cfg.removeEntry("Username");
1424 cfg.removeEntry(username); 1427 cfg.removeEntry(username);
1425 1428
1426 currentServerConfig=currentServerConfig-1; 1429 currentServerConfig=currentServerConfig-1;
1427 1430
1428 fillCombos(); 1431 fillCombos();
1429 update(); 1432 update();
1430} 1433}
1431 1434
1432void OpieFtp::upDir() 1435void OpieFtp::upDir()
1433{ 1436{
1434 if (TabWidget->currentPageIndex() == 0) { 1437 if (TabWidget->currentPageIndex() == 0) {
1435 QString current = currentDir.canonicalPath(); 1438 QString current = currentDir.canonicalPath();
1436 QDir dir(current); 1439 QDir dir(current);
1437 dir.cdUp(); 1440 dir.cdUp();
1438 current = dir.canonicalPath(); 1441 current = dir.canonicalPath();
1439 chdir( current.latin1() ); 1442 chdir( current.latin1() );
1440 currentDir.cd( current, TRUE); 1443 currentDir.cd( current, TRUE);
1441 populateLocalView(); 1444 populateLocalView();
1442 update(); 1445 update();
1443 } else { 1446 } else {
1444 if( FtpCDUp( conn) == 0) { 1447 if( FtpCDUp( conn) == 0) {
1445 QString msg; 1448 QString msg;
1446 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 1449 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
1447 msg.replace(QRegExp(":"),"\n"); 1450 msg.replace(QRegExp(":"),"\n");
1448 QMessageBox::message(tr("Note"),msg); 1451 QMessageBox::message(tr("Note"),msg);
1449// qDebug(msg); 1452// odebug << msg << oendl;
1450 } 1453 }
1451 char path[256]; 1454 char path[256];
1452 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 1455 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
1453 QString msg; 1456 QString msg;
1454 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 1457 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
1455 msg.replace(QRegExp(":"),"\n"); 1458 msg.replace(QRegExp(":"),"\n");
1456 QMessageBox::message(tr("Note"),msg); 1459 QMessageBox::message(tr("Note"),msg);
1457// qDebug(msg); 1460// odebug << msg << oendl;
1458 } 1461 }
1459 currentRemoteDir=path; 1462 currentRemoteDir=path;
1460 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1463 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1461 if(currentRemoteDir.right(1) !="/") 1464 if(currentRemoteDir.right(1) !="/")
1462 currentRemoteDir +="/"; 1465 currentRemoteDir +="/";
1463 currentPathCombo->lineEdit()->setText( currentRemoteDir); 1466 currentPathCombo->lineEdit()->setText( currentRemoteDir);
1464 fillRemoteCombo( (const QString &)currentRemoteDir); 1467 fillRemoteCombo( (const QString &)currentRemoteDir);
1465 1468
1466 } 1469 }
1467} 1470}
1468 1471
1469void OpieFtp::docButtonPushed() { 1472void OpieFtp::docButtonPushed() {
1470 QString current = QPEApplication::documentDir(); 1473 QString current = QPEApplication::documentDir();
1471 chdir( current.latin1() ); 1474 chdir( current.latin1() );
1472 currentDir.cd( current, TRUE); 1475 currentDir.cd( current, TRUE);
1473 populateLocalView(); 1476 populateLocalView();
1474 update(); 1477 update();
1475 1478
1476} 1479}
1477 1480
1478void OpieFtp::homeButtonPushed() { 1481void OpieFtp::homeButtonPushed() {
1479 QString current = QDir::homeDirPath(); 1482 QString current = QDir::homeDirPath();
1480 chdir( current.latin1() ); 1483 chdir( current.latin1() );
1481 currentDir.cd( current, TRUE); 1484 currentDir.cd( current, TRUE);
1482 populateLocalView(); 1485 populateLocalView();
1483 update(); 1486 update();
1484} 1487}
1485 1488
1486void OpieFtp::doAbout() { 1489void OpieFtp::doAbout() {
1487 QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n" 1490 QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n"
1488 "L.J.Potter<llornkcor@handhelds.org>\n" 1491 "L.J.Potter<llornkcor@handhelds.org>\n"
1489 "and uses ftplib copyright 1996-2000\n" 1492 "and uses ftplib copyright 1996-2000\n"
1490 "by Thomas Pfau, pfau@cnj.digex.net\n\n" 1493 "by Thomas Pfau, pfau@cnj.digex.net\n\n"
1491 "and is licensed by the GPL"); 1494 "and is licensed by the GPL");
1492} 1495}
1493 1496
1494void OpieFtp::NewServer() { 1497void OpieFtp::NewServer() {
1495 InputDialog *fileDlg; 1498 InputDialog *fileDlg;
1496 fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0); 1499 fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0);
1497 fileDlg->exec(); 1500 fileDlg->exec();
1498 Config cfg("opieftp"); 1501 Config cfg("opieftp");
1499 if( fileDlg->result() == 1 ) { 1502 if( fileDlg->result() == 1 ) {
1500 newServerName = fileDlg->LineEdit1->text(); 1503 newServerName = fileDlg->LineEdit1->text();
1501 for(int i=1;i<serverListView->count();i++) { 1504 for(int i=1;i<serverListView->count();i++) {
1502 cfg.setGroup( QString::number(i)); 1505 cfg.setGroup( QString::number(i));
1503 if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) { 1506 if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) {
1504 QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken")); 1507 QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken"));
1505 return; 1508 return;
1506 } 1509 }
1507 } 1510 }
1508 currentServerConfig =-1; 1511 currentServerConfig =-1;
1509 writeConfig(); 1512 writeConfig();
1510 serverListView->insertItem( newServerName ); 1513 serverListView->insertItem( newServerName );
1511 serverListView->setCurrentItem( serverListView->count()); 1514 serverListView->setCurrentItem( serverListView->count());
1512 } 1515 }
1513} 1516}
1514 1517
1515void OpieFtp::serverListClicked( const QString &item) { 1518void OpieFtp::serverListClicked( const QString &item) {
1516 if(item.isEmpty()) return; 1519 if(item.isEmpty()) return;
1517 Config cfg("opieftp"); 1520 Config cfg("opieftp");
1518 qDebug("highltined "+item); 1521 odebug << "highltined "+item << oendl;
1519 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1522 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1520 for (int i = 1; i <= numberOfEntries; i++) { 1523 for (int i = 1; i <= numberOfEntries; i++) {
1521 cfg.setGroup(QString::number(i)); 1524 cfg.setGroup(QString::number(i));
1522 if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack) 1525 if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack)
1523 serverComboSelected(i-1); 1526 serverComboSelected(i-1);
1524 } 1527 }
1525} 1528}
1526 1529
1527void OpieFtp::timerOut() { 1530void OpieFtp::timerOut() {
1528 1531
1529} 1532}
diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro
index 2f97dc2..003b166 100644
--- a/noncore/net/opieftp/opieftp.pro
+++ b/noncore/net/opieftp/opieftp.pro
@@ -1,11 +1,10 @@
1#CONFIG += qt warn_on quick-app 1CONFIG += qt warn_on
2CONFIG += qt warn_on 2HEADERS = opieftp.h inputDialog.h
3HEADERS = opieftp.h inputDialog.h 3SOURCES = opieftp.cpp inputDialog.cpp main.cpp
4SOURCES = opieftp.cpp inputDialog.cpp main.cpp 4TARGET = opieftp
5TARGET = opieftp
6INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lqpe -lftplib 7LIBS += -lqpe -lopiecore2 -lftplib
9DESTDIR = $(OPIEDIR)/bin 8DESTDIR = $(OPIEDIR)/bin
10 9
11include ( $(OPIEDIR)/include.pro ) 10include ( $(OPIEDIR)/include.pro )