-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 0b88a35..7ca3fff 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -97,1025 +97,1025 @@ OpieFtp::OpieFtp( ) | |||
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 QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); |
129 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 129 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
130 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 130 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
131 | cdUpButton ->setFlat(TRUE); | 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 QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); |
142 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 142 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
143 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 143 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
144 | homeButton->setFlat(TRUE); | 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 | ||
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 | 253 | ||
254 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 254 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
255 | TextLabel4->setText( tr( "Port" ) ); | 255 | TextLabel4->setText( tr( "Port" ) ); |
256 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 256 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
257 | 257 | ||
258 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 258 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
259 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 259 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
260 | PortSpinBox->setMaxValue(32786); | 260 | PortSpinBox->setMaxValue(32786); |
261 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 261 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
262 | 262 | ||
263 | QPushButton *deleteServerBtn; | 263 | QPushButton *deleteServerBtn; |
264 | deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); | 264 | deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); |
265 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); | 265 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); |
266 | 266 | ||
267 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 267 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
268 | 268 | ||
269 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); | 269 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); |
270 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); | 270 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); |
271 | connectServerBtn->setToggleButton(TRUE); | 271 | connectServerBtn->setToggleButton(TRUE); |
272 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); | 272 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); |
273 | 273 | ||
274 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 274 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
275 | tabLayout_3->addItem( spacer, 5, 0 ); | 275 | tabLayout_3->addItem( spacer, 5, 0 ); |
276 | 276 | ||
277 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 277 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
278 | 278 | ||
279 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 279 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
280 | this,SLOT(tabChanged(QWidget*))); | 280 | this,SLOT(tabChanged(QWidget*))); |
281 | 281 | ||
282 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 282 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
283 | currentDir.setPath( QDir::currentDirPath()); | 283 | currentDir.setPath( QDir::currentDirPath()); |
284 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 284 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
285 | 285 | ||
286 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 286 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
287 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); | 287 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); |
288 | 288 | ||
289 | currentPathCombo->setEditable(TRUE); | 289 | currentPathCombo->setEditable(TRUE); |
290 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 290 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
291 | 291 | ||
292 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 292 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
293 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 293 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
294 | 294 | ||
295 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 295 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
296 | this,SLOT(currentPathComboChanged())); | 296 | this,SLOT(currentPathComboChanged())); |
297 | 297 | ||
298 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 298 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
299 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 299 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
300 | 300 | ||
301 | // fillCombos(); | 301 | // fillCombos(); |
302 | 302 | ||
303 | filterStr="*"; | 303 | filterStr="*"; |
304 | b=FALSE; | 304 | b=FALSE; |
305 | populateLocalView(); | 305 | populateLocalView(); |
306 | readConfig(); | 306 | readConfig(); |
307 | ServerComboBox->setCurrentItem(currentServerConfig); | 307 | ServerComboBox->setCurrentItem(currentServerConfig); |
308 | 308 | ||
309 | TabWidget->setCurrentPage(2); | 309 | TabWidget->setCurrentPage(2); |
310 | } | 310 | } |
311 | 311 | ||
312 | OpieFtp::~OpieFtp() | 312 | OpieFtp::~OpieFtp() |
313 | { | 313 | { |
314 | } | 314 | } |
315 | 315 | ||
316 | void OpieFtp::cleanUp() | 316 | void OpieFtp::cleanUp() |
317 | { | 317 | { |
318 | if(conn) | 318 | if(conn) |
319 | FtpQuit(conn); | 319 | FtpQuit(conn); |
320 | QString sfile=QDir::homeDirPath(); | 320 | QString sfile=QDir::homeDirPath(); |
321 | if(sfile.right(1) != "/") | 321 | if(sfile.right(1) != "/") |
322 | sfile+="/._temp"; | 322 | sfile+="/._temp"; |
323 | else | 323 | else |
324 | sfile+="._temp"; | 324 | sfile+="._temp"; |
325 | QFile file( sfile); | 325 | QFile file( sfile); |
326 | if(file.exists()) | 326 | if(file.exists()) |
327 | file.remove(); | 327 | file.remove(); |
328 | exit(0); | 328 | exit(0); |
329 | } | 329 | } |
330 | 330 | ||
331 | void OpieFtp::tabChanged(QWidget *w) | 331 | void OpieFtp::tabChanged(QWidget *w) |
332 | { | 332 | { |
333 | if (TabWidget->currentPageIndex() == 0) { | 333 | if (TabWidget->currentPageIndex() == 0) { |
334 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 334 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
335 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 335 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
336 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 336 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
337 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 337 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
338 | if(cdUpButton->isHidden()) | 338 | if(cdUpButton->isHidden()) |
339 | cdUpButton->show(); | 339 | cdUpButton->show(); |
340 | if(homeButton->isHidden()) | 340 | if(homeButton->isHidden()) |
341 | homeButton->show(); | 341 | homeButton->show(); |
342 | 342 | ||
343 | } | 343 | } |
344 | if (TabWidget->currentPageIndex() == 1) { | 344 | if (TabWidget->currentPageIndex() == 1) { |
345 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 345 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
346 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 346 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
347 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 347 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
348 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 348 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
349 | if(cdUpButton->isHidden()) | 349 | if(cdUpButton->isHidden()) |
350 | cdUpButton->show(); | 350 | cdUpButton->show(); |
351 | homeButton->hide(); | 351 | homeButton->hide(); |
352 | 352 | ||
353 | } | 353 | } |
354 | if (TabWidget->currentPageIndex() == 2) { | 354 | if (TabWidget->currentPageIndex() == 2) { |
355 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 355 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
356 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 356 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
357 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 357 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
358 | cdUpButton->hide(); | 358 | cdUpButton->hide(); |
359 | homeButton->hide(); | 359 | homeButton->hide(); |
360 | } | 360 | } |
361 | } | 361 | } |
362 | 362 | ||
363 | void OpieFtp::newConnection() | 363 | void OpieFtp::newConnection() |
364 | { | 364 | { |
365 | UsernameComboBox->lineEdit()->setText(""); | 365 | UsernameComboBox->lineEdit()->setText(""); |
366 | PasswordEdit->setText( "" ); | 366 | PasswordEdit->setText( "" ); |
367 | ServerComboBox->lineEdit()->setText( ""); | 367 | ServerComboBox->lineEdit()->setText( ""); |
368 | remotePath->setText( currentRemoteDir = "/"); | 368 | remotePath->setText( currentRemoteDir = "/"); |
369 | PortSpinBox->setValue( 21); | 369 | PortSpinBox->setValue( 21); |
370 | TabWidget->setCurrentPage(2); | 370 | TabWidget->setCurrentPage(2); |
371 | } | 371 | } |
372 | 372 | ||
373 | void OpieFtp::serverComboEdited(const QString & edit) | 373 | void OpieFtp::serverComboEdited(const QString & edit) |
374 | { | 374 | { |
375 | if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { | 375 | if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { |
376 | qDebug("ServerComboEdited"); | 376 | qDebug("ServerComboEdited"); |
377 | currentServerConfig = -1; | 377 | currentServerConfig = -1; |
378 | } | 378 | } |
379 | } | 379 | } |
380 | 380 | ||
381 | void OpieFtp::connectorBtnToggled(bool On) | 381 | void OpieFtp::connectorBtnToggled(bool On) |
382 | { | 382 | { |
383 | if(On) { | 383 | if(On) { |
384 | connector(); | 384 | connector(); |
385 | } else { | 385 | } else { |
386 | disConnector(); | 386 | disConnector(); |
387 | } | 387 | } |
388 | 388 | ||
389 | } | 389 | } |
390 | 390 | ||
391 | void OpieFtp::connector() | 391 | void OpieFtp::connector() |
392 | { | 392 | { |
393 | // QCopEnvelope ( "QPE/System", "busy()" ); | 393 | // QCopEnvelope ( "QPE/System", "busy()" ); |
394 | // qApp->processEvents(); | 394 | // qApp->processEvents(); |
395 | currentRemoteDir=remotePath->text(); | 395 | currentRemoteDir=remotePath->text(); |
396 | if(ServerComboBox->currentText().isEmpty()) { | 396 | if(ServerComboBox->currentText().isEmpty()) { |
397 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 397 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
398 | TabWidget->setCurrentPage(2); | 398 | TabWidget->setCurrentPage(2); |
399 | ServerComboBox->setFocus(); | 399 | ServerComboBox->setFocus(); |
400 | connectServerBtn->setOn(FALSE); | 400 | connectServerBtn->setOn(FALSE); |
401 | connectServerBtn->setText( tr("Connect")); | 401 | connectServerBtn->setText( tr("Connect")); |
402 | return; | 402 | return; |
403 | } | 403 | } |
404 | FtpInit(); | 404 | FtpInit(); |
405 | TabWidget->setCurrentPage(1); | 405 | TabWidget->setCurrentPage(1); |
406 | QString ftp_host = ServerComboBox->currentText(); | 406 | QString ftp_host = ServerComboBox->currentText(); |
407 | QString ftp_user = UsernameComboBox->currentText(); | 407 | QString ftp_user = UsernameComboBox->currentText(); |
408 | QString ftp_pass = PasswordEdit->text(); | 408 | QString ftp_pass = PasswordEdit->text(); |
409 | QString port=PortSpinBox->cleanText(); | 409 | QString port=PortSpinBox->cleanText(); |
410 | port.stripWhiteSpace(); | 410 | port.stripWhiteSpace(); |
411 | 411 | ||
412 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) | 412 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) |
413 | ftp_host=ftp_host.right(ftp_host.length()-6); | 413 | ftp_host=ftp_host.right(ftp_host.length()-6); |
414 | ftp_host+=":"+port; | 414 | ftp_host+=":"+port; |
415 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | 415 | if (!FtpConnect( ftp_host.latin1(), &conn)) { |
416 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); | 416 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); |
417 | connectServerBtn->setOn(FALSE); | 417 | connectServerBtn->setOn(FALSE); |
418 | connectServerBtn->setText( tr("Connect")); | 418 | connectServerBtn->setText( tr("Connect")); |
419 | return ; | 419 | return ; |
420 | } | 420 | } |
421 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 421 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
422 | QString msg; | 422 | QString msg; |
423 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); | 423 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); |
424 | msg.replace(QRegExp(":"),"\n"); | 424 | msg.replace(QRegExp(":"),"\n"); |
425 | QMessageBox::message(tr("Note"),msg); | 425 | QMessageBox::message(tr("Note"),msg); |
426 | if(conn) | 426 | if(conn) |
427 | FtpQuit(conn); | 427 | FtpQuit(conn); |
428 | connectServerBtn->setOn(FALSE); | 428 | connectServerBtn->setOn(FALSE); |
429 | connectServerBtn->setText( tr("Connect")); | 429 | connectServerBtn->setText( tr("Connect")); |
430 | return ; | 430 | return ; |
431 | } | 431 | } |
432 | remoteDirList("/") ; | 432 | remoteDirList("/") ; |
433 | setCaption(ftp_host); | 433 | setCaption(ftp_host); |
434 | writeConfig(); | 434 | writeConfig(); |
435 | connectServerBtn->setText( tr("Disconnect")); | 435 | connectServerBtn->setText( tr("Disconnect")); |
436 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 436 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
437 | } | 437 | } |
438 | 438 | ||
439 | void OpieFtp::disConnector() | 439 | void OpieFtp::disConnector() |
440 | { | 440 | { |
441 | if(conn) | 441 | if(conn) |
442 | FtpQuit(conn); | 442 | FtpQuit(conn); |
443 | setCaption("OpieFtp"); | 443 | setCaption("OpieFtp"); |
444 | currentRemoteDir="/"; | 444 | currentRemoteDir="/"; |
445 | Remote_View->clear(); | 445 | Remote_View->clear(); |
446 | connectServerBtn->setText( tr("Connect")); | 446 | connectServerBtn->setText( tr("Connect")); |
447 | connectServerBtn->setOn(FALSE); | 447 | connectServerBtn->setOn(FALSE); |
448 | setCaption("OpieFtp"); | 448 | setCaption("OpieFtp"); |
449 | } | 449 | } |
450 | 450 | ||
451 | void OpieFtp::localUpload() | 451 | void OpieFtp::localUpload() |
452 | { | 452 | { |
453 | int fsz; | 453 | int fsz; |
454 | // QCopEnvelope ( "QPE/System", "busy()" ); | 454 | // QCopEnvelope ( "QPE/System", "busy()" ); |
455 | // qApp->processEvents(); | 455 | // qApp->processEvents(); |
456 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 456 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
457 | QListViewItemIterator it( Local_View ); | 457 | QListViewItemIterator it( Local_View ); |
458 | for ( ; it.current(); ++it ) { | 458 | for ( ; it.current(); ++it ) { |
459 | if ( it.current()->isSelected() ) { | 459 | if ( it.current()->isSelected() ) { |
460 | QString strItem = it.current()->text(0); | 460 | QString strItem = it.current()->text(0); |
461 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 461 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
462 | QString remoteFile= currentRemoteDir+strItem; | 462 | QString remoteFile= currentRemoteDir+strItem; |
463 | QFileInfo fi(localFile); | 463 | QFileInfo fi(localFile); |
464 | if( !fi.isDir()) { | 464 | if( !fi.isDir()) { |
465 | fsz=fi.size(); | 465 | fsz=fi.size(); |
466 | ProgressBar->setTotalSteps(fsz); | 466 | ProgressBar->setTotalSteps(fsz); |
467 | 467 | ||
468 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 468 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
469 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 469 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
470 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 470 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
471 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 471 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
472 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); | 472 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); |
473 | 473 | ||
474 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 474 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
475 | QString msg; | 475 | QString msg; |
476 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); | 476 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); |
477 | msg.replace(QRegExp(":"),"\n"); | 477 | msg.replace(QRegExp(":"),"\n"); |
478 | QMessageBox::message(tr("Note"),msg); | 478 | QMessageBox::message(tr("Note"),msg); |
479 | } | 479 | } |
480 | } else { | 480 | } else { |
481 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | 481 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); |
482 | } | 482 | } |
483 | ProgressBar->reset(); | 483 | ProgressBar->reset(); |
484 | nullifyCallBack(); | 484 | nullifyCallBack(); |
485 | it.current()->setSelected(FALSE); | 485 | it.current()->setSelected(FALSE); |
486 | } //end currentSelected | 486 | } //end currentSelected |
487 | } | 487 | } |
488 | for ( ; it.current(); ++it ) { | 488 | for ( ; it.current(); ++it ) { |
489 | Local_View->clearSelection(); | 489 | Local_View->clearSelection(); |
490 | } | 490 | } |
491 | Local_View->clearFocus(); | 491 | Local_View->clearFocus(); |
492 | TabWidget->setCurrentPage(1); | 492 | TabWidget->setCurrentPage(1); |
493 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 493 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
494 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 494 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
495 | } | 495 | } |
496 | 496 | ||
497 | void OpieFtp::nullifyCallBack() | 497 | void OpieFtp::nullifyCallBack() |
498 | { | 498 | { |
499 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); | 499 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); |
500 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); | 500 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); |
501 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); | 501 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); |
502 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); | 502 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); |
503 | } | 503 | } |
504 | 504 | ||
505 | void OpieFtp::remoteDownload() | 505 | void OpieFtp::remoteDownload() |
506 | { | 506 | { |
507 | // qApp->processEvents(); | 507 | // qApp->processEvents(); |
508 | int fsz; | 508 | int fsz; |
509 | // QCopEnvelope ( "QPE/System", "busy()" ); | 509 | // QCopEnvelope ( "QPE/System", "busy()" ); |
510 | 510 | ||
511 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 511 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
512 | QListViewItemIterator it( Remote_View ); | 512 | QListViewItemIterator it( Remote_View ); |
513 | for ( ; it.current(); ++it ) { | 513 | for ( ; it.current(); ++it ) { |
514 | if ( it.current()->isSelected() ) { | 514 | if ( it.current()->isSelected() ) { |
515 | QString strItem = it.current()->text(0); | 515 | QString strItem = it.current()->text(0); |
516 | // strItem=strItem.right(strItem.length()-1); | 516 | // strItem=strItem.right(strItem.length()-1); |
517 | QString localFile = currentDir.canonicalPath(); | 517 | QString localFile = currentDir.canonicalPath(); |
518 | if(localFile.right(1).find("/",0,TRUE) == -1) | 518 | if(localFile.right(1).find("/",0,TRUE) == -1) |
519 | localFile += "/"; | 519 | localFile += "/"; |
520 | localFile += strItem; | 520 | localFile += strItem; |
521 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 521 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
522 | QString remoteFile= currentRemoteDir+strItem; | 522 | QString remoteFile= currentRemoteDir+strItem; |
523 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 523 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
524 | fsz = 0; | 524 | fsz = 0; |
525 | QString temp; | 525 | QString temp; |
526 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 526 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
527 | 527 | ||
528 | ProgressBar->setTotalSteps(fsz); | 528 | ProgressBar->setTotalSteps(fsz); |
529 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 529 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
530 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 530 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
531 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 531 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
532 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 532 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
533 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 533 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); |
534 | 534 | ||
535 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 535 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
536 | QString msg; | 536 | QString msg; |
537 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 537 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
538 | msg.replace(QRegExp(":"),"\n"); | 538 | msg.replace(QRegExp(":"),"\n"); |
539 | QMessageBox::message(tr("Note"),msg); | 539 | QMessageBox::message(tr("Note"),msg); |
540 | } | 540 | } |
541 | ProgressBar->reset(); | 541 | ProgressBar->reset(); |
542 | nullifyCallBack(); | 542 | nullifyCallBack(); |
543 | it.current()->setSelected(FALSE); | 543 | it.current()->setSelected(FALSE); |
544 | } | 544 | } |
545 | } | 545 | } |
546 | for ( ; it.current(); ++it ) { | 546 | for ( ; it.current(); ++it ) { |
547 | Remote_View->clearSelection(); | 547 | Remote_View->clearSelection(); |
548 | } | 548 | } |
549 | Remote_View->setFocus(); | 549 | Remote_View->setFocus(); |
550 | TabWidget->setCurrentPage(0); | 550 | TabWidget->setCurrentPage(0); |
551 | populateLocalView(); | 551 | populateLocalView(); |
552 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 552 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
553 | } | 553 | } |
554 | 554 | ||
555 | bool OpieFtp::remoteDirList(const QString &dir) | 555 | bool OpieFtp::remoteDirList(const QString &dir) |
556 | { | 556 | { |
557 | QString tmp = QDir::homeDirPath(); | 557 | QString tmp = QDir::homeDirPath(); |
558 | if(tmp.right(1) != "/") | 558 | if(tmp.right(1) != "/") |
559 | tmp+="/._temp"; | 559 | tmp+="/._temp"; |
560 | else | 560 | else |
561 | tmp+="._temp"; | 561 | tmp+="._temp"; |
562 | // qDebug("Listing remote dir "+tmp); | 562 | // qDebug("Listing remote dir "+tmp); |
563 | // QCopEnvelope ( "QPE/System", "busy()" ); | 563 | // QCopEnvelope ( "QPE/System", "busy()" ); |
564 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 564 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
565 | QString msg; | 565 | QString msg; |
566 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 566 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
567 | msg.replace(QRegExp(":"),"\n"); | 567 | msg.replace(QRegExp(":"),"\n"); |
568 | QMessageBox::message(tr("Note"),msg); | 568 | QMessageBox::message(tr("Note"),msg); |
569 | return false; | 569 | return false; |
570 | } | 570 | } |
571 | populateRemoteView() ; | 571 | populateRemoteView() ; |
572 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 572 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
573 | return true; | 573 | return true; |
574 | } | 574 | } |
575 | 575 | ||
576 | bool OpieFtp::remoteChDir(const QString &dir) | 576 | bool OpieFtp::remoteChDir(const QString &dir) |
577 | { | 577 | { |
578 | // QCopEnvelope ( "QPE/System", "busy()" ); | 578 | // QCopEnvelope ( "QPE/System", "busy()" ); |
579 | if (!FtpChdir( dir.latin1(), conn )) { | 579 | if (!FtpChdir( dir.latin1(), conn )) { |
580 | QString msg; | 580 | QString msg; |
581 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 581 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
582 | msg.replace(QRegExp(":"),"\n"); | 582 | msg.replace(QRegExp(":"),"\n"); |
583 | QMessageBox::message(tr("Note"),msg); | 583 | QMessageBox::message(tr("Note"),msg); |
584 | // qDebug(msg); | 584 | // qDebug(msg); |
585 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 585 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
586 | return FALSE; | 586 | return FALSE; |
587 | } | 587 | } |
588 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 588 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
589 | return TRUE; | 589 | return TRUE; |
590 | } | 590 | } |
591 | 591 | ||
592 | void OpieFtp::populateLocalView() | 592 | void OpieFtp::populateLocalView() |
593 | { | 593 | { |
594 | Local_View->clear(); | 594 | Local_View->clear(); |
595 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 595 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
596 | currentDir.setMatchAllDirs(TRUE); | 596 | currentDir.setMatchAllDirs(TRUE); |
597 | currentDir.setNameFilter(filterStr); | 597 | currentDir.setNameFilter(filterStr); |
598 | QString fileL, fileS, fileDate; | 598 | QString fileL, fileS, fileDate; |
599 | bool isDir=FALSE; | 599 | bool isDir=FALSE; |
600 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 600 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
601 | QFileInfoListIterator it(*list); | 601 | QFileInfoListIterator it(*list); |
602 | QFileInfo *fi; | 602 | QFileInfo *fi; |
603 | while ( (fi=it.current()) ) { | 603 | while ( (fi=it.current()) ) { |
604 | if (fi->isSymLink() ){ | 604 | if (fi->isSymLink() ){ |
605 | QString symLink=fi->readLink(); | 605 | QString symLink=fi->readLink(); |
606 | // qDebug("Symlink detected "+symLink); | 606 | // qDebug("Symlink detected "+symLink); |
607 | QFileInfo sym( symLink); | 607 | QFileInfo sym( symLink); |
608 | fileS.sprintf( "%10li", sym.size() ); | 608 | fileS.sprintf( "%10li", sym.size() ); |
609 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 609 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
610 | fileDate = sym.lastModified().toString(); | 610 | fileDate = sym.lastModified().toString(); |
611 | } else { | 611 | } else { |
612 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 612 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
613 | fileS.sprintf( "%10li", fi->size() ); | 613 | fileS.sprintf( "%10li", fi->size() ); |
614 | fileL.sprintf( "%s",fi->fileName().data() ); | 614 | fileL.sprintf( "%s",fi->fileName().data() ); |
615 | fileDate= fi->lastModified().toString(); | 615 | fileDate= fi->lastModified().toString(); |
616 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 616 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
617 | fileL+="/"; | 617 | fileL+="/"; |
618 | isDir=TRUE; | 618 | isDir=TRUE; |
619 | // qDebug( fileL); | 619 | // qDebug( fileL); |
620 | } | 620 | } |
621 | } | 621 | } |
622 | if(fileL !="./" && fi->exists()) { | 622 | if(fileL !="./" && fi->exists()) { |
623 | item= new QListViewItem( Local_View,fileL, fileDate, fileS ); | 623 | item= new QListViewItem( Local_View,fileL, fileDate, fileS ); |
624 | QPixmap pm; | 624 | QPixmap pm; |
625 | 625 | ||
626 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 626 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
627 | if( !QDir( fi->filePath() ).isReadable()) | 627 | if( !QDir( fi->filePath() ).isReadable()) |
628 | pm = Resource::loadPixmap( "lockedfolder" ); | 628 | pm = Resource::loadPixmap( "lockedfolder" ); |
629 | else | 629 | else |
630 | pm= Resource::loadPixmap( "folder" ); | 630 | pm= Resource::loadPixmap( "folder" ); |
631 | item->setPixmap( 0,pm ); | 631 | item->setPixmap( 0,pm ); |
632 | } else { | 632 | } else { |
633 | if( !fi->isReadable() ) | 633 | if( !fi->isReadable() ) |
634 | pm = Resource::loadPixmap( "locked" ); | 634 | pm = Resource::loadPixmap( "locked" ); |
635 | else { | 635 | else { |
636 | MimeType mt(fi->filePath()); | 636 | MimeType mt(fi->filePath()); |
637 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 637 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
638 | if(pm.isNull()) | 638 | if(pm.isNull()) |
639 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 639 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
640 | item->setPixmap( 0,pm); | 640 | item->setPixmap( 0,pm); |
641 | } | 641 | } |
642 | } | 642 | } |
643 | if( fileL.find("->",0,TRUE) != -1) { | 643 | if( fileL.find("->",0,TRUE) != -1) { |
644 | // overlay link image | 644 | // overlay link image |
645 | pm= Resource::loadPixmap( "folder" ); | 645 | pm= Resource::loadPixmap( "folder" ); |
646 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 646 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
647 | QPainter painter( &pm ); | 647 | QPainter painter( &pm ); |
648 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 648 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
649 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 649 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
650 | item->setPixmap( 0, pm); | 650 | item->setPixmap( 0, pm); |
651 | } | 651 | } |
652 | } | 652 | } |
653 | isDir=FALSE; | 653 | isDir=FALSE; |
654 | ++it; | 654 | ++it; |
655 | } | 655 | } |
656 | Local_View->setSorting( 3,FALSE); | 656 | Local_View->setSorting( 3,FALSE); |
657 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 657 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
658 | fillCombo( (const QString &)currentDir); | 658 | fillCombo( (const QString &)currentDir); |
659 | } | 659 | } |
660 | 660 | ||
661 | bool OpieFtp::populateRemoteView( ) | 661 | bool OpieFtp::populateRemoteView( ) |
662 | { | 662 | { |
663 | // qDebug("populate remoteview"); | 663 | // qDebug("populate remoteview"); |
664 | QString sfile=QDir::homeDirPath(); | 664 | QString sfile=QDir::homeDirPath(); |
665 | if(sfile.right(1) != "/") | 665 | if(sfile.right(1) != "/") |
666 | sfile+="/._temp"; | 666 | sfile+="/._temp"; |
667 | else | 667 | else |
668 | sfile+="._temp"; | 668 | sfile+="._temp"; |
669 | QFile file( sfile); | 669 | QFile file( sfile); |
670 | Remote_View->clear(); | 670 | Remote_View->clear(); |
671 | QString s, File_Name; | 671 | QString s, File_Name; |
672 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 672 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
673 | QString fileL, fileS, fileDate; | 673 | QString fileL, fileS, fileDate; |
674 | if ( file.open(IO_ReadOnly)) { | 674 | if ( file.open(IO_ReadOnly)) { |
675 | QTextStream t( &file ); // use a text stream | 675 | QTextStream t( &file ); // use a text stream |
676 | while ( !t.eof()) { | 676 | while ( !t.eof()) { |
677 | s = t.readLine(); | 677 | s = t.readLine(); |
678 | fileL = s.right(s.length()-55); | 678 | fileL = s.right(s.length()-55); |
679 | fileL = fileL.stripWhiteSpace(); | 679 | fileL = fileL.stripWhiteSpace(); |
680 | if(s.left(1) == "d") | 680 | if(s.left(1) == "d") |
681 | fileL = fileL+"/"; | 681 | fileL = fileL+"/"; |
682 | // fileL = "/"+fileL+"/"; | 682 | // fileL = "/"+fileL+"/"; |
683 | fileS = s.mid( 30, 42-30); | 683 | fileS = s.mid( 30, 42-30); |
684 | fileS = fileS.stripWhiteSpace(); | 684 | fileS = fileS.stripWhiteSpace(); |
685 | fileDate = s.mid( 42, 55-42); | 685 | fileDate = s.mid( 42, 55-42); |
686 | fileDate = fileDate.stripWhiteSpace(); | 686 | fileDate = fileDate.stripWhiteSpace(); |
687 | if(fileL.find("total",0,TRUE) == -1) { | 687 | if(fileL.find("total",0,TRUE) == -1) { |
688 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { | 688 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { |
689 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); | 689 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); |
690 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | 690 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); |
691 | // if(itemDir) | 691 | // if(itemDir) |
692 | item->moveItem(itemDir); | 692 | item->moveItem(itemDir); |
693 | itemDir=item; | 693 | itemDir=item; |
694 | } else { | 694 | } else { |
695 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); | 695 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); |
696 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 696 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); |
697 | // if(itemFile) | 697 | // if(itemFile) |
698 | item->moveItem(itemDir); | 698 | item->moveItem(itemDir); |
699 | item->moveItem(itemFile); | 699 | item->moveItem(itemFile); |
700 | itemFile=item; | 700 | itemFile=item; |
701 | } | 701 | } |
702 | } | 702 | } |
703 | } | 703 | } |
704 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 704 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
705 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 705 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |
706 | file.close(); | 706 | file.close(); |
707 | if( file.exists()) | 707 | if( file.exists()) |
708 | file. remove(); | 708 | file. remove(); |
709 | } else | 709 | } else |
710 | qDebug("temp file not opened successfullly "+sfile); | 710 | qDebug("temp file not opened successfullly "+sfile); |
711 | Remote_View->setSorting( 4,TRUE); | 711 | Remote_View->setSorting( 4,TRUE); |
712 | return true; | 712 | return true; |
713 | } | 713 | } |
714 | 714 | ||
715 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 715 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
716 | { | 716 | { |
717 | if( selectedItem) { | 717 | if( selectedItem) { |
718 | // QCopEnvelope ( "QPE/System", "busy()" ); | 718 | // QCopEnvelope ( "QPE/System", "busy()" ); |
719 | QString oldRemoteCurrentDir = currentRemoteDir; | 719 | QString oldRemoteCurrentDir = currentRemoteDir; |
720 | QString strItem=selectedItem->text(0); | 720 | QString strItem=selectedItem->text(0); |
721 | strItem=strItem.simplifyWhiteSpace(); | 721 | strItem=strItem.simplifyWhiteSpace(); |
722 | if(strItem == "../") { // the user wants to go ^ | 722 | if(strItem == "../") { // the user wants to go ^ |
723 | if( FtpCDUp( conn) == 0) { | 723 | if( FtpCDUp( conn) == 0) { |
724 | QString msg; | 724 | QString msg; |
725 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 725 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
726 | msg.replace(QRegExp(":"),"\n"); | 726 | msg.replace(QRegExp(":"),"\n"); |
727 | QMessageBox::message(tr("Note"),msg); | 727 | QMessageBox::message(tr("Note"),msg); |
728 | // qDebug(msg); | 728 | // qDebug(msg); |
729 | } | 729 | } |
730 | char path[256]; | 730 | char path[256]; |
731 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 731 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
732 | QString msg; | 732 | QString msg; |
733 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 733 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
734 | msg.replace(QRegExp(":"),"\n"); | 734 | msg.replace(QRegExp(":"),"\n"); |
735 | QMessageBox::message(tr("Note"),msg); | 735 | QMessageBox::message(tr("Note"),msg); |
736 | // qDebug(msg); | 736 | // qDebug(msg); |
737 | } | 737 | } |
738 | currentRemoteDir=path; | 738 | currentRemoteDir=path; |
739 | } else { | 739 | } else { |
740 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | 740 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers |
741 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | 741 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); |
742 | strItem = strItem.stripWhiteSpace(); | 742 | strItem = strItem.stripWhiteSpace(); |
743 | currentRemoteDir = strItem; | 743 | currentRemoteDir = strItem; |
744 | if( !remoteChDir( (const QString &)strItem)) { | 744 | if( !remoteChDir( (const QString &)strItem)) { |
745 | currentRemoteDir = oldRemoteCurrentDir; | 745 | currentRemoteDir = oldRemoteCurrentDir; |
746 | strItem=""; | 746 | strItem=""; |
747 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 747 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
748 | } | 748 | } |
749 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 749 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory |
750 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 750 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
751 | currentRemoteDir = oldRemoteCurrentDir; | 751 | currentRemoteDir = oldRemoteCurrentDir; |
752 | strItem=""; | 752 | strItem=""; |
753 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 753 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
754 | 754 | ||
755 | } else { | 755 | } else { |
756 | currentRemoteDir = currentRemoteDir+strItem; | 756 | currentRemoteDir = currentRemoteDir+strItem; |
757 | } | 757 | } |
758 | } else { | 758 | } else { |
759 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 759 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
760 | return; | 760 | return; |
761 | } | 761 | } |
762 | } | 762 | } |
763 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 763 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
764 | if(currentRemoteDir.right(1) !="/") | 764 | if(currentRemoteDir.right(1) !="/") |
765 | currentRemoteDir +="/"; | 765 | currentRemoteDir +="/"; |
766 | currentPathCombo->lineEdit()->setText( currentRemoteDir); | 766 | currentPathCombo->lineEdit()->setText( currentRemoteDir); |
767 | fillRemoteCombo( (const QString &)currentRemoteDir); | 767 | fillRemoteCombo( (const QString &)currentRemoteDir); |
768 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 768 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
769 | } | 769 | } |
770 | } | 770 | } |
771 | 771 | ||
772 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 772 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
773 | { | 773 | { |
774 | if(selectedItem!= NULL) { | 774 | if(selectedItem!= NULL) { |
775 | 775 | ||
776 | QString strItem=selectedItem->text(0); | 776 | QString strItem=selectedItem->text(0); |
777 | QString strSize=selectedItem->text(1); | 777 | QString strSize=selectedItem->text(1); |
778 | strSize=strSize.stripWhiteSpace(); | 778 | strSize=strSize.stripWhiteSpace(); |
779 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 779 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
780 | // is symlink | 780 | // is symlink |
781 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 781 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
782 | if(QDir(strItem2).exists() ) { | 782 | if(QDir(strItem2).exists() ) { |
783 | currentDir.cd(strItem2, TRUE); | 783 | currentDir.cd(strItem2, TRUE); |
784 | populateLocalView(); | 784 | populateLocalView(); |
785 | } | 785 | } |
786 | } else { // not a symlink | 786 | } else { // not a symlink |
787 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 787 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
788 | 788 | ||
789 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 789 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
790 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 790 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
791 | currentDir.cd(strItem,FALSE); | 791 | currentDir.cd(strItem,FALSE); |
792 | populateLocalView(); | 792 | populateLocalView(); |
793 | } else { | 793 | } else { |
794 | currentDir.cdUp(); | 794 | currentDir.cdUp(); |
795 | populateLocalView(); | 795 | populateLocalView(); |
796 | } | 796 | } |
797 | if(QDir(strItem).exists()){ | 797 | if(QDir(strItem).exists()){ |
798 | currentDir.cd(strItem, TRUE); | 798 | currentDir.cd(strItem, TRUE); |
799 | populateLocalView(); | 799 | populateLocalView(); |
800 | } | 800 | } |
801 | } else { | 801 | } else { |
802 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 802 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
803 | if( QFile::exists(strItem ) ) { | 803 | if( QFile::exists(strItem ) ) { |
804 | // qDebug("upload "+strItem); | 804 | // qDebug("upload "+strItem); |
805 | return; | 805 | return; |
806 | } | 806 | } |
807 | } //end not symlink | 807 | } //end not symlink |
808 | chdir(strItem.latin1()); | 808 | chdir(strItem.latin1()); |
809 | } | 809 | } |
810 | } | 810 | } |
811 | } | 811 | } |
812 | 812 | ||
813 | void OpieFtp::doLocalCd() | 813 | void OpieFtp::doLocalCd() |
814 | { | 814 | { |
815 | localListClicked( Local_View->currentItem()); | 815 | localListClicked( Local_View->currentItem()); |
816 | } | 816 | } |
817 | 817 | ||
818 | void OpieFtp:: doRemoteCd() | 818 | void OpieFtp:: doRemoteCd() |
819 | { | 819 | { |
820 | remoteListClicked( Remote_View->currentItem()); | 820 | remoteListClicked( Remote_View->currentItem()); |
821 | 821 | ||
822 | } | 822 | } |
823 | 823 | ||
824 | void OpieFtp::showHidden() | 824 | void OpieFtp::showHidden() |
825 | { | 825 | { |
826 | if (!b) { | 826 | if (!b) { |
827 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 827 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
828 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 828 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
829 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 829 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
830 | b=TRUE; | 830 | b=TRUE; |
831 | 831 | ||
832 | } else { | 832 | } else { |
833 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 833 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
834 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 834 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
835 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 835 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
836 | b=FALSE; | 836 | b=FALSE; |
837 | } | 837 | } |
838 | populateLocalView(); | 838 | populateLocalView(); |
839 | } | 839 | } |
840 | 840 | ||
841 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 841 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
842 | { | 842 | { |
843 | // if(item) | 843 | // if(item) |
844 | if (mouse == 2) { | 844 | if (mouse == 2) { |
845 | showLocalMenu(item); | 845 | showLocalMenu(item); |
846 | } | 846 | } |
847 | } | 847 | } |
848 | 848 | ||
849 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 849 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
850 | { | 850 | { |
851 | if(mouse == 2) { | 851 | if(mouse == 2) { |
852 | showRemoteMenu(item); | 852 | showRemoteMenu(item); |
853 | } | 853 | } |
854 | } | 854 | } |
855 | 855 | ||
856 | void OpieFtp::showRemoteMenu(QListViewItem * item) | 856 | void OpieFtp::showRemoteMenu(QListViewItem * item) |
857 | { | 857 | { |
858 | QPopupMenu * m;// = new QPopupMenu( Local_View ); | 858 | QPopupMenu * m;// = new QPopupMenu( Local_View ); |
859 | m = new QPopupMenu(this); | 859 | m = new QPopupMenu(this); |
860 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) | 860 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) |
861 | m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 861 | m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
862 | else | 862 | else |
863 | m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 863 | m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
864 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 864 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
865 | m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() )); | 865 | m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() )); |
866 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 866 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
867 | m->insertSeparator(); | 867 | m->insertSeparator(); |
868 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 868 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
869 | m->exec( QCursor::pos() ); | 869 | m->exec( QCursor::pos() ); |
870 | delete m; | 870 | delete m; |
871 | } | 871 | } |
872 | 872 | ||
873 | void OpieFtp::showLocalMenu(QListViewItem * item) | 873 | void OpieFtp::showLocalMenu(QListViewItem * item) |
874 | { | 874 | { |
875 | 875 | ||
876 | QPopupMenu *m; | 876 | QPopupMenu *m; |
877 | m = new QPopupMenu( this); | 877 | m = new QPopupMenu( this); |
878 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 878 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
879 | m->insertSeparator(); | 879 | m->insertSeparator(); |
880 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 880 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
881 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 881 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
882 | else | 882 | else |
883 | m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 883 | m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
884 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 884 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
885 | m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() )); | 885 | m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() )); |
886 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 886 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
887 | m->insertSeparator(); | 887 | m->insertSeparator(); |
888 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 888 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
889 | m->setCheckable(TRUE); | 889 | m->setCheckable(TRUE); |
890 | if (b) | 890 | if (b) |
891 | m->setItemChecked(m->idAt(0),TRUE); | 891 | m->setItemChecked(m->idAt(0),TRUE); |
892 | else | 892 | else |
893 | m->setItemChecked(m->idAt(0),FALSE); | 893 | m->setItemChecked(m->idAt(0),FALSE); |
894 | 894 | ||
895 | m->exec( QCursor::pos() ); | 895 | m->exec( QCursor::pos() ); |
896 | delete m; | 896 | delete m; |
897 | } | 897 | } |
898 | 898 | ||
899 | void OpieFtp::localMakDir() | 899 | void OpieFtp::localMakDir() |
900 | { | 900 | { |
901 | InputDialog *fileDlg; | 901 | InputDialog *fileDlg; |
902 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 902 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
903 | fileDlg->exec(); | 903 | fileDlg->exec(); |
904 | if( fileDlg->result() == 1 ) { | 904 | if( fileDlg->result() == 1 ) { |
905 | QString filename = fileDlg->LineEdit1->text(); | 905 | QString filename = fileDlg->LineEdit1->text(); |
906 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 906 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
907 | } | 907 | } |
908 | populateLocalView(); | 908 | populateLocalView(); |
909 | } | 909 | } |
910 | 910 | ||
911 | void OpieFtp::localDelete() | 911 | void OpieFtp::localDelete() |
912 | { | 912 | { |
913 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 913 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
914 | QListViewItemIterator it( Local_View ); | 914 | QListViewItemIterator it( Local_View ); |
915 | for ( ; it.current(); ++it ) { | 915 | for ( ; it.current(); ++it ) { |
916 | if ( it.current()->isSelected() ) { | 916 | if ( it.current()->isSelected() ) { |
917 | QString f = it.current()->text(0); | 917 | QString f = it.current()->text(0); |
918 | it.current()->setSelected(FALSE); | 918 | it.current()->setSelected(FALSE); |
919 | 919 | ||
920 | // QString f = Local_View->currentItem()->text(0); | 920 | // QString f = Local_View->currentItem()->text(0); |
921 | if(QDir(f).exists() ) { | 921 | if(QDir(f).exists() ) { |
922 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 922 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
923 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { | 923 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { |
924 | case 0: { | 924 | case 0: { |
925 | f=currentDir.canonicalPath()+"/"+f; | 925 | f=currentDir.canonicalPath()+"/"+f; |
926 | QString cmd="rmdir "+f; | 926 | QString cmd="rmdir "+f; |
927 | system( cmd.latin1()); | 927 | system( cmd.latin1()); |
928 | } | 928 | } |
929 | break; | 929 | break; |
930 | case 1: | 930 | case 1: |
931 | // exit | 931 | // exit |
932 | break; | 932 | break; |
933 | }; | 933 | }; |
934 | 934 | ||
935 | } else { | 935 | } else { |
936 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 936 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
937 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 937 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
938 | case 0: { | 938 | case 0: { |
939 | f=currentDir.canonicalPath()+"/"+f; | 939 | f=currentDir.canonicalPath()+"/"+f; |
940 | QString cmd="rm "+f; | 940 | QString cmd="rm "+f; |
941 | system( cmd.latin1()); | 941 | system( cmd.latin1()); |
942 | } | 942 | } |
943 | break; | 943 | break; |
944 | case 1: | 944 | case 1: |
945 | // exit | 945 | // exit |
946 | break; | 946 | break; |
947 | }; | 947 | }; |
948 | } | 948 | } |
949 | } | 949 | } |
950 | } | 950 | } |
951 | populateLocalView(); | 951 | populateLocalView(); |
952 | 952 | ||
953 | } | 953 | } |
954 | 954 | ||
955 | void OpieFtp::remoteMakDir() | 955 | void OpieFtp::remoteMakDir() |
956 | { | 956 | { |
957 | InputDialog *fileDlg; | 957 | InputDialog *fileDlg; |
958 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 958 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
959 | fileDlg->exec(); | 959 | fileDlg->exec(); |
960 | if( fileDlg->result() == 1 ) { | 960 | if( fileDlg->result() == 1 ) { |
961 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; | 961 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; |
962 | QString tmp=currentRemoteDir+filename; | 962 | QString tmp=currentRemoteDir+filename; |
963 | // QCopEnvelope ( "QPE/System", "busy()" ); | 963 | // QCopEnvelope ( "QPE/System", "busy()" ); |
964 | if(FtpMkdir( tmp.latin1(), conn) == 0) { | 964 | if(FtpMkdir( tmp.latin1(), conn) == 0) { |
965 | QString msg; | 965 | QString msg; |
966 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); | 966 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); |
967 | msg.replace(QRegExp(":"),"\n"); | 967 | msg.replace(QRegExp(":"),"\n"); |
968 | QMessageBox::message(tr("Note"),msg); | 968 | QMessageBox::message(tr("Note"),msg); |
969 | } | 969 | } |
970 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 970 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
971 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 971 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
972 | } | 972 | } |
973 | } | 973 | } |
974 | 974 | ||
975 | void OpieFtp::remoteDelete() | 975 | void OpieFtp::remoteDelete() |
976 | { | 976 | { |
977 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 977 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
978 | QListViewItemIterator it( Remote_View ); | 978 | QListViewItemIterator it( Remote_View ); |
979 | for ( ; it.current(); ++it ) { | 979 | for ( ; it.current(); ++it ) { |
980 | if ( it.current()->isSelected() ) { | 980 | if ( it.current()->isSelected() ) { |
981 | QString f = it.current()->text(0); | 981 | QString f = it.current()->text(0); |
982 | // QString f = Remote_View->currentItem()->text(0); | 982 | // QString f = Remote_View->currentItem()->text(0); |
983 | // QCopEnvelope ( "QPE/System", "busy()" ); | 983 | // QCopEnvelope ( "QPE/System", "busy()" ); |
984 | if( f.right(1) =="/") { | 984 | if( f.right(1) =="/") { |
985 | QString path= currentRemoteDir+f; | 985 | QString path= currentRemoteDir+f; |
986 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" | 986 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" |
987 | ,tr("Yes"),tr("No"),0,0,1) ) { | 987 | ,tr("Yes"),tr("No"),0,0,1) ) { |
988 | case 0: { | 988 | case 0: { |
989 | f=currentDir.canonicalPath()+"/"+f; | 989 | f=currentDir.canonicalPath()+"/"+f; |
990 | if(FtpRmdir( path.latin1(), conn) ==0) { | 990 | if(FtpRmdir( path.latin1(), conn) ==0) { |
991 | QString msg; | 991 | QString msg; |
992 | msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); | 992 | msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); |
993 | msg.replace(QRegExp(":"),"\n"); | 993 | msg.replace(QRegExp(":"),"\n"); |
994 | QMessageBox::message(tr("Note"),msg); | 994 | QMessageBox::message(tr("Note"),msg); |
995 | } | 995 | } |
996 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 996 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
997 | } | 997 | } |
998 | break; | 998 | break; |
999 | }; | 999 | }; |
1000 | } else { | 1000 | } else { |
1001 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" | 1001 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" |
1002 | ,tr("Yes"),tr("No"),0,0,1) ) { | 1002 | ,tr("Yes"),tr("No"),0,0,1) ) { |
1003 | case 0: { | 1003 | case 0: { |
1004 | QString path= currentRemoteDir+f; | 1004 | QString path= currentRemoteDir+f; |
1005 | if(FtpDelete( path.latin1(), conn)==0) { | 1005 | if(FtpDelete( path.latin1(), conn)==0) { |
1006 | QString msg; | 1006 | QString msg; |
1007 | msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); | 1007 | msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); |
1008 | msg.replace(QRegExp(":"),"\n"); | 1008 | msg.replace(QRegExp(":"),"\n"); |
1009 | QMessageBox::message(tr("Note"),msg); | 1009 | QMessageBox::message(tr("Note"),msg); |
1010 | } | 1010 | } |
1011 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 1011 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
1012 | } | 1012 | } |
1013 | break; | 1013 | break; |
1014 | }; | 1014 | }; |
1015 | } | 1015 | } |
1016 | } | 1016 | } |
1017 | } | 1017 | } |
1018 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 1018 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | void OpieFtp::remoteRename() | 1021 | void OpieFtp::remoteRename() |
1022 | { | 1022 | { |
1023 | QString curFile = Remote_View->currentItem()->text(0); | 1023 | QString curFile = Remote_View->currentItem()->text(0); |
1024 | InputDialog *fileDlg; | 1024 | InputDialog *fileDlg; |
1025 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 1025 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
1026 | fileDlg->setTextEdit((const QString &)curFile); | 1026 | fileDlg->setTextEdit((const QString &)curFile); |
1027 | fileDlg->exec(); | 1027 | fileDlg->exec(); |
1028 | if( fileDlg->result() == 1 ) { | 1028 | if( fileDlg->result() == 1 ) { |
1029 | QString oldName = currentRemoteDir +"/"+ curFile; | 1029 | QString oldName = currentRemoteDir +"/"+ curFile; |
1030 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; | 1030 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; |
1031 | // QCopEnvelope ( "QPE/System", "busy()" ); | 1031 | // QCopEnvelope ( "QPE/System", "busy()" ); |
1032 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { | 1032 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { |
1033 | QString msg; | 1033 | QString msg; |
1034 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); | 1034 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); |
1035 | msg.replace(QRegExp(":"),"\n"); | 1035 | msg.replace(QRegExp(":"),"\n"); |
1036 | QMessageBox::message(tr("Note"),msg); | 1036 | QMessageBox::message(tr("Note"),msg); |
1037 | } | 1037 | } |
1038 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 1038 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
1039 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 1039 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
1040 | } | 1040 | } |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | void OpieFtp::localRename() | 1043 | void OpieFtp::localRename() |
1044 | { | 1044 | { |
1045 | QString curFile = Local_View->currentItem()->text(0); | 1045 | QString curFile = Local_View->currentItem()->text(0); |
1046 | InputDialog *fileDlg; | 1046 | InputDialog *fileDlg; |
1047 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 1047 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
1048 | fileDlg->setTextEdit((const QString &)curFile); | 1048 | fileDlg->setTextEdit((const QString &)curFile); |
1049 | fileDlg->exec(); | 1049 | fileDlg->exec(); |
1050 | if( fileDlg->result() == 1 ) { | 1050 | if( fileDlg->result() == 1 ) { |
1051 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 1051 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
1052 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 1052 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
1053 | if( rename(oldname.latin1(), newName.latin1())== -1) | 1053 | if( rename(oldname.latin1(), newName.latin1())== -1) |
1054 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 1054 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
1055 | } | 1055 | } |
1056 | populateLocalView(); | 1056 | populateLocalView(); |
1057 | } | 1057 | } |
1058 | 1058 | ||
1059 | void OpieFtp::currentPathComboActivated(const QString & currentPath) { | 1059 | void OpieFtp::currentPathComboActivated(const QString & currentPath) { |
1060 | if (TabWidget->currentPageIndex() == 0) { | 1060 | if (TabWidget->currentPageIndex() == 0) { |
1061 | chdir( currentPath.latin1() ); | 1061 | chdir( currentPath.latin1() ); |
1062 | currentDir.cd( currentPath, TRUE); | 1062 | currentDir.cd( currentPath, TRUE); |
1063 | populateLocalView(); | 1063 | populateLocalView(); |
1064 | update(); | 1064 | update(); |
1065 | } else { | 1065 | } else { |
1066 | // chdir( currentPath.latin1() ); | 1066 | // chdir( currentPath.latin1() ); |
1067 | // currentDir.cd( currentPath, TRUE); | 1067 | // currentDir.cd( currentPath, TRUE); |
1068 | // populateList(); | 1068 | // populateList(); |
1069 | // update(); | 1069 | // update(); |
1070 | 1070 | ||
1071 | } | 1071 | } |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | void OpieFtp::fillCombo(const QString ¤tPath) { | 1074 | void OpieFtp::fillCombo(const QString ¤tPath) { |
1075 | 1075 | ||
1076 | currentPathCombo->lineEdit()->setText(currentPath); | 1076 | currentPathCombo->lineEdit()->setText(currentPath); |
1077 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 1077 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
1078 | currentPathCombo->clear(); | 1078 | currentPathCombo->clear(); |
1079 | localDirPathStringList.prepend(currentPath ); | 1079 | localDirPathStringList.prepend(currentPath ); |
1080 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 1080 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
1081 | } | 1081 | } |
1082 | currentPathCombo->lineEdit()->setText(currentPath); | 1082 | currentPathCombo->lineEdit()->setText(currentPath); |
1083 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 1083 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
1084 | currentPathCombo->clear(); | 1084 | currentPathCombo->clear(); |
1085 | remoteDirPathStringList.prepend(currentPath ); | 1085 | remoteDirPathStringList.prepend(currentPath ); |
1086 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 1086 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
1087 | } | 1087 | } |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | void OpieFtp::fillRemoteCombo(const QString ¤tPath) { | 1090 | void OpieFtp::fillRemoteCombo(const QString ¤tPath) { |
1091 | 1091 | ||
1092 | currentPathCombo->lineEdit()->setText(currentPath); | 1092 | currentPathCombo->lineEdit()->setText(currentPath); |
1093 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 1093 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
1094 | currentPathCombo->clear(); | 1094 | currentPathCombo->clear(); |
1095 | remoteDirPathStringList.prepend(currentPath ); | 1095 | remoteDirPathStringList.prepend(currentPath ); |
1096 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 1096 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
1097 | } | 1097 | } |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | void OpieFtp::currentPathComboChanged() | 1100 | void OpieFtp::currentPathComboChanged() |
1101 | { | 1101 | { |
1102 | QString oldRemoteCurrentDir = currentRemoteDir; | 1102 | QString oldRemoteCurrentDir = currentRemoteDir; |
1103 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); | 1103 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); |
1104 | if (TabWidget->currentPageIndex() == 0) { | 1104 | if (TabWidget->currentPageIndex() == 0) { |
1105 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 1105 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
1106 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 1106 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
1107 | populateLocalView(); | 1107 | populateLocalView(); |
1108 | } else { | 1108 | } else { |
1109 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 1109 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
1110 | } | 1110 | } |
1111 | } | 1111 | } |
1112 | if (TabWidget->currentPageIndex() == 1) { | 1112 | if (TabWidget->currentPageIndex() == 1) { |
1113 | currentRemoteDir = currentPathCombo->lineEdit()->text(); | 1113 | currentRemoteDir = currentPathCombo->lineEdit()->text(); |
1114 | if(currentRemoteDir.right(1) !="/") { | 1114 | if(currentRemoteDir.right(1) !="/") { |
1115 | currentRemoteDir = currentRemoteDir +"/"; | 1115 | currentRemoteDir = currentRemoteDir +"/"; |
1116 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 1116 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
1117 | } | 1117 | } |
1118 | if( !remoteChDir( (const QString &)currentRemoteDir) ) { | 1118 | if( !remoteChDir( (const QString &)currentRemoteDir) ) { |
1119 | currentRemoteDir = oldRemoteCurrentDir; | 1119 | currentRemoteDir = oldRemoteCurrentDir; |
1120 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 1120 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
1121 | } | 1121 | } |