summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp28
-rw-r--r--noncore/net/opieftp/opieftp.h4
-rw-r--r--noncore/net/opieftp/opieftp.pro4
3 files changed, 24 insertions, 12 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 7f5d71c..e15bbef 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -1,1315 +1,1327 @@
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#include "ftplib.h" 15#include "ftplib.h"
16#include "inputDialog.h" 16#include "inputDialog.h"
17 17
18#include <qpe/qpemenubar.h> 18#include <qpe/qpemenubar.h>
19#include <qpe/qpetoolbar.h> 19#include <qpe/qpetoolbar.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/mimetype.h> 24#include <qpe/mimetype.h>
25#include <qpe/qpemessagebox.h>
25 26
26#include <qstringlist.h> 27#include <qstringlist.h>
27#include <qtextstream.h> 28#include <qtextstream.h>
28#include <qpushbutton.h> 29#include <qpushbutton.h>
29#include <qtoolbutton.h> 30#include <qtoolbutton.h>
30#include <qdatetime.h> 31#include <qdatetime.h>
31#include <qdir.h> 32#include <qdir.h>
32#include <qfile.h> 33#include <qfile.h>
33#include <qstring.h> 34#include <qstring.h>
34#include <qcombobox.h> 35#include <qcombobox.h>
35#include <qpopupmenu.h> 36#include <qpopupmenu.h>
36#include <qlistview.h> 37#include <qlistview.h>
37#include <qmainwindow.h> 38#include <qmainwindow.h>
38#include <qlabel.h> 39#include <qlabel.h>
39#include <qprogressbar.h> 40#include <qprogressbar.h>
40#include <qspinbox.h> 41#include <qspinbox.h>
41#include <qtabwidget.h> 42#include <qtabwidget.h>
42#include <qwidget.h> 43#include <qwidget.h>
43#include <qlayout.h> 44#include <qlayout.h>
44#include <qimage.h> 45#include <qimage.h>
45#include <qpixmap.h> 46#include <qpixmap.h>
46#include <qmessagebox.h> 47#include <qmessagebox.h>
47#include <qlineedit.h> 48#include <qlineedit.h>
48#include <qregexp.h> 49#include <qregexp.h>
49 50
50#include <unistd.h> 51#include <unistd.h>
51#include <stdlib.h> 52#include <stdlib.h>
52 53
53 54
54QProgressBar *ProgressBar; 55QProgressBar *ProgressBar;
55static netbuf *conn=NULL; 56static netbuf *conn=NULL;
56 57
57static int log_progress(netbuf *ctl, int xfered, void *arg) 58static int log_progress(netbuf *ctl, int xfered, void *arg)
58{ 59{
59 int fsz = *(int *)arg; 60 int fsz = *(int *)arg;
60 int pct = (xfered * 100) / fsz; 61 int pct = (xfered * 100) / fsz;
61// printf("%3d%%\r", pct); 62// printf("%3d%%\r", pct);
62// fflush(stdout); 63// fflush(stdout);
63 ProgressBar->setProgress(xfered); 64 ProgressBar->setProgress(xfered);
64 qApp->processEvents(); 65 qApp->processEvents();
65 return 1; 66 return 1;
66} 67}
67 68
68OpieFtp::OpieFtp( ) 69OpieFtp::OpieFtp( )
69 : QMainWindow( ) 70 : QMainWindow( )
70{ 71{
71 setCaption( tr( "OpieFtp" ) ); 72 setCaption( tr( "OpieFtp" ) );
72 73
73 QGridLayout *layout = new QGridLayout( this ); 74 QGridLayout *layout = new QGridLayout( this );
74 layout->setSpacing( 2); 75 layout->setSpacing( 2);
75 layout->setMargin( 2); 76 layout->setMargin( 2);
76 77
77 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 78 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
78 79
79 QPEMenuBar *menuBar = new QPEMenuBar(this); 80 QPEMenuBar *menuBar = new QPEMenuBar(this);
80// QPEToolBar *menuBar = new QPEToolBar(this); 81// QPEToolBar *menuBar = new QPEToolBar(this);
81// menuBar->setHorizontalStretchable( TRUE ); 82// menuBar->setHorizontalStretchable( TRUE );
82 83
83 connectionMenu = new QPopupMenu( this ); 84 connectionMenu = new QPopupMenu( this );
84 localMenu = new QPopupMenu( this ); 85 localMenu = new QPopupMenu( this );
85 remoteMenu = new QPopupMenu( this ); 86 remoteMenu = new QPopupMenu( this );
86 tabMenu = new QPopupMenu( this ); 87 tabMenu = new QPopupMenu( this );
87 88
88 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); 89 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
89 90
90 menuBar->insertItem( tr( "Connection" ), connectionMenu); 91 menuBar->insertItem( tr( "Connection" ), connectionMenu);
91 menuBar->insertItem( tr( "Local" ), localMenu); 92 menuBar->insertItem( tr( "Local" ), localMenu);
92 menuBar->insertItem( tr( "Remote" ), remoteMenu); 93 menuBar->insertItem( tr( "Remote" ), remoteMenu);
93 menuBar->insertItem( tr( "View" ), tabMenu); 94 menuBar->insertItem( tr( "View" ), tabMenu);
94 95
95 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 96 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
96 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 97 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
97 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 98 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
98 99
99 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 100 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
100 localMenu->insertSeparator(); 101 localMenu->insertSeparator();
101 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 102 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
102 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 103 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
103 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 104 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
104 localMenu->insertSeparator(); 105 localMenu->insertSeparator();
105 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 106 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
106 localMenu->setCheckable(TRUE); 107 localMenu->setCheckable(TRUE);
107 108
108 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 109 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
109 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 110 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
110 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 111 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
111 remoteMenu->insertSeparator(); 112 remoteMenu->insertSeparator();
112 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 113 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
113 114
114 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 115 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
115 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 116 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
116 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); 117 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
118 tabMenu->insertSeparator();
119 tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
117 tabMenu->setCheckable(TRUE); 120 tabMenu->setCheckable(TRUE);
118 121
119 122
123
120 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); 124 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
121 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 125 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
122 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 126 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
123 cdUpButton ->setFlat(TRUE); 127 cdUpButton ->setFlat(TRUE);
124 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); 128 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
125 cdUpButton->hide(); 129 cdUpButton->hide();
126 130
127// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 131// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
128// docButton->setFixedSize( QSize( 20, 20 ) ); 132// docButton->setFixedSize( QSize( 20, 20 ) );
129// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 133// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
130// docButton->setFlat(TRUE); 134// docButton->setFlat(TRUE);
131// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 135// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
132 136
133 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); 137 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
134 homeButton->setFixedSize( QSize( 20, 20 ) ); 138 homeButton->setFixedSize( QSize( 20, 20 ) );
135 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 139 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
136 homeButton->setFlat(TRUE); 140 homeButton->setFlat(TRUE);
137 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); 141 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
138 homeButton->hide(); 142 homeButton->hide();
139 143
140 TabWidget = new QTabWidget( this, "TabWidget" ); 144 TabWidget = new QTabWidget( this, "TabWidget" );
141 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); 145 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
142 146
143// TabWidget->setTabShape(QTabWidget::Triangular); 147// TabWidget->setTabShape(QTabWidget::Triangular);
144 148
145 tab = new QWidget( TabWidget, "tab" ); 149 tab = new QWidget( TabWidget, "tab" );
146 tabLayout = new QGridLayout( tab ); 150 tabLayout = new QGridLayout( tab );
147 tabLayout->setSpacing( 2); 151 tabLayout->setSpacing( 2);
148 tabLayout->setMargin( 2); 152 tabLayout->setMargin( 2);
149 153
150 Local_View = new QListView( tab, "Local_View" ); 154 Local_View = new QListView( tab, "Local_View" );
151// Local_View->setResizePolicy( QListView::AutoOneFit ); 155// Local_View->setResizePolicy( QListView::AutoOneFit );
152 Local_View->addColumn( tr("File"),150); 156 Local_View->addColumn( tr("File"),150);
153 Local_View->addColumn( tr("Size"),-1);
154 Local_View->setColumnAlignment(1,QListView::AlignRight);
155 Local_View->addColumn( tr("Date"),-1); 157 Local_View->addColumn( tr("Date"),-1);
158 Local_View->setColumnAlignment(1,QListView::AlignRight);
159 Local_View->addColumn( tr("Size"),-1);
156 Local_View->setColumnAlignment(2,QListView::AlignRight); 160 Local_View->setColumnAlignment(2,QListView::AlignRight);
157 Local_View->setAllColumnsShowFocus(TRUE); 161 Local_View->setAllColumnsShowFocus(TRUE);
158 162
159 Local_View->setMultiSelection( TRUE); 163 Local_View->setMultiSelection( TRUE);
160 Local_View->setSelectionMode(QListView::Extended); 164 Local_View->setSelectionMode(QListView::Extended);
161 Local_View->setFocusPolicy(QWidget::ClickFocus); 165 Local_View->setFocusPolicy(QWidget::ClickFocus);
162 166
163 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 167 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
164 168
165 tabLayout->addWidget( Local_View, 0, 0 ); 169 tabLayout->addWidget( Local_View, 0, 0 );
166 170
167 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 171 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
168 this,SLOT( localListClicked(QListViewItem *)) ); 172 this,SLOT( localListClicked(QListViewItem *)) );
169// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), 173// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)),
170// this,SLOT( localListClicked(QListViewItem *)) ); 174// this,SLOT( localListClicked(QListViewItem *)) );
171 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 175 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
172 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 176 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
173 177
174 TabWidget->insertTab( tab, tr( "Local" ) ); 178 TabWidget->insertTab( tab, tr( "Local" ) );
175 179
176 tab_2 = new QWidget( TabWidget, "tab_2" ); 180 tab_2 = new QWidget( TabWidget, "tab_2" );
177 tabLayout_2 = new QGridLayout( tab_2 ); 181 tabLayout_2 = new QGridLayout( tab_2 );
178 tabLayout_2->setSpacing( 2); 182 tabLayout_2->setSpacing( 2);
179 tabLayout_2->setMargin( 2); 183 tabLayout_2->setMargin( 2);
180 184
181 Remote_View = new QListView( tab_2, "Remote_View" ); 185 Remote_View = new QListView( tab_2, "Remote_View" );
182 Remote_View->addColumn( tr("File"),150); 186 Remote_View->addColumn( tr("File"),150);
183 Remote_View->addColumn( tr("Size"),-1);
184 Remote_View->setColumnAlignment(1,QListView::AlignRight);
185 Remote_View->addColumn( tr("Date"),-1); 187 Remote_View->addColumn( tr("Date"),-1);
188 Remote_View->setColumnAlignment(1,QListView::AlignRight);
189 Remote_View->addColumn( tr("Size"),-1);
186 Remote_View->setColumnAlignment(2,QListView::AlignRight); 190 Remote_View->setColumnAlignment(2,QListView::AlignRight);
187 Remote_View->addColumn( tr("Dir"),-1); 191 Remote_View->addColumn( tr("Dir"),-1);
188 Remote_View->setColumnAlignment(4,QListView::AlignRight); 192 Remote_View->setColumnAlignment(4,QListView::AlignRight);
189 Remote_View->setAllColumnsShowFocus(TRUE); 193 Remote_View->setAllColumnsShowFocus(TRUE);
190 194
191 Remote_View->setMultiSelection( FALSE); 195 Remote_View->setMultiSelection( FALSE);
192 Remote_View->setSelectionMode(QListView::Extended); 196 Remote_View->setSelectionMode(QListView::Extended);
193 Remote_View->setFocusPolicy(QWidget::ClickFocus); 197 Remote_View->setFocusPolicy(QWidget::ClickFocus);
194 198
195 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 199 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
196 200
197 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 201 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
198 this,SLOT( remoteListClicked(QListViewItem *)) ); 202 this,SLOT( remoteListClicked(QListViewItem *)) );
199 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 203 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
200 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 204 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) );
201 205
202 tabLayout_2->addWidget( Remote_View, 0, 0 ); 206 tabLayout_2->addWidget( Remote_View, 0, 0 );
203 207
204 TabWidget->insertTab( tab_2, tr( "Remote" ) ); 208 TabWidget->insertTab( tab_2, tr( "Remote" ) );
205 209
206 tab_3 = new QWidget( TabWidget, "tab_3" ); 210 tab_3 = new QWidget( TabWidget, "tab_3" );
207 tabLayout_3 = new QGridLayout( tab_3 ); 211 tabLayout_3 = new QGridLayout( tab_3 );
208 tabLayout_3->setSpacing( 2); 212 tabLayout_3->setSpacing( 2);
209 tabLayout_3->setMargin( 2); 213 tabLayout_3->setMargin( 2);
210 214
211 TextLabel1 = new QLabel( tab_3, "TextLabel1" ); 215 TextLabel1 = new QLabel( tab_3, "TextLabel1" );
212 TextLabel1->setText( tr( "Username" ) ); 216 TextLabel1->setText( tr( "Username" ) );
213 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); 217 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
214 218
215 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); 219 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
216 UsernameComboBox->setEditable(TRUE); 220 UsernameComboBox->setEditable(TRUE);
217 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); 221 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
218 222
219 TextLabel2 = new QLabel( tab_3, "TextLabel2" ); 223 TextLabel2 = new QLabel( tab_3, "TextLabel2" );
220 TextLabel2->setText( tr( "Password" ) ); 224 TextLabel2->setText( tr( "Password" ) );
221 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); 225 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
222 226
223 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); 227 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
224 PasswordEdit->setEchoMode(QLineEdit::Password); 228 PasswordEdit->setEchoMode(QLineEdit::Password);
225 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); 229 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
226 230
227 TextLabel3 = new QLabel( tab_3, "TextLabel3" ); 231 TextLabel3 = new QLabel( tab_3, "TextLabel3" );
228 TextLabel3->setText( tr( "Remote server" ) ); 232 TextLabel3->setText( tr( "Remote server" ) );
229 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); 233 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
230 234
231 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); 235 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
232 ServerComboBox->setEditable(TRUE); 236 ServerComboBox->setEditable(TRUE);
233 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); 237 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
234 238
235 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); 239 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) ));
236 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); 240 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) ));
237 241
238 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 242 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
239 TextLabel5->setText( tr( "Remote path" ) ); 243 TextLabel5->setText( tr( "Remote path" ) );
240 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); 244 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
241 245
242 246
243 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 247 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
244 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); 248 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
245 249
246 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 250 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
247 TextLabel4->setText( tr( "Port" ) ); 251 TextLabel4->setText( tr( "Port" ) );
248 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 252 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
249 253
250 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 254 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
251 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 255 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
252 PortSpinBox->setMaxValue(32786); 256 PortSpinBox->setMaxValue(32786);
253 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 257 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
254 258
255 QPushButton *deleteServerBtn; 259 QPushButton *deleteServerBtn;
256 deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); 260 deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" );
257 tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); 261 tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3);
258 262
259 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); 263 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
260 264
261 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); 265 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" );
262 tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); 266 tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1);
263 connectServerBtn->setToggleButton(TRUE); 267 connectServerBtn->setToggleButton(TRUE);
264 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); 268 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) ));
265 269
266 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 270 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
267 tabLayout_3->addItem( spacer, 5, 0 ); 271 tabLayout_3->addItem( spacer, 5, 0 );
268 272
269 TabWidget->insertTab( tab_3, tr( "Config" ) ); 273 TabWidget->insertTab( tab_3, tr( "Config" ) );
270 274
271 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 275 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
272 this,SLOT(tabChanged(QWidget*))); 276 this,SLOT(tabChanged(QWidget*)));
273 277
274 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 278 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
275 currentDir.setPath( QDir::currentDirPath()); 279 currentDir.setPath( QDir::currentDirPath());
276// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 280// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
277 281
278 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 282 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
279 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); 283 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
280 284
281 currentPathCombo->setEditable(TRUE); 285 currentPathCombo->setEditable(TRUE);
282 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 286 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
283 287
284 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 288 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
285 this, SLOT( currentPathComboActivated( const QString & ) ) ); 289 this, SLOT( currentPathComboActivated( const QString & ) ) );
286 290
287 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 291 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
288 this,SLOT(currentPathComboChanged())); 292 this,SLOT(currentPathComboChanged()));
289 293
290 ProgressBar = new QProgressBar( this, "ProgressBar" ); 294 ProgressBar = new QProgressBar( this, "ProgressBar" );
291 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); 295 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
292 296
293// fillCombos(); 297// fillCombos();
294 298
295 filterStr="*"; 299 filterStr="*";
296 b=FALSE; 300 b=FALSE;
297 populateLocalView(); 301 populateLocalView();
298 readConfig(); 302 readConfig();
299 ServerComboBox->setCurrentItem(currentServerConfig); 303 ServerComboBox->setCurrentItem(currentServerConfig);
300 304
301 TabWidget->setCurrentPage(2); 305 TabWidget->setCurrentPage(2);
302} 306}
303 307
304OpieFtp::~OpieFtp() 308OpieFtp::~OpieFtp()
305{ 309{
306} 310}
307 311
308void OpieFtp::cleanUp() 312void OpieFtp::cleanUp()
309{ 313{
310 if(conn) 314 if(conn)
311 FtpQuit(conn); 315 FtpQuit(conn);
312 QString sfile=QDir::homeDirPath(); 316 QString sfile=QDir::homeDirPath();
313 if(sfile.right(1) != "/") 317 if(sfile.right(1) != "/")
314 sfile+="/._temp"; 318 sfile+="/._temp";
315 else 319 else
316 sfile+="._temp"; 320 sfile+="._temp";
317 QFile file( sfile); 321 QFile file( sfile);
318 if(file.exists()) 322 if(file.exists())
319 file.remove(); 323 file.remove();
320 exit(0); 324 exit(0);
321} 325}
322 326
323void OpieFtp::tabChanged(QWidget *w) 327void OpieFtp::tabChanged(QWidget *w)
324{ 328{
325 if (TabWidget->currentPageIndex() == 0) { 329 if (TabWidget->currentPageIndex() == 0) {
326 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 330 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
327 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 331 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
328 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 332 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
329 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 333 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
330 if(cdUpButton->isHidden()) 334 if(cdUpButton->isHidden())
331 cdUpButton->show(); 335 cdUpButton->show();
332 if(homeButton->isHidden()) 336 if(homeButton->isHidden())
333 homeButton->show(); 337 homeButton->show();
334 338
335 } 339 }
336 if (TabWidget->currentPageIndex() == 1) { 340 if (TabWidget->currentPageIndex() == 1) {
337 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 341 currentPathCombo->lineEdit()->setText( currentRemoteDir );
338 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); 342 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
339 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 343 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
340 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 344 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
341 if(cdUpButton->isHidden()) 345 if(cdUpButton->isHidden())
342 cdUpButton->show(); 346 cdUpButton->show();
343 homeButton->hide(); 347 homeButton->hide();
344 348
345 } 349 }
346 if (TabWidget->currentPageIndex() == 2) { 350 if (TabWidget->currentPageIndex() == 2) {
347 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); 351 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
348 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 352 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
349 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 353 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
350 cdUpButton->hide(); 354 cdUpButton->hide();
351 homeButton->hide(); 355 homeButton->hide();
352 } 356 }
353} 357}
354 358
355void OpieFtp::newConnection() 359void OpieFtp::newConnection()
356{ 360{
357 UsernameComboBox->lineEdit()->setText(""); 361 UsernameComboBox->lineEdit()->setText("");
358 PasswordEdit->setText( "" ); 362 PasswordEdit->setText( "" );
359 ServerComboBox->lineEdit()->setText( ""); 363 ServerComboBox->lineEdit()->setText( "");
360 remotePath->setText( currentRemoteDir = "/"); 364 remotePath->setText( currentRemoteDir = "/");
361 PortSpinBox->setValue( 21); 365 PortSpinBox->setValue( 21);
362 TabWidget->setCurrentPage(2); 366 TabWidget->setCurrentPage(2);
363} 367}
364 368
365void OpieFtp::serverComboEdited(const QString & edit) 369void OpieFtp::serverComboEdited(const QString & edit)
366{ 370{
367 if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { 371 if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) {
368 qDebug("ServerComboEdited"); 372 qDebug("ServerComboEdited");
369 currentServerConfig = -1; 373 currentServerConfig = -1;
370 } 374 }
371} 375}
372 376
373void OpieFtp::connectorBtnToggled(bool On) 377void OpieFtp::connectorBtnToggled(bool On)
374{ 378{
375 if(On) { 379 if(On) {
376 connector(); 380 connector();
377 } else { 381 } else {
378 disConnector(); 382 disConnector();
379 } 383 }
380 384
381} 385}
382 386
383void OpieFtp::connector() 387void OpieFtp::connector()
384{ 388{
385 QCopEnvelope ( "QPE/System", "busy()" ); 389 QCopEnvelope ( "QPE/System", "busy()" );
386// qApp->processEvents(); 390// qApp->processEvents();
387 currentRemoteDir=remotePath->text(); 391 currentRemoteDir=remotePath->text();
388 if(ServerComboBox->currentText().isEmpty()) { 392 if(ServerComboBox->currentText().isEmpty()) {
389 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); 393 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0);
390 TabWidget->setCurrentPage(2); 394 TabWidget->setCurrentPage(2);
391 ServerComboBox->setFocus(); 395 ServerComboBox->setFocus();
392 connectServerBtn->setOn(FALSE); 396 connectServerBtn->setOn(FALSE);
393 connectServerBtn->setText( tr("Connect")); 397 connectServerBtn->setText( tr("Connect"));
394 return; 398 return;
395 } 399 }
396 FtpInit(); 400 FtpInit();
397 TabWidget->setCurrentPage(1); 401 TabWidget->setCurrentPage(1);
398 QString ftp_host = ServerComboBox->currentText(); 402 QString ftp_host = ServerComboBox->currentText();
399 QString ftp_user = UsernameComboBox->currentText(); 403 QString ftp_user = UsernameComboBox->currentText();
400 QString ftp_pass = PasswordEdit->text(); 404 QString ftp_pass = PasswordEdit->text();
401 QString port=PortSpinBox->cleanText(); 405 QString port=PortSpinBox->cleanText();
402 port.stripWhiteSpace(); 406 port.stripWhiteSpace();
403 407
404 if(ftp_host.find("ftp://",0, TRUE) != -1 ) 408 if(ftp_host.find("ftp://",0, TRUE) != -1 )
405 ftp_host=ftp_host.right(ftp_host.length()-6); 409 ftp_host=ftp_host.right(ftp_host.length()-6);
406 ftp_host+=":"+port; 410 ftp_host+=":"+port;
407 if (!FtpConnect( ftp_host.latin1(), &conn)) { 411 if (!FtpConnect( ftp_host.latin1(), &conn)) {
408 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); 412 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host);
409 connectServerBtn->setOn(FALSE); 413 connectServerBtn->setOn(FALSE);
410 connectServerBtn->setText( tr("Connect")); 414 connectServerBtn->setText( tr("Connect"));
411 return ; 415 return ;
412 } 416 }
413 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { 417 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
414 QString msg; 418 QString msg;
415 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); 419 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn));
416 msg.replace(QRegExp(":"),"\n"); 420 msg.replace(QRegExp(":"),"\n");
417 QMessageBox::message(tr("Note"),msg); 421 QMessageBox::message(tr("Note"),msg);
418 if(conn) 422 if(conn)
419 FtpQuit(conn); 423 FtpQuit(conn);
420 connectServerBtn->setOn(FALSE); 424 connectServerBtn->setOn(FALSE);
421 connectServerBtn->setText( tr("Connect")); 425 connectServerBtn->setText( tr("Connect"));
422 return ; 426 return ;
423 } 427 }
424 remoteDirList("/") ; 428 remoteDirList("/") ;
425 setCaption(ftp_host); 429 setCaption(ftp_host);
426 writeConfig(); 430 writeConfig();
427 connectServerBtn->setText( tr("Disconnect")); 431 connectServerBtn->setText( tr("Disconnect"));
428 QCopEnvelope ( "QPE/System", "notBusy()" ); 432 QCopEnvelope ( "QPE/System", "notBusy()" );
429} 433}
430 434
431void OpieFtp::disConnector() 435void OpieFtp::disConnector()
432{ 436{
433 if(conn) 437 if(conn)
434 FtpQuit(conn); 438 FtpQuit(conn);
435 setCaption("OpieFtp"); 439 setCaption("OpieFtp");
436 currentRemoteDir="/"; 440 currentRemoteDir="/";
437 Remote_View->clear(); 441 Remote_View->clear();
438 connectServerBtn->setText( tr("Connect")); 442 connectServerBtn->setText( tr("Connect"));
439 connectServerBtn->setOn(FALSE); 443 connectServerBtn->setOn(FALSE);
440} 444}
441 445
442void OpieFtp::localUpload() 446void OpieFtp::localUpload()
443{ 447{
444 int fsz; 448 int fsz;
445// QCopEnvelope ( "QPE/System", "busy()" ); 449// QCopEnvelope ( "QPE/System", "busy()" );
446// qApp->processEvents(); 450// qApp->processEvents();
447 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 451 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
448 QListViewItemIterator it( Local_View ); 452 QListViewItemIterator it( Local_View );
449 for ( ; it.current(); ++it ) { 453 for ( ; it.current(); ++it ) {
450 if ( it.current()->isSelected() ) { 454 if ( it.current()->isSelected() ) {
451 QString strItem = it.current()->text(0); 455 QString strItem = it.current()->text(0);
452 QString localFile = currentDir.canonicalPath()+"/"+strItem; 456 QString localFile = currentDir.canonicalPath()+"/"+strItem;
453 QString remoteFile= currentRemoteDir+strItem; 457 QString remoteFile= currentRemoteDir+strItem;
454 QFileInfo fi(localFile); 458 QFileInfo fi(localFile);
455 if( !fi.isDir()) { 459 if( !fi.isDir()) {
456 fsz=fi.size(); 460 fsz=fi.size();
457 ProgressBar->setTotalSteps(fsz); 461 ProgressBar->setTotalSteps(fsz);
458 462
459 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 463 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
460 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 464 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
461 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 465 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
462 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 466 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
463 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); 467 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
464 468
465 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 469 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
466 QString msg; 470 QString msg;
467 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); 471 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
468 msg.replace(QRegExp(":"),"\n"); 472 msg.replace(QRegExp(":"),"\n");
469 QMessageBox::message(tr("Note"),msg); 473 QMessageBox::message(tr("Note"),msg);
470 } 474 }
471 } else { 475 } else {
472 QMessageBox::message(tr("Note"),tr("Cannot upload directories")); 476 QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
473 } 477 }
474 ProgressBar->reset(); 478 ProgressBar->reset();
475 nullifyCallBack(); 479 nullifyCallBack();
476 it.current()->setSelected(FALSE); 480 it.current()->setSelected(FALSE);
477 } //end currentSelected 481 } //end currentSelected
478 } 482 }
479 for ( ; it.current(); ++it ) { 483 for ( ; it.current(); ++it ) {
480 Local_View->clearSelection(); 484 Local_View->clearSelection();
481 } 485 }
482 Local_View->clearFocus(); 486 Local_View->clearFocus();
483 TabWidget->setCurrentPage(1); 487 TabWidget->setCurrentPage(1);
484 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 488 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
485 QCopEnvelope ( "QPE/System", "notBusy()" ); 489 QCopEnvelope ( "QPE/System", "notBusy()" );
486} 490}
487 491
488void OpieFtp::nullifyCallBack() 492void OpieFtp::nullifyCallBack()
489{ 493{
490 FtpOptions(FTPLIB_CALLBACK, NULL, conn); 494 FtpOptions(FTPLIB_CALLBACK, NULL, conn);
491 FtpOptions(FTPLIB_IDLETIME, NULL, conn); 495 FtpOptions(FTPLIB_IDLETIME, NULL, conn);
492 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); 496 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn);
493 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); 497 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn);
494} 498}
495 499
496void OpieFtp::remoteDownload() 500void OpieFtp::remoteDownload()
497{ 501{
498// qApp->processEvents(); 502// qApp->processEvents();
499 int fsz; 503 int fsz;
500 QCopEnvelope ( "QPE/System", "busy()" ); 504 QCopEnvelope ( "QPE/System", "busy()" );
501 505
502 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 506 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
503 QListViewItemIterator it( Remote_View ); 507 QListViewItemIterator it( Remote_View );
504 for ( ; it.current(); ++it ) { 508 for ( ; it.current(); ++it ) {
505 if ( it.current()->isSelected() ) { 509 if ( it.current()->isSelected() ) {
506 QString strItem = it.current()->text(0); 510 QString strItem = it.current()->text(0);
507// strItem=strItem.right(strItem.length()-1); 511// strItem=strItem.right(strItem.length()-1);
508 QString localFile = currentDir.canonicalPath(); 512 QString localFile = currentDir.canonicalPath();
509 if(localFile.right(1).find("/",0,TRUE) == -1) 513 if(localFile.right(1).find("/",0,TRUE) == -1)
510 localFile += "/"; 514 localFile += "/";
511 localFile += strItem; 515 localFile += strItem;
512// QString localFile = currentDir.canonicalPath()+"/"+strItem; 516// QString localFile = currentDir.canonicalPath()+"/"+strItem;
513 QString remoteFile= currentRemoteDir+strItem; 517 QString remoteFile= currentRemoteDir+strItem;
514 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) 518 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
515 fsz = 0; 519 fsz = 0;
516 QString temp; 520 QString temp;
517 temp.sprintf( remoteFile+" "+" %dkb", fsz); 521 temp.sprintf( remoteFile+" "+" %dkb", fsz);
518 522
519 ProgressBar->setTotalSteps(fsz); 523 ProgressBar->setTotalSteps(fsz);
520 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 524 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
521 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 525 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
522 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 526 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
523 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 527 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
524 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); 528 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
525 529
526 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 530 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
527 QString msg; 531 QString msg;
528 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); 532 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
529 msg.replace(QRegExp(":"),"\n"); 533 msg.replace(QRegExp(":"),"\n");
530 QMessageBox::message(tr("Note"),msg); 534 QMessageBox::message(tr("Note"),msg);
531 } 535 }
532 ProgressBar->reset(); 536 ProgressBar->reset();
533 nullifyCallBack(); 537 nullifyCallBack();
534 it.current()->setSelected(FALSE); 538 it.current()->setSelected(FALSE);
535 } 539 }
536 } 540 }
537 for ( ; it.current(); ++it ) { 541 for ( ; it.current(); ++it ) {
538 Remote_View->clearSelection(); 542 Remote_View->clearSelection();
539 } 543 }
540 Remote_View->setFocus(); 544 Remote_View->setFocus();
541 TabWidget->setCurrentPage(0); 545 TabWidget->setCurrentPage(0);
542 populateLocalView(); 546 populateLocalView();
543 QCopEnvelope ( "QPE/System", "notBusy()" ); 547 QCopEnvelope ( "QPE/System", "notBusy()" );
544} 548}
545 549
546bool OpieFtp::remoteDirList(const QString &dir) 550bool OpieFtp::remoteDirList(const QString &dir)
547{ 551{
548 QString tmp = QDir::homeDirPath(); 552 QString tmp = QDir::homeDirPath();
549 if(tmp.right(1) != "/") 553 if(tmp.right(1) != "/")
550 tmp+="/._temp"; 554 tmp+="/._temp";
551 else 555 else
552 tmp+="._temp"; 556 tmp+="._temp";
553// qDebug("Listing remote dir "+tmp); 557// qDebug("Listing remote dir "+tmp);
554 QCopEnvelope ( "QPE/System", "busy()" ); 558 QCopEnvelope ( "QPE/System", "busy()" );
555 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 559 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
556 QString msg; 560 QString msg;
557 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); 561 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
558 msg.replace(QRegExp(":"),"\n"); 562 msg.replace(QRegExp(":"),"\n");
559 QMessageBox::message(tr("Note"),msg); 563 QMessageBox::message(tr("Note"),msg);
560 return false; 564 return false;
561 } 565 }
562 populateRemoteView() ; 566 populateRemoteView() ;
563 QCopEnvelope ( "QPE/System", "notBusy()" ); 567 QCopEnvelope ( "QPE/System", "notBusy()" );
564 return true; 568 return true;
565} 569}
566 570
567bool OpieFtp::remoteChDir(const QString &dir) 571bool OpieFtp::remoteChDir(const QString &dir)
568{ 572{
569 QCopEnvelope ( "QPE/System", "busy()" ); 573 QCopEnvelope ( "QPE/System", "busy()" );
570 if (!FtpChdir( dir.latin1(), conn )) { 574 if (!FtpChdir( dir.latin1(), conn )) {
571 QString msg; 575 QString msg;
572 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); 576 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
573 msg.replace(QRegExp(":"),"\n"); 577 msg.replace(QRegExp(":"),"\n");
574 QMessageBox::message(tr("Note"),msg); 578 QMessageBox::message(tr("Note"),msg);
575// qDebug(msg); 579// qDebug(msg);
576 QCopEnvelope ( "QPE/System", "notBusy()" ); 580 QCopEnvelope ( "QPE/System", "notBusy()" );
577 return FALSE; 581 return FALSE;
578 } 582 }
579 QCopEnvelope ( "QPE/System", "notBusy()" ); 583 QCopEnvelope ( "QPE/System", "notBusy()" );
580 return TRUE; 584 return TRUE;
581} 585}
582 586
583void OpieFtp::populateLocalView() 587void OpieFtp::populateLocalView()
584{ 588{
585 Local_View->clear(); 589 Local_View->clear();
586 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 590 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
587 currentDir.setMatchAllDirs(TRUE); 591 currentDir.setMatchAllDirs(TRUE);
588 currentDir.setNameFilter(filterStr); 592 currentDir.setNameFilter(filterStr);
589 QString fileL, fileS, fileDate; 593 QString fileL, fileS, fileDate;
590 bool isDir=FALSE; 594 bool isDir=FALSE;
591 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 595 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
592 QFileInfoListIterator it(*list); 596 QFileInfoListIterator it(*list);
593 QFileInfo *fi; 597 QFileInfo *fi;
594 while ( (fi=it.current()) ) { 598 while ( (fi=it.current()) ) {
595 if (fi->isSymLink() ){ 599 if (fi->isSymLink() ){
596 QString symLink=fi->readLink(); 600 QString symLink=fi->readLink();
597// qDebug("Symlink detected "+symLink); 601// qDebug("Symlink detected "+symLink);
598 QFileInfo sym( symLink); 602 QFileInfo sym( symLink);
599 fileS.sprintf( "%10li", sym.size() ); 603 fileS.sprintf( "%10li", sym.size() );
600 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 604 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
601 fileDate = sym.lastModified().toString(); 605 fileDate = sym.lastModified().toString();
602 } else { 606 } else {
603// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 607// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
604 fileS.sprintf( "%10li", fi->size() ); 608 fileS.sprintf( "%10li", fi->size() );
605 fileL.sprintf( "%s",fi->fileName().data() ); 609 fileL.sprintf( "%s",fi->fileName().data() );
606 fileDate= fi->lastModified().toString(); 610 fileDate= fi->lastModified().toString();
607 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 611 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
608 fileL+="/"; 612 fileL+="/";
609 isDir=TRUE; 613 isDir=TRUE;
610// qDebug( fileL); 614// qDebug( fileL);
611 } 615 }
612 } 616 }
613 if(fileL !="./" && fi->exists()) { 617 if(fileL !="./" && fi->exists()) {
614 item= new QListViewItem( Local_View,fileL,fileS , fileDate); 618 item= new QListViewItem( Local_View,fileL, fileDate, fileS );
615 QPixmap pm; 619 QPixmap pm;
616 620
617 if(isDir || fileL.find("/",0,TRUE) != -1) { 621 if(isDir || fileL.find("/",0,TRUE) != -1) {
618 if( !QDir( fi->filePath() ).isReadable()) 622 if( !QDir( fi->filePath() ).isReadable())
619 pm = Resource::loadPixmap( "lockedfolder" ); 623 pm = Resource::loadPixmap( "lockedfolder" );
620 else 624 else
621 pm= Resource::loadPixmap( "folder" ); 625 pm= Resource::loadPixmap( "folder" );
622 item->setPixmap( 0,pm ); 626 item->setPixmap( 0,pm );
623 } else { 627 } else {
624 if( !fi->isReadable() ) 628 if( !fi->isReadable() )
625 pm = Resource::loadPixmap( "locked" ); 629 pm = Resource::loadPixmap( "locked" );
626 else { 630 else {
627 MimeType mt(fi->filePath()); 631 MimeType mt(fi->filePath());
628 pm=mt.pixmap(); //sets the correct pixmap for mimetype 632 pm=mt.pixmap(); //sets the correct pixmap for mimetype
629 if(pm.isNull()) 633 if(pm.isNull())
630 pm = Resource::loadPixmap( "UnknownDocument-14" ); 634 pm = Resource::loadPixmap( "UnknownDocument-14" );
631 item->setPixmap( 0,pm); 635 item->setPixmap( 0,pm);
632 } 636 }
633 } 637 }
634 if( fileL.find("->",0,TRUE) != -1) { 638 if( fileL.find("->",0,TRUE) != -1) {
635 // overlay link image 639 // overlay link image
636 pm= Resource::loadPixmap( "folder" ); 640 pm= Resource::loadPixmap( "folder" );
637 QPixmap lnk = Resource::loadPixmap( "symlink" ); 641 QPixmap lnk = Resource::loadPixmap( "symlink" );
638 QPainter painter( &pm ); 642 QPainter painter( &pm );
639 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 643 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
640 pm.setMask( pm.createHeuristicMask( FALSE ) ); 644 pm.setMask( pm.createHeuristicMask( FALSE ) );
641 item->setPixmap( 0, pm); 645 item->setPixmap( 0, pm);
642 } 646 }
643 } 647 }
644 isDir=FALSE; 648 isDir=FALSE;
645 ++it; 649 ++it;
646 } 650 }
647 Local_View->setSorting( 3,FALSE); 651 Local_View->setSorting( 3,FALSE);
648 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); 652 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
649 fillCombo( (const QString &)currentDir); 653 fillCombo( (const QString &)currentDir);
650} 654}
651 655
652bool OpieFtp::populateRemoteView( ) 656bool OpieFtp::populateRemoteView( )
653{ 657{
654// qDebug("populate remoteview"); 658// qDebug("populate remoteview");
655 QString sfile=QDir::homeDirPath(); 659 QString sfile=QDir::homeDirPath();
656 if(sfile.right(1) != "/") 660 if(sfile.right(1) != "/")
657 sfile+="/._temp"; 661 sfile+="/._temp";
658 else 662 else
659 sfile+="._temp"; 663 sfile+="._temp";
660 QFile file( sfile); 664 QFile file( sfile);
661 Remote_View->clear(); 665 Remote_View->clear();
662 QString s, File_Name; 666 QString s, File_Name;
663 QListViewItem *itemDir=NULL, *itemFile=NULL; 667 QListViewItem *itemDir=NULL, *itemFile=NULL;
664 QString fileL, fileS, fileDate; 668 QString fileL, fileS, fileDate;
665 if ( file.open(IO_ReadOnly)) { 669 if ( file.open(IO_ReadOnly)) {
666 QTextStream t( &file ); // use a text stream 670 QTextStream t( &file ); // use a text stream
667 while ( !t.eof()) { 671 while ( !t.eof()) {
668 s = t.readLine(); 672 s = t.readLine();
669 fileL = s.right(s.length()-55); 673 fileL = s.right(s.length()-55);
670 fileL = fileL.stripWhiteSpace(); 674 fileL = fileL.stripWhiteSpace();
671 if(s.left(1) == "d") 675 if(s.left(1) == "d")
672 fileL = fileL+"/"; 676 fileL = fileL+"/";
673// fileL = "/"+fileL+"/"; 677// fileL = "/"+fileL+"/";
674 fileS = s.mid( 30, 42-30); 678 fileS = s.mid( 30, 42-30);
675 fileS = fileS.stripWhiteSpace(); 679 fileS = fileS.stripWhiteSpace();
676 fileDate = s.mid( 42, 55-42); 680 fileDate = s.mid( 42, 55-42);
677 fileDate = fileDate.stripWhiteSpace(); 681 fileDate = fileDate.stripWhiteSpace();
678 if(fileL.find("total",0,TRUE) == -1) { 682 if(fileL.find("total",0,TRUE) == -1) {
679 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { 683 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
680 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"d"); 684 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d");
681 item->setPixmap( 0, Resource::loadPixmap( "folder" )); 685 item->setPixmap( 0, Resource::loadPixmap( "folder" ));
682// if(itemDir) 686// if(itemDir)
683 item->moveItem(itemDir); 687 item->moveItem(itemDir);
684 itemDir=item; 688 itemDir=item;
685 } else { 689 } else {
686 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"f"); 690 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f");
687 item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); 691 item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
688// if(itemFile) 692// if(itemFile)
689 item->moveItem(itemDir); 693 item->moveItem(itemDir);
690 item->moveItem(itemFile); 694 item->moveItem(itemFile);
691 itemFile=item; 695 itemFile=item;
692 } 696 }
693 } 697 }
694 } 698 }
695 QListViewItem * item1 = new QListViewItem( Remote_View, "../"); 699 QListViewItem * item1 = new QListViewItem( Remote_View, "../");
696 item1->setPixmap( 0, Resource::loadPixmap( "folder" )); 700 item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
697 file.close(); 701 file.close();
698 if( file.exists()) 702 if( file.exists())
699 file. remove(); 703 file. remove();
700 } else 704 } else
701 qDebug("temp file not opened successfullly "+sfile); 705 qDebug("temp file not opened successfullly "+sfile);
702 Remote_View->setSorting( 4,TRUE); 706 Remote_View->setSorting( 4,TRUE);
703 return true; 707 return true;
704} 708}
705 709
706void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 710void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
707{ 711{
708 if( selectedItem) { 712 if( selectedItem) {
709// QCopEnvelope ( "QPE/System", "busy()" ); 713// QCopEnvelope ( "QPE/System", "busy()" );
710 QString oldRemoteCurrentDir = currentRemoteDir; 714 QString oldRemoteCurrentDir = currentRemoteDir;
711 QString strItem=selectedItem->text(0); 715 QString strItem=selectedItem->text(0);
712 strItem=strItem.simplifyWhiteSpace(); 716 strItem=strItem.simplifyWhiteSpace();
713 if(strItem == "../") { // the user wants to go ^ 717 if(strItem == "../") { // the user wants to go ^
714 if( FtpCDUp( conn) == 0) { 718 if( FtpCDUp( conn) == 0) {
715 QString msg; 719 QString msg;
716 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 720 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
717 msg.replace(QRegExp(":"),"\n"); 721 msg.replace(QRegExp(":"),"\n");
718 QMessageBox::message(tr("Note"),msg); 722 QMessageBox::message(tr("Note"),msg);
719// qDebug(msg); 723// qDebug(msg);
720 } 724 }
721 char path[256]; 725 char path[256];
722 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 726 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
723 QString msg; 727 QString msg;
724 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 728 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
725 msg.replace(QRegExp(":"),"\n"); 729 msg.replace(QRegExp(":"),"\n");
726 QMessageBox::message(tr("Note"),msg); 730 QMessageBox::message(tr("Note"),msg);
727// qDebug(msg); 731// qDebug(msg);
728 } 732 }
729 currentRemoteDir=path; 733 currentRemoteDir=path;
730 } else { 734 } else {
731 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers 735 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
732 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); 736 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
733 strItem = strItem.stripWhiteSpace(); 737 strItem = strItem.stripWhiteSpace();
734 currentRemoteDir = strItem; 738 currentRemoteDir = strItem;
735 if( !remoteChDir( (const QString &)strItem)) { 739 if( !remoteChDir( (const QString &)strItem)) {
736 currentRemoteDir = oldRemoteCurrentDir; 740 currentRemoteDir = oldRemoteCurrentDir;
737 strItem=""; 741 strItem="";
738// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 742// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
739 } 743 }
740 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory 744 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
741 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { 745 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
742 currentRemoteDir = oldRemoteCurrentDir; 746 currentRemoteDir = oldRemoteCurrentDir;
743 strItem=""; 747 strItem="";
744// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 748// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
745 749
746 } else { 750 } else {
747 currentRemoteDir = currentRemoteDir+strItem; 751 currentRemoteDir = currentRemoteDir+strItem;
748 } 752 }
749 } else { 753 } else {
750 QCopEnvelope ( "QPE/System", "notBusy()" ); 754 QCopEnvelope ( "QPE/System", "notBusy()" );
751 return; 755 return;
752 } 756 }
753 } 757 }
754 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 758 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
755 if(currentRemoteDir.right(1) !="/") 759 if(currentRemoteDir.right(1) !="/")
756 currentRemoteDir +="/"; 760 currentRemoteDir +="/";
757 currentPathCombo->lineEdit()->setText( currentRemoteDir); 761 currentPathCombo->lineEdit()->setText( currentRemoteDir);
758 fillRemoteCombo( (const QString &)currentRemoteDir); 762 fillRemoteCombo( (const QString &)currentRemoteDir);
759// QCopEnvelope ( "QPE/System", "notBusy()" ); 763// QCopEnvelope ( "QPE/System", "notBusy()" );
760 } 764 }
761} 765}
762 766
763void OpieFtp::localListClicked(QListViewItem *selectedItem) 767void OpieFtp::localListClicked(QListViewItem *selectedItem)
764{ 768{
765 if(selectedItem!= NULL) { 769 if(selectedItem!= NULL) {
766 770
767 QString strItem=selectedItem->text(0); 771 QString strItem=selectedItem->text(0);
768 QString strSize=selectedItem->text(1); 772 QString strSize=selectedItem->text(1);
769 strSize=strSize.stripWhiteSpace(); 773 strSize=strSize.stripWhiteSpace();
770 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 774 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
771 // is symlink 775 // is symlink
772 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 776 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
773 if(QDir(strItem2).exists() ) { 777 if(QDir(strItem2).exists() ) {
774 currentDir.cd(strItem2, TRUE); 778 currentDir.cd(strItem2, TRUE);
775 populateLocalView(); 779 populateLocalView();
776 } 780 }
777 } else { // not a symlink 781 } else { // not a symlink
778 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 782 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
779 783
780 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 784 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
781 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 785 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
782 currentDir.cd(strItem,FALSE); 786 currentDir.cd(strItem,FALSE);
783 populateLocalView(); 787 populateLocalView();
784 } else { 788 } else {
785 currentDir.cdUp(); 789 currentDir.cdUp();
786 populateLocalView(); 790 populateLocalView();
787 } 791 }
788 if(QDir(strItem).exists()){ 792 if(QDir(strItem).exists()){
789 currentDir.cd(strItem, TRUE); 793 currentDir.cd(strItem, TRUE);
790 populateLocalView(); 794 populateLocalView();
791 } 795 }
792 } else { 796 } else {
793 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 797 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
794 if( QFile::exists(strItem ) ) { 798 if( QFile::exists(strItem ) ) {
795 // qDebug("upload "+strItem); 799 // qDebug("upload "+strItem);
796 return; 800 return;
797 } 801 }
798 } //end not symlink 802 } //end not symlink
799 chdir(strItem.latin1()); 803 chdir(strItem.latin1());
800 } 804 }
801 } 805 }
802} 806}
803 807
804void OpieFtp::doLocalCd() 808void OpieFtp::doLocalCd()
805{ 809{
806 localListClicked( Local_View->currentItem()); 810 localListClicked( Local_View->currentItem());
807} 811}
808 812
809void OpieFtp:: doRemoteCd() 813void OpieFtp:: doRemoteCd()
810{ 814{
811 remoteListClicked( Remote_View->currentItem()); 815 remoteListClicked( Remote_View->currentItem());
812 816
813} 817}
814 818
815void OpieFtp::showHidden() 819void OpieFtp::showHidden()
816{ 820{
817 if (!b) { 821 if (!b) {
818 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 822 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
819 localMenu->setItemChecked(localMenu->idAt(0),TRUE); 823 localMenu->setItemChecked(localMenu->idAt(0),TRUE);
820// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 824// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
821 b=TRUE; 825 b=TRUE;
822 826
823 } else { 827 } else {
824 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 828 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
825 localMenu->setItemChecked(localMenu->idAt(0),FALSE); 829 localMenu->setItemChecked(localMenu->idAt(0),FALSE);
826// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 830// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
827 b=FALSE; 831 b=FALSE;
828 } 832 }
829 populateLocalView(); 833 populateLocalView();
830} 834}
831 835
832void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 836void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
833{ 837{
834// if(item) 838// if(item)
835 if (mouse == 2) { 839 if (mouse == 2) {
836 showLocalMenu(item); 840 showLocalMenu(item);
837 } 841 }
838} 842}
839 843
840void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 844void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
841{ 845{
842 if(mouse == 2) { 846 if(mouse == 2) {
843 showRemoteMenu(item); 847 showRemoteMenu(item);
844 } 848 }
845} 849}
846 850
847void OpieFtp::showRemoteMenu(QListViewItem * item) 851void OpieFtp::showRemoteMenu(QListViewItem * item)
848{ 852{
849 QPopupMenu * m;// = new QPopupMenu( Local_View ); 853 QPopupMenu * m;// = new QPopupMenu( Local_View );
850 m = new QPopupMenu(this); 854 m = new QPopupMenu(this);
851 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) 855 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1)
852 m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 856 m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
853 else 857 else
854 m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 858 m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
855 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 859 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
856 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 860 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
857 m->insertSeparator(); 861 m->insertSeparator();
858 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 862 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
859 m->exec( QCursor::pos() ); 863 m->exec( QCursor::pos() );
860 delete m; 864 delete m;
861} 865}
862 866
863void OpieFtp::showLocalMenu(QListViewItem * item) 867void OpieFtp::showLocalMenu(QListViewItem * item)
864{ 868{
865 869
866 QPopupMenu *m; 870 QPopupMenu *m;
867 m = new QPopupMenu( this); 871 m = new QPopupMenu( this);
868 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 872 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
869 m->insertSeparator(); 873 m->insertSeparator();
870 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 874 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
871 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 875 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
872 else 876 else
873 m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 877 m->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
874 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 878 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
875 m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 879 m->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
876 m->insertSeparator(); 880 m->insertSeparator();
877 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 881 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
878 m->setCheckable(TRUE); 882 m->setCheckable(TRUE);
879 if (b) 883 if (b)
880 m->setItemChecked(m->idAt(0),TRUE); 884 m->setItemChecked(m->idAt(0),TRUE);
881 else 885 else
882 m->setItemChecked(m->idAt(0),FALSE); 886 m->setItemChecked(m->idAt(0),FALSE);
883 887
884 m->exec( QCursor::pos() ); 888 m->exec( QCursor::pos() );
885 delete m; 889 delete m;
886} 890}
887 891
888void OpieFtp::localMakDir() 892void OpieFtp::localMakDir()
889{ 893{
890 InputDialog *fileDlg; 894 InputDialog *fileDlg;
891 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 895 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
892 fileDlg->exec(); 896 fileDlg->exec();
893 if( fileDlg->result() == 1 ) { 897 if( fileDlg->result() == 1 ) {
894 QString filename = fileDlg->LineEdit1->text(); 898 QString filename = fileDlg->LineEdit1->text();
895 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 899 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
896 } 900 }
897 populateLocalView(); 901 populateLocalView();
898} 902}
899 903
900void OpieFtp::localDelete() 904void OpieFtp::localDelete()
901{ 905{
902 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 906 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
903 QListViewItemIterator it( Local_View ); 907 QListViewItemIterator it( Local_View );
904 for ( ; it.current(); ++it ) { 908 for ( ; it.current(); ++it ) {
905 if ( it.current()->isSelected() ) { 909 if ( it.current()->isSelected() ) {
906 QString f = it.current()->text(0); 910 QString f = it.current()->text(0);
907 it.current()->setSelected(FALSE); 911 it.current()->setSelected(FALSE);
908 912
909// QString f = Local_View->currentItem()->text(0); 913// QString f = Local_View->currentItem()->text(0);
910 if(QDir(f).exists() ) { 914 if(QDir(f).exists() ) {
911 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 915 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
912 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { 916 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
913 case 0: { 917 case 0: {
914 f=currentDir.canonicalPath()+"/"+f; 918 f=currentDir.canonicalPath()+"/"+f;
915 QString cmd="rmdir "+f; 919 QString cmd="rmdir "+f;
916 system( cmd.latin1()); 920 system( cmd.latin1());
917 } 921 }
918 break; 922 break;
919 case 1: 923 case 1:
920 // exit 924 // exit
921 break; 925 break;
922 }; 926 };
923 927
924 } else { 928 } else {
925 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 929 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
926 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 930 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
927 case 0: { 931 case 0: {
928 f=currentDir.canonicalPath()+"/"+f; 932 f=currentDir.canonicalPath()+"/"+f;
929 QString cmd="rm "+f; 933 QString cmd="rm "+f;
930 system( cmd.latin1()); 934 system( cmd.latin1());
931 } 935 }
932 break; 936 break;
933 case 1: 937 case 1:
934 // exit 938 // exit
935 break; 939 break;
936 }; 940 };
937 } 941 }
938 } 942 }
939 } 943 }
940 populateLocalView(); 944 populateLocalView();
941 945
942} 946}
943 947
944void OpieFtp::remoteMakDir() 948void OpieFtp::remoteMakDir()
945{ 949{
946 InputDialog *fileDlg; 950 InputDialog *fileDlg;
947 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 951 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
948 fileDlg->exec(); 952 fileDlg->exec();
949 if( fileDlg->result() == 1 ) { 953 if( fileDlg->result() == 1 ) {
950 QString filename = fileDlg->LineEdit1->text();//+".playlist"; 954 QString filename = fileDlg->LineEdit1->text();//+".playlist";
951 QString tmp=currentRemoteDir+filename; 955 QString tmp=currentRemoteDir+filename;
952 QCopEnvelope ( "QPE/System", "busy()" ); 956 QCopEnvelope ( "QPE/System", "busy()" );
953 if(FtpMkdir( tmp.latin1(), conn) == 0) { 957 if(FtpMkdir( tmp.latin1(), conn) == 0) {
954 QString msg; 958 QString msg;
955 msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); 959 msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn));
956 msg.replace(QRegExp(":"),"\n"); 960 msg.replace(QRegExp(":"),"\n");
957 QMessageBox::message(tr("Note"),msg); 961 QMessageBox::message(tr("Note"),msg);
958 } 962 }
959 QCopEnvelope ( "QPE/System", "notBusy()" ); 963 QCopEnvelope ( "QPE/System", "notBusy()" );
960 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 964 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
961 } 965 }
962} 966}
963 967
964void OpieFtp::remoteDelete() 968void OpieFtp::remoteDelete()
965{ 969{
966 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 970 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
967 QListViewItemIterator it( Remote_View ); 971 QListViewItemIterator it( Remote_View );
968 for ( ; it.current(); ++it ) { 972 for ( ; it.current(); ++it ) {
969 if ( it.current()->isSelected() ) { 973 if ( it.current()->isSelected() ) {
970 QString f = it.current()->text(0); 974 QString f = it.current()->text(0);
971// QString f = Remote_View->currentItem()->text(0); 975// QString f = Remote_View->currentItem()->text(0);
972 QCopEnvelope ( "QPE/System", "busy()" ); 976 QCopEnvelope ( "QPE/System", "busy()" );
973 if( f.right(1) =="/") { 977 if( f.right(1) =="/") {
974 QString path= currentRemoteDir+f; 978 QString path= currentRemoteDir+f;
975 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" 979 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
976 ,tr("Yes"),tr("No"),0,0,1) ) { 980 ,tr("Yes"),tr("No"),0,0,1) ) {
977 case 0: { 981 case 0: {
978 f=currentDir.canonicalPath()+"/"+f; 982 f=currentDir.canonicalPath()+"/"+f;
979 if(FtpRmdir( path.latin1(), conn) ==0) { 983 if(FtpRmdir( path.latin1(), conn) ==0) {
980 QString msg; 984 QString msg;
981 msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); 985 msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn));
982 msg.replace(QRegExp(":"),"\n"); 986 msg.replace(QRegExp(":"),"\n");
983 QMessageBox::message(tr("Note"),msg); 987 QMessageBox::message(tr("Note"),msg);
984 } 988 }
985 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 989 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
986 } 990 }
987 break; 991 break;
988 }; 992 };
989 } else { 993 } else {
990 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" 994 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
991 ,tr("Yes"),tr("No"),0,0,1) ) { 995 ,tr("Yes"),tr("No"),0,0,1) ) {
992 case 0: { 996 case 0: {
993 QString path= currentRemoteDir+f; 997 QString path= currentRemoteDir+f;
994 if(FtpDelete( path.latin1(), conn)==0) { 998 if(FtpDelete( path.latin1(), conn)==0) {
995 QString msg; 999 QString msg;
996 msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); 1000 msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn));
997 msg.replace(QRegExp(":"),"\n"); 1001 msg.replace(QRegExp(":"),"\n");
998 QMessageBox::message(tr("Note"),msg); 1002 QMessageBox::message(tr("Note"),msg);
999 } 1003 }
1000 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1004 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1001 } 1005 }
1002 break; 1006 break;
1003 }; 1007 };
1004 } 1008 }
1005 } 1009 }
1006 } 1010 }
1007 QCopEnvelope ( "QPE/System", "notBusy()" ); 1011 QCopEnvelope ( "QPE/System", "notBusy()" );
1008} 1012}
1009 1013
1010void OpieFtp::remoteRename() 1014void OpieFtp::remoteRename()
1011{ 1015{
1012 QString curFile = Remote_View->currentItem()->text(0); 1016 QString curFile = Remote_View->currentItem()->text(0);
1013 InputDialog *fileDlg; 1017 InputDialog *fileDlg;
1014 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 1018 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
1015 fileDlg->setTextEdit((const QString &)curFile); 1019 fileDlg->setTextEdit((const QString &)curFile);
1016 fileDlg->exec(); 1020 fileDlg->exec();
1017 if( fileDlg->result() == 1 ) { 1021 if( fileDlg->result() == 1 ) {
1018 QString oldName = currentRemoteDir +"/"+ curFile; 1022 QString oldName = currentRemoteDir +"/"+ curFile;
1019 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; 1023 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist";
1020 QCopEnvelope ( "QPE/System", "busy()" ); 1024 QCopEnvelope ( "QPE/System", "busy()" );
1021 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { 1025 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) {
1022 QString msg; 1026 QString msg;
1023 msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); 1027 msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn));
1024 msg.replace(QRegExp(":"),"\n"); 1028 msg.replace(QRegExp(":"),"\n");
1025 QMessageBox::message(tr("Note"),msg); 1029 QMessageBox::message(tr("Note"),msg);
1026 } 1030 }
1027 QCopEnvelope ( "QPE/System", "notBusy()" ); 1031 QCopEnvelope ( "QPE/System", "notBusy()" );
1028 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1032 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1029 } 1033 }
1030} 1034}
1031 1035
1032void OpieFtp::localRename() 1036void OpieFtp::localRename()
1033{ 1037{
1034 QString curFile = Local_View->currentItem()->text(0); 1038 QString curFile = Local_View->currentItem()->text(0);
1035 InputDialog *fileDlg; 1039 InputDialog *fileDlg;
1036 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 1040 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
1037 fileDlg->setTextEdit((const QString &)curFile); 1041 fileDlg->setTextEdit((const QString &)curFile);
1038 fileDlg->exec(); 1042 fileDlg->exec();
1039 if( fileDlg->result() == 1 ) { 1043 if( fileDlg->result() == 1 ) {
1040 QString oldname = currentDir.canonicalPath() + "/" + curFile; 1044 QString oldname = currentDir.canonicalPath() + "/" + curFile;
1041 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 1045 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
1042 if( rename(oldname.latin1(), newName.latin1())== -1) 1046 if( rename(oldname.latin1(), newName.latin1())== -1)
1043 QMessageBox::message(tr("Note"),tr("Could not rename")); 1047 QMessageBox::message(tr("Note"),tr("Could not rename"));
1044 } 1048 }
1045 populateLocalView(); 1049 populateLocalView();
1046} 1050}
1047 1051
1048void OpieFtp::currentPathComboActivated(const QString & currentPath) { 1052void OpieFtp::currentPathComboActivated(const QString & currentPath) {
1049 if (TabWidget->currentPageIndex() == 0) { 1053 if (TabWidget->currentPageIndex() == 0) {
1050 chdir( currentPath.latin1() ); 1054 chdir( currentPath.latin1() );
1051 currentDir.cd( currentPath, TRUE); 1055 currentDir.cd( currentPath, TRUE);
1052 populateLocalView(); 1056 populateLocalView();
1053 update(); 1057 update();
1054 } else { 1058 } else {
1055// chdir( currentPath.latin1() ); 1059// chdir( currentPath.latin1() );
1056// currentDir.cd( currentPath, TRUE); 1060// currentDir.cd( currentPath, TRUE);
1057// populateList(); 1061// populateList();
1058// update(); 1062// update();
1059 1063
1060 } 1064 }
1061} 1065}
1062 1066
1063void OpieFtp::fillCombo(const QString &currentPath) { 1067void OpieFtp::fillCombo(const QString &currentPath) {
1064 1068
1065 currentPathCombo->lineEdit()->setText(currentPath); 1069 currentPathCombo->lineEdit()->setText(currentPath);
1066 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1070 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1067 currentPathCombo->clear(); 1071 currentPathCombo->clear();
1068 localDirPathStringList.prepend(currentPath ); 1072 localDirPathStringList.prepend(currentPath );
1069 currentPathCombo->insertStringList( localDirPathStringList,-1); 1073 currentPathCombo->insertStringList( localDirPathStringList,-1);
1070 } 1074 }
1071 currentPathCombo->lineEdit()->setText(currentPath); 1075 currentPathCombo->lineEdit()->setText(currentPath);
1072 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1076 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1073 currentPathCombo->clear(); 1077 currentPathCombo->clear();
1074 remoteDirPathStringList.prepend(currentPath ); 1078 remoteDirPathStringList.prepend(currentPath );
1075 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1079 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1076 } 1080 }
1077} 1081}
1078 1082
1079void OpieFtp::fillRemoteCombo(const QString &currentPath) { 1083void OpieFtp::fillRemoteCombo(const QString &currentPath) {
1080 1084
1081 currentPathCombo->lineEdit()->setText(currentPath); 1085 currentPathCombo->lineEdit()->setText(currentPath);
1082 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1086 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1083 currentPathCombo->clear(); 1087 currentPathCombo->clear();
1084 remoteDirPathStringList.prepend(currentPath ); 1088 remoteDirPathStringList.prepend(currentPath );
1085 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1089 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1086 } 1090 }
1087} 1091}
1088 1092
1089void OpieFtp::currentPathComboChanged() 1093void OpieFtp::currentPathComboChanged()
1090{ 1094{
1091 QString oldRemoteCurrentDir = currentRemoteDir; 1095 QString oldRemoteCurrentDir = currentRemoteDir;
1092// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); 1096// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
1093 if (TabWidget->currentPageIndex() == 0) { 1097 if (TabWidget->currentPageIndex() == 0) {
1094 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 1098 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
1095 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 1099 currentDir.setPath( currentPathCombo->lineEdit()->text() );
1096 populateLocalView(); 1100 populateLocalView();
1097 } else { 1101 } else {
1098 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 1102 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
1099 } 1103 }
1100 } 1104 }
1101 if (TabWidget->currentPageIndex() == 1) { 1105 if (TabWidget->currentPageIndex() == 1) {
1102 currentRemoteDir = currentPathCombo->lineEdit()->text(); 1106 currentRemoteDir = currentPathCombo->lineEdit()->text();
1103 if(currentRemoteDir.right(1) !="/") { 1107 if(currentRemoteDir.right(1) !="/") {
1104 currentRemoteDir = currentRemoteDir +"/"; 1108 currentRemoteDir = currentRemoteDir +"/";
1105 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 1109 currentPathCombo->lineEdit()->setText( currentRemoteDir );
1106 } 1110 }
1107 if( !remoteChDir( (const QString &)currentRemoteDir) ) { 1111 if( !remoteChDir( (const QString &)currentRemoteDir) ) {
1108 currentRemoteDir = oldRemoteCurrentDir; 1112 currentRemoteDir = oldRemoteCurrentDir;
1109 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 1113 currentPathCombo->lineEdit()->setText( currentRemoteDir );
1110 } 1114 }
1111 1115
1112 remoteDirList( (const QString &)currentRemoteDir); 1116 remoteDirList( (const QString &)currentRemoteDir);
1113 } 1117 }
1114} 1118}
1115 1119
1116void OpieFtp::switchToLocalTab() 1120void OpieFtp::switchToLocalTab()
1117{ 1121{
1118 TabWidget->setCurrentPage(0); 1122 TabWidget->setCurrentPage(0);
1119} 1123}
1120 1124
1121void OpieFtp::switchToRemoteTab() 1125void OpieFtp::switchToRemoteTab()
1122{ 1126{
1123 TabWidget->setCurrentPage(1); 1127 TabWidget->setCurrentPage(1);
1124} 1128}
1125 1129
1126void OpieFtp::switchToConfigTab() 1130void OpieFtp::switchToConfigTab()
1127{ 1131{
1128 TabWidget->setCurrentPage(2); 1132 TabWidget->setCurrentPage(2);
1129} 1133}
1130 1134
1131void OpieFtp::readConfig() 1135void OpieFtp::readConfig()
1132{ 1136{
1133 fillCombos(); 1137 fillCombos();
1134 Config cfg("opieftp"); 1138 Config cfg("opieftp");
1135 cfg.setGroup("Server"); 1139 cfg.setGroup("Server");
1136 currentServerConfig = cfg.readNumEntry("currentServer", -1); 1140 currentServerConfig = cfg.readNumEntry("currentServer", -1);
1137// qDebug("Reading %d", currentServerConfig); 1141// qDebug("Reading %d", currentServerConfig);
1138 serverComboSelected( currentServerConfig); 1142 serverComboSelected( currentServerConfig);
1139} 1143}
1140 1144
1141void OpieFtp::writeConfig() 1145void OpieFtp::writeConfig()
1142{ 1146{
1143 Config cfg("opieftp"); 1147 Config cfg("opieftp");
1144 cfg.setGroup("Server"); 1148 cfg.setGroup("Server");
1145 QString username, remoteServerStr, remotePathStr, password, port, temp; 1149 QString username, remoteServerStr, remotePathStr, password, port, temp;
1146 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1150 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1147 if( currentServerConfig == -1) { 1151 if( currentServerConfig == -1) {
1148 for (int i = 1; i <= numberOfEntries; i++) { 1152 for (int i = 1; i <= numberOfEntries; i++) {
1149 temp.setNum(i); 1153 temp.setNum(i);
1150 cfg.setGroup("Server"); 1154 cfg.setGroup("Server");
1151 QString tempStr = cfg.readEntry( temp,""); 1155 QString tempStr = cfg.readEntry( temp,"");
1152 } 1156 }
1153 temp.setNum( numberOfEntries + 1); 1157 temp.setNum( numberOfEntries + 1);
1154 cfg.setGroup("Server"); 1158 cfg.setGroup("Server");
1155 remoteServerStr = cfg.readEntry( temp,""); 1159 remoteServerStr = cfg.readEntry( temp,"");
1156 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1160 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1157 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1161 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1158 1162
1159 temp.setNum(numberOfEntries+1); 1163 temp.setNum(numberOfEntries+1);
1160 cfg.setGroup("Server"); 1164 cfg.setGroup("Server");
1161 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); 1165 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() );
1162 cfg.setGroup(temp); 1166 cfg.setGroup(temp);
1163 cfg.writeEntry("RemotePath", remotePath->text()); 1167 cfg.writeEntry("RemotePath", remotePath->text());
1164 cfg.writeEntry("Username", UsernameComboBox->currentText()); 1168 cfg.writeEntry("Username", UsernameComboBox->currentText());
1165 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); 1169 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text());
1166 cfg.setGroup("Server"); 1170 cfg.setGroup("Server");
1167 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); 1171 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 ));
1168 } 1172 }
1169} 1173}
1170 1174
1171void OpieFtp::fillCombos() 1175void OpieFtp::fillCombos()
1172{ 1176{
1173 Config cfg("opieftp"); 1177 Config cfg("opieftp");
1174 cfg.setGroup("Server"); 1178 cfg.setGroup("Server");
1175 QString username, remoteServerStr, remotePathStr, password, port, temp; 1179 QString username, remoteServerStr, remotePathStr, password, port, temp;
1176 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1180 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1177 for (int i = 1; i <= numberOfEntries; i++) { 1181 for (int i = 1; i <= numberOfEntries; i++) {
1178 temp.setNum(i); 1182 temp.setNum(i);
1179 cfg.setGroup("Server"); 1183 cfg.setGroup("Server");
1180 remoteServerStr = cfg.readEntry( temp,""); 1184 remoteServerStr = cfg.readEntry( temp,"");
1181 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1185 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1182 port = remoteServerStr.right( divider - 1); 1186 port = remoteServerStr.right( divider - 1);
1183 bool ok; 1187 bool ok;
1184 PortSpinBox->setValue( port.toInt(&ok,10)); 1188 PortSpinBox->setValue( port.toInt(&ok,10));
1185 1189
1186 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1190 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1187 ServerComboBox->insertItem( remoteServerStr ); 1191 ServerComboBox->insertItem( remoteServerStr );
1188// cfg.setGroup(temp); 1192// cfg.setGroup(temp);
1189 1193
1190// remotePathStr = cfg.readEntry(remoteServer,""); 1194// remotePathStr = cfg.readEntry(remoteServer,"");
1191// int divider = remoteServer.length() - remoteServer.find(":",0,TRUE); 1195// int divider = remoteServer.length() - remoteServer.find(":",0,TRUE);
1192// port = remoteServer.right( divider+1); 1196// port = remoteServer.right( divider+1);
1193// PortSpinBox->setValue( port); 1197// PortSpinBox->setValue( port);
1194 1198
1195// remoteServer = remoteServer.left(divider - 1); 1199// remoteServer = remoteServer.left(divider - 1);
1196// remotePath->setText( remotePathStr); 1200// remotePath->setText( remotePathStr);
1197 1201
1198// username = cfg.readEntry(temp); 1202// username = cfg.readEntry(temp);
1199// UsernameComboBox->insertItem(username); 1203// UsernameComboBox->insertItem(username);
1200// password = cfg.readEntryCrypt(username,""); 1204// password = cfg.readEntryCrypt(username,"");
1201// PasswordEdit->setText(password); 1205// PasswordEdit->setText(password);
1202 } 1206 }
1203} 1207}
1204 1208
1205 1209
1206void OpieFtp::serverComboSelected(int index) 1210void OpieFtp::serverComboSelected(int index)
1207{ 1211{
1208 currentServerConfig = index; 1212 currentServerConfig = index;
1209 QString username, remoteServerStr, remotePathStr, password, port, temp; 1213 QString username, remoteServerStr, remotePathStr, password, port, temp;
1210// remoteServerStr = ServerComboBox->text(index); 1214// remoteServerStr = ServerComboBox->text(index);
1211 Config cfg("opieftp"); 1215 Config cfg("opieftp");
1212 cfg.setGroup("Server"); 1216 cfg.setGroup("Server");
1213 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1217 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1214 1218
1215 temp.setNum(index+1); 1219 temp.setNum(index+1);
1216 remoteServerStr = cfg.readEntry( temp,""); 1220 remoteServerStr = cfg.readEntry( temp,"");
1217 cfg.setGroup(temp); 1221 cfg.setGroup(temp);
1218// qDebug(temp); 1222// qDebug(temp);
1219 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1223 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1220 port = remoteServerStr.right( divider - 1); 1224 port = remoteServerStr.right( divider - 1);
1221 bool ok; 1225 bool ok;
1222 int portInt = port.toInt(&ok,10); 1226 int portInt = port.toInt(&ok,10);
1223 if( portInt == 0) portInt = 21; 1227 if( portInt == 0) portInt = 21;
1224 1228
1225 PortSpinBox->setValue( portInt); 1229 PortSpinBox->setValue( portInt);
1226 1230
1227 remotePath->setText(cfg.readEntry("RemotePath", "/")); 1231 remotePath->setText(cfg.readEntry("RemotePath", "/"));
1228 1232
1229 username = cfg.readEntry("Username", "anonymous"); 1233 username = cfg.readEntry("Username", "anonymous");
1230 UsernameComboBox->lineEdit()->setText(username); 1234 UsernameComboBox->lineEdit()->setText(username);
1231 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); 1235 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
1232 1236
1233 cfg.setGroup("Server"); 1237 cfg.setGroup("Server");
1234 temp.sprintf("%d",currentServerConfig); 1238 temp.sprintf("%d",currentServerConfig);
1235 cfg.writeEntry("currentServer", temp); 1239 cfg.writeEntry("currentServer", temp);
1236 update(); 1240 update();
1237} 1241}
1238// UsernameComboBox->lineEdit()->setText("root"); 1242// UsernameComboBox->lineEdit()->setText("root");
1239// PasswordEdit->setText( tr( "" ) ); 1243// PasswordEdit->setText( tr( "" ) );
1240// ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); 1244// ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) );
1241// remotePath->setText( currentRemoteDir = "/home/llornkcor/"); 1245// remotePath->setText( currentRemoteDir = "/home/llornkcor/");
1242// PortSpinBox->setValue( 4242); 1246// PortSpinBox->setValue( 4242);
1243 1247
1244void OpieFtp::deleteServer() 1248void OpieFtp::deleteServer()
1245{ 1249{
1246 QString username, remoteServerStr, remotePathStr, password, port, temp; 1250 QString username, remoteServerStr, remotePathStr, password, port, temp;
1247 remoteServerStr = ServerComboBox->currentText( ); 1251 remoteServerStr = ServerComboBox->currentText( );
1248 username = UsernameComboBox->currentText(); 1252 username = UsernameComboBox->currentText();
1249 Config cfg("opieftp"); 1253 Config cfg("opieftp");
1250 cfg.setGroup("Server"); 1254 cfg.setGroup("Server");
1251 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1255 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1252 for (int i = 0; i <= numberOfEntries; i++) { 1256 for (int i = 0; i <= numberOfEntries; i++) {
1253 temp.setNum(i+1); 1257 temp.setNum(i+1);
1254 cfg.setGroup("Server"); 1258 cfg.setGroup("Server");
1255 if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1 1259 if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1
1256 && cfg.readEntry(temp).find(username,0,TRUE) != -1 1260 && cfg.readEntry(temp).find(username,0,TRUE) != -1
1257 && !remoteServerStr.isEmpty()) { 1261 && !remoteServerStr.isEmpty()) {
1258 qDebug(temp); 1262 qDebug(temp);
1259 } 1263 }
1260 } 1264 }
1261} 1265}
1262 1266
1263void OpieFtp::upDir() 1267void OpieFtp::upDir()
1264{ 1268{
1265 if (TabWidget->currentPageIndex() == 0) { 1269 if (TabWidget->currentPageIndex() == 0) {
1266 QString current = currentDir.canonicalPath(); 1270 QString current = currentDir.canonicalPath();
1267 QDir dir(current); 1271 QDir dir(current);
1268 dir.cdUp(); 1272 dir.cdUp();
1269 current = dir.canonicalPath(); 1273 current = dir.canonicalPath();
1270 chdir( current.latin1() ); 1274 chdir( current.latin1() );
1271 currentDir.cd( current, TRUE); 1275 currentDir.cd( current, TRUE);
1272 populateLocalView(); 1276 populateLocalView();
1273 update(); 1277 update();
1274 } else { 1278 } else {
1275 if( FtpCDUp( conn) == 0) { 1279 if( FtpCDUp( conn) == 0) {
1276 QString msg; 1280 QString msg;
1277 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 1281 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
1278 msg.replace(QRegExp(":"),"\n"); 1282 msg.replace(QRegExp(":"),"\n");
1279 QMessageBox::message(tr("Note"),msg); 1283 QMessageBox::message(tr("Note"),msg);
1280// qDebug(msg); 1284// qDebug(msg);
1281 } 1285 }
1282 char path[256]; 1286 char path[256];
1283 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 1287 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
1284 QString msg; 1288 QString msg;
1285 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 1289 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
1286 msg.replace(QRegExp(":"),"\n"); 1290 msg.replace(QRegExp(":"),"\n");
1287 QMessageBox::message(tr("Note"),msg); 1291 QMessageBox::message(tr("Note"),msg);
1288// qDebug(msg); 1292// qDebug(msg);
1289 } 1293 }
1290 currentRemoteDir=path; 1294 currentRemoteDir=path;
1291 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1295 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1292 if(currentRemoteDir.right(1) !="/") 1296 if(currentRemoteDir.right(1) !="/")
1293 currentRemoteDir +="/"; 1297 currentRemoteDir +="/";
1294 currentPathCombo->lineEdit()->setText( currentRemoteDir); 1298 currentPathCombo->lineEdit()->setText( currentRemoteDir);
1295 fillRemoteCombo( (const QString &)currentRemoteDir); 1299 fillRemoteCombo( (const QString &)currentRemoteDir);
1296 1300
1297 } 1301 }
1298} 1302}
1299 1303
1300void OpieFtp::docButtonPushed() { 1304void OpieFtp::docButtonPushed() {
1301 QString current = QPEApplication::documentDir(); 1305 QString current = QPEApplication::documentDir();
1302 chdir( current.latin1() ); 1306 chdir( current.latin1() );
1303 currentDir.cd( current, TRUE); 1307 currentDir.cd( current, TRUE);
1304 populateLocalView(); 1308 populateLocalView();
1305 update(); 1309 update();
1306 1310
1307} 1311}
1308 1312
1309void OpieFtp::homeButtonPushed() { 1313void OpieFtp::homeButtonPushed() {
1310 QString current = QDir::homeDirPath(); 1314 QString current = QDir::homeDirPath();
1311 chdir( current.latin1() ); 1315 chdir( current.latin1() );
1312 currentDir.cd( current, TRUE); 1316 currentDir.cd( current, TRUE);
1313 populateLocalView(); 1317 populateLocalView();
1314 update(); 1318 update();
1315} 1319}
1320
1321void OpieFtp::doAbout() {
1322 QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n"
1323 "L.J.Potter<llornkcor@handhelds.org>\n"
1324 "and uses ftplib copyright 1996-2000\n"
1325 "by Thomas Pfau, pfau@cnj.digex.net\n\n"
1326 "and is licensed by the GPL");
1327}
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h
index 6852b1c..218a958 100644
--- a/noncore/net/opieftp/opieftp.h
+++ b/noncore/net/opieftp/opieftp.h
@@ -1,120 +1,120 @@
1/*************************************************************************** 1/***************************************************************************
2 opieftp.h 2 opieftp.h
3 ------------------- 3 -------------------
4** Created: Sat Mar 9 23:33:09 2002 4** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#ifndef OPIEFTP_H 12#ifndef OPIEFTP_H
13#define OPIEFTP_H 13#define OPIEFTP_H
14 14
15#include <qvariant.h> 15#include <qvariant.h>
16#include <qdialog.h> 16#include <qdialog.h>
17#include <qmainwindow.h> 17#include <qmainwindow.h>
18#include <qdir.h> 18#include <qdir.h>
19#include <qstring.h> 19#include <qstring.h>
20#include <qpoint.h> 20#include <qpoint.h>
21 21
22class QVBoxLayout; 22class QVBoxLayout;
23class QHBoxLayout; 23class QHBoxLayout;
24class QGridLayout; 24class QGridLayout;
25class QComboBox; 25class QComboBox;
26class QListView; 26class QListView;
27class QListviewItem; 27class QListviewItem;
28class QLabel; 28class QLabel;
29class QProgressBar; 29class QProgressBar;
30class QSpinBox; 30class QSpinBox;
31class QTabWidget; 31class QTabWidget;
32class QWidget; 32class QWidget;
33class QPEToolBar; 33class QPEToolBar;
34class QPEMenuBar; 34class QPEMenuBar;
35class QPopupMenu; 35class QPopupMenu;
36class QFile; 36class QFile;
37class QListViewItem; 37class QListViewItem;
38class QLineEdit; 38class QLineEdit;
39class QPushButton; 39class QPushButton;
40class QStringList; 40class QStringList;
41 41
42class OpieFtp : public QMainWindow 42class OpieFtp : public QMainWindow
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 45
46public: 46public:
47 OpieFtp( ); 47 OpieFtp( );
48 ~OpieFtp(); 48 ~OpieFtp();
49 49
50 QTabWidget *TabWidget; 50 QTabWidget *TabWidget;
51 QWidget *tab, *tab_2, *tab_3; 51 QWidget *tab, *tab_2, *tab_3;
52 QListView *Local_View, *Remote_View; 52 QListView *Local_View, *Remote_View;
53 53
54 QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; 54 QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo;
55 QLineEdit *PasswordEdit, *remotePath; 55 QLineEdit *PasswordEdit, *remotePath;
56 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; 56 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;;
57 QSpinBox* PortSpinBox; 57 QSpinBox* PortSpinBox;
58 QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; 58 QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu;
59 QDir currentDir; 59 QDir currentDir;
60 QString currentRemoteDir; 60 QString currentRemoteDir;
61 QString filterStr; 61 QString filterStr;
62 QListViewItem * item; 62 QListViewItem * item;
63 QPushButton *connectServerBtn, *cdUpButton, *homeButton, *docButton; 63 QPushButton *connectServerBtn, *cdUpButton, *homeButton, *docButton;
64 bool b; 64 bool b;
65 int currentServerConfig; 65 int currentServerConfig;
66protected slots: 66protected slots:
67 void upDir(); 67 void upDir();
68 void homeButtonPushed(); 68 void homeButtonPushed();
69 void docButtonPushed(); 69 void docButtonPushed();
70 70 void doAbout();
71 void serverComboEdited(const QString & ); 71 void serverComboEdited(const QString & );
72 void showLocalMenu( QListViewItem *); 72 void showLocalMenu( QListViewItem *);
73 void showRemoteMenu( QListViewItem *); 73 void showRemoteMenu( QListViewItem *);
74 void doLocalCd(); 74 void doLocalCd();
75 void doRemoteCd(); 75 void doRemoteCd();
76 void localUpload(); 76 void localUpload();
77 void remoteDownload(); 77 void remoteDownload();
78 void newConnection(); 78 void newConnection();
79 void connector(); 79 void connector();
80 void disConnector(); 80 void disConnector();
81 void populateLocalView(); 81 void populateLocalView();
82 bool populateRemoteView(); 82 bool populateRemoteView();
83 void showHidden(); 83 void showHidden();
84 void writeConfig(); 84 void writeConfig();
85 void readConfig(); 85 void readConfig();
86 void localListClicked(QListViewItem *); 86 void localListClicked(QListViewItem *);
87 void remoteListClicked(QListViewItem *); 87 void remoteListClicked(QListViewItem *);
88 void ListPressed( int, QListViewItem *, const QPoint&, int); 88 void ListPressed( int, QListViewItem *, const QPoint&, int);
89 void RemoteListPressed( int, QListViewItem *, const QPoint&, int); 89 void RemoteListPressed( int, QListViewItem *, const QPoint&, int);
90 void localMakDir(); 90 void localMakDir();
91 void localDelete(); 91 void localDelete();
92 void remoteMakDir(); 92 void remoteMakDir();
93 void remoteDelete(); 93 void remoteDelete();
94 bool remoteDirList(const QString &); 94 bool remoteDirList(const QString &);
95 bool remoteChDir(const QString &); 95 bool remoteChDir(const QString &);
96 void tabChanged(QWidget*); 96 void tabChanged(QWidget*);
97 void cleanUp(); 97 void cleanUp();
98 void remoteRename(); 98 void remoteRename();
99 void localRename(); 99 void localRename();
100 void currentPathComboChanged(); 100 void currentPathComboChanged();
101 void currentPathComboActivated(const QString &); 101 void currentPathComboActivated(const QString &);
102 void switchToLocalTab(); 102 void switchToLocalTab();
103 void switchToRemoteTab(); 103 void switchToRemoteTab();
104 void switchToConfigTab(); 104 void switchToConfigTab();
105 void fillCombos(); 105 void fillCombos();
106 void fillRemoteCombo(const QString&); 106 void fillRemoteCombo(const QString&);
107 void fillCombo(const QString &); 107 void fillCombo(const QString &);
108 void serverComboSelected(int); 108 void serverComboSelected(int);
109 void deleteServer(); 109 void deleteServer();
110 void connectorBtnToggled(bool); 110 void connectorBtnToggled(bool);
111protected: 111protected:
112 QStringList remoteDirPathStringList, localDirPathStringList; 112 QStringList remoteDirPathStringList, localDirPathStringList;
113 void nullifyCallBack(); 113 void nullifyCallBack();
114 QGridLayout* tabLayout; 114 QGridLayout* tabLayout;
115 QGridLayout* tabLayout_2; 115 QGridLayout* tabLayout_2;
116 QGridLayout* tabLayout_3; 116 QGridLayout* tabLayout_3;
117 117
118}; 118};
119 119
120#endif // OPIEFTP_H 120#endif // OPIEFTP_H
diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro
index f25d15f..7aead00 100644
--- a/noncore/net/opieftp/opieftp.pro
+++ b/noncore/net/opieftp/opieftp.pro
@@ -1,23 +1,23 @@
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 filePermissions.h
4SOURCES = opieftp.cpp inputDialog.cpp ftplib.c main.cpp 4SOURCES = opieftp.cpp inputDialog.cpp ftplib.c filePermissions.cpp 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
13TRANSLATIONS += ../../i18n/de/opieftp.ts 13TRANSLATIONS += ../../i18n/de/opieftp.ts
14TRANSLATIONS += ../../i18n/en/opieftp.ts 14TRANSLATIONS += ../../i18n/en/opieftp.ts
15TRANSLATIONS += ../../i18n/hu/opieftp.ts 15TRANSLATIONS += ../../i18n/hu/opieftp.ts
16TRANSLATIONS += ../../i18n/sl/opieftp.ts 16TRANSLATIONS += ../../i18n/sl/opieftp.ts
17TRANSLATIONS += ../../i18n/pl/opieftp.ts 17TRANSLATIONS += ../../i18n/pl/opieftp.ts
18TRANSLATIONS += ../../i18n/ja/opieftp.ts 18TRANSLATIONS += ../../i18n/ja/opieftp.ts
19TRANSLATIONS += ../../i18n/ko/opieftp.ts 19TRANSLATIONS += ../../i18n/ko/opieftp.ts
20TRANSLATIONS += ../../i18n/no/opieftp.ts 20TRANSLATIONS += ../../i18n/no/opieftp.ts
21TRANSLATIONS += ../../i18n/zh_CN/opieftp.ts 21TRANSLATIONS += ../../i18n/zh_CN/opieftp.ts
22TRANSLATIONS += ../../i18n/zh_TW/opieftp.ts 22TRANSLATIONS += ../../i18n/zh_TW/opieftp.ts
23TRANSLATIONS += ../../i18n/fr/opieftp.ts 23TRANSLATIONS += ../../i18n/fr/opieftp.ts