summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/inputDialog.cpp2
-rw-r--r--noncore/net/opieftp/opieftp.cpp90
-rw-r--r--noncore/net/opieftp/opieftp.pro2
3 files changed, 47 insertions, 47 deletions
diff --git a/noncore/net/opieftp/inputDialog.cpp b/noncore/net/opieftp/inputDialog.cpp
index 22205d3..89b345e 100644
--- a/noncore/net/opieftp/inputDialog.cpp
+++ b/noncore/net/opieftp/inputDialog.cpp
@@ -1,40 +1,40 @@
1/**************************************************************************** 1/****************************************************************************
2 inputDialog.cpp 2 inputDialog.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 12
13#include "inputDialog.h" 13#include "inputDialog.h"
14 14
15#include <qlineedit.h> 15#include <qlineedit.h>
16#include <qlayout.h> 16#include <qlayout.h>
17#include <qvariant.h> 17#include <qvariant.h>
18#include <qtooltip.h> 18#include <qtooltip.h>
19#include <qwhatsthis.h> 19#include <qwhatsthis.h>
20 20
21 21
22InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 22InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
23 : QDialog( parent, name, modal, fl ) 23 : QDialog( parent, name, modal, fl )
24{ 24{
25 if ( !name ) 25 if ( !name )
26 setName( "InputDialog" ); 26 setName( "InputDialog" );
27 resize( 234, 50 ); 27 resize( 234, 50 );
28 setMaximumSize( QSize( 240, 50 ) ); 28 setMaximumSize( QSize( 240, 50 ) );
29 setCaption( tr(name ) ); 29 setCaption( tr(name ) );
30 30
31 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 31 LineEdit1 = new QLineEdit( this, "LineEdit1" );
32 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); 32 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
33} 33}
34 34
35InputDialog::~InputDialog() 35InputDialog::~InputDialog()
36{ 36{
37 inputText= LineEdit1->text(); 37 inputText= LineEdit1->text();
38 38
39} 39}
40 40
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 814d706..f70011b 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -1,916 +1,916 @@
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 12
13#include "opieftp.h" 13#include "opieftp.h"
14#include "ftplib.h" 14#include "ftplib.h"
15#include "inputDialog.h" 15#include "inputDialog.h"
16 16
17#include <qpe/qpemenubar.h> 17#include <qpe/qpemenubar.h>
18#include <qpe/qpetoolbar.h> 18#include <qpe/qpetoolbar.h>
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
22 22
23#include <qtextstream.h> 23#include <qtextstream.h>
24#include <qtoolbutton.h> 24#include <qtoolbutton.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qdir.h> 26#include <qdir.h>
27#include <qfile.h> 27#include <qfile.h>
28#include <qstring.h> 28#include <qstring.h>
29#include <qcombobox.h> 29#include <qcombobox.h>
30#include <qpopupmenu.h> 30#include <qpopupmenu.h>
31#include <qlistview.h> 31#include <qlistview.h>
32#include <qmainwindow.h> 32#include <qmainwindow.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qprogressbar.h> 34#include <qprogressbar.h>
35#include <qspinbox.h> 35#include <qspinbox.h>
36#include <qtabwidget.h> 36#include <qtabwidget.h>
37#include <qwidget.h> 37#include <qwidget.h>
38#include <qlayout.h> 38#include <qlayout.h>
39#include <qimage.h> 39#include <qimage.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qmessagebox.h> 41#include <qmessagebox.h>
42#include <qlineedit.h> 42#include <qlineedit.h>
43#include <qregexp.h> 43#include <qregexp.h>
44 44
45#include <unistd.h> 45#include <unistd.h>
46#include <stdlib.h> 46#include <stdlib.h>
47 47
48 48
49QProgressBar *ProgressBar; 49QProgressBar *ProgressBar;
50static netbuf *conn=NULL; 50static netbuf *conn=NULL;
51 51
52static int log_progress(netbuf *ctl, int xfered, void *arg) 52static int log_progress(netbuf *ctl, int xfered, void *arg)
53{ 53{
54 int fsz = *(int *)arg; 54 int fsz = *(int *)arg;
55 int pct = (xfered * 100) / fsz; 55 int pct = (xfered * 100) / fsz;
56// printf("%3d%%\r", pct); 56// printf("%3d%%\r", pct);
57// fflush(stdout); 57// fflush(stdout);
58 ProgressBar->setProgress(xfered); 58 ProgressBar->setProgress(xfered);
59 qApp->processEvents(); 59 qApp->processEvents();
60 return 1; 60 return 1;
61} 61}
62 62
63OpieFtp::OpieFtp( ) 63OpieFtp::OpieFtp( )
64 : QMainWindow( ) 64 : QMainWindow( )
65{ 65{
66 setCaption( tr( "OpieFtp" ) ); 66 setCaption( tr( "OpieFtp" ) );
67 67
68 QGridLayout *layout = new QGridLayout( this ); 68 QGridLayout *layout = new QGridLayout( this );
69 layout->setSpacing( 2); 69 layout->setSpacing( 2);
70 layout->setMargin( 2); 70 layout->setMargin( 2);
71 71
72 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 72 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
73 73
74 QPEMenuBar *menuBar = new QPEMenuBar(this); 74 QPEMenuBar *menuBar = new QPEMenuBar(this);
75 connectionMenu = new QPopupMenu( this ); 75 connectionMenu = new QPopupMenu( this );
76 localMenu = new QPopupMenu( this ); 76 localMenu = new QPopupMenu( this );
77 remoteMenu = new QPopupMenu( this ); 77 remoteMenu = new QPopupMenu( this );
78 tabMenu = new QPopupMenu( this ); 78 tabMenu = new QPopupMenu( this );
79 79
80 layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 ); 80 layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 );
81 81
82 menuBar->insertItem( tr( "Connection" ), connectionMenu); 82 menuBar->insertItem( tr( "Connection" ), connectionMenu);
83 menuBar->insertItem( tr( "Local" ), localMenu); 83 menuBar->insertItem( tr( "Local" ), localMenu);
84 menuBar->insertItem( tr( "Remote" ), remoteMenu); 84 menuBar->insertItem( tr( "Remote" ), remoteMenu);
85 menuBar->insertItem( tr( "View" ), tabMenu); 85 menuBar->insertItem( tr( "View" ), tabMenu);
86 86
87 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 87 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
88 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 88 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
89 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 89 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
90 90
91 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 91 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
92 localMenu->insertSeparator(); 92 localMenu->insertSeparator();
93 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 93 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
94 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 94 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
95 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 95 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
96 localMenu->insertSeparator(); 96 localMenu->insertSeparator();
97 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 97 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
98 localMenu->setCheckable(TRUE); 98 localMenu->setCheckable(TRUE);
99 99
100 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 100 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
101 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 101 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
102 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 102 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
103 remoteMenu->insertSeparator(); 103 remoteMenu->insertSeparator();
104 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 104 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
105 105
106 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 106 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
107 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 107 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
108 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); 108 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
109 tabMenu->setCheckable(TRUE); 109 tabMenu->setCheckable(TRUE);
110 110
111 TabWidget = new QTabWidget( this, "TabWidget" ); 111 TabWidget = new QTabWidget( this, "TabWidget" );
112 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); 112 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 );
113 113
114 TabWidget->setTabShape(QTabWidget::Triangular); 114 TabWidget->setTabShape(QTabWidget::Triangular);
115 115
116 tab = new QWidget( TabWidget, "tab" ); 116 tab = new QWidget( TabWidget, "tab" );
117 tabLayout = new QGridLayout( tab ); 117 tabLayout = new QGridLayout( tab );
118 tabLayout->setSpacing( 2); 118 tabLayout->setSpacing( 2);
119 tabLayout->setMargin( 2); 119 tabLayout->setMargin( 2);
120 120
121 Local_View = new QListView( tab, "Local_View" ); 121 Local_View = new QListView( tab, "Local_View" );
122// Local_View->setResizePolicy( QListView::AutoOneFit ); 122// Local_View->setResizePolicy( QListView::AutoOneFit );
123 Local_View->addColumn( "File",120); 123 Local_View->addColumn( tr("File"),120);
124 Local_View->addColumn( "Size",-1); 124 Local_View->addColumn( tr("Size"),-1);
125 Local_View->setColumnAlignment(1,QListView::AlignRight); 125 Local_View->setColumnAlignment(1,QListView::AlignRight);
126 Local_View->addColumn( "Date",-1); 126 Local_View->addColumn( tr("Date"),-1);
127 Local_View->setColumnAlignment(2,QListView::AlignRight); 127 Local_View->setColumnAlignment(2,QListView::AlignRight);
128 Local_View->setAllColumnsShowFocus(TRUE); 128 Local_View->setAllColumnsShowFocus(TRUE);
129 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 129 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
130 130
131 tabLayout->addWidget( Local_View, 0, 0 ); 131 tabLayout->addWidget( Local_View, 0, 0 );
132 132
133 connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), 133 connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)),
134 this,SLOT( localListClicked(QListViewItem *)) ); 134 this,SLOT( localListClicked(QListViewItem *)) );
135 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 135 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
136 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 136 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
137 137
138 TabWidget->insertTab( tab, tr( "Local" ) ); 138 TabWidget->insertTab( tab, tr( "Local" ) );
139 139
140 tab_2 = new QWidget( TabWidget, "tab_2" ); 140 tab_2 = new QWidget( TabWidget, "tab_2" );
141 tabLayout_2 = new QGridLayout( tab_2 ); 141 tabLayout_2 = new QGridLayout( tab_2 );
142 tabLayout_2->setSpacing( 2); 142 tabLayout_2->setSpacing( 2);
143 tabLayout_2->setMargin( 2); 143 tabLayout_2->setMargin( 2);
144 144
145 Remote_View = new QListView( tab_2, "Remote_View" ); 145 Remote_View = new QListView( tab_2, "Remote_View" );
146 Remote_View->addColumn( "File",120); 146 Remote_View->addColumn( tr("File"),120);
147 Remote_View->addColumn( "Size",-1); 147 Remote_View->addColumn( tr("Size"),-1);
148 Remote_View->setColumnAlignment(1,QListView::AlignRight); 148 Remote_View->setColumnAlignment(1,QListView::AlignRight);
149 Remote_View->addColumn( "Date",-1); 149 Remote_View->addColumn( tr("Date"),-1);
150 Remote_View->setColumnAlignment(2,QListView::AlignRight); 150 Remote_View->setColumnAlignment(2,QListView::AlignRight);
151 Remote_View->setAllColumnsShowFocus(TRUE); 151 Remote_View->setAllColumnsShowFocus(TRUE);
152 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 152 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
153 153
154 connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), 154 connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)),
155 this,SLOT( remoteListClicked(QListViewItem *)) ); 155 this,SLOT( remoteListClicked(QListViewItem *)) );
156 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 156 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
157 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 157 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) );
158 158
159 tabLayout_2->addWidget( Remote_View, 0, 0 ); 159 tabLayout_2->addWidget( Remote_View, 0, 0 );
160 160
161 TabWidget->insertTab( tab_2, tr( "Remote" ) ); 161 TabWidget->insertTab( tab_2, tr( "Remote" ) );
162 162
163 tab_3 = new QWidget( TabWidget, "tab_3" ); 163 tab_3 = new QWidget( TabWidget, "tab_3" );
164 tabLayout_3 = new QGridLayout( tab_3 ); 164 tabLayout_3 = new QGridLayout( tab_3 );
165 tabLayout_3->setSpacing( 2); 165 tabLayout_3->setSpacing( 2);
166 tabLayout_3->setMargin( 2); 166 tabLayout_3->setMargin( 2);
167 167
168 TextLabel1 = new QLabel( tab_3, "TextLabel1" ); 168 TextLabel1 = new QLabel( tab_3, "TextLabel1" );
169 TextLabel1->setText( tr( "Username" ) ); 169 TextLabel1->setText( tr( "Username" ) );
170 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); 170 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
171 171
172 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); 172 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
173 UsernameComboBox->setEditable(TRUE); 173 UsernameComboBox->setEditable(TRUE);
174// UsernameComboBox->lineEdit()->setText("anonymous"); 174// UsernameComboBox->lineEdit()->setText("anonymous");
175 UsernameComboBox->lineEdit()->setText("root"); 175 UsernameComboBox->lineEdit()->setText("root");
176// UsernameComboBox->lineEdit()->setText("llornkcor"); 176// UsernameComboBox->lineEdit()->setText("llornkcor");
177 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); 177 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
178 178
179 TextLabel2 = new QLabel( tab_3, "TextLabel2" ); 179 TextLabel2 = new QLabel( tab_3, "TextLabel2" );
180 TextLabel2->setText( tr( "Password" ) ); 180 TextLabel2->setText( tr( "Password" ) );
181 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); 181 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
182 182
183 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); 183 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
184 PasswordEdit->setEchoMode(QLineEdit::Password); 184 PasswordEdit->setEchoMode(QLineEdit::Password);
185// PasswordEdit->setText( tr( "me@opieftp.org" ) ); 185// PasswordEdit->setText( tr( "me@opieftp.org" ) );
186// PasswordEdit->setText( tr( "" ) ); 186// PasswordEdit->setText( tr( "" ) );
187 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); 187 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
188 188
189 TextLabel3 = new QLabel( tab_3, "TextLabel3" ); 189 TextLabel3 = new QLabel( tab_3, "TextLabel3" );
190 TextLabel3->setText( tr( "Remote server" ) ); 190 TextLabel3->setText( tr( "Remote server" ) );
191 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); 191 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
192 192
193 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); 193 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
194 ServerComboBox->setEditable(TRUE); 194 ServerComboBox->setEditable(TRUE);
195 ServerComboBox->lineEdit()->setText( tr( "" ) ); 195 ServerComboBox->lineEdit()->setText( tr( "" ) );
196 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); 196 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
197// ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); 197// ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) );
198 ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); 198 ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) );
199 199
200 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 200 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
201 TextLabel5->setText( tr( "Remote path" ) ); 201 TextLabel5->setText( tr( "Remote path" ) );
202 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); 202 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
203 203
204 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 204 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
205 remotePath->setText( currentRemoteDir = "/"); 205 remotePath->setText( currentRemoteDir = "/");
206// remotePath->setText( currentRemoteDir = "/home/llornkcor/"); 206// remotePath->setText( currentRemoteDir = "/home/llornkcor/");
207 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); 207 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
208 208
209 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 209 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
210 TextLabel4->setText( tr( "Port" ) ); 210 TextLabel4->setText( tr( "Port" ) );
211 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 211 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
212 212
213 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 213 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
214 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 214 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
215 PortSpinBox->setMaxValue(32786); 215 PortSpinBox->setMaxValue(32786);
216 PortSpinBox->setValue( 4242); 216 PortSpinBox->setValue( 4242);
217// PortSpinBox->setValue( 21); 217// PortSpinBox->setValue( 21);
218 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 218 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
219 219
220 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 220 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
221 tabLayout_3->addItem( spacer, 5, 0 ); 221 tabLayout_3->addItem( spacer, 5, 0 );
222 222
223 TabWidget->insertTab( tab_3, tr( "Config" ) ); 223 TabWidget->insertTab( tab_3, tr( "Config" ) );
224 224
225 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 225 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
226 this,SLOT(tabChanged(QWidget*))); 226 this,SLOT(tabChanged(QWidget*)));
227 227
228 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 228 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
229 currentDir.setPath( QDir::currentDirPath()); 229 currentDir.setPath( QDir::currentDirPath());
230// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 230// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
231 currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); 231 currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" );
232 layout->addMultiCellWidget( currentPathEdit, 3, 3, 0, 3 ); 232 layout->addMultiCellWidget( currentPathEdit, 3, 3, 0, 3 );
233 233
234 currentPathEdit->setText( currentDir.canonicalPath()); 234 currentPathEdit->setText( currentDir.canonicalPath());
235 connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); 235 connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged()));
236 236
237 ProgressBar = new QProgressBar( this, "ProgressBar" ); 237 ProgressBar = new QProgressBar( this, "ProgressBar" );
238 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); 238 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 );
239 239
240 filterStr="*"; 240 filterStr="*";
241 b=FALSE; 241 b=FALSE;
242 populateLocalView(); 242 populateLocalView();
243} 243}
244 244
245OpieFtp::~OpieFtp() 245OpieFtp::~OpieFtp()
246{ 246{
247} 247}
248 248
249void OpieFtp::cleanUp() 249void OpieFtp::cleanUp()
250{ 250{
251 if(conn) 251 if(conn)
252 FtpQuit(conn); 252 FtpQuit(conn);
253 QString sfile=QDir::homeDirPath(); 253 QString sfile=QDir::homeDirPath();
254 if(sfile.right(1) != "/") 254 if(sfile.right(1) != "/")
255 sfile+="/._temp"; 255 sfile+="/._temp";
256 else 256 else
257 sfile+="._temp"; 257 sfile+="._temp";
258 QFile file( sfile); 258 QFile file( sfile);
259 if(file.exists()) 259 if(file.exists())
260 file.remove(); 260 file.remove();
261} 261}
262 262
263void OpieFtp::tabChanged(QWidget *w) 263void OpieFtp::tabChanged(QWidget *w)
264{ 264{
265 if (TabWidget->currentPageIndex() == 0) { 265 if (TabWidget->currentPageIndex() == 0) {
266 currentPathEdit->setText( currentDir.canonicalPath()); 266 currentPathEdit->setText( currentDir.canonicalPath());
267 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 267 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
268 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 268 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
269 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 269 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
270 } 270 }
271 if (TabWidget->currentPageIndex() == 1) { 271 if (TabWidget->currentPageIndex() == 1) {
272 currentPathEdit->setText( currentRemoteDir ); 272 currentPathEdit->setText( currentRemoteDir );
273 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); 273 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
274 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 274 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
275 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 275 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
276 } 276 }
277 if (TabWidget->currentPageIndex() == 2) { 277 if (TabWidget->currentPageIndex() == 2) {
278 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); 278 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
279 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 279 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
280 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 280 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
281 } 281 }
282} 282}
283 283
284void OpieFtp::localUpload() 284void OpieFtp::localUpload()
285{ 285{
286 int fsz; 286 int fsz;
287 QCopEnvelope ( "QPE/System", "busy()" ); 287 QCopEnvelope ( "QPE/System", "busy()" );
288 qApp->processEvents(); 288 qApp->processEvents();
289 QString strItem = Local_View->currentItem()->text(0); 289 QString strItem = Local_View->currentItem()->text(0);
290 QString localFile = currentDir.canonicalPath()+"/"+strItem; 290 QString localFile = currentDir.canonicalPath()+"/"+strItem;
291 QString remoteFile= currentRemoteDir+strItem; 291 QString remoteFile= currentRemoteDir+strItem;
292 QFileInfo fi(localFile); 292 QFileInfo fi(localFile);
293 if( !fi.isDir()) { 293 if( !fi.isDir()) {
294 fsz=fi.size(); 294 fsz=fi.size();
295 ProgressBar->setTotalSteps(fsz); 295 ProgressBar->setTotalSteps(fsz);
296 296
297 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 297 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
298 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 298 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
299 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 299 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
300 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 300 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
301 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); 301 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
302 302
303 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 303 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
304 QString msg; 304 QString msg;
305 msg.sprintf("Unable to upload\n%s",FtpLastResponse(conn)); 305 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
306 msg.replace(QRegExp(":"),"\n"); 306 msg.replace(QRegExp(":"),"\n");
307 QMessageBox::message("Note",msg); 307 QMessageBox::message(tr("Note"),msg);
308// FtpQuit(conn); 308// FtpQuit(conn);
309 } 309 }
310 ProgressBar->reset(); 310 ProgressBar->reset();
311 nullifyCallBack(); 311 nullifyCallBack();
312 } else { 312 } else {
313 QMessageBox::message("Note","Cannot upload directories"); 313 QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
314 } 314 }
315 TabWidget->setCurrentPage(1); 315 TabWidget->setCurrentPage(1);
316 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 316 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
317 QCopEnvelope ( "QPE/System", "notBusy()" ); 317 QCopEnvelope ( "QPE/System", "notBusy()" );
318} 318}
319 319
320void OpieFtp::nullifyCallBack() 320void OpieFtp::nullifyCallBack()
321{ 321{
322 FtpOptions(FTPLIB_CALLBACK, NULL, conn); 322 FtpOptions(FTPLIB_CALLBACK, NULL, conn);
323 FtpOptions(FTPLIB_IDLETIME, NULL, conn); 323 FtpOptions(FTPLIB_IDLETIME, NULL, conn);
324 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); 324 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn);
325 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); 325 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn);
326 326
327} 327}
328 328
329void OpieFtp::remoteDownload() 329void OpieFtp::remoteDownload()
330{ 330{
331 int fsz; 331 int fsz;
332 QCopEnvelope ( "QPE/System", "busy()" ); 332 QCopEnvelope ( "QPE/System", "busy()" );
333 qApp->processEvents(); 333 qApp->processEvents();
334 QString strItem = Remote_View->currentItem()->text(0); 334 QString strItem = Remote_View->currentItem()->text(0);
335// strItem=strItem.right(strItem.length()-1); 335// strItem=strItem.right(strItem.length()-1);
336 336
337 QString localFile = currentDir.canonicalPath()+strItem; 337 QString localFile = currentDir.canonicalPath()+strItem;
338// QString localFile = currentDir.canonicalPath()+"/"+strItem; 338// QString localFile = currentDir.canonicalPath()+"/"+strItem;
339 QString remoteFile= currentRemoteDir+strItem; 339 QString remoteFile= currentRemoteDir+strItem;
340 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) 340 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
341 fsz = 0; 341 fsz = 0;
342 QString temp; 342 QString temp;
343 temp.sprintf( remoteFile+" "+" %dkb", fsz); 343 temp.sprintf( remoteFile+" "+" %dkb", fsz);
344 344
345 ProgressBar->setTotalSteps(fsz); 345 ProgressBar->setTotalSteps(fsz);
346 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 346 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
347 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 347 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
348 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 348 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
349 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 349 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
350 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); 350 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
351 351
352 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 352 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
353 QString msg; 353 QString msg;
354 msg.sprintf("Unable to download \n%s",FtpLastResponse(conn)); 354 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
355 msg.replace(QRegExp(":"),"\n"); 355 msg.replace(QRegExp(":"),"\n");
356 QMessageBox::message("Note",msg); 356 QMessageBox::message(tr("Note"),msg);
357// FtpQuit(conn); 357// FtpQuit(conn);
358 } 358 }
359 ProgressBar->reset(); 359 ProgressBar->reset();
360 nullifyCallBack(); 360 nullifyCallBack();
361 TabWidget->setCurrentPage(0); 361 TabWidget->setCurrentPage(0);
362 populateLocalView(); 362 populateLocalView();
363 QCopEnvelope ( "QPE/System", "notBusy()" ); 363 QCopEnvelope ( "QPE/System", "notBusy()" );
364} 364}
365 365
366 366
367void OpieFtp::newConnection() 367void OpieFtp::newConnection()
368{ 368{
369 TabWidget->setCurrentPage(2); 369 TabWidget->setCurrentPage(2);
370} 370}
371 371
372void OpieFtp::connector() 372void OpieFtp::connector()
373{ 373{
374 QCopEnvelope ( "QPE/System", "busy()" ); 374 QCopEnvelope ( "QPE/System", "busy()" );
375 qApp->processEvents(); 375 qApp->processEvents();
376 currentRemoteDir=remotePath->text(); 376 currentRemoteDir=remotePath->text();
377 if(ServerComboBox->currentText().isEmpty()) { 377 if(ServerComboBox->currentText().isEmpty()) {
378 QMessageBox::warning(this,"Ftp","Please set the server info","Ok",0,0); 378 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0);
379 TabWidget->setCurrentPage(2); 379 TabWidget->setCurrentPage(2);
380 ServerComboBox->setFocus(); 380 ServerComboBox->setFocus();
381 return; 381 return;
382 } 382 }
383 FtpInit(); 383 FtpInit();
384 TabWidget->setCurrentPage(1); 384 TabWidget->setCurrentPage(1);
385 QString ftp_host = ServerComboBox->currentText(); 385 QString ftp_host = ServerComboBox->currentText();
386 QString ftp_user = UsernameComboBox->currentText(); 386 QString ftp_user = UsernameComboBox->currentText();
387 QString ftp_pass = PasswordEdit->text(); 387 QString ftp_pass = PasswordEdit->text();
388 QString port=PortSpinBox->cleanText(); 388 QString port=PortSpinBox->cleanText();
389 port.stripWhiteSpace(); 389 port.stripWhiteSpace();
390 390
391 if(ftp_host.find("ftp://",0, TRUE) != -1 ) 391 if(ftp_host.find("ftp://",0, TRUE) != -1 )
392 ftp_host=ftp_host.right(ftp_host.length()-6); 392 ftp_host=ftp_host.right(ftp_host.length()-6);
393 ftp_host+=":"+port; 393 ftp_host+=":"+port;
394 if (!FtpConnect( ftp_host.latin1(), &conn)) { 394 if (!FtpConnect( ftp_host.latin1(), &conn)) {
395 QMessageBox::message("Note","Unable to connect to\n"+ftp_host); 395 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host);
396 return ; 396 return ;
397 } 397 }
398 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { 398 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
399 QString msg; 399 QString msg;
400 msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn)); 400 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn));
401 msg.replace(QRegExp(":"),"\n"); 401 msg.replace(QRegExp(":"),"\n");
402 QMessageBox::message("Note",msg); 402 QMessageBox::message(tr("Note"),msg);
403 FtpQuit(conn); 403 FtpQuit(conn);
404 return ; 404 return ;
405 } 405 }
406 remoteDirList("/") ; 406 remoteDirList("/") ;
407 setCaption(ftp_host); 407 setCaption(ftp_host);
408 QCopEnvelope ( "QPE/System", "notBusy()" ); 408 QCopEnvelope ( "QPE/System", "notBusy()" );
409} 409}
410 410
411void OpieFtp::disConnector() 411void OpieFtp::disConnector()
412{ 412{
413 FtpQuit(conn); 413 FtpQuit(conn);
414 setCaption("OpieFtp"); 414 setCaption("OpieFtp");
415 currentRemoteDir="/"; 415 currentRemoteDir="/";
416 Remote_View->clear(); 416 Remote_View->clear();
417} 417}
418 418
419bool OpieFtp::remoteDirList(const QString &dir) 419bool OpieFtp::remoteDirList(const QString &dir)
420{ 420{
421 QString tmp = QDir::homeDirPath(); 421 QString tmp = QDir::homeDirPath();
422 if(tmp.right(1) != "/") 422 if(tmp.right(1) != "/")
423 tmp+="/._temp"; 423 tmp+="/._temp";
424 else 424 else
425 tmp+="._temp"; 425 tmp+="._temp";
426// qDebug("Listing remote dir "+tmp); 426// qDebug("Listing remote dir "+tmp);
427 QCopEnvelope ( "QPE/System", "busy()" ); 427 QCopEnvelope ( "QPE/System", "busy()" );
428 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 428 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
429 QString msg; 429 QString msg;
430 msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn) ); 430 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
431 msg.replace(QRegExp(":"),"\n"); 431 msg.replace(QRegExp(":"),"\n");
432 QMessageBox::message("Note",msg); 432 QMessageBox::message(tr("Note"),msg);
433// FtpQuit(conn); 433// FtpQuit(conn);
434 return false; 434 return false;
435 } 435 }
436 populateRemoteView() ; 436 populateRemoteView() ;
437 QCopEnvelope ( "QPE/System", "notBusy()" ); 437 QCopEnvelope ( "QPE/System", "notBusy()" );
438 return true; 438 return true;
439} 439}
440 440
441bool OpieFtp::remoteChDir(const QString &dir) 441bool OpieFtp::remoteChDir(const QString &dir)
442{ 442{
443 QCopEnvelope ( "QPE/System", "busy()" ); 443 QCopEnvelope ( "QPE/System", "busy()" );
444 if (!FtpChdir( dir.latin1(), conn )) { 444 if (!FtpChdir( dir.latin1(), conn )) {
445 QString msg; 445 QString msg;
446 msg.sprintf("Unable to change directories\n"+dir+"\n%s",FtpLastResponse(conn)); 446 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
447 msg.replace(QRegExp(":"),"\n"); 447 msg.replace(QRegExp(":"),"\n");
448 QMessageBox::message("Note",msg); 448 QMessageBox::message(tr("Note"),msg);
449 qDebug(msg); 449 qDebug(msg);
450// FtpQuit(conn); 450// FtpQuit(conn);
451 QCopEnvelope ( "QPE/System", "notBusy()" ); 451 QCopEnvelope ( "QPE/System", "notBusy()" );
452 return FALSE; 452 return FALSE;
453 } 453 }
454 QCopEnvelope ( "QPE/System", "notBusy()" ); 454 QCopEnvelope ( "QPE/System", "notBusy()" );
455 return TRUE; 455 return TRUE;
456} 456}
457 457
458void OpieFtp::populateLocalView() 458void OpieFtp::populateLocalView()
459{ 459{
460 Local_View->clear(); 460 Local_View->clear();
461 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 461 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
462 currentDir.setMatchAllDirs(TRUE); 462 currentDir.setMatchAllDirs(TRUE);
463 currentDir.setNameFilter(filterStr); 463 currentDir.setNameFilter(filterStr);
464 QString fileL, fileS, fileDate; 464 QString fileL, fileS, fileDate;
465 bool isDir=FALSE; 465 bool isDir=FALSE;
466 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 466 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
467 QFileInfoListIterator it(*list); 467 QFileInfoListIterator it(*list);
468 QFileInfo *fi; 468 QFileInfo *fi;
469 while ( (fi=it.current()) ) { 469 while ( (fi=it.current()) ) {
470 if (fi->isSymLink() ){ 470 if (fi->isSymLink() ){
471 QString symLink=fi->readLink(); 471 QString symLink=fi->readLink();
472// qDebug("Symlink detected "+symLink); 472// qDebug("Symlink detected "+symLink);
473 QFileInfo sym( symLink); 473 QFileInfo sym( symLink);
474 fileS.sprintf( "%10li", sym.size() ); 474 fileS.sprintf( "%10li", sym.size() );
475 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 475 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
476 fileDate = sym.lastModified().toString(); 476 fileDate = sym.lastModified().toString();
477 } else { 477 } else {
478// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 478// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
479 fileS.sprintf( "%10li", fi->size() ); 479 fileS.sprintf( "%10li", fi->size() );
480 fileL.sprintf( "%s",fi->fileName().data() ); 480 fileL.sprintf( "%s",fi->fileName().data() );
481 fileDate= fi->lastModified().toString(); 481 fileDate= fi->lastModified().toString();
482 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 482 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
483 fileL+="/"; 483 fileL+="/";
484 isDir=TRUE; 484 isDir=TRUE;
485// qDebug( fileL); 485// qDebug( fileL);
486 } 486 }
487 } 487 }
488 if(fileL !="./") { 488 if(fileL !="./") {
489 item = new QListViewItem( Local_View,fileL,fileS, fileDate); 489 item = new QListViewItem( Local_View,fileL,fileS, fileDate);
490 if(isDir || fileL.find("/",0,TRUE) != -1) 490 if(isDir || fileL.find("/",0,TRUE) != -1)
491 item->setPixmap( 0, Resource::loadPixmap( "folder" )); 491 item->setPixmap( 0, Resource::loadPixmap( "folder" ));
492 else 492 else
493 item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); 493 item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
494 } 494 }
495 isDir=FALSE; 495 isDir=FALSE;
496 ++it; 496 ++it;
497 } 497 }
498 Local_View->setSorting( 3,FALSE); 498 Local_View->setSorting( 3,FALSE);
499 currentPathEdit->setText( currentDir.canonicalPath() ); 499 currentPathEdit->setText( currentDir.canonicalPath() );
500} 500}
501 501
502bool OpieFtp::populateRemoteView( ) 502bool OpieFtp::populateRemoteView( )
503{ 503{
504// qDebug("populate remoteview"); 504// qDebug("populate remoteview");
505 QString sfile=QDir::homeDirPath(); 505 QString sfile=QDir::homeDirPath();
506 if(sfile.right(1) != "/") 506 if(sfile.right(1) != "/")
507 sfile+="/._temp"; 507 sfile+="/._temp";
508 else 508 else
509 sfile+="._temp"; 509 sfile+="._temp";
510 QFile file( sfile); 510 QFile file( sfile);
511 Remote_View->clear(); 511 Remote_View->clear();
512 QString s, File_Name; 512 QString s, File_Name;
513 QListViewItem *itemDir=NULL, *itemFile=NULL; 513 QListViewItem *itemDir=NULL, *itemFile=NULL;
514 QString fileL, fileS, fileDate; 514 QString fileL, fileS, fileDate;
515 if ( file.open(IO_ReadOnly)) { 515 if ( file.open(IO_ReadOnly)) {
516 QTextStream t( &file ); // use a text stream 516 QTextStream t( &file ); // use a text stream
517 while ( !t.eof()) { 517 while ( !t.eof()) {
518 s = t.readLine(); 518 s = t.readLine();
519 fileL = s.right(s.length()-55); 519 fileL = s.right(s.length()-55);
520 fileL = fileL.stripWhiteSpace(); 520 fileL = fileL.stripWhiteSpace();
521 if(s.left(1) == "d") 521 if(s.left(1) == "d")
522 fileL = fileL+"/"; 522 fileL = fileL+"/";
523// fileL = "/"+fileL+"/"; 523// fileL = "/"+fileL+"/";
524 fileS = s.mid( 30, 42-30); 524 fileS = s.mid( 30, 42-30);
525 fileS = fileS.stripWhiteSpace(); 525 fileS = fileS.stripWhiteSpace();
526 fileDate = s.mid( 42, 55-42); 526 fileDate = s.mid( 42, 55-42);
527 fileDate = fileDate.stripWhiteSpace(); 527 fileDate = fileDate.stripWhiteSpace();
528 if(fileL.find("total",0,TRUE) == -1) { 528 if(fileL.find("total",0,TRUE) == -1) {
529 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate); 529 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate);
530 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { 530 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
531 item->setPixmap( 0, Resource::loadPixmap( "folder" )); 531 item->setPixmap( 0, Resource::loadPixmap( "folder" ));
532 if(itemDir) 532 if(itemDir)
533 item->moveItem(itemDir); 533 item->moveItem(itemDir);
534 itemDir=item; 534 itemDir=item;
535 } else { 535 } else {
536 item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); 536 item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
537 if(itemFile) 537 if(itemFile)
538 item->moveItem(itemFile); 538 item->moveItem(itemFile);
539 itemFile=item; 539 itemFile=item;
540 } 540 }
541 } 541 }
542 } 542 }
543 QListViewItem * item1 = new QListViewItem( Remote_View, "../"); 543 QListViewItem * item1 = new QListViewItem( Remote_View, "../");
544 item1->setPixmap( 0, Resource::loadPixmap( "folder" )); 544 item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
545 file.close(); 545 file.close();
546 if( file.exists()) 546 if( file.exists())
547 file. remove(); 547 file. remove();
548 } else 548 } else
549 qDebug("temp file not opened successfullly "+sfile); 549 qDebug("temp file not opened successfullly "+sfile);
550 Remote_View->setSorting( 4,TRUE); 550 Remote_View->setSorting( 4,TRUE);
551 551
552 return true; 552 return true;
553} 553}
554 554
555void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 555void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
556{ 556{
557 QCopEnvelope ( "QPE/System", "busy()" ); 557 QCopEnvelope ( "QPE/System", "busy()" );
558 QString oldRemoteCurrentDir = currentRemoteDir; 558 QString oldRemoteCurrentDir = currentRemoteDir;
559 QString strItem=selectedItem->text(0); 559 QString strItem=selectedItem->text(0);
560 strItem=strItem.simplifyWhiteSpace(); 560 strItem=strItem.simplifyWhiteSpace();
561 if(strItem == "../") { // the user wants to go ^ 561 if(strItem == "../") { // the user wants to go ^
562 if( FtpCDUp( conn) == 0) { 562 if( FtpCDUp( conn) == 0) {
563 QString msg; 563 QString msg;
564 msg.sprintf("Unable to cd up\n%s",FtpLastResponse(conn)); 564 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
565 msg.replace(QRegExp(":"),"\n"); 565 msg.replace(QRegExp(":"),"\n");
566 QMessageBox::message("Note",msg); 566 QMessageBox::message(tr("Note"),msg);
567 qDebug(msg); 567 qDebug(msg);
568 } 568 }
569 char path[256]; 569 char path[256];
570 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 570 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
571 QString msg; 571 QString msg;
572 msg.sprintf("Unable to get working dir\n%s",FtpLastResponse(conn)); 572 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
573 msg.replace(QRegExp(":"),"\n"); 573 msg.replace(QRegExp(":"),"\n");
574 QMessageBox::message("Note",msg); 574 QMessageBox::message(tr("Note"),msg);
575 qDebug(msg); 575 qDebug(msg);
576 } 576 }
577 currentRemoteDir=path; 577 currentRemoteDir=path;
578 } else { 578 } else {
579 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers 579 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
580 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); 580 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
581 strItem = strItem.stripWhiteSpace(); 581 strItem = strItem.stripWhiteSpace();
582 currentRemoteDir = strItem; 582 currentRemoteDir = strItem;
583 if( !remoteChDir( (const QString &)strItem)) { 583 if( !remoteChDir( (const QString &)strItem)) {
584 currentRemoteDir = oldRemoteCurrentDir; 584 currentRemoteDir = oldRemoteCurrentDir;
585 strItem=""; 585 strItem="";
586 qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 586 qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
587 } 587 }
588 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory 588 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
589 qDebug("trying directory"); 589 qDebug("trying directory");
590 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { 590 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
591 currentRemoteDir = oldRemoteCurrentDir; 591 currentRemoteDir = oldRemoteCurrentDir;
592 strItem=""; 592 strItem="";
593 qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 593 qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
594 594
595 } else { 595 } else {
596 currentRemoteDir = currentRemoteDir+strItem; 596 currentRemoteDir = currentRemoteDir+strItem;
597 } 597 }
598 } else { 598 } else {
599 qDebug("download "+strItem); 599 qDebug("download "+strItem);
600 } 600 }
601 } 601 }
602 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 602 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
603 if(currentRemoteDir.right(1) !="/") 603 if(currentRemoteDir.right(1) !="/")
604 currentRemoteDir +="/"; 604 currentRemoteDir +="/";
605 currentPathEdit->setText( currentRemoteDir ); 605 currentPathEdit->setText( currentRemoteDir );
606 QCopEnvelope ( "QPE/System", "notBusy()" ); 606 QCopEnvelope ( "QPE/System", "notBusy()" );
607} 607}
608 608
609void OpieFtp::localListClicked(QListViewItem *selectedItem) 609void OpieFtp::localListClicked(QListViewItem *selectedItem)
610{ 610{
611 QString strItem=selectedItem->text(0); 611 QString strItem=selectedItem->text(0);
612 QString strSize=selectedItem->text(1); 612 QString strSize=selectedItem->text(1);
613 strSize=strSize.stripWhiteSpace(); 613 strSize=strSize.stripWhiteSpace();
614 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 614 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
615 // is symlink 615 // is symlink
616 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 616 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
617 if(QDir(strItem2).exists() ) { 617 if(QDir(strItem2).exists() ) {
618 currentDir.cd(strItem2, TRUE); 618 currentDir.cd(strItem2, TRUE);
619 populateLocalView(); 619 populateLocalView();
620 } 620 }
621 } else { // not a symlink 621 } else { // not a symlink
622 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 622 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
623 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 623 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
624 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 624 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
625 currentDir.cd(strItem,FALSE); 625 currentDir.cd(strItem,FALSE);
626 populateLocalView(); 626 populateLocalView();
627 } else { 627 } else {
628 currentDir.cdUp(); 628 currentDir.cdUp();
629 populateLocalView(); 629 populateLocalView();
630 } 630 }
631 if(QDir(strItem).exists()){ 631 if(QDir(strItem).exists()){
632 currentDir.cd(strItem, TRUE); 632 currentDir.cd(strItem, TRUE);
633 populateLocalView(); 633 populateLocalView();
634 } 634 }
635 } else { 635 } else {
636 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 636 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
637 if( QFile::exists(strItem ) ) { 637 if( QFile::exists(strItem ) ) {
638 qDebug("upload "+strItem); 638 qDebug("upload "+strItem);
639 } 639 }
640 } //end not symlink 640 } //end not symlink
641 chdir(strItem.latin1()); 641 chdir(strItem.latin1());
642 } 642 }
643} 643}
644 644
645void OpieFtp::doLocalCd() 645void OpieFtp::doLocalCd()
646{ 646{
647 localListClicked( Local_View->currentItem()); 647 localListClicked( Local_View->currentItem());
648} 648}
649 649
650void OpieFtp:: doRemoteCd() 650void OpieFtp:: doRemoteCd()
651{ 651{
652 remoteListClicked( Remote_View->currentItem()); 652 remoteListClicked( Remote_View->currentItem());
653 653
654} 654}
655 655
656void OpieFtp::showHidden() 656void OpieFtp::showHidden()
657{ 657{
658 if (!b) { 658 if (!b) {
659 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 659 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
660 localMenu->setItemChecked(localMenu->idAt(0),TRUE); 660 localMenu->setItemChecked(localMenu->idAt(0),TRUE);
661// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 661// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
662 b=TRUE; 662 b=TRUE;
663 663
664 } else { 664 } else {
665 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 665 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
666 localMenu->setItemChecked(localMenu->idAt(0),FALSE); 666 localMenu->setItemChecked(localMenu->idAt(0),FALSE);
667// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 667// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
668 b=FALSE; 668 b=FALSE;
669 } 669 }
670 populateLocalView(); 670 populateLocalView();
671} 671}
672 672
673void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 673void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
674{ 674{
675 switch (mouse) { 675 switch (mouse) {
676 case 1: 676 case 1:
677 break; 677 break;
678 case 2: 678 case 2:
679 showLocalMenu(item); 679 showLocalMenu(item);
680 break; 680 break;
681 }; 681 };
682} 682}
683 683
684void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 684void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
685{ 685{
686 switch (mouse) { 686 switch (mouse) {
687 case 1: 687 case 1:
688 break; 688 break;
689 case 2: 689 case 2:
690 showRemoteMenu(item); 690 showRemoteMenu(item);
691 break; 691 break;
692 }; 692 };
693} 693}
694 694
695void OpieFtp::showRemoteMenu(QListViewItem * item) 695void OpieFtp::showRemoteMenu(QListViewItem * item)
696{ 696{
697 QPopupMenu m;// = new QPopupMenu( Local_View ); 697 QPopupMenu m;// = new QPopupMenu( Local_View );
698 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE)) 698 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE))
699 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 699 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
700 else 700 else
701 m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 701 m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
702 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 702 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
703 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 703 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
704 m.insertSeparator(); 704 m.insertSeparator();
705 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 705 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
706 m.exec( QCursor::pos() ); 706 m.exec( QCursor::pos() );
707} 707}
708 708
709void OpieFtp::showLocalMenu(QListViewItem * item) 709void OpieFtp::showLocalMenu(QListViewItem * item)
710{ 710{
711 QPopupMenu m; 711 QPopupMenu m;
712 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 712 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
713 m.insertSeparator(); 713 m.insertSeparator();
714 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE)) 714 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE))
715 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 715 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
716 else 716 else
717 m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 717 m.insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
718 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 718 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
719 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 719 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
720 m.insertSeparator(); 720 m.insertSeparator();
721 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 721 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
722 m.setCheckable(TRUE); 722 m.setCheckable(TRUE);
723 if (b) 723 if (b)
724 m.setItemChecked(m.idAt(0),TRUE); 724 m.setItemChecked(m.idAt(0),TRUE);
725 else 725 else
726 m.setItemChecked(m.idAt(0),FALSE); 726 m.setItemChecked(m.idAt(0),FALSE);
727 727
728 m.exec( QCursor::pos() ); 728 m.exec( QCursor::pos() );
729} 729}
730 730
731void OpieFtp::localMakDir() 731void OpieFtp::localMakDir()
732{ 732{
733 InputDialog *fileDlg; 733 InputDialog *fileDlg;
734 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); 734 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
735 fileDlg->exec(); 735 fileDlg->exec();
736 if( fileDlg->result() == 1 ) { 736 if( fileDlg->result() == 1 ) {
737 QString filename = fileDlg->LineEdit1->text(); 737 QString filename = fileDlg->LineEdit1->text();
738 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 738 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
739 } 739 }
740 populateLocalView(); 740 populateLocalView();
741} 741}
742 742
743void OpieFtp::localDelete() 743void OpieFtp::localDelete()
744{ 744{
745 QString f = Local_View->currentItem()->text(0); 745 QString f = Local_View->currentItem()->text(0);
746 if(QDir(f).exists() ) { 746 if(QDir(f).exists() ) {
747 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+ 747 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
748 " ?\nIt must be empty","Yes","No",0,0,1) ) { 748 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
749 case 0: { 749 case 0: {
750 f=currentDir.canonicalPath()+"/"+f; 750 f=currentDir.canonicalPath()+"/"+f;
751 QString cmd="rmdir "+f; 751 QString cmd="rmdir "+f;
752 system( cmd.latin1()); 752 system( cmd.latin1());
753 populateLocalView(); 753 populateLocalView();
754 } 754 }
755 break; 755 break;
756 case 1: 756 case 1:
757 // exit 757 // exit
758 break; 758 break;
759 }; 759 };
760 760
761 } else { 761 } else {
762 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f 762 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
763 +" ?","Yes","No",0,0,1) ) { 763 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
764 case 0: { 764 case 0: {
765 f=currentDir.canonicalPath()+"/"+f; 765 f=currentDir.canonicalPath()+"/"+f;
766 QString cmd="rm "+f; 766 QString cmd="rm "+f;
767 system( cmd.latin1()); 767 system( cmd.latin1());
768 populateLocalView(); 768 populateLocalView();
769 } 769 }
770 break; 770 break;
771 case 1: 771 case 1:
772 // exit 772 // exit
773 break; 773 break;
774 }; 774 };
775 } 775 }
776} 776}
777 777
778void OpieFtp::remoteMakDir() 778void OpieFtp::remoteMakDir()
779{ 779{
780 InputDialog *fileDlg; 780 InputDialog *fileDlg;
781 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); 781 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
782 fileDlg->exec(); 782 fileDlg->exec();
783 if( fileDlg->result() == 1 ) { 783 if( fileDlg->result() == 1 ) {
784 QString filename = fileDlg->LineEdit1->text();//+".playlist"; 784 QString filename = fileDlg->LineEdit1->text();//+".playlist";
785 QString tmp=currentRemoteDir+filename; 785 QString tmp=currentRemoteDir+filename;
786 QCopEnvelope ( "QPE/System", "busy()" ); 786 QCopEnvelope ( "QPE/System", "busy()" );
787 if(FtpMkdir( tmp.latin1(), conn) == 0) { 787 if(FtpMkdir( tmp.latin1(), conn) == 0) {
788 QString msg; 788 QString msg;
789 msg.sprintf("Unable to make directory\n%s",FtpLastResponse(conn)); 789 msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn));
790 msg.replace(QRegExp(":"),"\n"); 790 msg.replace(QRegExp(":"),"\n");
791 QMessageBox::message("Note",msg); 791 QMessageBox::message(tr("Note"),msg);
792 } 792 }
793 QCopEnvelope ( "QPE/System", "notBusy()" ); 793 QCopEnvelope ( "QPE/System", "notBusy()" );
794 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 794 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
795 } 795 }
796} 796}
797 797
798void OpieFtp::remoteDelete() 798void OpieFtp::remoteDelete()
799{ 799{
800 QString f = Remote_View->currentItem()->text(0); 800 QString f = Remote_View->currentItem()->text(0);
801 QCopEnvelope ( "QPE/System", "busy()" ); 801 QCopEnvelope ( "QPE/System", "busy()" );
802 if( f.right(1) =="/") { 802 if( f.right(1) =="/") {
803 QString path= currentRemoteDir+f; 803 QString path= currentRemoteDir+f;
804 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?" 804 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
805 ,"Yes","No",0,0,1) ) { 805 ,tr("Yes"),tr("No"),0,0,1) ) {
806 case 0: { 806 case 0: {
807 f=currentDir.canonicalPath()+"/"+f; 807 f=currentDir.canonicalPath()+"/"+f;
808 if(FtpRmdir( path.latin1(), conn) ==0) { 808 if(FtpRmdir( path.latin1(), conn) ==0) {
809 QString msg; 809 QString msg;
810 msg.sprintf("Unable to remove directory\n%s",FtpLastResponse(conn)); 810 msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn));
811 msg.replace(QRegExp(":"),"\n"); 811 msg.replace(QRegExp(":"),"\n");
812 QMessageBox::message("Note",msg); 812 QMessageBox::message(tr("Note"),msg);
813 } 813 }
814 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 814 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
815 815
816 } 816 }
817 break; 817 break;
818 }; 818 };
819 } else { 819 } else {
820 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?" 820 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
821 ,"Yes","No",0,0,1) ) { 821 ,tr("Yes"),tr("No"),0,0,1) ) {
822 case 0: { 822 case 0: {
823 QString path= currentRemoteDir+f; 823 QString path= currentRemoteDir+f;
824 if(FtpDelete( path.latin1(), conn)==0) { 824 if(FtpDelete( path.latin1(), conn)==0) {
825 QString msg; 825 QString msg;
826 msg.sprintf("Unable to delete file\n%s",FtpLastResponse(conn)); 826 msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn));
827 msg.replace(QRegExp(":"),"\n"); 827 msg.replace(QRegExp(":"),"\n");
828 QMessageBox::message("Note",msg); 828 QMessageBox::message(tr("Note"),msg);
829 } 829 }
830 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 830 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
831 } 831 }
832 break; 832 break;
833 }; 833 };
834 } 834 }
835 QCopEnvelope ( "QPE/System", "notBusy()" ); 835 QCopEnvelope ( "QPE/System", "notBusy()" );
836} 836}
837 837
838void OpieFtp::remoteRename() 838void OpieFtp::remoteRename()
839{ 839{
840 QString curFile = Remote_View->currentItem()->text(0); 840 QString curFile = Remote_View->currentItem()->text(0);
841 InputDialog *fileDlg; 841 InputDialog *fileDlg;
842 fileDlg = new InputDialog(this,"Rename",TRUE, 0); 842 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
843 fileDlg->inputText = curFile; 843 fileDlg->inputText = curFile;
844 fileDlg->exec(); 844 fileDlg->exec();
845 if( fileDlg->result() == 1 ) { 845 if( fileDlg->result() == 1 ) {
846 QString oldName = currentRemoteDir +"/"+ curFile; 846 QString oldName = currentRemoteDir +"/"+ curFile;
847 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; 847 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist";
848 QCopEnvelope ( "QPE/System", "busy()" ); 848 QCopEnvelope ( "QPE/System", "busy()" );
849 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { 849 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) {
850 QString msg; 850 QString msg;
851 msg.sprintf("Unable to rename file\n%s",FtpLastResponse(conn)); 851 msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn));
852 msg.replace(QRegExp(":"),"\n"); 852 msg.replace(QRegExp(":"),"\n");
853 QMessageBox::message("Note",msg); 853 QMessageBox::message(tr("Note"),msg);
854 } 854 }
855 QCopEnvelope ( "QPE/System", "notBusy()" ); 855 QCopEnvelope ( "QPE/System", "notBusy()" );
856 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 856 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
857 } 857 }
858} 858}
859 859
860void OpieFtp::localRename() 860void OpieFtp::localRename()
861{ 861{
862 QString curFile = Local_View->currentItem()->text(0); 862 QString curFile = Local_View->currentItem()->text(0);
863 InputDialog *fileDlg; 863 InputDialog *fileDlg;
864 fileDlg = new InputDialog(this,"Rename",TRUE, 0); 864 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
865 fileDlg->inputText = curFile; 865 fileDlg->inputText = curFile;
866 fileDlg->exec(); 866 fileDlg->exec();
867 if( fileDlg->result() == 1 ) { 867 if( fileDlg->result() == 1 ) {
868 QString oldname = currentDir.canonicalPath() + "/" + curFile; 868 QString oldname = currentDir.canonicalPath() + "/" + curFile;
869 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 869 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
870 if( rename(oldname.latin1(), newName.latin1())== -1) 870 if( rename(oldname.latin1(), newName.latin1())== -1)
871 QMessageBox::message("Note","Could not rename"); 871 QMessageBox::message(tr("Note"),tr("Could not rename"));
872 } 872 }
873 populateLocalView(); 873 populateLocalView();
874} 874}
875 875
876void OpieFtp::currentPathEditChanged() 876void OpieFtp::currentPathEditChanged()
877{ 877{
878 QString oldRemoteCurrentDir = currentRemoteDir; 878 QString oldRemoteCurrentDir = currentRemoteDir;
879// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); 879// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
880 if (TabWidget->currentPageIndex() == 0) { 880 if (TabWidget->currentPageIndex() == 0) {
881 if(QDir( currentPathEdit->text()).exists()) { 881 if(QDir( currentPathEdit->text()).exists()) {
882 currentDir.setPath( currentPathEdit->text() ); 882 currentDir.setPath( currentPathEdit->text() );
883 populateLocalView(); 883 populateLocalView();
884 } else { 884 } else {
885 QMessageBox::message("Note","That directory does not exist"); 885 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
886 } 886 }
887 } 887 }
888 if (TabWidget->currentPageIndex() == 1) { 888 if (TabWidget->currentPageIndex() == 1) {
889 currentRemoteDir = currentPathEdit->text(); 889 currentRemoteDir = currentPathEdit->text();
890 if(currentRemoteDir.right(1) !="/") { 890 if(currentRemoteDir.right(1) !="/") {
891 currentRemoteDir = currentRemoteDir +"/"; 891 currentRemoteDir = currentRemoteDir +"/";
892 currentPathEdit->setText( currentRemoteDir ); 892 currentPathEdit->setText( currentRemoteDir );
893 } 893 }
894 if( !remoteChDir( (const QString &)currentRemoteDir) ) { 894 if( !remoteChDir( (const QString &)currentRemoteDir) ) {
895 currentRemoteDir = oldRemoteCurrentDir; 895 currentRemoteDir = oldRemoteCurrentDir;
896 currentPathEdit->setText( currentRemoteDir ); 896 currentPathEdit->setText( currentRemoteDir );
897 } 897 }
898 898
899 remoteDirList( (const QString &)currentRemoteDir); 899 remoteDirList( (const QString &)currentRemoteDir);
900 } 900 }
901} 901}
902 902
903void OpieFtp::switchToLocalTab() 903void OpieFtp::switchToLocalTab()
904{ 904{
905 TabWidget->setCurrentPage(0); 905 TabWidget->setCurrentPage(0);
906} 906}
907 907
908void OpieFtp::switchToRemoteTab() 908void OpieFtp::switchToRemoteTab()
909{ 909{
910 TabWidget->setCurrentPage(1); 910 TabWidget->setCurrentPage(1);
911} 911}
912 912
913void OpieFtp::switchToConfigTab() 913void OpieFtp::switchToConfigTab()
914{ 914{
915 TabWidget->setCurrentPage(2); 915 TabWidget->setCurrentPage(2);
916} 916}
diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro
index f485cdf..147a8c5 100644
--- a/noncore/net/opieftp/opieftp.pro
+++ b/noncore/net/opieftp/opieftp.pro
@@ -1,12 +1,12 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3HEADERS = opieftp.h inputDialog.h ftplib.h 3HEADERS = opieftp.h inputDialog.h ftplib.h
4SOURCES = opieftp.cpp inputDialog.cpp ftplib.c main.cpp 4SOURCES = opieftp.cpp inputDialog.cpp ftplib.c main.cpp
5TARGET = opieftp 5TARGET = opieftp
6REQUIRES=medium-config 6REQUIRES=medium-config
7DESTDIR = $(OPIEDIR)/bin 7DESTDIR = $(OPIEDIR)/bin
8INCLUDEPATH += $(OPIEDIR)/include 8INCLUDEPATH += $(OPIEDIR)/include
9DEPENDPATH += $(OPIEDIR)/include 9DEPENDPATH += $(OPIEDIR)/include
10LIBS += -lqpe 10LIBS += -lqpe
11 11
12TRANSLATIONS = ../../i18n/pt_BR/opieftp.ts 12TRANSLATIONS += ../../i18n/pt_BR/opieftp.ts