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