summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-05-20 00:05:18 (UTC)
committer llornkcor <llornkcor>2003-05-20 00:05:18 (UTC)
commit5e86b57756459ebab4e0df224b833a38ec9ba223 (patch) (unidiff)
tree5e46d4d1f4384af88fb30141d0a5d968b4ca3f52
parentec7b5087388f611b994666254c08ce2543dd446a (diff)
downloadopie-5e86b57756459ebab4e0df224b833a38ec9ba223.zip
opie-5e86b57756459ebab4e0df224b833a38ec9ba223.tar.gz
opie-5e86b57756459ebab4e0df224b833a38ec9ba223.tar.bz2
fix menu issue
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index d3429de..e81b7ca 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -1,640 +1,644 @@
1/*************************************************************************** 1/***************************************************************************
2 opieftp.cpp 2 opieftp.cpp
3 ------------------- 3 -------------------
4** Created: Sat Mar 9 23:33:09 2002 4** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12//#define DEVELOPERS_VERSION 12//#define DEVELOPERS_VERSION
13 13
14#include "opieftp.h" 14#include "opieftp.h"
15 15
16extern "C" { 16extern "C" {
17#include "../ftplib/ftplib.h" 17#include "../ftplib/ftplib.h"
18} 18}
19 19
20#include "inputDialog.h" 20#include "inputDialog.h"
21 21
22#include <qpe/qpemenubar.h> 22#include <qpe/qpemenubar.h>
23#include <qpe/qpetoolbar.h> 23#include <qpe/qpetoolbar.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
27#include <qpe/config.h> 27#include <qpe/config.h>
28#include <qpe/mimetype.h> 28#include <qpe/mimetype.h>
29#include <qpe/qpemessagebox.h> 29#include <qpe/qpemessagebox.h>
30 30
31#include <qstringlist.h> 31#include <qstringlist.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qtoolbutton.h> 34#include <qtoolbutton.h>
35#include <qdatetime.h> 35#include <qdatetime.h>
36#include <qdir.h> 36#include <qdir.h>
37#include <qfile.h> 37#include <qfile.h>
38#include <qstring.h> 38#include <qstring.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qpopupmenu.h> 40#include <qpopupmenu.h>
41#include <qlistview.h> 41#include <qlistview.h>
42#include <qmainwindow.h> 42#include <qmainwindow.h>
43#include <qlabel.h> 43#include <qlabel.h>
44#include <qprogressbar.h> 44#include <qprogressbar.h>
45#include <qspinbox.h> 45#include <qspinbox.h>
46#include <qtabwidget.h> 46#include <qtabwidget.h>
47#include <qwidget.h> 47#include <qwidget.h>
48#include <qlayout.h> 48#include <qlayout.h>
49#include <qimage.h> 49#include <qimage.h>
50#include <qpixmap.h> 50#include <qpixmap.h>
51#include <qmessagebox.h> 51#include <qmessagebox.h>
52#include <qlineedit.h> 52#include <qlineedit.h>
53#include <qregexp.h> 53#include <qregexp.h>
54#include <qlistbox.h> 54#include <qlistbox.h>
55 55
56#include <unistd.h> 56#include <unistd.h>
57#include <stdlib.h> 57#include <stdlib.h>
58 58
59 59
60QProgressBar *ProgressBar; 60QProgressBar *ProgressBar;
61static netbuf *conn=NULL; 61static netbuf *conn=NULL;
62 62
63static int log_progress(netbuf *, int xfered, void *) 63static int log_progress(netbuf *, int xfered, void *)
64{ 64{
65// int fsz = *(int *)arg; 65// int fsz = *(int *)arg;
66// int pct = (xfered * 100) / fsz; 66// int pct = (xfered * 100) / fsz;
67// printf("%3d%%\r", pct); 67// printf("%3d%%\r", pct);
68// fflush(stdout); 68// fflush(stdout);
69 ProgressBar->setProgress(xfered); 69 ProgressBar->setProgress(xfered);
70 qApp->processEvents(); 70 qApp->processEvents();
71 return 1; 71 return 1;
72} 72}
73 73
74OpieFtp::OpieFtp( ) 74OpieFtp::OpieFtp( )
75 : QMainWindow( ) 75 : QMainWindow( )
76{ 76{
77 setCaption( tr( "OpieFtp" ) ); 77 setCaption( tr( "OpieFtp" ) );
78 fuckeduphack=FALSE; 78 fuckeduphack=FALSE;
79 QGridLayout *layout = new QGridLayout( this ); 79 QGridLayout *layout = new QGridLayout( this );
80 layout->setSpacing( 2); 80 layout->setSpacing( 2);
81 layout->setMargin( 2); 81 layout->setMargin( 2);
82 82
83 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 83 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
84 84
85 QPEMenuBar *menuBar = new QPEMenuBar(this); 85 QPEMenuBar *menuBar = new QPEMenuBar(this);
86// QPEToolBar *menuBar = new QPEToolBar(this); 86// QPEToolBar *menuBar = new QPEToolBar(this);
87// menuBar->setHorizontalStretchable( TRUE ); 87// menuBar->setHorizontalStretchable( TRUE );
88 88
89 QWMatrix matrix; 89 QWMatrix matrix;
90 QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); 90 QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
91 matrix.scale( .4, .4); 91 matrix.scale( .4, .4);
92 unknownXpm = pix.xForm(matrix); 92 unknownXpm = pix.xForm(matrix);
93 93
94 connectionMenu = new QPopupMenu( this ); 94 connectionMenu = new QPopupMenu( this );
95 localMenu = new QPopupMenu( this ); 95 localMenu = new QPopupMenu( this );
96 remoteMenu = new QPopupMenu( this ); 96 remoteMenu = new QPopupMenu( this );
97 tabMenu = new QPopupMenu( this ); 97 tabMenu = new QPopupMenu( this );
98 98
99 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); 99 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
100 100
101 menuBar->insertItem( tr( "Connection" ), connectionMenu); 101 menuBar->insertItem( tr( "Connection" ), connectionMenu);
102 menuBar->insertItem( tr( "Local" ), localMenu); 102// menuBar->insertItem( tr( "Local" ), localMenu);
103 menuBar->insertItem( tr( "Remote" ), remoteMenu); 103// menuBar->insertItem( tr( "Remote" ), remoteMenu);
104 menuBar->insertItem( tr( "View" ), tabMenu); 104 menuBar->insertItem( tr( "View" ), tabMenu);
105 105
106 tabMenu->insertItem( tr( "Local" ), localMenu);
107 tabMenu->insertItem( tr( "Remote" ), remoteMenu);
108
106 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 109 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
107 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 110 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
108 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 111 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
109 112
110 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 113 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
111 localMenu->insertSeparator(); 114 localMenu->insertSeparator();
112 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 115 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
113 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 116 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
114 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 117 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
115 localMenu->insertSeparator(); 118 localMenu->insertSeparator();
116 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 119 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
117 localMenu->setCheckable(TRUE); 120 localMenu->setCheckable(TRUE);
118 121
119 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 122 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
120 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 123 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
121 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 124 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
122 remoteMenu->insertSeparator(); 125 remoteMenu->insertSeparator();
123 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 126 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
124 127
128 tabMenu->insertSeparator();
125 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 129 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
126 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 130 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
127 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); 131 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
128// tabMenu->insertSeparator(); 132 tabMenu->insertSeparator();
129// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 133// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
130 tabMenu->setCheckable(TRUE); 134 tabMenu->setCheckable(TRUE);
131 135
132 136
133 137
134 cdUpButton = new QToolButton( this,"cdUpButton"); 138 cdUpButton = new QToolButton( this,"cdUpButton");
135 cdUpButton->setPixmap(Resource::loadPixmap("up")); 139 cdUpButton->setPixmap(Resource::loadPixmap("up"));
136 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 140 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
137 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 141 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
138 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); 142 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
139 cdUpButton->hide(); 143 cdUpButton->hide();
140 144
141// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 145// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
142// docButton->setFixedSize( QSize( 20, 20 ) ); 146// docButton->setFixedSize( QSize( 20, 20 ) );
143// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 147// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
144// docButton->setFlat(TRUE); 148// docButton->setFlat(TRUE);
145// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 149// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
146 150
147 homeButton = new QToolButton(this,"homeButton"); 151 homeButton = new QToolButton(this,"homeButton");
148 homeButton->setPixmap( Resource::loadPixmap("home")); 152 homeButton->setPixmap( Resource::loadPixmap("home"));
149 homeButton->setFixedSize( QSize( 20, 20 ) ); 153 homeButton->setFixedSize( QSize( 20, 20 ) );
150 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 154 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
151 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); 155 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
152 homeButton->hide(); 156 homeButton->hide();
153 157
154 TabWidget = new QTabWidget( this, "TabWidget" ); 158 TabWidget = new QTabWidget( this, "TabWidget" );
155 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); 159 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
156 160
157// TabWidget->setTabShape(QTabWidget::Triangular); 161// TabWidget->setTabShape(QTabWidget::Triangular);
158 162
159 tab = new QWidget( TabWidget, "tab" ); 163 tab = new QWidget( TabWidget, "tab" );
160 tabLayout = new QGridLayout( tab ); 164 tabLayout = new QGridLayout( tab );
161 tabLayout->setSpacing( 2); 165 tabLayout->setSpacing( 2);
162 tabLayout->setMargin( 2); 166 tabLayout->setMargin( 2);
163 167
164 Local_View = new QListView( tab, "Local_View" ); 168 Local_View = new QListView( tab, "Local_View" );
165// Local_View->setResizePolicy( QListView::AutoOneFit ); 169// Local_View->setResizePolicy( QListView::AutoOneFit );
166 Local_View->addColumn( tr("File"),150); 170 Local_View->addColumn( tr("File"),150);
167 Local_View->addColumn( tr("Date"),-1); 171 Local_View->addColumn( tr("Date"),-1);
168 Local_View->setColumnAlignment(1,QListView::AlignRight); 172 Local_View->setColumnAlignment(1,QListView::AlignRight);
169 Local_View->addColumn( tr("Size"),-1); 173 Local_View->addColumn( tr("Size"),-1);
170 Local_View->setColumnAlignment(2,QListView::AlignRight); 174 Local_View->setColumnAlignment(2,QListView::AlignRight);
171 Local_View->setAllColumnsShowFocus(TRUE); 175 Local_View->setAllColumnsShowFocus(TRUE);
172 176
173 Local_View->setMultiSelection( TRUE); 177 Local_View->setMultiSelection( TRUE);
174 Local_View->setSelectionMode(QListView::Extended); 178 Local_View->setSelectionMode(QListView::Extended);
175 Local_View->setFocusPolicy(QWidget::ClickFocus); 179 Local_View->setFocusPolicy(QWidget::ClickFocus);
176 180
177 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 181 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
178 182
179 tabLayout->addWidget( Local_View, 0, 0 ); 183 tabLayout->addWidget( Local_View, 0, 0 );
180 184
181 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 185 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
182 this,SLOT( localListClicked(QListViewItem *)) ); 186 this,SLOT( localListClicked(QListViewItem *)) );
183// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), 187// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)),
184// this,SLOT( localListClicked(QListViewItem *)) ); 188// this,SLOT( localListClicked(QListViewItem *)) );
185 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 189 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
186 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 190 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
187 191
188 TabWidget->insertTab( tab, tr( "Local" ) ); 192 TabWidget->insertTab( tab, tr( "Local" ) );
189 193
190 tab_2 = new QWidget( TabWidget, "tab_2" ); 194 tab_2 = new QWidget( TabWidget, "tab_2" );
191 tabLayout_2 = new QGridLayout( tab_2 ); 195 tabLayout_2 = new QGridLayout( tab_2 );
192 tabLayout_2->setSpacing( 2); 196 tabLayout_2->setSpacing( 2);
193 tabLayout_2->setMargin( 2); 197 tabLayout_2->setMargin( 2);
194 198
195 Remote_View = new QListView( tab_2, "Remote_View" ); 199 Remote_View = new QListView( tab_2, "Remote_View" );
196 Remote_View->addColumn( tr("File"),150); 200 Remote_View->addColumn( tr("File"),150);
197 Remote_View->addColumn( tr("Date"),-1); 201 Remote_View->addColumn( tr("Date"),-1);
198// Remote_View->setColumnAlignment(1,QListView::AlignRight); 202// Remote_View->setColumnAlignment(1,QListView::AlignRight);
199 Remote_View->addColumn( tr("Size"),-1); 203 Remote_View->addColumn( tr("Size"),-1);
200 Remote_View->setColumnAlignment(2,QListView::AlignRight); 204 Remote_View->setColumnAlignment(2,QListView::AlignRight);
201 Remote_View->setColumnAlignment(3,QListView::AlignCenter); 205 Remote_View->setColumnAlignment(3,QListView::AlignCenter);
202 Remote_View->addColumn( tr("Dir"),-1); 206 Remote_View->addColumn( tr("Dir"),-1);
203 Remote_View->setColumnAlignment(4,QListView::AlignRight); 207 Remote_View->setColumnAlignment(4,QListView::AlignRight);
204 Remote_View->setAllColumnsShowFocus(TRUE); 208 Remote_View->setAllColumnsShowFocus(TRUE);
205 209
206 Remote_View->setMultiSelection( FALSE); 210 Remote_View->setMultiSelection( FALSE);
207 Remote_View->setSelectionMode(QListView::Extended); 211 Remote_View->setSelectionMode(QListView::Extended);
208 Remote_View->setFocusPolicy(QWidget::ClickFocus); 212 Remote_View->setFocusPolicy(QWidget::ClickFocus);
209 213
210 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 214 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
211 215
212 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 216 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
213 this,SLOT( remoteListClicked(QListViewItem *)) ); 217 this,SLOT( remoteListClicked(QListViewItem *)) );
214 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 218 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
215 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 219 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) );
216 220
217 tabLayout_2->addWidget( Remote_View, 0, 0 ); 221 tabLayout_2->addWidget( Remote_View, 0, 0 );
218 222
219 TabWidget->insertTab( tab_2, tr( "Remote" ) ); 223 TabWidget->insertTab( tab_2, tr( "Remote" ) );
220 224
221 tab_3 = new QWidget( TabWidget, "tab_3" ); 225 tab_3 = new QWidget( TabWidget, "tab_3" );
222 tabLayout_3 = new QGridLayout( tab_3 ); 226 tabLayout_3 = new QGridLayout( tab_3 );
223 tabLayout_3->setSpacing( 2); 227 tabLayout_3->setSpacing( 2);
224 tabLayout_3->setMargin( 2); 228 tabLayout_3->setMargin( 2);
225 229
226 TextLabel1 = new QLabel( tab_3, "TextLabel1" ); 230 TextLabel1 = new QLabel( tab_3, "TextLabel1" );
227 TextLabel1->setText( tr( "Username" ) ); 231 TextLabel1->setText( tr( "Username" ) );
228 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); 232 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
229 233
230 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); 234 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
231 UsernameComboBox->setEditable(TRUE); 235 UsernameComboBox->setEditable(TRUE);
232 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); 236 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
233 237
234 connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this, 238 connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this,
235 SLOT( UsernameComboBoxEdited(const QString & ) )); 239 SLOT( UsernameComboBoxEdited(const QString & ) ));
236 240
237 TextLabel2 = new QLabel( tab_3, "TextLabel2" ); 241 TextLabel2 = new QLabel( tab_3, "TextLabel2" );
238 TextLabel2->setText( tr( "Password" ) ); 242 TextLabel2->setText( tr( "Password" ) );
239 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); 243 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
240 244
241 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); 245 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
242 PasswordEdit->setEchoMode(QLineEdit::Password); 246 PasswordEdit->setEchoMode(QLineEdit::Password);
243 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); 247 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
244 248
245 connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this, 249 connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this,
246 SLOT( PasswordEditEdited(const QString & ) )); 250 SLOT( PasswordEditEdited(const QString & ) ));
247 251
248//PasswordEdit->setFixedWidth(85); 252//PasswordEdit->setFixedWidth(85);
249 TextLabel3 = new QLabel( tab_3, "TextLabel3" ); 253 TextLabel3 = new QLabel( tab_3, "TextLabel3" );
250 TextLabel3->setText( tr( "Remote server" ) ); 254 TextLabel3->setText( tr( "Remote server" ) );
251 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); 255 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
252 256
253 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); 257 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
254 ServerComboBox->setEditable(TRUE); 258 ServerComboBox->setEditable(TRUE);
255 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); 259 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
256 260
257 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); 261 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) ));
258 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this, 262 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,
259 SLOT(serverComboEdited(const QString & ) )); 263 SLOT(serverComboEdited(const QString & ) ));
260 264
261 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 265 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
262 TextLabel5->setText( tr( "Remote path" ) ); 266 TextLabel5->setText( tr( "Remote path" ) );
263 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); 267 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
264 268
265 269
266 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 270 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
267 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); 271 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
268 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 272 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
269 TextLabel4->setText( tr( "Port" ) ); 273 TextLabel4->setText( tr( "Port" ) );
270 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 274 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
271 275
272 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 276 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
273 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 277 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
274 PortSpinBox->setMaxValue(32786); 278 PortSpinBox->setMaxValue(32786);
275 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 279 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
276 280
277 serverListView = new QListBox( tab_3, "ServerListView" ); 281 serverListView = new QListBox( tab_3, "ServerListView" );
278 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); 282 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5);
279 283
280 connect( serverListView, SIGNAL( highlighted( const QString &)), 284 connect( serverListView, SIGNAL( highlighted( const QString &)),
281 this,SLOT( serverListClicked( const QString &) ) ); 285 this,SLOT( serverListClicked( const QString &) ) );
282 286
283 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); 287 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" );
284 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); 288 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1);
285 connectServerBtn->setToggleButton(TRUE); 289 connectServerBtn->setToggleButton(TRUE);
286 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); 290 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) ));
287 291
288 newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); 292 newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" );
289 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); 293 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2);
290 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); 294 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() ));
291 295
292 QPushButton *deleteServerBtn; 296 QPushButton *deleteServerBtn;
293 deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" ); 297 deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" );
294 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); 298 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3);
295 299
296 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); 300 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
297 301
298 302
299 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 303 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
300 tabLayout_3->addItem( spacer, 5, 0 ); 304 tabLayout_3->addItem( spacer, 5, 0 );
301 305
302 TabWidget->insertTab( tab_3, tr( "Config" ) ); 306 TabWidget->insertTab( tab_3, tr( "Config" ) );
303 307
304 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 308 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
305 this,SLOT(tabChanged(QWidget*))); 309 this,SLOT(tabChanged(QWidget*)));
306 310
307 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 311 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
308 currentDir.setPath( QDir::currentDirPath()); 312 currentDir.setPath( QDir::currentDirPath());
309// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 313// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
310 314
311 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 315 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
312 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); 316 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
313 currentPathCombo ->setFixedWidth(220); 317 currentPathCombo ->setFixedWidth(220);
314 currentPathCombo->setEditable(TRUE); 318 currentPathCombo->setEditable(TRUE);
315 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 319 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
316 320
317 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 321 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
318 this, SLOT( currentPathComboActivated( const QString & ) ) ); 322 this, SLOT( currentPathComboActivated( const QString & ) ) );
319 323
320 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 324 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
321 this,SLOT(currentPathComboChanged())); 325 this,SLOT(currentPathComboChanged()));
322 326
323 ProgressBar = new QProgressBar( this, "ProgressBar" ); 327 ProgressBar = new QProgressBar( this, "ProgressBar" );
324 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); 328 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
325 ProgressBar->setMaximumHeight(10); 329 ProgressBar->setMaximumHeight(10);
326 filterStr="*"; 330 filterStr="*";
327 b=FALSE; 331 b=FALSE;
328 populateLocalView(); 332 populateLocalView();
329 readConfig(); 333 readConfig();
330 334
331// ServerComboBox->setCurrentItem(currentServerConfig); 335// ServerComboBox->setCurrentItem(currentServerConfig);
332 336
333 TabWidget->setCurrentPage(2); 337 TabWidget->setCurrentPage(2);
334} 338}
335 339
336OpieFtp::~OpieFtp() 340OpieFtp::~OpieFtp()
337{ 341{
338} 342}
339 343
340void OpieFtp::cleanUp() 344void OpieFtp::cleanUp()
341{ 345{
342 if(conn) 346 if(conn)
343 FtpQuit(conn); 347 FtpQuit(conn);
344 QString sfile=QDir::homeDirPath(); 348 QString sfile=QDir::homeDirPath();
345 if(sfile.right(1) != "/") 349 if(sfile.right(1) != "/")
346 sfile+="/._temp"; 350 sfile+="/._temp";
347 else 351 else
348 sfile+="._temp"; 352 sfile+="._temp";
349 QFile file( sfile); 353 QFile file( sfile);
350 if(file.exists()) 354 if(file.exists())
351 file.remove(); 355 file.remove();
352 Config cfg("opieftp"); 356 Config cfg("opieftp");
353 cfg.setGroup("Server"); 357 cfg.setGroup("Server");
354 cfg.writeEntry("currentServer", currentServerConfig); 358 cfg.writeEntry("currentServer", currentServerConfig);
355 359
356 exit(0); 360 exit(0);
357} 361}
358 362
359void OpieFtp::tabChanged(QWidget *) 363void OpieFtp::tabChanged(QWidget *)
360{ 364{
361 if (TabWidget->currentPageIndex() == 0) { 365 if (TabWidget->currentPageIndex() == 0) {
362 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 366 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
363 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 367 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
364 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 368 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
365 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 369 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
366 if(cdUpButton->isHidden()) 370 if(cdUpButton->isHidden())
367 cdUpButton->show(); 371 cdUpButton->show();
368 if(homeButton->isHidden()) 372 if(homeButton->isHidden())
369 homeButton->show(); 373 homeButton->show();
370 374
371 } 375 }
372 if (TabWidget->currentPageIndex() == 1) { 376 if (TabWidget->currentPageIndex() == 1) {
373 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 377 currentPathCombo->lineEdit()->setText( currentRemoteDir );
374 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); 378 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
375 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 379 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
376 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 380 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
377 if(cdUpButton->isHidden()) 381 if(cdUpButton->isHidden())
378 cdUpButton->show(); 382 cdUpButton->show();
379 homeButton->hide(); 383 homeButton->hide();
380 384
381 } 385 }
382 if (TabWidget->currentPageIndex() == 2) { 386 if (TabWidget->currentPageIndex() == 2) {
383 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); 387 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
384 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 388 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
385 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 389 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
386 cdUpButton->hide(); 390 cdUpButton->hide();
387 homeButton->hide(); 391 homeButton->hide();
388 } 392 }
389} 393}
390 394
391void OpieFtp::newConnection() 395void OpieFtp::newConnection()
392{ 396{
393 UsernameComboBox->lineEdit()->setText(""); 397 UsernameComboBox->lineEdit()->setText("");
394 PasswordEdit->setText( "" ); 398 PasswordEdit->setText( "" );
395 ServerComboBox->lineEdit()->setText( ""); 399 ServerComboBox->lineEdit()->setText( "");
396 remotePath->setText( currentRemoteDir = "/"); 400 remotePath->setText( currentRemoteDir = "/");
397 PortSpinBox->setValue( 21); 401 PortSpinBox->setValue( 21);
398 TabWidget->setCurrentPage(2); 402 TabWidget->setCurrentPage(2);
399} 403}
400 404
401void OpieFtp::serverComboEdited(const QString & ) 405void OpieFtp::serverComboEdited(const QString & )
402{ 406{
403// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { 407// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) {
404// qDebug("ServerComboEdited"); 408// qDebug("ServerComboEdited");
405// // currentServerConfig = -1; 409// // currentServerConfig = -1;
406// } 410// }
407} 411}
408 412
409void OpieFtp::UsernameComboBoxEdited(const QString &) { 413void OpieFtp::UsernameComboBoxEdited(const QString &) {
410// currentServerConfig = -1; 414// currentServerConfig = -1;
411} 415}
412 416
413void OpieFtp::PasswordEditEdited(const QString & ) { 417void OpieFtp::PasswordEditEdited(const QString & ) {
414// currentServerConfig = -1; 418// currentServerConfig = -1;
415} 419}
416 420
417void OpieFtp::connectorBtnToggled(bool On) 421void OpieFtp::connectorBtnToggled(bool On)
418{ 422{
419 if(On) { 423 if(On) {
420 connector(); 424 connector();
421 } else { 425 } else {
422 disConnector(); 426 disConnector();
423 } 427 }
424 428
425} 429}
426 430
427void OpieFtp::connector() 431void OpieFtp::connector()
428{ 432{
429// QCopEnvelope ( "QPE/System", "busy()" ); 433// QCopEnvelope ( "QPE/System", "busy()" );
430// qApp->processEvents(); 434// qApp->processEvents();
431 currentRemoteDir=remotePath->text(); 435 currentRemoteDir=remotePath->text();
432 436
433 if( ServerComboBox->currentText().isEmpty()) { 437 if( ServerComboBox->currentText().isEmpty()) {
434 438
435 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); 439 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0);
436 TabWidget->setCurrentPage(2); 440 TabWidget->setCurrentPage(2);
437 ServerComboBox->setFocus(); 441 ServerComboBox->setFocus();
438 connectServerBtn->setOn(FALSE); 442 connectServerBtn->setOn(FALSE);
439 connectServerBtn->setText( tr("Connect")); 443 connectServerBtn->setText( tr("Connect"));
440 return; 444 return;
441 } 445 }
442 446
443 FtpInit(); 447 FtpInit();
444 448
445 TabWidget->setCurrentPage(1); 449 TabWidget->setCurrentPage(1);
446 QString ftp_host = ServerComboBox->currentText(); 450 QString ftp_host = ServerComboBox->currentText();
447 QString ftp_user = UsernameComboBox->currentText(); 451 QString ftp_user = UsernameComboBox->currentText();
448 QString ftp_pass = PasswordEdit->text(); 452 QString ftp_pass = PasswordEdit->text();
449 QString port=PortSpinBox->cleanText(); 453 QString port=PortSpinBox->cleanText();
450 port.stripWhiteSpace(); 454 port.stripWhiteSpace();
451 455
452 Config cfg("opieftp"); 456 Config cfg("opieftp");
453 cfg.setGroup("Server"); 457 cfg.setGroup("Server");
454// int current=cfg.readNumEntry("currentServer", 1); 458// int current=cfg.readNumEntry("currentServer", 1);
455 459
456// if(ftp_host!= cfg.readEntry(QString::number( current))) 460// if(ftp_host!= cfg.readEntry(QString::number( current)))
457// currentServerConfig=-1; 461// currentServerConfig=-1;
458// cfg.setGroup(QString::number(current)); 462// cfg.setGroup(QString::number(current));
459// if( ftp_user != cfg.readEntry("Username")) 463// if( ftp_user != cfg.readEntry("Username"))
460// currentServerConfig=-1; 464// currentServerConfig=-1;
461// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) 465// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username")))
462// currentServerConfig=-1; 466// currentServerConfig=-1;
463 467
464 468
465 if(ftp_host.find("ftp://",0, TRUE) != -1 ) 469 if(ftp_host.find("ftp://",0, TRUE) != -1 )
466 ftp_host=ftp_host.right(ftp_host.length()-6); 470 ftp_host=ftp_host.right(ftp_host.length()-6);
467 ftp_host+=":"+port; 471 ftp_host+=":"+port;
468 472
469 if (!FtpConnect( ftp_host.latin1(), &conn)) { 473 if (!FtpConnect( ftp_host.latin1(), &conn)) {
470 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); 474 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host);
471 connectServerBtn->setOn(FALSE); 475 connectServerBtn->setOn(FALSE);
472 connectServerBtn->setText( tr("Connect")); 476 connectServerBtn->setText( tr("Connect"));
473 return ; 477 return ;
474 } 478 }
475 479
476 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { 480 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
477 QString msg; 481 QString msg;
478 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); 482 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn));
479 msg.replace(QRegExp(":"),"\n"); 483 msg.replace(QRegExp(":"),"\n");
480 QMessageBox::message(tr("Note"),msg); 484 QMessageBox::message(tr("Note"),msg);
481 if(conn) 485 if(conn)
482 FtpQuit(conn); 486 FtpQuit(conn);
483 connectServerBtn->setOn(FALSE); 487 connectServerBtn->setOn(FALSE);
484 connectServerBtn->setText( tr("Connect")); 488 connectServerBtn->setText( tr("Connect"));
485 return ; 489 return ;
486 } 490 }
487 491
488 remoteDirList("/") ; 492 remoteDirList("/") ;
489 setCaption(ftp_host); 493 setCaption(ftp_host);
490 if( currentServerConfig == -1) 494 if( currentServerConfig == -1)
491 writeConfig(); 495 writeConfig();
492 connectServerBtn->setText( tr("Disconnect")); 496 connectServerBtn->setText( tr("Disconnect"));
493// QCopEnvelope ( "QPE/System", "notBusy()" ); 497// QCopEnvelope ( "QPE/System", "notBusy()" );
494} 498}
495 499
496void OpieFtp::disConnector() 500void OpieFtp::disConnector()
497{ 501{
498 if(conn) 502 if(conn)
499 FtpQuit(conn); 503 FtpQuit(conn);
500 setCaption("OpieFtp"); 504 setCaption("OpieFtp");
501 currentRemoteDir="/"; 505 currentRemoteDir="/";
502 Remote_View->clear(); 506 Remote_View->clear();
503 connectServerBtn->setText( tr("Connect")); 507 connectServerBtn->setText( tr("Connect"));
504 connectServerBtn->setOn(FALSE); 508 connectServerBtn->setOn(FALSE);
505 setCaption("OpieFtp"); 509 setCaption("OpieFtp");
506} 510}
507 511
508void OpieFtp::localUpload() 512void OpieFtp::localUpload()
509{ 513{
510 int fsz; 514 int fsz;
511// QCopEnvelope ( "QPE/System", "busy()" ); 515// QCopEnvelope ( "QPE/System", "busy()" );
512// qApp->processEvents(); 516// qApp->processEvents();
513 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 517 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
514 QListViewItemIterator it( Local_View ); 518 QListViewItemIterator it( Local_View );
515 for ( ; it.current(); ++it ) { 519 for ( ; it.current(); ++it ) {
516 if ( it.current()->isSelected() ) { 520 if ( it.current()->isSelected() ) {
517 QString strItem = it.current()->text(0); 521 QString strItem = it.current()->text(0);
518 QString localFile = currentDir.canonicalPath()+"/"+strItem; 522 QString localFile = currentDir.canonicalPath()+"/"+strItem;
519 QString remoteFile= currentRemoteDir+strItem; 523 QString remoteFile= currentRemoteDir+strItem;
520 QFileInfo fi(localFile); 524 QFileInfo fi(localFile);
521 if( !fi.isDir()) { 525 if( !fi.isDir()) {
522 fsz=fi.size(); 526 fsz=fi.size();
523 ProgressBar->setTotalSteps(fsz); 527 ProgressBar->setTotalSteps(fsz);
524 528
525 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 529 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
526 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 530 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
527 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 531 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
528 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 532 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
529 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); 533 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
530 534
531 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 535 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
532 QString msg; 536 QString msg;
533 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); 537 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
534 msg.replace(QRegExp(":"),"\n"); 538 msg.replace(QRegExp(":"),"\n");
535 QMessageBox::message(tr("Note"),msg); 539 QMessageBox::message(tr("Note"),msg);
536 } 540 }
537 } else { 541 } else {
538 QMessageBox::message(tr("Note"),tr("Cannot upload directories")); 542 QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
539 } 543 }
540 ProgressBar->reset(); 544 ProgressBar->reset();
541 nullifyCallBack(); 545 nullifyCallBack();
542 it.current()->setSelected(FALSE); 546 it.current()->setSelected(FALSE);
543 } //end currentSelected 547 } //end currentSelected
544 } 548 }
545 for ( ; it.current(); ++it ) { 549 for ( ; it.current(); ++it ) {
546 Local_View->clearSelection(); 550 Local_View->clearSelection();
547 } 551 }
548 Local_View->clearFocus(); 552 Local_View->clearFocus();
549 TabWidget->setCurrentPage(1); 553 TabWidget->setCurrentPage(1);
550 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 554 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
551// QCopEnvelope ( "QPE/System", "notBusy()" ); 555// QCopEnvelope ( "QPE/System", "notBusy()" );
552} 556}
553 557
554void OpieFtp::nullifyCallBack() 558void OpieFtp::nullifyCallBack()
555{ 559{
556 FtpOptions(FTPLIB_CALLBACK, 0, conn); 560 FtpOptions(FTPLIB_CALLBACK, 0, conn);
557 FtpOptions(FTPLIB_IDLETIME, 0, conn); 561 FtpOptions(FTPLIB_IDLETIME, 0, conn);
558 FtpOptions(FTPLIB_CALLBACKARG, 0, conn); 562 FtpOptions(FTPLIB_CALLBACKARG, 0, conn);
559 FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn); 563 FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn);
560} 564}
561 565
562void OpieFtp::remoteDownload() 566void OpieFtp::remoteDownload()
563{ 567{
564// qApp->processEvents(); 568// qApp->processEvents();
565 int fsz; 569 int fsz;
566// QCopEnvelope ( "QPE/System", "busy()" ); 570// QCopEnvelope ( "QPE/System", "busy()" );
567 571
568 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 572 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
569 QListViewItemIterator it( Remote_View ); 573 QListViewItemIterator it( Remote_View );
570 for ( ; it.current(); ++it ) { 574 for ( ; it.current(); ++it ) {
571 if ( it.current()->isSelected() ) { 575 if ( it.current()->isSelected() ) {
572 QString strItem = it.current()->text(0); 576 QString strItem = it.current()->text(0);
573// strItem=strItem.right(strItem.length()-1); 577// strItem=strItem.right(strItem.length()-1);
574 QString localFile = currentDir.canonicalPath(); 578 QString localFile = currentDir.canonicalPath();
575 if(localFile.right(1).find("/",0,TRUE) == -1) 579 if(localFile.right(1).find("/",0,TRUE) == -1)
576 localFile += "/"; 580 localFile += "/";
577 localFile += strItem; 581 localFile += strItem;
578// QString localFile = currentDir.canonicalPath()+"/"+strItem; 582// QString localFile = currentDir.canonicalPath()+"/"+strItem;
579 QString remoteFile= currentRemoteDir+strItem; 583 QString remoteFile= currentRemoteDir+strItem;
580 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) 584 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
581 fsz = 0; 585 fsz = 0;
582 QString temp; 586 QString temp;
583 temp.sprintf( remoteFile+" "+" %dkb", fsz); 587 temp.sprintf( remoteFile+" "+" %dkb", fsz);
584 588
585 ProgressBar->setTotalSteps(fsz); 589 ProgressBar->setTotalSteps(fsz);
586 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 590 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
587 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 591 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
588 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 592 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
589 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 593 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
590 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); 594 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
591 595
592 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 596 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
593 QString msg; 597 QString msg;
594 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); 598 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
595 msg.replace(QRegExp(":"),"\n"); 599 msg.replace(QRegExp(":"),"\n");
596 QMessageBox::message(tr("Note"),msg); 600 QMessageBox::message(tr("Note"),msg);
597 } 601 }
598 ProgressBar->reset(); 602 ProgressBar->reset();
599 nullifyCallBack(); 603 nullifyCallBack();
600 it.current()->setSelected(FALSE); 604 it.current()->setSelected(FALSE);
601 } 605 }
602 } 606 }
603 for ( ; it.current(); ++it ) { 607 for ( ; it.current(); ++it ) {
604 Remote_View->clearSelection(); 608 Remote_View->clearSelection();
605 } 609 }
606 Remote_View->setFocus(); 610 Remote_View->setFocus();
607 TabWidget->setCurrentPage(0); 611 TabWidget->setCurrentPage(0);
608 populateLocalView(); 612 populateLocalView();
609// QCopEnvelope ( "QPE/System", "notBusy()" ); 613// QCopEnvelope ( "QPE/System", "notBusy()" );
610} 614}
611 615
612bool OpieFtp::remoteDirList(const QString &dir) 616bool OpieFtp::remoteDirList(const QString &dir)
613{ 617{
614 QString tmp = QDir::homeDirPath(); 618 QString tmp = QDir::homeDirPath();
615 if(tmp.right(1) != "/") 619 if(tmp.right(1) != "/")
616 tmp+="/._temp"; 620 tmp+="/._temp";
617 else 621 else
618 tmp+="._temp"; 622 tmp+="._temp";
619// qDebug("Listing remote dir "+tmp); 623// qDebug("Listing remote dir "+tmp);
620// QCopEnvelope ( "QPE/System", "busy()" ); 624// QCopEnvelope ( "QPE/System", "busy()" );
621 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 625 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
622 QString msg; 626 QString msg;
623 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); 627 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
624 msg.replace(QRegExp(":"),"\n"); 628 msg.replace(QRegExp(":"),"\n");
625 QMessageBox::message(tr("Note"),msg); 629 QMessageBox::message(tr("Note"),msg);
626 return false; 630 return false;
627 } 631 }
628 populateRemoteView() ; 632 populateRemoteView() ;
629// QCopEnvelope ( "QPE/System", "notBusy()" ); 633// QCopEnvelope ( "QPE/System", "notBusy()" );
630 return true; 634 return true;
631} 635}
632 636
633bool OpieFtp::remoteChDir(const QString &dir) 637bool OpieFtp::remoteChDir(const QString &dir)
634{ 638{
635// QCopEnvelope ( "QPE/System", "busy()" ); 639// QCopEnvelope ( "QPE/System", "busy()" );
636 if (!FtpChdir( dir.latin1(), conn )) { 640 if (!FtpChdir( dir.latin1(), conn )) {
637 QString msg; 641 QString msg;
638 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); 642 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
639 msg.replace(QRegExp(":"),"\n"); 643 msg.replace(QRegExp(":"),"\n");
640 QMessageBox::message(tr("Note"),msg); 644 QMessageBox::message(tr("Note"),msg);