summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-07-20 02:35:34 (UTC)
committer llornkcor <llornkcor>2002-07-20 02:35:34 (UTC)
commit8256eec0103a50f80905e71891904a4267754559 (patch) (unidiff)
tree8dc249ea2db645d38c9ce39a6000e9ee833978b4
parenta4a56e27ba0f4fd2bdbc56e20c9e7f4ccc8be535 (diff)
downloadopie-8256eec0103a50f80905e71891904a4267754559.zip
opie-8256eec0103a50f80905e71891904a4267754559.tar.gz
opie-8256eec0103a50f80905e71891904a4267754559.tar.bz2
fixes and changes.. _should_ remember servers. Still needs work
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp260
-rw-r--r--noncore/net/opieftp/opieftp.h42
2 files changed, 237 insertions, 65 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 9d6356d..9beac94 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -1,721 +1,767 @@
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.h" 17#include "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 55
55#include <unistd.h> 56#include <unistd.h>
56#include <stdlib.h> 57#include <stdlib.h>
57 58
58 59
59QProgressBar *ProgressBar; 60QProgressBar *ProgressBar;
60static netbuf *conn=NULL; 61static netbuf *conn=NULL;
61 62
62static int log_progress(netbuf *ctl, int xfered, void *arg) 63static int log_progress(netbuf *ctl, int xfered, void *arg)
63{ 64{
64 int fsz = *(int *)arg; 65 int fsz = *(int *)arg;
65 int pct = (xfered * 100) / fsz; 66 int pct = (xfered * 100) / fsz;
66// printf("%3d%%\r", pct); 67// printf("%3d%%\r", pct);
67// fflush(stdout); 68// fflush(stdout);
68 ProgressBar->setProgress(xfered); 69 ProgressBar->setProgress(xfered);
69 qApp->processEvents(); 70 qApp->processEvents();
70 return 1; 71 return 1;
71} 72}
72 73
73OpieFtp::OpieFtp( ) 74OpieFtp::OpieFtp( )
74 : QMainWindow( ) 75 : QMainWindow( )
75{ 76{
76 setCaption( tr( "OpieFtp" ) ); 77 setCaption( tr( "OpieFtp" ) );
77 78 fuckeduphack=FALSE;
78 QGridLayout *layout = new QGridLayout( this ); 79 QGridLayout *layout = new QGridLayout( this );
79 layout->setSpacing( 2); 80 layout->setSpacing( 2);
80 layout->setMargin( 2); 81 layout->setMargin( 2);
81 82
82 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 83 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
83 84
84 QPEMenuBar *menuBar = new QPEMenuBar(this); 85 QPEMenuBar *menuBar = new QPEMenuBar(this);
85// QPEToolBar *menuBar = new QPEToolBar(this); 86// QPEToolBar *menuBar = new QPEToolBar(this);
86// menuBar->setHorizontalStretchable( TRUE ); 87// menuBar->setHorizontalStretchable( TRUE );
87 88
88 connectionMenu = new QPopupMenu( this ); 89 connectionMenu = new QPopupMenu( this );
89 localMenu = new QPopupMenu( this ); 90 localMenu = new QPopupMenu( this );
90 remoteMenu = new QPopupMenu( this ); 91 remoteMenu = new QPopupMenu( this );
91 tabMenu = new QPopupMenu( this ); 92 tabMenu = new QPopupMenu( this );
92 93
93 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); 94 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
94 95
95 menuBar->insertItem( tr( "Connection" ), connectionMenu); 96 menuBar->insertItem( tr( "Connection" ), connectionMenu);
96 menuBar->insertItem( tr( "Local" ), localMenu); 97 menuBar->insertItem( tr( "Local" ), localMenu);
97 menuBar->insertItem( tr( "Remote" ), remoteMenu); 98 menuBar->insertItem( tr( "Remote" ), remoteMenu);
98 menuBar->insertItem( tr( "View" ), tabMenu); 99 menuBar->insertItem( tr( "View" ), tabMenu);
99 100
100 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 101 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
101 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 102 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
102 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 103 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
103 104
104 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 105 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
105 localMenu->insertSeparator(); 106 localMenu->insertSeparator();
106 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 107 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
107 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 108 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
108 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 109 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
109 localMenu->insertSeparator(); 110 localMenu->insertSeparator();
110 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 111 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
111 localMenu->setCheckable(TRUE); 112 localMenu->setCheckable(TRUE);
112 113
113 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 114 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
114 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 115 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
115 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 116 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
116 remoteMenu->insertSeparator(); 117 remoteMenu->insertSeparator();
117 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 118 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
118 119
119 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 120 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
120 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 121 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
121 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); 122 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
122 tabMenu->insertSeparator(); 123 tabMenu->insertSeparator();
123 tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 124 tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
124 tabMenu->setCheckable(TRUE); 125 tabMenu->setCheckable(TRUE);
125 126
126 127
127 128
128 cdUpButton = new QToolButton( this,"cdUpButton"); 129 cdUpButton = new QToolButton( this,"cdUpButton");
129 cdUpButton->setPixmap(Resource::loadPixmap("up")); 130 cdUpButton->setPixmap(Resource::loadPixmap("up"));
130 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 131 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
131 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 132 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
132 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); 133 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
133 cdUpButton->hide(); 134 cdUpButton->hide();
134 135
135// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 136// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
136// docButton->setFixedSize( QSize( 20, 20 ) ); 137// docButton->setFixedSize( QSize( 20, 20 ) );
137// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 138// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
138// docButton->setFlat(TRUE); 139// docButton->setFlat(TRUE);
139// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 140// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
140 141
141 homeButton = new QToolButton(this,"homeButton"); 142 homeButton = new QToolButton(this,"homeButton");
142 homeButton->setPixmap( Resource::loadPixmap("home")); 143 homeButton->setPixmap( Resource::loadPixmap("home"));
143 homeButton->setFixedSize( QSize( 20, 20 ) ); 144 homeButton->setFixedSize( QSize( 20, 20 ) );
144 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 145 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
145 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); 146 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
146 homeButton->hide(); 147 homeButton->hide();
147 148
148 TabWidget = new QTabWidget( this, "TabWidget" ); 149 TabWidget = new QTabWidget( this, "TabWidget" );
149 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); 150 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
150 151
151// TabWidget->setTabShape(QTabWidget::Triangular); 152// TabWidget->setTabShape(QTabWidget::Triangular);
152 153
153 tab = new QWidget( TabWidget, "tab" ); 154 tab = new QWidget( TabWidget, "tab" );
154 tabLayout = new QGridLayout( tab ); 155 tabLayout = new QGridLayout( tab );
155 tabLayout->setSpacing( 2); 156 tabLayout->setSpacing( 2);
156 tabLayout->setMargin( 2); 157 tabLayout->setMargin( 2);
157 158
158 Local_View = new QListView( tab, "Local_View" ); 159 Local_View = new QListView( tab, "Local_View" );
159// Local_View->setResizePolicy( QListView::AutoOneFit ); 160// Local_View->setResizePolicy( QListView::AutoOneFit );
160 Local_View->addColumn( tr("File"),150); 161 Local_View->addColumn( tr("File"),150);
161 Local_View->addColumn( tr("Date"),-1); 162 Local_View->addColumn( tr("Date"),-1);
162 Local_View->setColumnAlignment(1,QListView::AlignRight); 163 Local_View->setColumnAlignment(1,QListView::AlignRight);
163 Local_View->addColumn( tr("Size"),-1); 164 Local_View->addColumn( tr("Size"),-1);
164 Local_View->setColumnAlignment(2,QListView::AlignRight); 165 Local_View->setColumnAlignment(2,QListView::AlignRight);
165 Local_View->setAllColumnsShowFocus(TRUE); 166 Local_View->setAllColumnsShowFocus(TRUE);
166 167
167 Local_View->setMultiSelection( TRUE); 168 Local_View->setMultiSelection( TRUE);
168 Local_View->setSelectionMode(QListView::Extended); 169 Local_View->setSelectionMode(QListView::Extended);
169 Local_View->setFocusPolicy(QWidget::ClickFocus); 170 Local_View->setFocusPolicy(QWidget::ClickFocus);
170 171
171 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 172 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
172 173
173 tabLayout->addWidget( Local_View, 0, 0 ); 174 tabLayout->addWidget( Local_View, 0, 0 );
174 175
175 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 176 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
176 this,SLOT( localListClicked(QListViewItem *)) ); 177 this,SLOT( localListClicked(QListViewItem *)) );
177// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), 178// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)),
178// this,SLOT( localListClicked(QListViewItem *)) ); 179// this,SLOT( localListClicked(QListViewItem *)) );
179 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 180 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
180 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 181 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
181 182
182 TabWidget->insertTab( tab, tr( "Local" ) ); 183 TabWidget->insertTab( tab, tr( "Local" ) );
183 184
184 tab_2 = new QWidget( TabWidget, "tab_2" ); 185 tab_2 = new QWidget( TabWidget, "tab_2" );
185 tabLayout_2 = new QGridLayout( tab_2 ); 186 tabLayout_2 = new QGridLayout( tab_2 );
186 tabLayout_2->setSpacing( 2); 187 tabLayout_2->setSpacing( 2);
187 tabLayout_2->setMargin( 2); 188 tabLayout_2->setMargin( 2);
188 189
189 Remote_View = new QListView( tab_2, "Remote_View" ); 190 Remote_View = new QListView( tab_2, "Remote_View" );
190 Remote_View->addColumn( tr("File"),150); 191 Remote_View->addColumn( tr("File"),150);
191 Remote_View->addColumn( tr("Date"),-1); 192 Remote_View->addColumn( tr("Date"),-1);
192 Remote_View->setColumnAlignment(1,QListView::AlignRight); 193 Remote_View->setColumnAlignment(1,QListView::AlignRight);
193 Remote_View->addColumn( tr("Size"),-1); 194 Remote_View->addColumn( tr("Size"),-1);
194 Remote_View->setColumnAlignment(2,QListView::AlignRight); 195 Remote_View->setColumnAlignment(2,QListView::AlignRight);
195 Remote_View->addColumn( tr("Dir"),-1); 196 Remote_View->addColumn( tr("Dir"),-1);
196 Remote_View->setColumnAlignment(4,QListView::AlignRight); 197 Remote_View->setColumnAlignment(4,QListView::AlignRight);
197 Remote_View->setAllColumnsShowFocus(TRUE); 198 Remote_View->setAllColumnsShowFocus(TRUE);
198 199
199 Remote_View->setMultiSelection( FALSE); 200 Remote_View->setMultiSelection( FALSE);
200 Remote_View->setSelectionMode(QListView::Extended); 201 Remote_View->setSelectionMode(QListView::Extended);
201 Remote_View->setFocusPolicy(QWidget::ClickFocus); 202 Remote_View->setFocusPolicy(QWidget::ClickFocus);
202 203
203 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 204 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
204 205
205 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 206 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
206 this,SLOT( remoteListClicked(QListViewItem *)) ); 207 this,SLOT( remoteListClicked(QListViewItem *)) );
207 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 208 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
208 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 209 this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) );
209 210
210 tabLayout_2->addWidget( Remote_View, 0, 0 ); 211 tabLayout_2->addWidget( Remote_View, 0, 0 );
211 212
212 TabWidget->insertTab( tab_2, tr( "Remote" ) ); 213 TabWidget->insertTab( tab_2, tr( "Remote" ) );
213 214
214 tab_3 = new QWidget( TabWidget, "tab_3" ); 215 tab_3 = new QWidget( TabWidget, "tab_3" );
215 tabLayout_3 = new QGridLayout( tab_3 ); 216 tabLayout_3 = new QGridLayout( tab_3 );
216 tabLayout_3->setSpacing( 2); 217 tabLayout_3->setSpacing( 2);
217 tabLayout_3->setMargin( 2); 218 tabLayout_3->setMargin( 2);
218 219
219 TextLabel1 = new QLabel( tab_3, "TextLabel1" ); 220 TextLabel1 = new QLabel( tab_3, "TextLabel1" );
220 TextLabel1->setText( tr( "Username" ) ); 221 TextLabel1->setText( tr( "Username" ) );
221 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); 222 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
222 223
223 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); 224 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
224 UsernameComboBox->setEditable(TRUE); 225 UsernameComboBox->setEditable(TRUE);
225 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); 226 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
226 227
228 connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this,SLOT( UsernameComboBoxEdited(const QString & ) ));
229
227 TextLabel2 = new QLabel( tab_3, "TextLabel2" ); 230 TextLabel2 = new QLabel( tab_3, "TextLabel2" );
228 TextLabel2->setText( tr( "Password" ) ); 231 TextLabel2->setText( tr( "Password" ) );
229 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); 232 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
230 233
231 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); 234 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
232 PasswordEdit->setEchoMode(QLineEdit::Password); 235 PasswordEdit->setEchoMode(QLineEdit::Password);
233 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); 236 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
237
238 connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this,SLOT( PasswordEditEdited(const QString & ) ));
239
234//PasswordEdit->setFixedWidth(85); 240//PasswordEdit->setFixedWidth(85);
235 TextLabel3 = new QLabel( tab_3, "TextLabel3" ); 241 TextLabel3 = new QLabel( tab_3, "TextLabel3" );
236 TextLabel3->setText( tr( "Remote server" ) ); 242 TextLabel3->setText( tr( "Remote server" ) );
237 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); 243 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
238 244
239 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); 245 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
240 ServerComboBox->setEditable(TRUE); 246 ServerComboBox->setEditable(TRUE);
241 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); 247 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
242 248
243 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); 249 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) ));
244 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); 250 connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) ));
245 251
246 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 252 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
247 TextLabel5->setText( tr( "Remote path" ) ); 253 TextLabel5->setText( tr( "Remote path" ) );
248 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); 254 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
249 255
250 256
251 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 257 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
252 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); 258 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
253 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 259 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
254 TextLabel4->setText( tr( "Port" ) ); 260 TextLabel4->setText( tr( "Port" ) );
255 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 261 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
256 262
257 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 263 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
258 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 264 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
259 PortSpinBox->setMaxValue(32786); 265 PortSpinBox->setMaxValue(32786);
260 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 266 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
261 267
262 QPushButton *deleteServerBtn; 268 serverListView = new QListBox( tab_3, "ServerListView" );
263 deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); 269 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5);
264 tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3);
265
266 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
267 270
271 connect( serverListView, SIGNAL( highlighted( const QString &)),
272 this,SLOT( serverListClicked( const QString &) ) );
273
268 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); 274 connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" );
269 tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); 275 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1);
270 connectServerBtn->setToggleButton(TRUE); 276 connectServerBtn->setToggleButton(TRUE);
271 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); 277 connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) ));
272 278
279 newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" );
280 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2);
281 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() ));
282
283 QPushButton *deleteServerBtn;
284 deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" );
285 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3);
286
287 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
288
289
273 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 290 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
274 tabLayout_3->addItem( spacer, 5, 0 ); 291 tabLayout_3->addItem( spacer, 5, 0 );
275 292
276 TabWidget->insertTab( tab_3, tr( "Config" ) ); 293 TabWidget->insertTab( tab_3, tr( "Config" ) );
277 294
278 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 295 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
279 this,SLOT(tabChanged(QWidget*))); 296 this,SLOT(tabChanged(QWidget*)));
280 297
281 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 298 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
282 currentDir.setPath( QDir::currentDirPath()); 299 currentDir.setPath( QDir::currentDirPath());
283// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 300// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
284 301
285 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 302 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
286 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); 303 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
287 currentPathCombo ->setFixedWidth(220); 304 currentPathCombo ->setFixedWidth(220);
288 currentPathCombo->setEditable(TRUE); 305 currentPathCombo->setEditable(TRUE);
289 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 306 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
290 307
291 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 308 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
292 this, SLOT( currentPathComboActivated( const QString & ) ) ); 309 this, SLOT( currentPathComboActivated( const QString & ) ) );
293 310
294 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 311 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
295 this,SLOT(currentPathComboChanged())); 312 this,SLOT(currentPathComboChanged()));
296 313
297 ProgressBar = new QProgressBar( this, "ProgressBar" ); 314 ProgressBar = new QProgressBar( this, "ProgressBar" );
298 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); 315 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
299 316 ProgressBar->setMaximumHeight(10);
300 fillCombos();
301
302 filterStr="*"; 317 filterStr="*";
303 b=FALSE; 318 b=FALSE;
304 populateLocalView(); 319 populateLocalView();
305qDebug("read COnfig"); 320 readConfig();
306 readConfig(); 321
307 qDebug("Set current item"); 322// ServerComboBox->setCurrentItem(currentServerConfig);
308 ServerComboBox->setCurrentItem(currentServerConfig);
309 323
310 TabWidget->setCurrentPage(2); 324 TabWidget->setCurrentPage(2);
311} 325}
312 326
313OpieFtp::~OpieFtp() 327OpieFtp::~OpieFtp()
314{ 328{
315} 329}
316 330
317void OpieFtp::cleanUp() 331void OpieFtp::cleanUp()
318{ 332{
319 if(conn) 333 if(conn)
320 FtpQuit(conn); 334 FtpQuit(conn);
321 QString sfile=QDir::homeDirPath(); 335 QString sfile=QDir::homeDirPath();
322 if(sfile.right(1) != "/") 336 if(sfile.right(1) != "/")
323 sfile+="/._temp"; 337 sfile+="/._temp";
324 else 338 else
325 sfile+="._temp"; 339 sfile+="._temp";
326 QFile file( sfile); 340 QFile file( sfile);
327 if(file.exists()) 341 if(file.exists())
328 file.remove(); 342 file.remove();
343 Config cfg("opieftp");
344 cfg.setGroup("Server");
345 cfg.writeEntry("currentServer", currentServerConfig);
346
329 exit(0); 347 exit(0);
330} 348}
331 349
332void OpieFtp::tabChanged(QWidget *w) 350void OpieFtp::tabChanged(QWidget *w)
333{ 351{
334 if (TabWidget->currentPageIndex() == 0) { 352 if (TabWidget->currentPageIndex() == 0) {
335 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 353 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
336 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 354 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
337 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 355 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
338 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 356 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
339 if(cdUpButton->isHidden()) 357 if(cdUpButton->isHidden())
340 cdUpButton->show(); 358 cdUpButton->show();
341 if(homeButton->isHidden()) 359 if(homeButton->isHidden())
342 homeButton->show(); 360 homeButton->show();
343 361
344 } 362 }
345 if (TabWidget->currentPageIndex() == 1) { 363 if (TabWidget->currentPageIndex() == 1) {
346 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 364 currentPathCombo->lineEdit()->setText( currentRemoteDir );
347 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); 365 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
348 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 366 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
349 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 367 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
350 if(cdUpButton->isHidden()) 368 if(cdUpButton->isHidden())
351 cdUpButton->show(); 369 cdUpButton->show();
352 homeButton->hide(); 370 homeButton->hide();
353 371
354 } 372 }
355 if (TabWidget->currentPageIndex() == 2) { 373 if (TabWidget->currentPageIndex() == 2) {
356 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); 374 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
357 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 375 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
358 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 376 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
359 cdUpButton->hide(); 377 cdUpButton->hide();
360 homeButton->hide(); 378 homeButton->hide();
361 } 379 }
362} 380}
363 381
364void OpieFtp::newConnection() 382void OpieFtp::newConnection()
365{ 383{
366 UsernameComboBox->lineEdit()->setText(""); 384 UsernameComboBox->lineEdit()->setText("");
367 PasswordEdit->setText( "" ); 385 PasswordEdit->setText( "" );
368 ServerComboBox->lineEdit()->setText( ""); 386 ServerComboBox->lineEdit()->setText( "");
369 remotePath->setText( currentRemoteDir = "/"); 387 remotePath->setText( currentRemoteDir = "/");
370 PortSpinBox->setValue( 21); 388 PortSpinBox->setValue( 21);
371 TabWidget->setCurrentPage(2); 389 TabWidget->setCurrentPage(2);
372} 390}
373 391
374void OpieFtp::serverComboEdited(const QString & edit) 392void OpieFtp::serverComboEdited(const QString & edit)
375{ 393{
376 if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { 394// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) {
377 qDebug("ServerComboEdited"); 395// qDebug("ServerComboEdited");
378 currentServerConfig = -1; 396// // currentServerConfig = -1;
379 } 397// }
398}
399
400void OpieFtp::UsernameComboBoxEdited(const QString & use) {
401// currentServerConfig = -1;
402}
403
404void OpieFtp::PasswordEditEdited(const QString & pass) {
405// currentServerConfig = -1;
380} 406}
381 407
382void OpieFtp::connectorBtnToggled(bool On) 408void OpieFtp::connectorBtnToggled(bool On)
383{ 409{
384 if(On) { 410 if(On) {
385 connector(); 411 connector();
386 } else { 412 } else {
387 disConnector(); 413 disConnector();
388 } 414 }
389 415
390} 416}
391 417
392void OpieFtp::connector() 418void OpieFtp::connector()
393{ 419{
394// QCopEnvelope ( "QPE/System", "busy()" ); 420// QCopEnvelope ( "QPE/System", "busy()" );
395// qApp->processEvents(); 421// qApp->processEvents();
396 currentRemoteDir=remotePath->text(); 422 currentRemoteDir=remotePath->text();
397 if(ServerComboBox->currentText().isEmpty()) { 423
424 if( ServerComboBox->currentText().isEmpty()) {
425
398 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); 426 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0);
399 TabWidget->setCurrentPage(2); 427 TabWidget->setCurrentPage(2);
400 ServerComboBox->setFocus(); 428 ServerComboBox->setFocus();
401 connectServerBtn->setOn(FALSE); 429 connectServerBtn->setOn(FALSE);
402 connectServerBtn->setText( tr("Connect")); 430 connectServerBtn->setText( tr("Connect"));
403 return; 431 return;
404 } 432 }
433
405 FtpInit(); 434 FtpInit();
435
406 TabWidget->setCurrentPage(1); 436 TabWidget->setCurrentPage(1);
407 QString ftp_host = ServerComboBox->currentText(); 437 QString ftp_host = ServerComboBox->currentText();
408 QString ftp_user = UsernameComboBox->currentText(); 438 QString ftp_user = UsernameComboBox->currentText();
409 QString ftp_pass = PasswordEdit->text(); 439 QString ftp_pass = PasswordEdit->text();
410 QString port=PortSpinBox->cleanText(); 440 QString port=PortSpinBox->cleanText();
411 port.stripWhiteSpace(); 441 port.stripWhiteSpace();
412 442
443 Config cfg("opieftp");
444 cfg.setGroup("Server");
445 int current=cfg.readNumEntry("currentServer", 1);
446
447// if(ftp_host!= cfg.readEntry(QString::number( current)))
448// currentServerConfig=-1;
449// cfg.setGroup(QString::number(current));
450// if( ftp_user != cfg.readEntry("Username"))
451// currentServerConfig=-1;
452// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username")))
453// currentServerConfig=-1;
454
455
413 if(ftp_host.find("ftp://",0, TRUE) != -1 ) 456 if(ftp_host.find("ftp://",0, TRUE) != -1 )
414 ftp_host=ftp_host.right(ftp_host.length()-6); 457 ftp_host=ftp_host.right(ftp_host.length()-6);
415 ftp_host+=":"+port; 458 ftp_host+=":"+port;
459
416 if (!FtpConnect( ftp_host.latin1(), &conn)) { 460 if (!FtpConnect( ftp_host.latin1(), &conn)) {
417 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); 461 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host);
418 connectServerBtn->setOn(FALSE); 462 connectServerBtn->setOn(FALSE);
419 connectServerBtn->setText( tr("Connect")); 463 connectServerBtn->setText( tr("Connect"));
420 return ; 464 return ;
421 } 465 }
466
422 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { 467 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
423 QString msg; 468 QString msg;
424 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); 469 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn));
425 msg.replace(QRegExp(":"),"\n"); 470 msg.replace(QRegExp(":"),"\n");
426 QMessageBox::message(tr("Note"),msg); 471 QMessageBox::message(tr("Note"),msg);
427 if(conn) 472 if(conn)
428 FtpQuit(conn); 473 FtpQuit(conn);
429 connectServerBtn->setOn(FALSE); 474 connectServerBtn->setOn(FALSE);
430 connectServerBtn->setText( tr("Connect")); 475 connectServerBtn->setText( tr("Connect"));
431 return ; 476 return ;
432 } 477 }
478
433 remoteDirList("/") ; 479 remoteDirList("/") ;
434 setCaption(ftp_host); 480 setCaption(ftp_host);
435 if( currentServerConfig == -1) 481 if( currentServerConfig == -1)
436 writeConfig(); 482 writeConfig();
437 connectServerBtn->setText( tr("Disconnect")); 483 connectServerBtn->setText( tr("Disconnect"));
438// QCopEnvelope ( "QPE/System", "notBusy()" ); 484// QCopEnvelope ( "QPE/System", "notBusy()" );
439} 485}
440 486
441void OpieFtp::disConnector() 487void OpieFtp::disConnector()
442{ 488{
443 if(conn) 489 if(conn)
444 FtpQuit(conn); 490 FtpQuit(conn);
445 setCaption("OpieFtp"); 491 setCaption("OpieFtp");
446 currentRemoteDir="/"; 492 currentRemoteDir="/";
447 Remote_View->clear(); 493 Remote_View->clear();
448 connectServerBtn->setText( tr("Connect")); 494 connectServerBtn->setText( tr("Connect"));
449 connectServerBtn->setOn(FALSE); 495 connectServerBtn->setOn(FALSE);
450 setCaption("OpieFtp"); 496 setCaption("OpieFtp");
451} 497}
452 498
453void OpieFtp::localUpload() 499void OpieFtp::localUpload()
454{ 500{
455 int fsz; 501 int fsz;
456// QCopEnvelope ( "QPE/System", "busy()" ); 502// QCopEnvelope ( "QPE/System", "busy()" );
457// qApp->processEvents(); 503// qApp->processEvents();
458 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 504 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
459 QListViewItemIterator it( Local_View ); 505 QListViewItemIterator it( Local_View );
460 for ( ; it.current(); ++it ) { 506 for ( ; it.current(); ++it ) {
461 if ( it.current()->isSelected() ) { 507 if ( it.current()->isSelected() ) {
462 QString strItem = it.current()->text(0); 508 QString strItem = it.current()->text(0);
463 QString localFile = currentDir.canonicalPath()+"/"+strItem; 509 QString localFile = currentDir.canonicalPath()+"/"+strItem;
464 QString remoteFile= currentRemoteDir+strItem; 510 QString remoteFile= currentRemoteDir+strItem;
465 QFileInfo fi(localFile); 511 QFileInfo fi(localFile);
466 if( !fi.isDir()) { 512 if( !fi.isDir()) {
467 fsz=fi.size(); 513 fsz=fi.size();
468 ProgressBar->setTotalSteps(fsz); 514 ProgressBar->setTotalSteps(fsz);
469 515
470 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 516 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
471 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 517 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
472 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 518 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
473 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 519 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
474 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); 520 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
475 521
476 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 522 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
477 QString msg; 523 QString msg;
478 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); 524 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
479 msg.replace(QRegExp(":"),"\n"); 525 msg.replace(QRegExp(":"),"\n");
480 QMessageBox::message(tr("Note"),msg); 526 QMessageBox::message(tr("Note"),msg);
481 } 527 }
482 } else { 528 } else {
483 QMessageBox::message(tr("Note"),tr("Cannot upload directories")); 529 QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
484 } 530 }
485 ProgressBar->reset(); 531 ProgressBar->reset();
486 nullifyCallBack(); 532 nullifyCallBack();
487 it.current()->setSelected(FALSE); 533 it.current()->setSelected(FALSE);
488 } //end currentSelected 534 } //end currentSelected
489 } 535 }
490 for ( ; it.current(); ++it ) { 536 for ( ; it.current(); ++it ) {
491 Local_View->clearSelection(); 537 Local_View->clearSelection();
492 } 538 }
493 Local_View->clearFocus(); 539 Local_View->clearFocus();
494 TabWidget->setCurrentPage(1); 540 TabWidget->setCurrentPage(1);
495 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 541 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
496// QCopEnvelope ( "QPE/System", "notBusy()" ); 542// QCopEnvelope ( "QPE/System", "notBusy()" );
497} 543}
498 544
499void OpieFtp::nullifyCallBack() 545void OpieFtp::nullifyCallBack()
500{ 546{
501 FtpOptions(FTPLIB_CALLBACK, 0, conn); 547 FtpOptions(FTPLIB_CALLBACK, 0, conn);
502 FtpOptions(FTPLIB_IDLETIME, 0, conn); 548 FtpOptions(FTPLIB_IDLETIME, 0, conn);
503 FtpOptions(FTPLIB_CALLBACKARG, 0, conn); 549 FtpOptions(FTPLIB_CALLBACKARG, 0, conn);
504 FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn); 550 FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn);
505} 551}
506 552
507void OpieFtp::remoteDownload() 553void OpieFtp::remoteDownload()
508{ 554{
509// qApp->processEvents(); 555// qApp->processEvents();
510 int fsz; 556 int fsz;
511// QCopEnvelope ( "QPE/System", "busy()" ); 557// QCopEnvelope ( "QPE/System", "busy()" );
512 558
513 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 559 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
514 QListViewItemIterator it( Remote_View ); 560 QListViewItemIterator it( Remote_View );
515 for ( ; it.current(); ++it ) { 561 for ( ; it.current(); ++it ) {
516 if ( it.current()->isSelected() ) { 562 if ( it.current()->isSelected() ) {
517 QString strItem = it.current()->text(0); 563 QString strItem = it.current()->text(0);
518// strItem=strItem.right(strItem.length()-1); 564// strItem=strItem.right(strItem.length()-1);
519 QString localFile = currentDir.canonicalPath(); 565 QString localFile = currentDir.canonicalPath();
520 if(localFile.right(1).find("/",0,TRUE) == -1) 566 if(localFile.right(1).find("/",0,TRUE) == -1)
521 localFile += "/"; 567 localFile += "/";
522 localFile += strItem; 568 localFile += strItem;
523// QString localFile = currentDir.canonicalPath()+"/"+strItem; 569// QString localFile = currentDir.canonicalPath()+"/"+strItem;
524 QString remoteFile= currentRemoteDir+strItem; 570 QString remoteFile= currentRemoteDir+strItem;
525 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) 571 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
526 fsz = 0; 572 fsz = 0;
527 QString temp; 573 QString temp;
528 temp.sprintf( remoteFile+" "+" %dkb", fsz); 574 temp.sprintf( remoteFile+" "+" %dkb", fsz);
529 575
530 ProgressBar->setTotalSteps(fsz); 576 ProgressBar->setTotalSteps(fsz);
531 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 577 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
532 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 578 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
533 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 579 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
534 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 580 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
535 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); 581 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
536 582
537 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 583 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
538 QString msg; 584 QString msg;
539 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); 585 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
540 msg.replace(QRegExp(":"),"\n"); 586 msg.replace(QRegExp(":"),"\n");
541 QMessageBox::message(tr("Note"),msg); 587 QMessageBox::message(tr("Note"),msg);
542 } 588 }
543 ProgressBar->reset(); 589 ProgressBar->reset();
544 nullifyCallBack(); 590 nullifyCallBack();
545 it.current()->setSelected(FALSE); 591 it.current()->setSelected(FALSE);
546 } 592 }
547 } 593 }
548 for ( ; it.current(); ++it ) { 594 for ( ; it.current(); ++it ) {
549 Remote_View->clearSelection(); 595 Remote_View->clearSelection();
550 } 596 }
551 Remote_View->setFocus(); 597 Remote_View->setFocus();
552 TabWidget->setCurrentPage(0); 598 TabWidget->setCurrentPage(0);
553 populateLocalView(); 599 populateLocalView();
554// QCopEnvelope ( "QPE/System", "notBusy()" ); 600// QCopEnvelope ( "QPE/System", "notBusy()" );
555} 601}
556 602
557bool OpieFtp::remoteDirList(const QString &dir) 603bool OpieFtp::remoteDirList(const QString &dir)
558{ 604{
559 QString tmp = QDir::homeDirPath(); 605 QString tmp = QDir::homeDirPath();
560 if(tmp.right(1) != "/") 606 if(tmp.right(1) != "/")
561 tmp+="/._temp"; 607 tmp+="/._temp";
562 else 608 else
563 tmp+="._temp"; 609 tmp+="._temp";
564// qDebug("Listing remote dir "+tmp); 610// qDebug("Listing remote dir "+tmp);
565// QCopEnvelope ( "QPE/System", "busy()" ); 611// QCopEnvelope ( "QPE/System", "busy()" );
566 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 612 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
567 QString msg; 613 QString msg;
568 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); 614 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
569 msg.replace(QRegExp(":"),"\n"); 615 msg.replace(QRegExp(":"),"\n");
570 QMessageBox::message(tr("Note"),msg); 616 QMessageBox::message(tr("Note"),msg);
571 return false; 617 return false;
572 } 618 }
573 populateRemoteView() ; 619 populateRemoteView() ;
574// QCopEnvelope ( "QPE/System", "notBusy()" ); 620// QCopEnvelope ( "QPE/System", "notBusy()" );
575 return true; 621 return true;
576} 622}
577 623
578bool OpieFtp::remoteChDir(const QString &dir) 624bool OpieFtp::remoteChDir(const QString &dir)
579{ 625{
580// QCopEnvelope ( "QPE/System", "busy()" ); 626// QCopEnvelope ( "QPE/System", "busy()" );
581 if (!FtpChdir( dir.latin1(), conn )) { 627 if (!FtpChdir( dir.latin1(), conn )) {
582 QString msg; 628 QString msg;
583 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); 629 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
584 msg.replace(QRegExp(":"),"\n"); 630 msg.replace(QRegExp(":"),"\n");
585 QMessageBox::message(tr("Note"),msg); 631 QMessageBox::message(tr("Note"),msg);
586// qDebug(msg); 632// qDebug(msg);
587// QCopEnvelope ( "QPE/System", "notBusy()" ); 633// QCopEnvelope ( "QPE/System", "notBusy()" );
588 return FALSE; 634 return FALSE;
589 } 635 }
590// QCopEnvelope ( "QPE/System", "notBusy()" ); 636// QCopEnvelope ( "QPE/System", "notBusy()" );
591 return TRUE; 637 return TRUE;
592} 638}
593 639
594void OpieFtp::populateLocalView() 640void OpieFtp::populateLocalView()
595{ 641{
596 Local_View->clear(); 642 Local_View->clear();
597 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 643 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
598 currentDir.setMatchAllDirs(TRUE); 644 currentDir.setMatchAllDirs(TRUE);
599 currentDir.setNameFilter(filterStr); 645 currentDir.setNameFilter(filterStr);
600 QString fileL, fileS, fileDate; 646 QString fileL, fileS, fileDate;
601 bool isDir=FALSE; 647 bool isDir=FALSE;
602 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 648 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
603 QFileInfoListIterator it(*list); 649 QFileInfoListIterator it(*list);
604 QFileInfo *fi; 650 QFileInfo *fi;
605 while ( (fi=it.current()) ) { 651 while ( (fi=it.current()) ) {
606 if (fi->isSymLink() ){ 652 if (fi->isSymLink() ){
607 QString symLink=fi->readLink(); 653 QString symLink=fi->readLink();
608// qDebug("Symlink detected "+symLink); 654// qDebug("Symlink detected "+symLink);
609 QFileInfo sym( symLink); 655 QFileInfo sym( symLink);
610 fileS.sprintf( "%10li", sym.size() ); 656 fileS.sprintf( "%10li", sym.size() );
611 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 657 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
612 fileDate = sym.lastModified().toString(); 658 fileDate = sym.lastModified().toString();
613 } else { 659 } else {
614// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 660// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
615 fileS.sprintf( "%10li", fi->size() ); 661 fileS.sprintf( "%10li", fi->size() );
616 fileL.sprintf( "%s",fi->fileName().data() ); 662 fileL.sprintf( "%s",fi->fileName().data() );
617 fileDate= fi->lastModified().toString(); 663 fileDate= fi->lastModified().toString();
618 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 664 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
619 fileL+="/"; 665 fileL+="/";
620 isDir=TRUE; 666 isDir=TRUE;
621// qDebug( fileL); 667// qDebug( fileL);
622 } 668 }
623 } 669 }
624 if(fileL !="./" && fi->exists()) { 670 if(fileL !="./" && fi->exists()) {
625 item= new QListViewItem( Local_View,fileL, fileDate, fileS ); 671 item = new QListViewItem( Local_View,fileL, fileDate, fileS );
626 QPixmap pm; 672 QPixmap pm;
627 673
628 if(isDir || fileL.find("/",0,TRUE) != -1) { 674 if(isDir || fileL.find("/",0,TRUE) != -1) {
629 if( !QDir( fi->filePath() ).isReadable()) 675 if( !QDir( fi->filePath() ).isReadable())
630 pm = Resource::loadPixmap( "lockedfolder" ); 676 pm = Resource::loadPixmap( "lockedfolder" );
631 else 677 else
632 pm= Resource::loadPixmap( "folder" ); 678 pm= Resource::loadPixmap( "folder" );
633 item->setPixmap( 0,pm ); 679 item->setPixmap( 0,pm );
634 } else { 680 } else {
635 if( !fi->isReadable() ) 681 if( !fi->isReadable() )
636 pm = Resource::loadPixmap( "locked" ); 682 pm = Resource::loadPixmap( "locked" );
637 else { 683 else {
638 MimeType mt(fi->filePath()); 684 MimeType mt(fi->filePath());
639 pm=mt.pixmap(); //sets the correct pixmap for mimetype 685 pm=mt.pixmap(); //sets the correct pixmap for mimetype
640 if(pm.isNull()) 686 if(pm.isNull())
641 pm = Resource::loadPixmap( "UnknownDocument-14" ); 687 pm = Resource::loadPixmap( "UnknownDocument-14" );
642 item->setPixmap( 0,pm); 688 item->setPixmap( 0,pm);
643 } 689 }
644 } 690 }
645 if( fileL.find("->",0,TRUE) != -1) { 691 if( fileL.find("->",0,TRUE) != -1) {
646 // overlay link image 692 // overlay link image
647 pm= Resource::loadPixmap( "folder" ); 693 pm= Resource::loadPixmap( "folder" );
648 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 694 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
649 QPainter painter( &pm ); 695 QPainter painter( &pm );
650 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 696 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
651 pm.setMask( pm.createHeuristicMask( FALSE ) ); 697 pm.setMask( pm.createHeuristicMask( FALSE ) );
652 item->setPixmap( 0, pm); 698 item->setPixmap( 0, pm);
653 } 699 }
654 } 700 }
655 isDir=FALSE; 701 isDir=FALSE;
656 ++it; 702 ++it;
657 } 703 }
658 Local_View->setSorting( 3,FALSE); 704 Local_View->setSorting( 3,FALSE);
659 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); 705 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
660 fillCombo( (const QString &)currentDir); 706 fillCombo( (const QString &)currentDir);
661} 707}
662 708
663bool OpieFtp::populateRemoteView( ) 709bool OpieFtp::populateRemoteView( )
664{ 710{
665// qDebug("populate remoteview"); 711// qDebug("populate remoteview");
666 QString sfile=QDir::homeDirPath(); 712 QString sfile=QDir::homeDirPath();
667 if(sfile.right(1) != "/") 713 if(sfile.right(1) != "/")
668 sfile+="/._temp"; 714 sfile+="/._temp";
669 else 715 else
670 sfile+="._temp"; 716 sfile+="._temp";
671 QFile file( sfile); 717 QFile file( sfile);
672 Remote_View->clear(); 718 Remote_View->clear();
673 QString s, File_Name; 719 QString s, File_Name;
674 QListViewItem *itemDir=NULL, *itemFile=NULL; 720 QListViewItem *itemDir=NULL, *itemFile=NULL;
675 QString fileL, fileS, fileDate; 721 QString fileL, fileS, fileDate;
676 if ( file.open(IO_ReadOnly)) { 722 if ( file.open(IO_ReadOnly)) {
677 QTextStream t( &file ); // use a text stream 723 QTextStream t( &file ); // use a text stream
678 while ( !t.eof()) { 724 while ( !t.eof()) {
679 s = t.readLine(); 725 s = t.readLine();
680 fileL = s.right(s.length()-55); 726 fileL = s.right(s.length()-55);
681 fileL = fileL.stripWhiteSpace(); 727 fileL = fileL.stripWhiteSpace();
682 if(s.left(1) == "d") 728 if(s.left(1) == "d")
683 fileL = fileL+"/"; 729 fileL = fileL+"/";
684// fileL = "/"+fileL+"/"; 730// fileL = "/"+fileL+"/";
685 fileS = s.mid( 30, 42-30); 731 fileS = s.mid( 30, 42-30);
686 fileS = fileS.stripWhiteSpace(); 732 fileS = fileS.stripWhiteSpace();
687 fileDate = s.mid( 42, 55-42); 733 fileDate = s.mid( 42, 55-42);
688 fileDate = fileDate.stripWhiteSpace(); 734 fileDate = fileDate.stripWhiteSpace();
689 if(fileL.find("total",0,TRUE) == -1) { 735 if(fileL.find("total",0,TRUE) == -1) {
690 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { 736 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
691 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); 737 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d");
692 item->setPixmap( 0, Resource::loadPixmap( "folder" )); 738 item->setPixmap( 0, Resource::loadPixmap( "folder" ));
693// if(itemDir) 739// if(itemDir)
694 item->moveItem(itemDir); 740 item->moveItem(itemDir);
695 itemDir=item; 741 itemDir=item;
696 } else { 742 } else {
697 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); 743 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f");
698 item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); 744 item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
699// if(itemFile) 745// if(itemFile)
700 item->moveItem(itemDir); 746 item->moveItem(itemDir);
701 item->moveItem(itemFile); 747 item->moveItem(itemFile);
702 itemFile=item; 748 itemFile=item;
703 } 749 }
704 } 750 }
705 } 751 }
706 QListViewItem * item1 = new QListViewItem( Remote_View, "../"); 752 QListViewItem * item1 = new QListViewItem( Remote_View, "../");
707 item1->setPixmap( 0, Resource::loadPixmap( "folder" )); 753 item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
708 file.close(); 754 file.close();
709 if( file.exists()) 755 if( file.exists())
710 file. remove(); 756 file. remove();
711 } else 757 } else
712 qDebug("temp file not opened successfullly "+sfile); 758 qDebug("temp file not opened successfullly "+sfile);
713 Remote_View->setSorting( 4,TRUE); 759 Remote_View->setSorting( 4,TRUE);
714 return true; 760 return true;
715} 761}
716 762
717void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 763void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
718{ 764{
719 if( selectedItem) { 765 if( selectedItem) {
720// QCopEnvelope ( "QPE/System", "busy()" ); 766// QCopEnvelope ( "QPE/System", "busy()" );
721 QString oldRemoteCurrentDir = currentRemoteDir; 767 QString oldRemoteCurrentDir = currentRemoteDir;
@@ -1056,292 +1102,402 @@ void OpieFtp::localRename()
1056 QMessageBox::message(tr("Note"),tr("Could not rename")); 1102 QMessageBox::message(tr("Note"),tr("Could not rename"));
1057 } 1103 }
1058 populateLocalView(); 1104 populateLocalView();
1059} 1105}
1060 1106
1061void OpieFtp::currentPathComboActivated(const QString & currentPath) { 1107void OpieFtp::currentPathComboActivated(const QString & currentPath) {
1062 if (TabWidget->currentPageIndex() == 0) { 1108 if (TabWidget->currentPageIndex() == 0) {
1063 chdir( currentPath.latin1() ); 1109 chdir( currentPath.latin1() );
1064 currentDir.cd( currentPath, TRUE); 1110 currentDir.cd( currentPath, TRUE);
1065 populateLocalView(); 1111 populateLocalView();
1066 update(); 1112 update();
1067 } else { 1113 } else {
1068// chdir( currentPath.latin1() ); 1114// chdir( currentPath.latin1() );
1069// currentDir.cd( currentPath, TRUE); 1115// currentDir.cd( currentPath, TRUE);
1070// populateList(); 1116// populateList();
1071// update(); 1117// update();
1072 1118
1073 } 1119 }
1074} 1120}
1075 1121
1076void OpieFtp::fillCombo(const QString &currentPath) { 1122void OpieFtp::fillCombo(const QString &currentPath) {
1077 1123
1078 currentPathCombo->lineEdit()->setText(currentPath); 1124 currentPathCombo->lineEdit()->setText(currentPath);
1079 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1125 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1080 currentPathCombo->clear(); 1126 currentPathCombo->clear();
1081 localDirPathStringList.prepend(currentPath ); 1127 localDirPathStringList.prepend(currentPath );
1082 currentPathCombo->insertStringList( localDirPathStringList,-1); 1128 currentPathCombo->insertStringList( localDirPathStringList,-1);
1083 } 1129 }
1084 currentPathCombo->lineEdit()->setText(currentPath); 1130 currentPathCombo->lineEdit()->setText(currentPath);
1085 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1131 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1086 currentPathCombo->clear(); 1132 currentPathCombo->clear();
1087 remoteDirPathStringList.prepend(currentPath ); 1133 remoteDirPathStringList.prepend(currentPath );
1088 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1134 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1089 } 1135 }
1090} 1136}
1091 1137
1092void OpieFtp::fillRemoteCombo(const QString &currentPath) { 1138void OpieFtp::fillRemoteCombo(const QString &currentPath) {
1093 1139
1094 currentPathCombo->lineEdit()->setText(currentPath); 1140 currentPathCombo->lineEdit()->setText(currentPath);
1095 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1141 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1096 currentPathCombo->clear(); 1142 currentPathCombo->clear();
1097 remoteDirPathStringList.prepend(currentPath ); 1143 remoteDirPathStringList.prepend(currentPath );
1098 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1144 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1099 } 1145 }
1100} 1146}
1101 1147
1102void OpieFtp::currentPathComboChanged() 1148void OpieFtp::currentPathComboChanged()
1103{ 1149{
1104 QString oldRemoteCurrentDir = currentRemoteDir; 1150 QString oldRemoteCurrentDir = currentRemoteDir;
1105// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); 1151// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
1106 if (TabWidget->currentPageIndex() == 0) { 1152 if (TabWidget->currentPageIndex() == 0) {
1107 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 1153 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
1108 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 1154 currentDir.setPath( currentPathCombo->lineEdit()->text() );
1109 populateLocalView(); 1155 populateLocalView();
1110 } else { 1156 } else {
1111 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 1157 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
1112 } 1158 }
1113 } 1159 }
1114 if (TabWidget->currentPageIndex() == 1) { 1160 if (TabWidget->currentPageIndex() == 1) {
1115 currentRemoteDir = currentPathCombo->lineEdit()->text(); 1161 currentRemoteDir = currentPathCombo->lineEdit()->text();
1116 if(currentRemoteDir.right(1) !="/") { 1162 if(currentRemoteDir.right(1) !="/") {
1117 currentRemoteDir = currentRemoteDir +"/"; 1163 currentRemoteDir = currentRemoteDir +"/";
1118 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 1164 currentPathCombo->lineEdit()->setText( currentRemoteDir );
1119 } 1165 }
1120 if( !remoteChDir( (const QString &)currentRemoteDir) ) { 1166 if( !remoteChDir( (const QString &)currentRemoteDir) ) {
1121 currentRemoteDir = oldRemoteCurrentDir; 1167 currentRemoteDir = oldRemoteCurrentDir;
1122 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 1168 currentPathCombo->lineEdit()->setText( currentRemoteDir );
1123 } 1169 }
1124 1170
1125 remoteDirList( (const QString &)currentRemoteDir); 1171 remoteDirList( (const QString &)currentRemoteDir);
1126 } 1172 }
1127} 1173}
1128 1174
1129void OpieFtp::switchToLocalTab() 1175void OpieFtp::switchToLocalTab()
1130{ 1176{
1131 TabWidget->setCurrentPage(0); 1177 TabWidget->setCurrentPage(0);
1132} 1178}
1133 1179
1134void OpieFtp::switchToRemoteTab() 1180void OpieFtp::switchToRemoteTab()
1135{ 1181{
1136 TabWidget->setCurrentPage(1); 1182 TabWidget->setCurrentPage(1);
1137} 1183}
1138 1184
1139void OpieFtp::switchToConfigTab() 1185void OpieFtp::switchToConfigTab()
1140{ 1186{
1141 TabWidget->setCurrentPage(2); 1187 TabWidget->setCurrentPage(2);
1142} 1188}
1143 1189
1144void OpieFtp::readConfig() 1190void OpieFtp::readConfig()
1145{ 1191{
1146 fillCombos(); 1192 fillCombos();
1147 Config cfg("opieftp"); 1193 Config cfg("opieftp");
1148 cfg.setGroup("Server"); 1194 cfg.setGroup("Server");
1149 currentServerConfig = cfg.readNumEntry("currentServer", -1); 1195 currentServerConfig = cfg.readNumEntry("currentServer", -1);
1150 1196
1151// qDebug("Reading %d", currentServerConfig); 1197// qDebug("Reading %d", currentServerConfig);
1152 serverComboSelected( currentServerConfig); 1198 serverComboSelected( currentServerConfig-1);
1199
1153} 1200}
1154 1201
1155void OpieFtp::writeConfig() 1202void OpieFtp::writeConfig()
1156{ 1203{
1204 qDebug("write config");
1157 Config cfg("opieftp"); 1205 Config cfg("opieftp");
1158 cfg.setGroup("Server"); 1206 cfg.setGroup("Server");
1207
1159 QString username, remoteServerStr, remotePathStr, password, port, temp; 1208 QString username, remoteServerStr, remotePathStr, password, port, temp;
1209
1160 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1210 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1211
1161 if( currentServerConfig == -1) { 1212 if( currentServerConfig == -1) {
1162 for (int i = 1; i <= numberOfEntries; i++) { 1213
1214 for (int i = 1; i <= numberOfEntries; i++) {
1163 temp.setNum(i); 1215 temp.setNum(i);
1164 cfg.setGroup("Server"); 1216 cfg.setGroup("Server");
1165 QString tempStr = cfg.readEntry( temp,""); 1217 QString tempStr = cfg.readEntry( temp,"");
1166 } 1218 }
1219
1167 temp.setNum( numberOfEntries + 1); 1220 temp.setNum( numberOfEntries + 1);
1168 cfg.setGroup("Server"); 1221 cfg.setGroup("Server");
1222
1169 remoteServerStr = cfg.readEntry( temp,""); 1223 remoteServerStr = cfg.readEntry( temp,"");
1224
1170 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1225 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1171 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1226 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1172 1227
1173 temp.setNum(numberOfEntries+1); 1228 temp.setNum(numberOfEntries+1);
1174 cfg.setGroup("Server"); 1229 cfg.setGroup("Server");
1230
1175 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); 1231 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() );
1176 cfg.writeEntry("currentServer", numberOfEntries+1); 1232 cfg.writeEntry("currentServer", numberOfEntries+1);
1233
1234 currentServerConfig = numberOfEntries+1;
1235 qDebug("setting currentserverconfig to %d", currentServerConfig);
1236
1177 cfg.setGroup(temp); 1237 cfg.setGroup(temp);
1238 if(!newServerName.isEmpty())
1239 cfg.writeEntry("ServerName", newServerName);
1240
1178 cfg.writeEntry("RemotePath", remotePath->text()); 1241 cfg.writeEntry("RemotePath", remotePath->text());
1242
1179 cfg.writeEntry("Username", UsernameComboBox->currentText()); 1243 cfg.writeEntry("Username", UsernameComboBox->currentText());
1244
1180 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); 1245 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text());
1181 cfg.setGroup("Server"); 1246 cfg.setGroup("Server");
1247
1182 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); 1248 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 ));
1183 1249
1184 } 1250 }
1185} 1251}
1186 1252
1253void OpieFtp::clearCombos() {
1254 qDebug("clearing");
1255 ServerComboBox->clear();
1256 UsernameComboBox->clear();
1257 PasswordEdit->clear();
1258 serverListView->clear();
1259}
1260
1261
1187void OpieFtp::fillCombos() 1262void OpieFtp::fillCombos()
1188{ 1263{
1264 clearCombos();
1265
1189 Config cfg("opieftp"); 1266 Config cfg("opieftp");
1190 cfg.setGroup("Server"); 1267 cfg.setGroup("Server");
1191 QString username, remoteServerStr, remotePathStr, password, port, temp; 1268 QString username, remoteServerStr, remotePathStr, password, port, temp;
1192 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1269 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1270
1193 for (int i = 1; i <= numberOfEntries; i++) { 1271 for (int i = 1; i <= numberOfEntries; i++) {
1194 temp.setNum(i); 1272 temp.setNum(i);
1195 qDebug(temp); 1273 qDebug(temp);
1196 cfg.setGroup("Server"); 1274 cfg.setGroup("Server");
1197 remoteServerStr = cfg.readEntry( temp,""); 1275 remoteServerStr = cfg.readEntry( temp,"");
1198 qDebug( remoteServerStr); 1276 qDebug( remoteServerStr);
1277
1199 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1278 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1200 port = remoteServerStr.right( divider - 1); 1279 port = remoteServerStr.right( divider - 1);
1201 bool ok; 1280 bool ok;
1202 PortSpinBox->setValue( port.toInt(&ok,10)); 1281 PortSpinBox->setValue( port.toInt(&ok,10));
1203 1282
1204 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1283 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1205 qDebug( remoteServerStr); 1284 qDebug( "remote server string "+remoteServerStr);
1206 ServerComboBox->insertItem( remoteServerStr ); 1285 ServerComboBox->insertItem( remoteServerStr );
1207// cfg.setGroup(temp);
1208 1286
1209// remotePathStr = cfg.readEntry(remoteServer,""); 1287 cfg.setGroup(temp);
1210// int divider = remoteServer.length() - remoteServer.find(":",0,TRUE);
1211// port = remoteServer.right( divider+1);
1212// PortSpinBox->setValue( port);
1213 1288
1214// remoteServer = remoteServer.left(divider - 1); 1289 username = cfg.readEntry(temp);
1215// remotePath->setText( remotePathStr); 1290 UsernameComboBox->insertItem(username);
1291 password = cfg.readEntryCrypt(username,"");
1292 PasswordEdit->setText(password);
1216 1293
1217// username = cfg.readEntry(temp); 1294 serverListView->insertItem( cfg.readEntry("ServerName"));
1218// UsernameComboBox->insertItem(username);
1219// password = cfg.readEntryCrypt(username,"");
1220// PasswordEdit->setText(password);
1221 } 1295 }
1222} 1296}
1223 1297
1224 1298
1225void OpieFtp::serverComboSelected(int index) 1299void OpieFtp::serverComboSelected(int index)
1226{ 1300{
1227 currentServerConfig = index; 1301 currentServerConfig = index+1;
1302 qDebug("server combo selected %d", index+1);
1228 QString username, remoteServerStr, remotePathStr, password, port, temp; 1303 QString username, remoteServerStr, remotePathStr, password, port, temp;
1229// remoteServerStr = ServerComboBox->text(index); 1304// remoteServerStr = ServerComboBox->text(index);
1305
1230 Config cfg("opieftp"); 1306 Config cfg("opieftp");
1231 cfg.setGroup("Server"); 1307 cfg.setGroup("Server");
1232 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1308 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1233 1309
1234 temp.setNum(index); 1310 temp.setNum(index+1);
1235 remoteServerStr = cfg.readEntry( temp,""); 1311 remoteServerStr = cfg.readEntry( temp,"");
1312
1236 qDebug("Group" +temp); 1313 qDebug("Group" +temp);
1237 cfg.setGroup(temp); 1314 cfg.setGroup(temp);
1238// qDebug(temp); 1315// qDebug(temp);
1239 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1316 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1240 port = remoteServerStr.right( divider - 1); 1317 port = remoteServerStr.right( divider - 1);
1241 bool ok; 1318 bool ok;
1242 int portInt = port.toInt(&ok,10); 1319 int portInt = port.toInt(&ok,10);
1243 if( portInt == 0) portInt = 21; 1320 if( portInt == 0) portInt = 21;
1244 1321
1322 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE)));
1323
1245 PortSpinBox->setValue( portInt); 1324 PortSpinBox->setValue( portInt);
1246 1325
1247 remotePath->setText(cfg.readEntry("RemotePath", "/")); 1326 remotePath->setText(cfg.readEntry("RemotePath", "/"));
1248 1327
1249 username = cfg.readEntry("Username", "anonymous"); 1328 username = cfg.readEntry("Username", "anonymous");
1250 UsernameComboBox->lineEdit()->setText(username); 1329 UsernameComboBox->lineEdit()->setText(username);
1251 qDebug(username); 1330 qDebug(username);
1252// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); 1331// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org"));
1253 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); 1332 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
1254// UsernameComboBox 1333// UsernameComboBox
1255// PasswordEdit 1334// PasswordEdit
1256 1335
1257 cfg.setGroup("Server"); 1336 cfg.setGroup("Server");
1258 temp.sprintf("%d",currentServerConfig); 1337 temp.sprintf("%d",currentServerConfig);
1259 cfg.writeEntry("currentServer", temp); 1338 cfg.writeEntry("currentServer", temp);
1339
1340 fuckeduphack = TRUE;
1341 serverListView->setCurrentItem( index);
1342 fuckeduphack=FALSE;
1343 qDebug("server list set selected %d",index);
1260 update(); 1344 update();
1261} 1345}
1262// UsernameComboBox->lineEdit()->setText("root");
1263// PasswordEdit->setText( tr( "" ) );
1264// ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) );
1265// remotePath->setText( currentRemoteDir = "/home/llornkcor/");
1266// PortSpinBox->setValue( 4242);
1267 1346
1268void OpieFtp::deleteServer() 1347void OpieFtp::deleteServer()
1269{ 1348{
1270 QString username, remoteServerStr, remotePathStr, password, port, temp; 1349 QString username, remoteServerStr, remotePathStr, password, port, temp, servername;
1271 remoteServerStr = ServerComboBox->currentText( ); 1350 remoteServerStr = ServerComboBox->currentText( );
1272 username = UsernameComboBox->currentText(); 1351 username = UsernameComboBox->currentText();
1352 servername=serverListView->currentText();
1353
1273 Config cfg("opieftp"); 1354 Config cfg("opieftp");
1274 cfg.setGroup("Server"); 1355 cfg.setGroup("Server");
1356 QString tempname;
1275 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1357 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1276 for (int i = 0; i <= numberOfEntries; i++) { 1358
1277 temp.setNum(i+1); 1359 for (int i = 1; i <= numberOfEntries; i++) {
1278 cfg.setGroup("Server"); 1360 temp.setNum(i);
1279 if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1 1361// cfg.setGroup("Server");
1280 && cfg.readEntry(temp).find(username,0,TRUE) != -1 1362 cfg.setGroup(QString::number(i));
1281 && !remoteServerStr.isEmpty()) { 1363 tempname=cfg.readEntry( "ServerName","");
1282 qDebug(temp); 1364
1365 if( tempname.find( servername,0,TRUE) != -1 ) {
1366// servername.find( cfg.readEntry("ServerName")) != -1 &&
1367// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 &&
1368// username.find( cfg.readEntry("Username")) != -1) {
1369
1370 serverListView->removeItem(i);
1371
1372 qDebug("OK DELETE "+tempname);
1373 cfg.removeEntry(QString::number(i));
1374 for ( i; i <= numberOfEntries; i++) {
1375 cfg.setGroup("Server");
1376 cfg.writeEntry("Server", QString::number(numberOfEntries + 1 ));
1377
1378 cfg.setGroup(QString::number(i+1)); //get next server config
1379 servername=cfg.readEntry("ServerName");
1380 remoteServerStr=cfg.readEntry("RemotePath");
1381 username=cfg.readEntry("Username");
1382 password=cfg.readEntryCrypt( username);
1383
1384 cfg.setGroup(QString::number(i));
1385
1386 cfg.writeEntry("RemotePath", remoteServerStr);
1387 cfg.writeEntry("ServerName", servername);
1388 cfg.writeEntry("Username", username);
1389 cfg.writeEntryCrypt( username, password);
1390
1391 }
1392 cfg.setGroup("Server");
1393 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries - 1 ));
1283 } 1394 }
1284 } 1395 }
1396 cfg.setGroup(QString::number(numberOfEntries));
1397 cfg.removeEntry("Server");
1398 cfg.removeEntry("RemotePath");
1399 cfg.removeEntry("ServerName");
1400 username=cfg.readEntry("Username");
1401 cfg.removeEntry("Username");
1402 cfg.removeEntry(username);
1403
1404 currentServerConfig=currentServerConfig-1;
1405
1406 fillCombos();
1407 update();
1285} 1408}
1286 1409
1287void OpieFtp::upDir() 1410void OpieFtp::upDir()
1288{ 1411{
1289 if (TabWidget->currentPageIndex() == 0) { 1412 if (TabWidget->currentPageIndex() == 0) {
1290 QString current = currentDir.canonicalPath(); 1413 QString current = currentDir.canonicalPath();
1291 QDir dir(current); 1414 QDir dir(current);
1292 dir.cdUp(); 1415 dir.cdUp();
1293 current = dir.canonicalPath(); 1416 current = dir.canonicalPath();
1294 chdir( current.latin1() ); 1417 chdir( current.latin1() );
1295 currentDir.cd( current, TRUE); 1418 currentDir.cd( current, TRUE);
1296 populateLocalView(); 1419 populateLocalView();
1297 update(); 1420 update();
1298 } else { 1421 } else {
1299 if( FtpCDUp( conn) == 0) { 1422 if( FtpCDUp( conn) == 0) {
1300 QString msg; 1423 QString msg;
1301 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 1424 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
1302 msg.replace(QRegExp(":"),"\n"); 1425 msg.replace(QRegExp(":"),"\n");
1303 QMessageBox::message(tr("Note"),msg); 1426 QMessageBox::message(tr("Note"),msg);
1304// qDebug(msg); 1427// qDebug(msg);
1305 } 1428 }
1306 char path[256]; 1429 char path[256];
1307 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 1430 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
1308 QString msg; 1431 QString msg;
1309 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 1432 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
1310 msg.replace(QRegExp(":"),"\n"); 1433 msg.replace(QRegExp(":"),"\n");
1311 QMessageBox::message(tr("Note"),msg); 1434 QMessageBox::message(tr("Note"),msg);
1312// qDebug(msg); 1435// qDebug(msg);
1313 } 1436 }
1314 currentRemoteDir=path; 1437 currentRemoteDir=path;
1315 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1438 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1316 if(currentRemoteDir.right(1) !="/") 1439 if(currentRemoteDir.right(1) !="/")
1317 currentRemoteDir +="/"; 1440 currentRemoteDir +="/";
1318 currentPathCombo->lineEdit()->setText( currentRemoteDir); 1441 currentPathCombo->lineEdit()->setText( currentRemoteDir);
1319 fillRemoteCombo( (const QString &)currentRemoteDir); 1442 fillRemoteCombo( (const QString &)currentRemoteDir);
1320 1443
1321 } 1444 }
1322} 1445}
1323 1446
1324void OpieFtp::docButtonPushed() { 1447void OpieFtp::docButtonPushed() {
1325 QString current = QPEApplication::documentDir(); 1448 QString current = QPEApplication::documentDir();
1326 chdir( current.latin1() ); 1449 chdir( current.latin1() );
1327 currentDir.cd( current, TRUE); 1450 currentDir.cd( current, TRUE);
1328 populateLocalView(); 1451 populateLocalView();
1329 update(); 1452 update();
1330 1453
1331} 1454}
1332 1455
1333void OpieFtp::homeButtonPushed() { 1456void OpieFtp::homeButtonPushed() {
1334 QString current = QDir::homeDirPath(); 1457 QString current = QDir::homeDirPath();
1335 chdir( current.latin1() ); 1458 chdir( current.latin1() );
1336 currentDir.cd( current, TRUE); 1459 currentDir.cd( current, TRUE);
1337 populateLocalView(); 1460 populateLocalView();
1338 update(); 1461 update();
1339} 1462}
1340 1463
1341void OpieFtp::doAbout() { 1464void OpieFtp::doAbout() {
1342 QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n" 1465 QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n"
1343 "L.J.Potter<llornkcor@handhelds.org>\n" 1466 "L.J.Potter<llornkcor@handhelds.org>\n"
1344 "and uses ftplib copyright 1996-2000\n" 1467 "and uses ftplib copyright 1996-2000\n"
1345 "by Thomas Pfau, pfau@cnj.digex.net\n\n" 1468 "by Thomas Pfau, pfau@cnj.digex.net\n\n"
1346 "and is licensed by the GPL"); 1469 "and is licensed by the GPL");
1347} 1470}
1471
1472void OpieFtp::NewServer() {
1473 InputDialog *fileDlg;
1474 fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0);
1475 fileDlg->exec();
1476 Config cfg("opieftp");
1477 if( fileDlg->result() == 1 ) {
1478 newServerName = fileDlg->LineEdit1->text();
1479 for(int i=1;i<serverListView->count();i++) {
1480 cfg.setGroup( QString::number(i));
1481 if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) {
1482 QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken"));
1483 return;
1484 }
1485 }
1486 currentServerConfig =-1;
1487 writeConfig();
1488 serverListView->insertItem( newServerName );
1489 serverListView->setCurrentItem( serverListView->count());
1490 }
1491}
1492
1493void OpieFtp::serverListClicked( const QString &item) {
1494 if(item.isEmpty()) return;
1495 Config cfg("opieftp");
1496 qDebug("highltined "+item);
1497 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1498 for (int i = 1; i <= numberOfEntries; i++) {
1499 cfg.setGroup(QString::number(i));
1500 if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack)
1501 serverComboSelected(i-1);
1502 }
1503}
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h
index ad36b1d..2aa691a 100644
--- a/noncore/net/opieftp/opieftp.h
+++ b/noncore/net/opieftp/opieftp.h
@@ -1,122 +1,138 @@
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;
38class QLineEdit; 37class QLineEdit;
39class QPushButton; 38class QPushButton;
40class QToolButton; 39class QToolButton;
41class QStringList; 40class QStringList;
41class QListBox;
42 42
43class OpieFtp : public QMainWindow 43class OpieFtp : public QMainWindow
44{ 44{
45 Q_OBJECT 45 Q_OBJECT
46 46
47public: 47public:
48 OpieFtp( ); 48 OpieFtp( );
49 ~OpieFtp(); 49 ~OpieFtp();
50 50
51 QTabWidget *TabWidget; 51 QTabWidget *TabWidget;
52 QWidget *tab, *tab_2, *tab_3; 52 QWidget *tab, *tab_2, *tab_3;
53 QListView *Local_View, *Remote_View; 53 QListView *Local_View, *Remote_View;
54 QListBox *serverListView;
54 55
55 QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; 56 QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo;
56 QLineEdit *PasswordEdit, *remotePath; 57 QLineEdit *PasswordEdit, *remotePath;
57 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; 58 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;;
58 QSpinBox* PortSpinBox; 59 QSpinBox* PortSpinBox;
59 QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu; 60 QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu;
60 QDir currentDir; 61 QDir currentDir;
61 QString currentRemoteDir; 62 QString currentRemoteDir;
62 QString filterStr; 63 QString filterStr;
63 QListViewItem * item; 64 QListViewItem * item;
64 QPushButton *connectServerBtn;// 65 QPushButton *connectServerBtn, *newServerButton;//
65 QToolButton *cdUpButton, *homeButton, *docButton; 66 QToolButton *cdUpButton, *homeButton, *docButton;
66 bool b; 67 bool b;
67 int currentServerConfig; 68 int currentServerConfig;
68protected slots: 69protected slots:
69 void upDir(); 70 void upDir();
70 void homeButtonPushed(); 71 void homeButtonPushed();
71 void docButtonPushed(); 72 void docButtonPushed();
72 void doAbout(); 73 void doAbout();
74
73 void serverComboEdited(const QString & ); 75 void serverComboEdited(const QString & );
76 void UsernameComboBoxEdited(const QString & );
77 void PasswordEditEdited(const QString & );
78
74 void showLocalMenu( QListViewItem *); 79 void showLocalMenu( QListViewItem *);
75 void showRemoteMenu( QListViewItem *); 80 void showRemoteMenu( QListViewItem *);
76 void doLocalCd(); 81 void doLocalCd();
77 void doRemoteCd(); 82 void doRemoteCd();
78 void localUpload(); 83 void localUpload();
79 void remoteDownload(); 84 void remoteDownload();
80 void newConnection(); 85 void newConnection();
81 void connector(); 86 void connector();
82 void disConnector(); 87 void disConnector();
83 void populateLocalView(); 88 void populateLocalView();
84 bool populateRemoteView(); 89 bool populateRemoteView();
85 void showHidden(); 90 void showHidden();
86 void writeConfig(); 91 void writeConfig();
87 void readConfig(); 92 void readConfig();
88 void localListClicked(QListViewItem *); 93 void localListClicked(QListViewItem *);
89 void remoteListClicked(QListViewItem *); 94 void remoteListClicked(QListViewItem *);
90 void ListPressed( int, QListViewItem *, const QPoint&, int); 95 void ListPressed( int, QListViewItem *, const QPoint&, int);
91 void RemoteListPressed( int, QListViewItem *, const QPoint&, int); 96 void RemoteListPressed( int, QListViewItem *, const QPoint&, int);
92 void localMakDir(); 97 void localMakDir();
93 void localDelete(); 98 void localDelete();
94 void remoteMakDir(); 99 void remoteMakDir();
95 void remoteDelete(); 100 void remoteDelete();
101
96 bool remoteDirList(const QString &); 102 bool remoteDirList(const QString &);
97 bool remoteChDir(const QString &); 103 bool remoteChDir(const QString &);
104
98 void tabChanged(QWidget*); 105 void tabChanged(QWidget*);
99 void cleanUp(); 106 void cleanUp();
107
100 void remoteRename(); 108 void remoteRename();
101 void localRename(); 109 void localRename();
110
102 void currentPathComboChanged(); 111 void currentPathComboChanged();
103 void currentPathComboActivated(const QString &); 112 void currentPathComboActivated(const QString &);
104 void switchToLocalTab(); 113 void switchToLocalTab();
105 void switchToRemoteTab(); 114 void switchToRemoteTab();
106 void switchToConfigTab(); 115 void switchToConfigTab();
107 void fillCombos(); 116
108 void fillRemoteCombo(const QString&); 117 void fillCombos();
109 void fillCombo(const QString &); 118 void clearCombos();
110 void serverComboSelected(int); 119 void fillRemoteCombo(const QString&);
111 void deleteServer(); 120 void fillCombo(const QString &);
112 void connectorBtnToggled(bool); 121 void serverComboSelected(int);
122 void deleteServer();
123 void connectorBtnToggled(bool);
124 void NewServer();
125 void serverListClicked( const QString &);
126
113protected: 127protected:
128 bool fuckeduphack;
114 QStringList remoteDirPathStringList, localDirPathStringList; 129 QStringList remoteDirPathStringList, localDirPathStringList;
130 QString newServerName;
115 void nullifyCallBack(); 131 void nullifyCallBack();
116 QGridLayout* tabLayout; 132 QGridLayout* tabLayout;
117 QGridLayout* tabLayout_2; 133 QGridLayout* tabLayout_2;
118 QGridLayout* tabLayout_3; 134 QGridLayout* tabLayout_3;
119 135
120}; 136};
121 137
122#endif // OPIEFTP_H 138#endif // OPIEFTP_H