-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 15 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 4 |
2 files changed, 10 insertions, 9 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 8f2b9c9..9d6356d 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,480 +1,479 @@ | |||
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 | ||
16 | extern "C" { | 16 | extern "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 | 54 | ||
55 | #include <unistd.h> | 55 | #include <unistd.h> |
56 | #include <stdlib.h> | 56 | #include <stdlib.h> |
57 | 57 | ||
58 | 58 | ||
59 | QProgressBar *ProgressBar; | 59 | QProgressBar *ProgressBar; |
60 | static netbuf *conn=NULL; | 60 | static netbuf *conn=NULL; |
61 | 61 | ||
62 | static int log_progress(netbuf *ctl, int xfered, void *arg) | 62 | static int log_progress(netbuf *ctl, int xfered, void *arg) |
63 | { | 63 | { |
64 | int fsz = *(int *)arg; | 64 | int fsz = *(int *)arg; |
65 | int pct = (xfered * 100) / fsz; | 65 | int pct = (xfered * 100) / fsz; |
66 | // printf("%3d%%\r", pct); | 66 | // printf("%3d%%\r", pct); |
67 | // fflush(stdout); | 67 | // fflush(stdout); |
68 | ProgressBar->setProgress(xfered); | 68 | ProgressBar->setProgress(xfered); |
69 | qApp->processEvents(); | 69 | qApp->processEvents(); |
70 | return 1; | 70 | return 1; |
71 | } | 71 | } |
72 | 72 | ||
73 | OpieFtp::OpieFtp( ) | 73 | OpieFtp::OpieFtp( ) |
74 | : QMainWindow( ) | 74 | : QMainWindow( ) |
75 | { | 75 | { |
76 | setCaption( tr( "OpieFtp" ) ); | 76 | setCaption( tr( "OpieFtp" ) ); |
77 | 77 | ||
78 | QGridLayout *layout = new QGridLayout( this ); | 78 | QGridLayout *layout = new QGridLayout( this ); |
79 | layout->setSpacing( 2); | 79 | layout->setSpacing( 2); |
80 | layout->setMargin( 2); | 80 | layout->setMargin( 2); |
81 | 81 | ||
82 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 82 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
83 | 83 | ||
84 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 84 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
85 | // QPEToolBar *menuBar = new QPEToolBar(this); | 85 | // QPEToolBar *menuBar = new QPEToolBar(this); |
86 | // menuBar->setHorizontalStretchable( TRUE ); | 86 | // menuBar->setHorizontalStretchable( TRUE ); |
87 | 87 | ||
88 | connectionMenu = new QPopupMenu( this ); | 88 | connectionMenu = new QPopupMenu( this ); |
89 | localMenu = new QPopupMenu( this ); | 89 | localMenu = new QPopupMenu( this ); |
90 | remoteMenu = new QPopupMenu( this ); | 90 | remoteMenu = new QPopupMenu( this ); |
91 | tabMenu = new QPopupMenu( this ); | 91 | tabMenu = new QPopupMenu( this ); |
92 | 92 | ||
93 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); | 93 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); |
94 | 94 | ||
95 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 95 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
96 | menuBar->insertItem( tr( "Local" ), localMenu); | 96 | menuBar->insertItem( tr( "Local" ), localMenu); |
97 | menuBar->insertItem( tr( "Remote" ), remoteMenu); | 97 | menuBar->insertItem( tr( "Remote" ), remoteMenu); |
98 | menuBar->insertItem( tr( "View" ), tabMenu); | 98 | menuBar->insertItem( tr( "View" ), tabMenu); |
99 | 99 | ||
100 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 100 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
101 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 101 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
102 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 102 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
103 | 103 | ||
104 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 104 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
105 | localMenu->insertSeparator(); | 105 | localMenu->insertSeparator(); |
106 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 106 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
107 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 107 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
108 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 108 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
109 | localMenu->insertSeparator(); | 109 | localMenu->insertSeparator(); |
110 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 110 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
111 | localMenu->setCheckable(TRUE); | 111 | localMenu->setCheckable(TRUE); |
112 | 112 | ||
113 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 113 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
114 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 114 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
115 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 115 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
116 | remoteMenu->insertSeparator(); | 116 | remoteMenu->insertSeparator(); |
117 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 117 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
118 | 118 | ||
119 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 119 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
120 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 120 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
121 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 121 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
122 | tabMenu->insertSeparator(); | 122 | tabMenu->insertSeparator(); |
123 | tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 123 | tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
124 | tabMenu->setCheckable(TRUE); | 124 | tabMenu->setCheckable(TRUE); |
125 | 125 | ||
126 | 126 | ||
127 | 127 | ||
128 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | 128 | cdUpButton = new QToolButton( this,"cdUpButton"); |
129 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | ||
129 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 130 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
130 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 131 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
131 | cdUpButton ->setFlat(TRUE); | ||
132 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); | 132 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); |
133 | cdUpButton->hide(); | 133 | cdUpButton->hide(); |
134 | 134 | ||
135 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 135 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
136 | // docButton->setFixedSize( QSize( 20, 20 ) ); | 136 | // docButton->setFixedSize( QSize( 20, 20 ) ); |
137 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 137 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
138 | // docButton->setFlat(TRUE); | 138 | // docButton->setFlat(TRUE); |
139 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); | 139 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); |
140 | 140 | ||
141 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 141 | homeButton = new QToolButton(this,"homeButton"); |
142 | homeButton->setPixmap( Resource::loadPixmap("home")); | ||
142 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 143 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
143 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 144 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
144 | homeButton->setFlat(TRUE); | ||
145 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); | 145 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); |
146 | homeButton->hide(); | 146 | homeButton->hide(); |
147 | 147 | ||
148 | TabWidget = new QTabWidget( this, "TabWidget" ); | 148 | TabWidget = new QTabWidget( this, "TabWidget" ); |
149 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); | 149 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); |
150 | 150 | ||
151 | // TabWidget->setTabShape(QTabWidget::Triangular); | 151 | // TabWidget->setTabShape(QTabWidget::Triangular); |
152 | 152 | ||
153 | tab = new QWidget( TabWidget, "tab" ); | 153 | tab = new QWidget( TabWidget, "tab" ); |
154 | tabLayout = new QGridLayout( tab ); | 154 | tabLayout = new QGridLayout( tab ); |
155 | tabLayout->setSpacing( 2); | 155 | tabLayout->setSpacing( 2); |
156 | tabLayout->setMargin( 2); | 156 | tabLayout->setMargin( 2); |
157 | 157 | ||
158 | Local_View = new QListView( tab, "Local_View" ); | 158 | Local_View = new QListView( tab, "Local_View" ); |
159 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 159 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
160 | Local_View->addColumn( tr("File"),150); | 160 | Local_View->addColumn( tr("File"),150); |
161 | Local_View->addColumn( tr("Date"),-1); | 161 | Local_View->addColumn( tr("Date"),-1); |
162 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 162 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
163 | Local_View->addColumn( tr("Size"),-1); | 163 | Local_View->addColumn( tr("Size"),-1); |
164 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 164 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
165 | Local_View->setAllColumnsShowFocus(TRUE); | 165 | Local_View->setAllColumnsShowFocus(TRUE); |
166 | 166 | ||
167 | Local_View->setMultiSelection( TRUE); | 167 | Local_View->setMultiSelection( TRUE); |
168 | Local_View->setSelectionMode(QListView::Extended); | 168 | Local_View->setSelectionMode(QListView::Extended); |
169 | Local_View->setFocusPolicy(QWidget::ClickFocus); | 169 | Local_View->setFocusPolicy(QWidget::ClickFocus); |
170 | 170 | ||
171 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 171 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
172 | 172 | ||
173 | tabLayout->addWidget( Local_View, 0, 0 ); | 173 | tabLayout->addWidget( Local_View, 0, 0 ); |
174 | 174 | ||
175 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 175 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
176 | this,SLOT( localListClicked(QListViewItem *)) ); | 176 | this,SLOT( localListClicked(QListViewItem *)) ); |
177 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 177 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
178 | // this,SLOT( localListClicked(QListViewItem *)) ); | 178 | // this,SLOT( localListClicked(QListViewItem *)) ); |
179 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 179 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
180 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 180 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
181 | 181 | ||
182 | TabWidget->insertTab( tab, tr( "Local" ) ); | 182 | TabWidget->insertTab( tab, tr( "Local" ) ); |
183 | 183 | ||
184 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 184 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
185 | tabLayout_2 = new QGridLayout( tab_2 ); | 185 | tabLayout_2 = new QGridLayout( tab_2 ); |
186 | tabLayout_2->setSpacing( 2); | 186 | tabLayout_2->setSpacing( 2); |
187 | tabLayout_2->setMargin( 2); | 187 | tabLayout_2->setMargin( 2); |
188 | 188 | ||
189 | Remote_View = new QListView( tab_2, "Remote_View" ); | 189 | Remote_View = new QListView( tab_2, "Remote_View" ); |
190 | Remote_View->addColumn( tr("File"),150); | 190 | Remote_View->addColumn( tr("File"),150); |
191 | Remote_View->addColumn( tr("Date"),-1); | 191 | Remote_View->addColumn( tr("Date"),-1); |
192 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 192 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
193 | Remote_View->addColumn( tr("Size"),-1); | 193 | Remote_View->addColumn( tr("Size"),-1); |
194 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 194 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
195 | Remote_View->addColumn( tr("Dir"),-1); | 195 | Remote_View->addColumn( tr("Dir"),-1); |
196 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 196 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
197 | Remote_View->setAllColumnsShowFocus(TRUE); | 197 | Remote_View->setAllColumnsShowFocus(TRUE); |
198 | 198 | ||
199 | Remote_View->setMultiSelection( FALSE); | 199 | Remote_View->setMultiSelection( FALSE); |
200 | Remote_View->setSelectionMode(QListView::Extended); | 200 | Remote_View->setSelectionMode(QListView::Extended); |
201 | Remote_View->setFocusPolicy(QWidget::ClickFocus); | 201 | Remote_View->setFocusPolicy(QWidget::ClickFocus); |
202 | 202 | ||
203 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 203 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
204 | 204 | ||
205 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 205 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
206 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 206 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
207 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 207 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
208 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 208 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
209 | 209 | ||
210 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 210 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
211 | 211 | ||
212 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 212 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
213 | 213 | ||
214 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 214 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
215 | tabLayout_3 = new QGridLayout( tab_3 ); | 215 | tabLayout_3 = new QGridLayout( tab_3 ); |
216 | tabLayout_3->setSpacing( 2); | 216 | tabLayout_3->setSpacing( 2); |
217 | tabLayout_3->setMargin( 2); | 217 | tabLayout_3->setMargin( 2); |
218 | 218 | ||
219 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 219 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
220 | TextLabel1->setText( tr( "Username" ) ); | 220 | TextLabel1->setText( tr( "Username" ) ); |
221 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 221 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
222 | 222 | ||
223 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 223 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
224 | UsernameComboBox->setEditable(TRUE); | 224 | UsernameComboBox->setEditable(TRUE); |
225 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 225 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
226 | 226 | ||
227 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 227 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
228 | TextLabel2->setText( tr( "Password" ) ); | 228 | TextLabel2->setText( tr( "Password" ) ); |
229 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 229 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
230 | 230 | ||
231 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 231 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
232 | PasswordEdit->setEchoMode(QLineEdit::Password); | 232 | PasswordEdit->setEchoMode(QLineEdit::Password); |
233 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 233 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
234 | 234 | //PasswordEdit->setFixedWidth(85); | |
235 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 235 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
236 | TextLabel3->setText( tr( "Remote server" ) ); | 236 | TextLabel3->setText( tr( "Remote server" ) ); |
237 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 237 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
238 | 238 | ||
239 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 239 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
240 | ServerComboBox->setEditable(TRUE); | 240 | ServerComboBox->setEditable(TRUE); |
241 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 241 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
242 | 242 | ||
243 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); | 243 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); |
244 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); | 244 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); |
245 | 245 | ||
246 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 246 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
247 | TextLabel5->setText( tr( "Remote path" ) ); | 247 | TextLabel5->setText( tr( "Remote path" ) ); |
248 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 248 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
249 | 249 | ||
250 | 250 | ||
251 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 251 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
252 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 252 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
253 | |||
254 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 253 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
255 | TextLabel4->setText( tr( "Port" ) ); | 254 | TextLabel4->setText( tr( "Port" ) ); |
256 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 255 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
257 | 256 | ||
258 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 257 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
259 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 258 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
260 | PortSpinBox->setMaxValue(32786); | 259 | PortSpinBox->setMaxValue(32786); |
261 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 260 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
262 | 261 | ||
263 | QPushButton *deleteServerBtn; | 262 | QPushButton *deleteServerBtn; |
264 | deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); | 263 | deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); |
265 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); | 264 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); |
266 | 265 | ||
267 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 266 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
268 | 267 | ||
269 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); | 268 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); |
270 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); | 269 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); |
271 | connectServerBtn->setToggleButton(TRUE); | 270 | connectServerBtn->setToggleButton(TRUE); |
272 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); | 271 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); |
273 | 272 | ||
274 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 273 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
275 | tabLayout_3->addItem( spacer, 5, 0 ); | 274 | tabLayout_3->addItem( spacer, 5, 0 ); |
276 | 275 | ||
277 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 276 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
278 | 277 | ||
279 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 278 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
280 | this,SLOT(tabChanged(QWidget*))); | 279 | this,SLOT(tabChanged(QWidget*))); |
281 | 280 | ||
282 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 281 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
283 | currentDir.setPath( QDir::currentDirPath()); | 282 | currentDir.setPath( QDir::currentDirPath()); |
284 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 283 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
285 | 284 | ||
286 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 285 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
287 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); | 286 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); |
288 | 287 | currentPathCombo ->setFixedWidth(220); | |
289 | currentPathCombo->setEditable(TRUE); | 288 | currentPathCombo->setEditable(TRUE); |
290 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 289 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
291 | 290 | ||
292 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 291 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
293 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 292 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
294 | 293 | ||
295 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 294 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
296 | this,SLOT(currentPathComboChanged())); | 295 | this,SLOT(currentPathComboChanged())); |
297 | 296 | ||
298 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 297 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
299 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 298 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
300 | 299 | ||
301 | fillCombos(); | 300 | fillCombos(); |
302 | 301 | ||
303 | filterStr="*"; | 302 | filterStr="*"; |
304 | b=FALSE; | 303 | b=FALSE; |
305 | populateLocalView(); | 304 | populateLocalView(); |
306 | qDebug("read COnfig"); | 305 | qDebug("read COnfig"); |
307 | readConfig(); | 306 | readConfig(); |
308 | qDebug("Set current item"); | 307 | qDebug("Set current item"); |
309 | ServerComboBox->setCurrentItem(currentServerConfig); | 308 | ServerComboBox->setCurrentItem(currentServerConfig); |
310 | 309 | ||
311 | TabWidget->setCurrentPage(2); | 310 | TabWidget->setCurrentPage(2); |
312 | } | 311 | } |
313 | 312 | ||
314 | OpieFtp::~OpieFtp() | 313 | OpieFtp::~OpieFtp() |
315 | { | 314 | { |
316 | } | 315 | } |
317 | 316 | ||
318 | void OpieFtp::cleanUp() | 317 | void OpieFtp::cleanUp() |
319 | { | 318 | { |
320 | if(conn) | 319 | if(conn) |
321 | FtpQuit(conn); | 320 | FtpQuit(conn); |
322 | QString sfile=QDir::homeDirPath(); | 321 | QString sfile=QDir::homeDirPath(); |
323 | if(sfile.right(1) != "/") | 322 | if(sfile.right(1) != "/") |
324 | sfile+="/._temp"; | 323 | sfile+="/._temp"; |
325 | else | 324 | else |
326 | sfile+="._temp"; | 325 | sfile+="._temp"; |
327 | QFile file( sfile); | 326 | QFile file( sfile); |
328 | if(file.exists()) | 327 | if(file.exists()) |
329 | file.remove(); | 328 | file.remove(); |
330 | exit(0); | 329 | exit(0); |
331 | } | 330 | } |
332 | 331 | ||
333 | void OpieFtp::tabChanged(QWidget *w) | 332 | void OpieFtp::tabChanged(QWidget *w) |
334 | { | 333 | { |
335 | if (TabWidget->currentPageIndex() == 0) { | 334 | if (TabWidget->currentPageIndex() == 0) { |
336 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 335 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
337 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 336 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
338 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 337 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
339 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 338 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
340 | if(cdUpButton->isHidden()) | 339 | if(cdUpButton->isHidden()) |
341 | cdUpButton->show(); | 340 | cdUpButton->show(); |
342 | if(homeButton->isHidden()) | 341 | if(homeButton->isHidden()) |
343 | homeButton->show(); | 342 | homeButton->show(); |
344 | 343 | ||
345 | } | 344 | } |
346 | if (TabWidget->currentPageIndex() == 1) { | 345 | if (TabWidget->currentPageIndex() == 1) { |
347 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 346 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
348 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 347 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
349 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 348 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
350 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 349 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
351 | if(cdUpButton->isHidden()) | 350 | if(cdUpButton->isHidden()) |
352 | cdUpButton->show(); | 351 | cdUpButton->show(); |
353 | homeButton->hide(); | 352 | homeButton->hide(); |
354 | 353 | ||
355 | } | 354 | } |
356 | if (TabWidget->currentPageIndex() == 2) { | 355 | if (TabWidget->currentPageIndex() == 2) { |
357 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 356 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
358 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 357 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
359 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 358 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
360 | cdUpButton->hide(); | 359 | cdUpButton->hide(); |
361 | homeButton->hide(); | 360 | homeButton->hide(); |
362 | } | 361 | } |
363 | } | 362 | } |
364 | 363 | ||
365 | void OpieFtp::newConnection() | 364 | void OpieFtp::newConnection() |
366 | { | 365 | { |
367 | UsernameComboBox->lineEdit()->setText(""); | 366 | UsernameComboBox->lineEdit()->setText(""); |
368 | PasswordEdit->setText( "" ); | 367 | PasswordEdit->setText( "" ); |
369 | ServerComboBox->lineEdit()->setText( ""); | 368 | ServerComboBox->lineEdit()->setText( ""); |
370 | remotePath->setText( currentRemoteDir = "/"); | 369 | remotePath->setText( currentRemoteDir = "/"); |
371 | PortSpinBox->setValue( 21); | 370 | PortSpinBox->setValue( 21); |
372 | TabWidget->setCurrentPage(2); | 371 | TabWidget->setCurrentPage(2); |
373 | } | 372 | } |
374 | 373 | ||
375 | void OpieFtp::serverComboEdited(const QString & edit) | 374 | void OpieFtp::serverComboEdited(const QString & edit) |
376 | { | 375 | { |
377 | if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { | 376 | if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { |
378 | qDebug("ServerComboEdited"); | 377 | qDebug("ServerComboEdited"); |
379 | currentServerConfig = -1; | 378 | currentServerConfig = -1; |
380 | } | 379 | } |
381 | } | 380 | } |
382 | 381 | ||
383 | void OpieFtp::connectorBtnToggled(bool On) | 382 | void OpieFtp::connectorBtnToggled(bool On) |
384 | { | 383 | { |
385 | if(On) { | 384 | if(On) { |
386 | connector(); | 385 | connector(); |
387 | } else { | 386 | } else { |
388 | disConnector(); | 387 | disConnector(); |
389 | } | 388 | } |
390 | 389 | ||
391 | } | 390 | } |
392 | 391 | ||
393 | void OpieFtp::connector() | 392 | void OpieFtp::connector() |
394 | { | 393 | { |
395 | // QCopEnvelope ( "QPE/System", "busy()" ); | 394 | // QCopEnvelope ( "QPE/System", "busy()" ); |
396 | // qApp->processEvents(); | 395 | // qApp->processEvents(); |
397 | currentRemoteDir=remotePath->text(); | 396 | currentRemoteDir=remotePath->text(); |
398 | if(ServerComboBox->currentText().isEmpty()) { | 397 | if(ServerComboBox->currentText().isEmpty()) { |
399 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 398 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
400 | TabWidget->setCurrentPage(2); | 399 | TabWidget->setCurrentPage(2); |
401 | ServerComboBox->setFocus(); | 400 | ServerComboBox->setFocus(); |
402 | connectServerBtn->setOn(FALSE); | 401 | connectServerBtn->setOn(FALSE); |
403 | connectServerBtn->setText( tr("Connect")); | 402 | connectServerBtn->setText( tr("Connect")); |
404 | return; | 403 | return; |
405 | } | 404 | } |
406 | FtpInit(); | 405 | FtpInit(); |
407 | TabWidget->setCurrentPage(1); | 406 | TabWidget->setCurrentPage(1); |
408 | QString ftp_host = ServerComboBox->currentText(); | 407 | QString ftp_host = ServerComboBox->currentText(); |
409 | QString ftp_user = UsernameComboBox->currentText(); | 408 | QString ftp_user = UsernameComboBox->currentText(); |
410 | QString ftp_pass = PasswordEdit->text(); | 409 | QString ftp_pass = PasswordEdit->text(); |
411 | QString port=PortSpinBox->cleanText(); | 410 | QString port=PortSpinBox->cleanText(); |
412 | port.stripWhiteSpace(); | 411 | port.stripWhiteSpace(); |
413 | 412 | ||
414 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) | 413 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) |
415 | ftp_host=ftp_host.right(ftp_host.length()-6); | 414 | ftp_host=ftp_host.right(ftp_host.length()-6); |
416 | ftp_host+=":"+port; | 415 | ftp_host+=":"+port; |
417 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | 416 | if (!FtpConnect( ftp_host.latin1(), &conn)) { |
418 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); | 417 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); |
419 | connectServerBtn->setOn(FALSE); | 418 | connectServerBtn->setOn(FALSE); |
420 | connectServerBtn->setText( tr("Connect")); | 419 | connectServerBtn->setText( tr("Connect")); |
421 | return ; | 420 | return ; |
422 | } | 421 | } |
423 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 422 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
424 | QString msg; | 423 | QString msg; |
425 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); | 424 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); |
426 | msg.replace(QRegExp(":"),"\n"); | 425 | msg.replace(QRegExp(":"),"\n"); |
427 | QMessageBox::message(tr("Note"),msg); | 426 | QMessageBox::message(tr("Note"),msg); |
428 | if(conn) | 427 | if(conn) |
429 | FtpQuit(conn); | 428 | FtpQuit(conn); |
430 | connectServerBtn->setOn(FALSE); | 429 | connectServerBtn->setOn(FALSE); |
431 | connectServerBtn->setText( tr("Connect")); | 430 | connectServerBtn->setText( tr("Connect")); |
432 | return ; | 431 | return ; |
433 | } | 432 | } |
434 | remoteDirList("/") ; | 433 | remoteDirList("/") ; |
435 | setCaption(ftp_host); | 434 | setCaption(ftp_host); |
436 | if( currentServerConfig == -1) | 435 | if( currentServerConfig == -1) |
437 | writeConfig(); | 436 | writeConfig(); |
438 | connectServerBtn->setText( tr("Disconnect")); | 437 | connectServerBtn->setText( tr("Disconnect")); |
439 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 438 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
440 | } | 439 | } |
441 | 440 | ||
442 | void OpieFtp::disConnector() | 441 | void OpieFtp::disConnector() |
443 | { | 442 | { |
444 | if(conn) | 443 | if(conn) |
445 | FtpQuit(conn); | 444 | FtpQuit(conn); |
446 | setCaption("OpieFtp"); | 445 | setCaption("OpieFtp"); |
447 | currentRemoteDir="/"; | 446 | currentRemoteDir="/"; |
448 | Remote_View->clear(); | 447 | Remote_View->clear(); |
449 | connectServerBtn->setText( tr("Connect")); | 448 | connectServerBtn->setText( tr("Connect")); |
450 | connectServerBtn->setOn(FALSE); | 449 | connectServerBtn->setOn(FALSE); |
451 | setCaption("OpieFtp"); | 450 | setCaption("OpieFtp"); |
452 | } | 451 | } |
453 | 452 | ||
454 | void OpieFtp::localUpload() | 453 | void OpieFtp::localUpload() |
455 | { | 454 | { |
456 | int fsz; | 455 | int fsz; |
457 | // QCopEnvelope ( "QPE/System", "busy()" ); | 456 | // QCopEnvelope ( "QPE/System", "busy()" ); |
458 | // qApp->processEvents(); | 457 | // qApp->processEvents(); |
459 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 458 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
460 | QListViewItemIterator it( Local_View ); | 459 | QListViewItemIterator it( Local_View ); |
461 | for ( ; it.current(); ++it ) { | 460 | for ( ; it.current(); ++it ) { |
462 | if ( it.current()->isSelected() ) { | 461 | if ( it.current()->isSelected() ) { |
463 | QString strItem = it.current()->text(0); | 462 | QString strItem = it.current()->text(0); |
464 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 463 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
465 | QString remoteFile= currentRemoteDir+strItem; | 464 | QString remoteFile= currentRemoteDir+strItem; |
466 | QFileInfo fi(localFile); | 465 | QFileInfo fi(localFile); |
467 | if( !fi.isDir()) { | 466 | if( !fi.isDir()) { |
468 | fsz=fi.size(); | 467 | fsz=fi.size(); |
469 | ProgressBar->setTotalSteps(fsz); | 468 | ProgressBar->setTotalSteps(fsz); |
470 | 469 | ||
471 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 470 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
472 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 471 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
473 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 472 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
474 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 473 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
475 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); | 474 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); |
476 | 475 | ||
477 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 476 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
478 | QString msg; | 477 | QString msg; |
479 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); | 478 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); |
480 | msg.replace(QRegExp(":"),"\n"); | 479 | msg.replace(QRegExp(":"),"\n"); |
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index 218a958..ad36b1d 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -1,120 +1,122 @@ | |||
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 | ||
22 | class QVBoxLayout; | 22 | class QVBoxLayout; |
23 | class QHBoxLayout; | 23 | class QHBoxLayout; |
24 | class QGridLayout; | 24 | class QGridLayout; |
25 | class QComboBox; | 25 | class QComboBox; |
26 | class QListView; | 26 | class QListView; |
27 | class QListviewItem; | 27 | class QListviewItem; |
28 | class QLabel; | 28 | class QLabel; |
29 | class QProgressBar; | 29 | class QProgressBar; |
30 | class QSpinBox; | 30 | class QSpinBox; |
31 | class QTabWidget; | 31 | class QTabWidget; |
32 | class QWidget; | 32 | class QWidget; |
33 | class QPEToolBar; | 33 | class QPEToolBar; |
34 | class QPEMenuBar; | 34 | class QPEMenuBar; |
35 | class QPopupMenu; | 35 | class QPopupMenu; |
36 | class QFile; | 36 | class QFile; |
37 | class QListViewItem; | 37 | class QListViewItem; |
38 | class QLineEdit; | 38 | class QLineEdit; |
39 | class QPushButton; | 39 | class QPushButton; |
40 | class QToolButton; | ||
40 | class QStringList; | 41 | class QStringList; |
41 | 42 | ||
42 | class OpieFtp : public QMainWindow | 43 | class OpieFtp : public QMainWindow |
43 | { | 44 | { |
44 | Q_OBJECT | 45 | Q_OBJECT |
45 | 46 | ||
46 | public: | 47 | public: |
47 | OpieFtp( ); | 48 | OpieFtp( ); |
48 | ~OpieFtp(); | 49 | ~OpieFtp(); |
49 | 50 | ||
50 | QTabWidget *TabWidget; | 51 | QTabWidget *TabWidget; |
51 | QWidget *tab, *tab_2, *tab_3; | 52 | QWidget *tab, *tab_2, *tab_3; |
52 | QListView *Local_View, *Remote_View; | 53 | QListView *Local_View, *Remote_View; |
53 | 54 | ||
54 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; | 55 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; |
55 | QLineEdit *PasswordEdit, *remotePath; | 56 | QLineEdit *PasswordEdit, *remotePath; |
56 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; | 57 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; |
57 | QSpinBox* PortSpinBox; | 58 | QSpinBox* PortSpinBox; |
58 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu; | 59 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu; |
59 | QDir currentDir; | 60 | QDir currentDir; |
60 | QString currentRemoteDir; | 61 | QString currentRemoteDir; |
61 | QString filterStr; | 62 | QString filterStr; |
62 | QListViewItem * item; | 63 | QListViewItem * item; |
63 | QPushButton *connectServerBtn, *cdUpButton, *homeButton, *docButton; | 64 | QPushButton *connectServerBtn;// |
65 | QToolButton *cdUpButton, *homeButton, *docButton; | ||
64 | bool b; | 66 | bool b; |
65 | int currentServerConfig; | 67 | int currentServerConfig; |
66 | protected slots: | 68 | protected slots: |
67 | void upDir(); | 69 | void upDir(); |
68 | void homeButtonPushed(); | 70 | void homeButtonPushed(); |
69 | void docButtonPushed(); | 71 | void docButtonPushed(); |
70 | void doAbout(); | 72 | void doAbout(); |
71 | void serverComboEdited(const QString & ); | 73 | void serverComboEdited(const QString & ); |
72 | void showLocalMenu( QListViewItem *); | 74 | void showLocalMenu( QListViewItem *); |
73 | void showRemoteMenu( QListViewItem *); | 75 | void showRemoteMenu( QListViewItem *); |
74 | void doLocalCd(); | 76 | void doLocalCd(); |
75 | void doRemoteCd(); | 77 | void doRemoteCd(); |
76 | void localUpload(); | 78 | void localUpload(); |
77 | void remoteDownload(); | 79 | void remoteDownload(); |
78 | void newConnection(); | 80 | void newConnection(); |
79 | void connector(); | 81 | void connector(); |
80 | void disConnector(); | 82 | void disConnector(); |
81 | void populateLocalView(); | 83 | void populateLocalView(); |
82 | bool populateRemoteView(); | 84 | bool populateRemoteView(); |
83 | void showHidden(); | 85 | void showHidden(); |
84 | void writeConfig(); | 86 | void writeConfig(); |
85 | void readConfig(); | 87 | void readConfig(); |
86 | void localListClicked(QListViewItem *); | 88 | void localListClicked(QListViewItem *); |
87 | void remoteListClicked(QListViewItem *); | 89 | void remoteListClicked(QListViewItem *); |
88 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 90 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
89 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); | 91 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); |
90 | void localMakDir(); | 92 | void localMakDir(); |
91 | void localDelete(); | 93 | void localDelete(); |
92 | void remoteMakDir(); | 94 | void remoteMakDir(); |
93 | void remoteDelete(); | 95 | void remoteDelete(); |
94 | bool remoteDirList(const QString &); | 96 | bool remoteDirList(const QString &); |
95 | bool remoteChDir(const QString &); | 97 | bool remoteChDir(const QString &); |
96 | void tabChanged(QWidget*); | 98 | void tabChanged(QWidget*); |
97 | void cleanUp(); | 99 | void cleanUp(); |
98 | void remoteRename(); | 100 | void remoteRename(); |
99 | void localRename(); | 101 | void localRename(); |
100 | void currentPathComboChanged(); | 102 | void currentPathComboChanged(); |
101 | void currentPathComboActivated(const QString &); | 103 | void currentPathComboActivated(const QString &); |
102 | void switchToLocalTab(); | 104 | void switchToLocalTab(); |
103 | void switchToRemoteTab(); | 105 | void switchToRemoteTab(); |
104 | void switchToConfigTab(); | 106 | void switchToConfigTab(); |
105 | void fillCombos(); | 107 | void fillCombos(); |
106 | void fillRemoteCombo(const QString&); | 108 | void fillRemoteCombo(const QString&); |
107 | void fillCombo(const QString &); | 109 | void fillCombo(const QString &); |
108 | void serverComboSelected(int); | 110 | void serverComboSelected(int); |
109 | void deleteServer(); | 111 | void deleteServer(); |
110 | void connectorBtnToggled(bool); | 112 | void connectorBtnToggled(bool); |
111 | protected: | 113 | protected: |
112 | QStringList remoteDirPathStringList, localDirPathStringList; | 114 | QStringList remoteDirPathStringList, localDirPathStringList; |
113 | void nullifyCallBack(); | 115 | void nullifyCallBack(); |
114 | QGridLayout* tabLayout; | 116 | QGridLayout* tabLayout; |
115 | QGridLayout* tabLayout_2; | 117 | QGridLayout* tabLayout_2; |
116 | QGridLayout* tabLayout_3; | 118 | QGridLayout* tabLayout_3; |
117 | 119 | ||
118 | }; | 120 | }; |
119 | 121 | ||
120 | #endif // OPIEFTP_H | 122 | #endif // OPIEFTP_H |