-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 6a3a64d..118275b 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -53,130 +53,131 @@ static int log_progress(netbuf *ctl, int xfered, void *arg) | |||
53 | int fsz = *(int *)arg; | 53 | int fsz = *(int *)arg; |
54 | int pct = (xfered * 100) / fsz; | 54 | int pct = (xfered * 100) / fsz; |
55 | // printf("%3d%%\r", pct); | 55 | // printf("%3d%%\r", pct); |
56 | // fflush(stdout); | 56 | // fflush(stdout); |
57 | ProgressBar->setProgress(xfered); | 57 | ProgressBar->setProgress(xfered); |
58 | qApp->processEvents(); | 58 | qApp->processEvents(); |
59 | return 1; | 59 | return 1; |
60 | } | 60 | } |
61 | 61 | ||
62 | OpieFtp::OpieFtp( ) | 62 | OpieFtp::OpieFtp( ) |
63 | : QMainWindow( ) | 63 | : QMainWindow( ) |
64 | { | 64 | { |
65 | setCaption( tr( "OpieFtp" ) ); | 65 | setCaption( tr( "OpieFtp" ) ); |
66 | 66 | ||
67 | QGridLayout *layout = new QGridLayout( this ); | 67 | QGridLayout *layout = new QGridLayout( this ); |
68 | layout->setSpacing( 2); | 68 | layout->setSpacing( 2); |
69 | layout->setMargin( 2); | 69 | layout->setMargin( 2); |
70 | 70 | ||
71 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 71 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
72 | 72 | ||
73 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 73 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
74 | connectionMenu = new QPopupMenu( this ); | 74 | connectionMenu = new QPopupMenu( this ); |
75 | localMenu = new QPopupMenu( this ); | 75 | localMenu = new QPopupMenu( this ); |
76 | remoteMenu = new QPopupMenu( this ); | 76 | remoteMenu = new QPopupMenu( this ); |
77 | tabMenu = new QPopupMenu( this ); | 77 | tabMenu = new QPopupMenu( this ); |
78 | 78 | ||
79 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 ); | 79 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 ); |
80 | 80 | ||
81 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 81 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
82 | menuBar->insertItem( tr( "Local" ), localMenu); | 82 | menuBar->insertItem( tr( "Local" ), localMenu); |
83 | menuBar->insertItem( tr( "Remote" ), remoteMenu); | 83 | menuBar->insertItem( tr( "Remote" ), remoteMenu); |
84 | menuBar->insertItem( tr( "View" ), tabMenu); | 84 | menuBar->insertItem( tr( "View" ), tabMenu); |
85 | 85 | ||
86 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 86 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
87 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 87 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
88 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 88 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
89 | 89 | ||
90 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 90 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
91 | localMenu->insertSeparator(); | 91 | localMenu->insertSeparator(); |
92 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 92 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
93 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 93 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
94 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 94 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
95 | localMenu->insertSeparator(); | 95 | localMenu->insertSeparator(); |
96 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 96 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
97 | 97 | ||
98 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 98 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
99 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 99 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
100 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 100 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
101 | remoteMenu->insertSeparator(); | 101 | remoteMenu->insertSeparator(); |
102 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 102 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
103 | 103 | ||
104 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 104 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
105 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 105 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
106 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 106 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
107 | tabMenu->setCheckable(TRUE); | ||
107 | 108 | ||
108 | TabWidget = new QTabWidget( this, "TabWidget" ); | 109 | TabWidget = new QTabWidget( this, "TabWidget" ); |
109 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); | 110 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); |
110 | 111 | ||
111 | TabWidget->setTabShape(QTabWidget::Triangular); | 112 | TabWidget->setTabShape(QTabWidget::Triangular); |
112 | 113 | ||
113 | tab = new QWidget( TabWidget, "tab" ); | 114 | tab = new QWidget( TabWidget, "tab" ); |
114 | tabLayout = new QGridLayout( tab ); | 115 | tabLayout = new QGridLayout( tab ); |
115 | tabLayout->setSpacing( 2); | 116 | tabLayout->setSpacing( 2); |
116 | tabLayout->setMargin( 2); | 117 | tabLayout->setMargin( 2); |
117 | 118 | ||
118 | Local_View = new QListView( tab, "Local_View" ); | 119 | Local_View = new QListView( tab, "Local_View" ); |
119 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 120 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
120 | Local_View->addColumn( "File",120); | 121 | Local_View->addColumn( "File",120); |
121 | Local_View->addColumn( "Size",-1); | 122 | Local_View->addColumn( "Size",-1); |
122 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 123 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
123 | Local_View->addColumn( "Date",-1); | 124 | Local_View->addColumn( "Date",-1); |
124 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 125 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
125 | Local_View->setAllColumnsShowFocus(TRUE); | 126 | Local_View->setAllColumnsShowFocus(TRUE); |
126 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 127 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
127 | 128 | ||
128 | tabLayout->addWidget( Local_View, 0, 0 ); | 129 | tabLayout->addWidget( Local_View, 0, 0 ); |
129 | 130 | ||
130 | connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 131 | connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
131 | this,SLOT( localListClicked(QListViewItem *)) ); | 132 | this,SLOT( localListClicked(QListViewItem *)) ); |
132 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 133 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
133 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 134 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
134 | 135 | ||
135 | TabWidget->insertTab( tab, tr( "Local" ) ); | 136 | TabWidget->insertTab( tab, tr( "Local" ) ); |
136 | 137 | ||
137 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 138 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
138 | tabLayout_2 = new QGridLayout( tab_2 ); | 139 | tabLayout_2 = new QGridLayout( tab_2 ); |
139 | tabLayout_2->setSpacing( 2); | 140 | tabLayout_2->setSpacing( 2); |
140 | tabLayout_2->setMargin( 2); | 141 | tabLayout_2->setMargin( 2); |
141 | 142 | ||
142 | Remote_View = new QListView( tab_2, "Remote_View" ); | 143 | Remote_View = new QListView( tab_2, "Remote_View" ); |
143 | Remote_View->addColumn( "File",120); | 144 | Remote_View->addColumn( "File",120); |
144 | Remote_View->addColumn( "Size",-1); | 145 | Remote_View->addColumn( "Size",-1); |
145 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 146 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
146 | Remote_View->addColumn( "Date",-1); | 147 | Remote_View->addColumn( "Date",-1); |
147 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 148 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
148 | Remote_View->setAllColumnsShowFocus(TRUE); | 149 | Remote_View->setAllColumnsShowFocus(TRUE); |
149 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 150 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
150 | 151 | ||
151 | connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), | 152 | connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), |
152 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 153 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
153 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 154 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
154 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 155 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
155 | 156 | ||
156 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 157 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
157 | 158 | ||
158 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 159 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
159 | 160 | ||
160 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 161 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
161 | tabLayout_3 = new QGridLayout( tab_3 ); | 162 | tabLayout_3 = new QGridLayout( tab_3 ); |
162 | tabLayout_3->setSpacing( 2); | 163 | tabLayout_3->setSpacing( 2); |
163 | tabLayout_3->setMargin( 2); | 164 | tabLayout_3->setMargin( 2); |
164 | 165 | ||
165 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 166 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
166 | TextLabel1->setText( tr( "Username" ) ); | 167 | TextLabel1->setText( tr( "Username" ) ); |
167 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 168 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
168 | 169 | ||
169 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 170 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
170 | UsernameComboBox->setEditable(TRUE); | 171 | UsernameComboBox->setEditable(TRUE); |
171 | // UsernameComboBox->lineEdit()->setText("anonymous"); | 172 | // UsernameComboBox->lineEdit()->setText("anonymous"); |
172 | UsernameComboBox->lineEdit()->setText("root"); | 173 | UsernameComboBox->lineEdit()->setText("root"); |
173 | // UsernameComboBox->lineEdit()->setText("llornkcor"); | 174 | // UsernameComboBox->lineEdit()->setText("llornkcor"); |
174 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 175 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
175 | 176 | ||
176 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 177 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
177 | TextLabel2->setText( tr( "Password" ) ); | 178 | TextLabel2->setText( tr( "Password" ) ); |
178 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 179 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
179 | 180 | ||
180 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 181 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
181 | PasswordEdit->setEchoMode(QLineEdit::Password); | 182 | PasswordEdit->setEchoMode(QLineEdit::Password); |
182 | // PasswordEdit->setText( tr( "me@opieftp.org" ) ); | 183 | // PasswordEdit->setText( tr( "me@opieftp.org" ) ); |
@@ -184,108 +185,117 @@ OpieFtp::OpieFtp( ) | |||
184 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 185 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
185 | 186 | ||
186 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 187 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
187 | TextLabel3->setText( tr( "Remote server" ) ); | 188 | TextLabel3->setText( tr( "Remote server" ) ); |
188 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 189 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
189 | 190 | ||
190 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 191 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
191 | ServerComboBox->setEditable(TRUE); | 192 | ServerComboBox->setEditable(TRUE); |
192 | ServerComboBox->lineEdit()->setText( tr( "" ) ); | 193 | ServerComboBox->lineEdit()->setText( tr( "" ) ); |
193 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 194 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
194 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); | 195 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); |
195 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | 196 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); |
196 | 197 | ||
197 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 198 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
198 | TextLabel5->setText( tr( "Remote path" ) ); | 199 | TextLabel5->setText( tr( "Remote path" ) ); |
199 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 200 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
200 | 201 | ||
201 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 202 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
202 | remotePath->setText( currentRemoteDir = "/"); | 203 | remotePath->setText( currentRemoteDir = "/"); |
203 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 204 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
204 | // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); | 205 | // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); |
205 | 206 | ||
206 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 207 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
207 | TextLabel4->setText( tr( "Port" ) ); | 208 | TextLabel4->setText( tr( "Port" ) ); |
208 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 209 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
209 | 210 | ||
210 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 211 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
211 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 212 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
212 | PortSpinBox->setMaxValue(32786); | 213 | PortSpinBox->setMaxValue(32786); |
213 | PortSpinBox->setValue( 4242); | 214 | PortSpinBox->setValue( 4242); |
214 | // PortSpinBox->setValue( 21); | 215 | // PortSpinBox->setValue( 21); |
215 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 216 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
216 | 217 | ||
217 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 218 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
218 | tabLayout_3->addItem( spacer, 5, 0 ); | 219 | tabLayout_3->addItem( spacer, 5, 0 ); |
219 | 220 | ||
220 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 221 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
221 | 222 | ||
222 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 223 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
223 | this,SLOT(tabChanged(QWidget*))); | 224 | this,SLOT(tabChanged(QWidget*))); |
224 | 225 | ||
225 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 226 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
226 | currentDir.setPath( QDir::currentDirPath()); | 227 | currentDir.setPath( QDir::currentDirPath()); |
227 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 228 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
228 | currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); | 229 | currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); |
229 | layout->addMultiCellWidget( currentPathEdit, 3, 3, 0, 3 ); | 230 | layout->addMultiCellWidget( currentPathEdit, 3, 3, 0, 3 ); |
230 | 231 | ||
231 | currentPathEdit->setText( currentDir.canonicalPath()); | 232 | currentPathEdit->setText( currentDir.canonicalPath()); |
232 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); | 233 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); |
233 | 234 | ||
234 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 235 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
235 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); | 236 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); |
236 | 237 | ||
237 | filterStr="*"; | 238 | filterStr="*"; |
238 | populateLocalView(); | 239 | populateLocalView(); |
239 | } | 240 | } |
240 | 241 | ||
241 | OpieFtp::~OpieFtp() | 242 | OpieFtp::~OpieFtp() |
242 | { | 243 | { |
243 | } | 244 | } |
244 | 245 | ||
245 | void OpieFtp::cleanUp() | 246 | void OpieFtp::cleanUp() |
246 | { | 247 | { |
247 | if(conn) | 248 | if(conn) |
248 | FtpQuit(conn); | 249 | FtpQuit(conn); |
249 | QString sfile=QDir::homeDirPath(); | 250 | QString sfile=QDir::homeDirPath(); |
250 | if(sfile.right(1) != "/") | 251 | if(sfile.right(1) != "/") |
251 | sfile+="/._temp"; | 252 | sfile+="/._temp"; |
252 | else | 253 | else |
253 | sfile+="._temp"; | 254 | sfile+="._temp"; |
254 | QFile file( sfile); | 255 | QFile file( sfile); |
255 | if(file.exists()) | 256 | if(file.exists()) |
256 | file.remove(); | 257 | file.remove(); |
257 | } | 258 | } |
258 | 259 | ||
259 | void OpieFtp::tabChanged(QWidget *w) | 260 | void OpieFtp::tabChanged(QWidget *w) |
260 | { | 261 | { |
261 | if (TabWidget->currentPageIndex() == 0) { | 262 | if (TabWidget->currentPageIndex() == 0) { |
262 | currentPathEdit->setText( currentDir.canonicalPath()); | 263 | currentPathEdit->setText( currentDir.canonicalPath()); |
264 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | ||
265 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | ||
266 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | ||
263 | } | 267 | } |
264 | if (TabWidget->currentPageIndex() == 1) { | 268 | if (TabWidget->currentPageIndex() == 1) { |
265 | currentPathEdit->setText( currentRemoteDir ); | 269 | currentPathEdit->setText( currentRemoteDir ); |
270 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | ||
271 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | ||
272 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | ||
266 | } | 273 | } |
267 | if (TabWidget->currentPageIndex() == 2) { | 274 | if (TabWidget->currentPageIndex() == 2) { |
275 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | ||
276 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | ||
277 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | ||
268 | } | 278 | } |
269 | } | 279 | } |
270 | 280 | ||
271 | void OpieFtp::localUpload() | 281 | void OpieFtp::localUpload() |
272 | { | 282 | { |
273 | int fsz; | 283 | int fsz; |
274 | QCopEnvelope ( "QPE/System", "busy()" ); | 284 | QCopEnvelope ( "QPE/System", "busy()" ); |
275 | qApp->processEvents(); | 285 | qApp->processEvents(); |
276 | QString strItem = Local_View->currentItem()->text(0); | 286 | QString strItem = Local_View->currentItem()->text(0); |
277 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 287 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
278 | QString remoteFile= currentRemoteDir+strItem; | 288 | QString remoteFile= currentRemoteDir+strItem; |
279 | QFileInfo fi(localFile); | 289 | QFileInfo fi(localFile); |
280 | if( !fi.isDir()) { | 290 | if( !fi.isDir()) { |
281 | fsz=fi.size(); | 291 | fsz=fi.size(); |
282 | ProgressBar->setTotalSteps(fsz); | 292 | ProgressBar->setTotalSteps(fsz); |
283 | 293 | ||
284 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 294 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
285 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 295 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
286 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 296 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
287 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 297 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
288 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); | 298 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); |
289 | 299 | ||
290 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 300 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
291 | QString msg; | 301 | QString msg; |
@@ -832,36 +842,36 @@ void OpieFtp::currentPathEditChanged() | |||
832 | if(QDir( currentPathEdit->text()).exists()) { | 842 | if(QDir( currentPathEdit->text()).exists()) { |
833 | currentDir.setPath( currentPathEdit->text() ); | 843 | currentDir.setPath( currentPathEdit->text() ); |
834 | populateLocalView(); | 844 | populateLocalView(); |
835 | } else { | 845 | } else { |
836 | QMessageBox::message("Note","That directory does not exist"); | 846 | QMessageBox::message("Note","That directory does not exist"); |
837 | } | 847 | } |
838 | } | 848 | } |
839 | if (TabWidget->currentPageIndex() == 1) { | 849 | if (TabWidget->currentPageIndex() == 1) { |
840 | currentRemoteDir = currentPathEdit->text(); | 850 | currentRemoteDir = currentPathEdit->text(); |
841 | if(currentRemoteDir.right(1) !="/") { | 851 | if(currentRemoteDir.right(1) !="/") { |
842 | currentRemoteDir = currentRemoteDir +"/"; | 852 | currentRemoteDir = currentRemoteDir +"/"; |
843 | currentPathEdit->setText( currentRemoteDir ); | 853 | currentPathEdit->setText( currentRemoteDir ); |
844 | } | 854 | } |
845 | if( !remoteChDir( (const QString &)currentRemoteDir) ) { | 855 | if( !remoteChDir( (const QString &)currentRemoteDir) ) { |
846 | currentRemoteDir = oldRemoteCurrentDir; | 856 | currentRemoteDir = oldRemoteCurrentDir; |
847 | currentPathEdit->setText( currentRemoteDir ); | 857 | currentPathEdit->setText( currentRemoteDir ); |
848 | } | 858 | } |
849 | 859 | ||
850 | remoteDirList( (const QString &)currentRemoteDir); | 860 | remoteDirList( (const QString &)currentRemoteDir); |
851 | } | 861 | } |
852 | } | 862 | } |
853 | 863 | ||
854 | void OpieFtp::switchToLocalTab() | 864 | void OpieFtp::switchToLocalTab() |
855 | { | 865 | { |
856 | TabWidget->setCurrentPage(0); | 866 | TabWidget->setCurrentPage(0); |
857 | } | 867 | } |
858 | 868 | ||
859 | void OpieFtp::switchToRemoteTab() | 869 | void OpieFtp::switchToRemoteTab() |
860 | { | 870 | { |
861 | TabWidget->setCurrentPage(1); | 871 | TabWidget->setCurrentPage(1); |
862 | } | 872 | } |
863 | 873 | ||
864 | void OpieFtp::switchToConfigTab() | 874 | void OpieFtp::switchToConfigTab() |
865 | { | 875 | { |
866 | TabWidget->setCurrentPage(2); | 876 | TabWidget->setCurrentPage(2); |
867 | } | 877 | } |