-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 135 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 12 |
2 files changed, 105 insertions, 42 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index ed7f4bb..042ed59 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -59,146 +59,184 @@ static int log_progress(netbuf *ctl, int xfered, void *arg) | |||
59 | return 1; | 59 | return 1; |
60 | } | 60 | } |
61 | 61 | ||
62 | OpieFtp::OpieFtp( ) | 62 | OpieFtp::OpieFtp( ) |
63 | : QMainWindow( ) | 63 | : QMainWindow( ) |
64 | { | 64 | { |
65 | resize( 236, 290 ); | ||
66 | setMaximumSize( QSize( 240, 320 ) ); | ||
67 | setCaption( tr( "OpieFtp" ) ); | 65 | setCaption( tr( "OpieFtp" ) ); |
68 | 66 | ||
67 | QGridLayout *layout = new QGridLayout( this ); | ||
68 | layout->setSpacing( 2); | ||
69 | layout->setMargin( 2); | ||
70 | |||
69 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 71 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
70 | 72 | ||
71 | QPEMenuBar *menuBar = new QPEMenuBar( this ); | 73 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
72 | connectionMenu = new QPopupMenu( this ); | 74 | connectionMenu = new QPopupMenu( this ); |
73 | localMenu = new QPopupMenu( this ); | 75 | localMenu = new QPopupMenu( this ); |
74 | remoteMenu = new QPopupMenu( this ); | 76 | remoteMenu = new QPopupMenu( this ); |
77 | tabMenu = new QPopupMenu( this ); | ||
78 | |||
79 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 ); | ||
80 | |||
75 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 81 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
76 | menuBar->insertItem( tr( "Local" ), localMenu); | 82 | menuBar->insertItem( tr( "Local" ), localMenu); |
77 | menuBar->insertItem( tr( "Remote" ), remoteMenu); | 83 | menuBar->insertItem( tr( "Remote" ), remoteMenu); |
84 | menuBar->insertItem( tr( "View" ), tabMenu); | ||
78 | 85 | ||
79 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 86 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
80 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 87 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
81 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 88 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
82 | 89 | ||
83 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 90 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
91 | localMenu->insertSeparator(); | ||
84 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 92 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
85 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 93 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
86 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 94 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
87 | localMenu->insertSeparator(); | 95 | localMenu->insertSeparator(); |
88 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 96 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
89 | 97 | ||
90 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 98 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
91 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 99 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
92 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 100 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
93 | remoteMenu->insertSeparator(); | 101 | remoteMenu->insertSeparator(); |
94 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 102 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
95 | 103 | ||
96 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 104 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
97 | ProgressBar->setGeometry( QRect( 5, 268, 231, 15 ) ); | 105 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
106 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | ||
107 | |||
108 | TabWidget = new QTabWidget( this, "TabWidget" ); | ||
109 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); | ||
98 | 110 | ||
99 | TabWidget = new QTabWidget( this, "TabWidget2" ); | ||
100 | TabWidget->setGeometry( QRect( 3, 25, 240, 220 ) ); | ||
101 | TabWidget->setTabShape(QTabWidget::Triangular); | 111 | TabWidget->setTabShape(QTabWidget::Triangular); |
102 | 112 | ||
103 | tab = new QWidget( TabWidget, "tab" ); | 113 | tab = new QWidget( TabWidget, "tab" ); |
114 | tabLayout = new QGridLayout( tab ); | ||
115 | tabLayout->setSpacing( 2); | ||
116 | tabLayout->setMargin( 2); | ||
104 | 117 | ||
105 | Local_View = new QListView( tab, "Local_View" ); | 118 | Local_View = new QListView( tab, "Local_View" ); |
106 | Local_View->setGeometry( QRect( 3, 2, 225, 195 ) ); | 119 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
107 | Local_View->addColumn( "File",120); | 120 | Local_View->addColumn( "File",120); |
108 | Local_View->addColumn( "Size",-1); | 121 | Local_View->addColumn( "Size",-1); |
109 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 122 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
110 | Local_View->addColumn( "Date",-1); | 123 | Local_View->addColumn( "Date",-1); |
111 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 124 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
112 | Local_View->setAllColumnsShowFocus(TRUE); | 125 | Local_View->setAllColumnsShowFocus(TRUE); |
113 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 126 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
114 | 127 | ||
128 | tabLayout->addWidget( Local_View, 0, 0 ); | ||
129 | |||
115 | connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 130 | connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
116 | this,SLOT( localListClicked(QListViewItem *)) ); | 131 | this,SLOT( localListClicked(QListViewItem *)) ); |
117 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 132 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
118 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 133 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
119 | 134 | ||
120 | TabWidget->insertTab( tab, tr( "Local" ) ); | 135 | TabWidget->insertTab( tab, tr( "Local" ) ); |
121 | 136 | ||
122 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 137 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
138 | tabLayout_2 = new QGridLayout( tab_2 ); | ||
139 | tabLayout_2->setSpacing( 2); | ||
140 | tabLayout_2->setMargin( 2); | ||
123 | 141 | ||
124 | Remote_View = new QListView( tab_2, "Remote_View" ); | 142 | Remote_View = new QListView( tab_2, "Remote_View" ); |
125 | Remote_View->setGeometry( QRect( 3, 2, 225, 195 ) ); | ||
126 | Remote_View->addColumn( "File",120); | 143 | Remote_View->addColumn( "File",120); |
127 | Remote_View->addColumn( "Size",-1); | 144 | Remote_View->addColumn( "Size",-1); |
128 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 145 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
129 | Remote_View->addColumn( "Date",-1); | 146 | Remote_View->addColumn( "Date",-1); |
130 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 147 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
131 | Remote_View->setAllColumnsShowFocus(TRUE); | 148 | Remote_View->setAllColumnsShowFocus(TRUE); |
132 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 149 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
133 | 150 | ||
134 | connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), | 151 | connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), |
135 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 152 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
136 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 153 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
137 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 154 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
138 | 155 | ||
139 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 156 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
157 | |||
158 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | ||
140 | 159 | ||
141 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 160 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
161 | tabLayout_3 = new QGridLayout( tab_3 ); | ||
162 | tabLayout_3->setSpacing( 2); | ||
163 | tabLayout_3->setMargin( 2); | ||
142 | 164 | ||
143 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 165 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
144 | TextLabel1->setGeometry( QRect( 10, 10, 60, 16 ) ); | ||
145 | TextLabel1->setText( tr( "Username" ) ); | 166 | TextLabel1->setText( tr( "Username" ) ); |
167 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | ||
168 | |||
146 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 169 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
147 | UsernameComboBox->setGeometry( QRect( 10, 25, 196, 21 ) ); | ||
148 | UsernameComboBox->setEditable(TRUE); | 170 | UsernameComboBox->setEditable(TRUE); |
149 | UsernameComboBox->lineEdit()->setText("anonymous"); | 171 | // UsernameComboBox->lineEdit()->setText("anonymous"); |
172 | UsernameComboBox->lineEdit()->setText("root"); | ||
150 | // UsernameComboBox->lineEdit()->setText("llornkcor"); | 173 | // UsernameComboBox->lineEdit()->setText("llornkcor"); |
174 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | ||
151 | 175 | ||
152 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 176 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
153 | TextLabel2->setGeometry( QRect( 10, 50, 65, 16 ) ); | ||
154 | TextLabel2->setText( tr( "Password" ) ); | 177 | TextLabel2->setText( tr( "Password" ) ); |
178 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | ||
179 | |||
155 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 180 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
156 | PasswordEdit->setGeometry( QRect( 10, 65, 195, 16 ) ); | ||
157 | PasswordEdit->setEchoMode(QLineEdit::Password); | 181 | PasswordEdit->setEchoMode(QLineEdit::Password); |
158 | PasswordEdit->setText( tr( "me@opieftp.org" ) ); | 182 | // PasswordEdit->setText( tr( "me@opieftp.org" ) ); |
183 | // PasswordEdit->setText( tr( "" ) ); | ||
184 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | ||
159 | 185 | ||
160 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 186 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
161 | TextLabel3->setGeometry( QRect( 10, 90, 95, 16 ) ); | ||
162 | TextLabel3->setText( tr( "Remote server" ) ); | 187 | TextLabel3->setText( tr( "Remote server" ) ); |
188 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | ||
189 | |||
163 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 190 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
164 | ServerComboBox->setGeometry( QRect( 10, 105, 195, 21 ) ); | ||
165 | ServerComboBox->setEditable(TRUE); | 191 | ServerComboBox->setEditable(TRUE); |
166 | ServerComboBox->lineEdit()->setText( tr( "" ) ); | 192 | ServerComboBox->lineEdit()->setText( tr( "" ) ); |
193 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | ||
167 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); | 194 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); |
195 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | ||
168 | 196 | ||
169 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 197 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
170 | TextLabel5->setGeometry( QRect( 10, 130, 95, 16 ) ); | ||
171 | TextLabel5->setText( tr( "Remote path" ) ); | 198 | TextLabel5->setText( tr( "Remote path" ) ); |
199 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | ||
200 | |||
172 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 201 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
173 | remotePath->setGeometry( QRect( 10, 145, 195, 16 ) ); | ||
174 | remotePath->setText( currentRemoteDir = "/"); | 202 | remotePath->setText( currentRemoteDir = "/"); |
203 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | ||
175 | // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); | 204 | // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); |
176 | 205 | ||
177 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 206 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
178 | TextLabel4->setGeometry( QRect( 10, 170, 30, 21 ) ); | ||
179 | TextLabel4->setText( tr( "Port" ) ); | 207 | TextLabel4->setText( tr( "Port" ) ); |
180 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 208 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
181 | PortSpinBox->setGeometry( QRect( 40, 175, 75, 20 ) ); | 209 | |
210 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | ||
182 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 211 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
183 | PortSpinBox->setMaxValue(32786); | 212 | PortSpinBox->setMaxValue(32786); |
184 | PortSpinBox->setValue( 21); | 213 | PortSpinBox->setValue( 4242); |
214 | // PortSpinBox->setValue( 21); | ||
215 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | ||
185 | 216 | ||
186 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 217 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
218 | tabLayout_3->addItem( spacer, 5, 0 ); | ||
219 | |||
220 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | ||
187 | 221 | ||
188 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 222 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
189 | this,SLOT(tabChanged(QWidget*))); | 223 | this,SLOT(tabChanged(QWidget*))); |
190 | 224 | ||
191 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 225 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
192 | currentDir.setPath( QDir::currentDirPath()); | 226 | currentDir.setPath( QDir::currentDirPath()); |
193 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 227 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
194 | currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); | 228 | currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); |
195 | currentPathEdit->setGeometry( QRect( 5, 248, 220, 18 ) ); | 229 | layout->addMultiCellWidget( currentPathEdit, 3, 3, 0, 3 ); |
196 | currentPathEdit->setText( currentDir.canonicalPath()); | 230 | |
231 | currentPathEdit->setText( currentDir.canonicalPath()); | ||
197 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); | 232 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); |
198 | 233 | ||
234 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | ||
235 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); | ||
236 | |||
199 | filterStr="*"; | 237 | filterStr="*"; |
200 | populateLocalView(); | 238 | populateLocalView(); |
201 | } | 239 | } |
202 | 240 | ||
203 | OpieFtp::~OpieFtp() | 241 | OpieFtp::~OpieFtp() |
204 | { | 242 | { |
@@ -214,15 +252,18 @@ void OpieFtp::cleanUp() | |||
214 | } | 252 | } |
215 | 253 | ||
216 | void OpieFtp::tabChanged(QWidget *w) | 254 | void OpieFtp::tabChanged(QWidget *w) |
217 | { | 255 | { |
218 | if (TabWidget->currentPageIndex() == 0) { | 256 | if (TabWidget->currentPageIndex() == 0) { |
219 | currentPathEdit->setText( currentDir.canonicalPath()); | 257 | currentPathEdit->setText( currentDir.canonicalPath()); |
220 | } else if (TabWidget->currentPageIndex() == 1) { | 258 | } |
259 | if (TabWidget->currentPageIndex() == 1) { | ||
221 | currentPathEdit->setText( currentRemoteDir ); | 260 | currentPathEdit->setText( currentRemoteDir ); |
222 | } | 261 | } |
262 | if (TabWidget->currentPageIndex() == 2) { | ||
263 | } | ||
223 | } | 264 | } |
224 | 265 | ||
225 | void OpieFtp::localUpload() | 266 | void OpieFtp::localUpload() |
226 | { | 267 | { |
227 | int fsz; | 268 | int fsz; |
228 | QCopEnvelope ( "QPE/System", "busy()" ); | 269 | QCopEnvelope ( "QPE/System", "busy()" ); |
@@ -255,13 +296,14 @@ void OpieFtp::localUpload() | |||
255 | } | 296 | } |
256 | TabWidget->setCurrentPage(1); | 297 | TabWidget->setCurrentPage(1); |
257 | populateRemoteView(); | 298 | populateRemoteView(); |
258 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 299 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
259 | } | 300 | } |
260 | 301 | ||
261 | void OpieFtp::nullifyCallBack() { | 302 | void OpieFtp::nullifyCallBack() |
303 | { | ||
262 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); | 304 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); |
263 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); | 305 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); |
264 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); | 306 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); |
265 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); | 307 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); |
266 | 308 | ||
267 | } | 309 | } |
@@ -274,14 +316,14 @@ void OpieFtp::remoteDownload() | |||
274 | QString strItem = Remote_View->currentItem()->text(0); | 316 | QString strItem = Remote_View->currentItem()->text(0); |
275 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 317 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
276 | QString remoteFile= currentRemoteDir+strItem; | 318 | QString remoteFile= currentRemoteDir+strItem; |
277 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 319 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
278 | fsz = 0; | 320 | fsz = 0; |
279 | QString temp; | 321 | QString temp; |
280 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 322 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
281 | 323 | ||
282 | ProgressBar->setTotalSteps(fsz); | 324 | ProgressBar->setTotalSteps(fsz); |
283 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 325 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
284 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 326 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
285 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 327 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
286 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 328 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
287 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 329 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); |
@@ -400,18 +442,18 @@ void OpieFtp::populateLocalView() | |||
400 | if (fi->isSymLink() ){ | 442 | if (fi->isSymLink() ){ |
401 | QString symLink=fi->readLink(); | 443 | QString symLink=fi->readLink(); |
402 | // qDebug("Symlink detected "+symLink); | 444 | // qDebug("Symlink detected "+symLink); |
403 | QFileInfo sym( symLink); | 445 | QFileInfo sym( symLink); |
404 | fileS.sprintf( "%10li", sym.size() ); | 446 | fileS.sprintf( "%10li", sym.size() ); |
405 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 447 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
406 | fileDate = sym.lastModified().toString(); | 448 | fileDate = sym.lastModified().toString(); |
407 | } else { | 449 | } else { |
408 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 450 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
409 | fileS.sprintf( "%10li", fi->size() ); | 451 | fileS.sprintf( "%10li", fi->size() ); |
410 | fileL.sprintf( "%s",fi->fileName().data() ); | 452 | fileL.sprintf( "%s",fi->fileName().data() ); |
411 | fileDate= fi->lastModified().toString(); | 453 | fileDate= fi->lastModified().toString(); |
412 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 454 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
413 | fileL+="/"; | 455 | fileL+="/"; |
414 | // qDebug( fileL); | 456 | // qDebug( fileL); |
415 | } | 457 | } |
416 | } | 458 | } |
417 | item= new QListViewItem( Local_View,fileL,fileS, fileDate); | 459 | item= new QListViewItem( Local_View,fileL,fileS, fileDate); |
@@ -486,13 +528,13 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
486 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 528 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory |
487 | qDebug("trying directory"); | 529 | qDebug("trying directory"); |
488 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 530 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
489 | currentRemoteDir = oldRemoteCurrentDir; | 531 | currentRemoteDir = oldRemoteCurrentDir; |
490 | strItem=""; | 532 | strItem=""; |
491 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 533 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
492 | 534 | ||
493 | populateRemoteView(); | 535 | populateRemoteView(); |
494 | } else { | 536 | } else { |
495 | currentRemoteDir = currentRemoteDir+strItem; | 537 | currentRemoteDir = currentRemoteDir+strItem; |
496 | } | 538 | } |
497 | } else { | 539 | } else { |
498 | qDebug("download "+strItem); | 540 | qDebug("download "+strItem); |
@@ -780,10 +822,25 @@ void OpieFtp::currentPathEditChanged() | |||
780 | currentPathEdit->setText( currentRemoteDir ); | 822 | currentPathEdit->setText( currentRemoteDir ); |
781 | } | 823 | } |
782 | if( !remoteChDir( (const QString &)currentRemoteDir) ) { | 824 | if( !remoteChDir( (const QString &)currentRemoteDir) ) { |
783 | currentRemoteDir = oldRemoteCurrentDir; | 825 | currentRemoteDir = oldRemoteCurrentDir; |
784 | currentPathEdit->setText( currentRemoteDir ); | 826 | currentPathEdit->setText( currentRemoteDir ); |
785 | } | 827 | } |
786 | 828 | ||
787 | remoteDirList( (const QString &)currentRemoteDir); | 829 | remoteDirList( (const QString &)currentRemoteDir); |
788 | } | 830 | } |
789 | } | 831 | } |
832 | |||
833 | void OpieFtp::switchToLocalTab() | ||
834 | { | ||
835 | TabWidget->setCurrentPage(0); | ||
836 | } | ||
837 | |||
838 | void OpieFtp::switchToRemoteTab() | ||
839 | { | ||
840 | TabWidget->setCurrentPage(1); | ||
841 | } | ||
842 | |||
843 | void OpieFtp::switchToConfigTab() | ||
844 | { | ||
845 | TabWidget->setCurrentPage(2); | ||
846 | } | ||
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index 5d1c63d..e3ff334 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -43,20 +43,20 @@ class OpieFtp : public QMainWindow | |||
43 | 43 | ||
44 | public: | 44 | public: |
45 | OpieFtp( ); | 45 | OpieFtp( ); |
46 | ~OpieFtp(); | 46 | ~OpieFtp(); |
47 | 47 | ||
48 | QTabWidget *TabWidget; | 48 | QTabWidget *TabWidget; |
49 | QWidget *tab, *tab_2, *tab_3;; | 49 | QWidget *tab, *tab_2, *tab_3; |
50 | QListView *Local_View, *Remote_View; | 50 | QListView *Local_View, *Remote_View; |
51 | 51 | ||
52 | QComboBox *UsernameComboBox, *ServerComboBox; | 52 | QComboBox *UsernameComboBox, *ServerComboBox; |
53 | QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; | 53 | QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; |
54 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; | 54 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; |
55 | QSpinBox* PortSpinBox; | 55 | QSpinBox* PortSpinBox; |
56 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu; | 56 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; |
57 | QDir currentDir; | 57 | QDir currentDir; |
58 | QString currentRemoteDir; | 58 | QString currentRemoteDir; |
59 | QString filterStr; | 59 | QString filterStr; |
60 | QListViewItem * item; | 60 | QListViewItem * item; |
61 | bool b; | 61 | bool b; |
62 | 62 | ||
@@ -86,12 +86,18 @@ protected slots: | |||
86 | bool remoteChDir(const QString &); | 86 | bool remoteChDir(const QString &); |
87 | void tabChanged(QWidget*); | 87 | void tabChanged(QWidget*); |
88 | void cleanUp(); | 88 | void cleanUp(); |
89 | void remoteRename(); | 89 | void remoteRename(); |
90 | void localRename(); | 90 | void localRename(); |
91 | void currentPathEditChanged(); | 91 | void currentPathEditChanged(); |
92 | void switchToLocalTab(); | ||
93 | void switchToRemoteTab(); | ||
94 | void switchToConfigTab(); | ||
92 | protected: | 95 | protected: |
93 | void nullifyCallBack(); | 96 | void nullifyCallBack(); |
97 | QGridLayout* tabLayout; | ||
98 | QGridLayout* tabLayout_2; | ||
99 | QGridLayout* tabLayout_3; | ||
94 | 100 | ||
95 | }; | 101 | }; |
96 | 102 | ||
97 | #endif // OPIEFTP_H | 103 | #endif // OPIEFTP_H |