author | llornkcor <llornkcor> | 2002-03-13 02:45:30 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-13 02:45:30 (UTC) |
commit | fac27f0d83dd361e27bacdf552932c9ea60e66e8 (patch) (unidiff) | |
tree | 3910ee937e9bc2b018b30f9b521b7f38cdcf2124 | |
parent | fc49c34cfd2ce2adad2920daa368b25f42b8bad7 (diff) | |
download | opie-fac27f0d83dd361e27bacdf552932c9ea60e66e8.zip opie-fac27f0d83dd361e27bacdf552932c9ea60e66e8.tar.gz opie-fac27f0d83dd361e27bacdf552932c9ea60e66e8.tar.bz2 |
fixed crash bug when remote directory doesn't exist. Fixed progess bar indicator
continuing on dir listings after an upload/download.
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 114 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 3 |
2 files changed, 79 insertions, 38 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index e1dd582..0cdac79 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,728 +1,766 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | opieftp.cpp | 2 | opieftp.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | 12 | ||
13 | #include "opieftp.h" | 13 | #include "opieftp.h" |
14 | #include "ftplib.h" | 14 | #include "ftplib.h" |
15 | #include "inputDialog.h" | 15 | #include "inputDialog.h" |
16 | 16 | ||
17 | #include <qpe/qpemenubar.h> | 17 | #include <qpe/qpemenubar.h> |
18 | #include <qpe/qpetoolbar.h> | 18 | #include <qpe/qpetoolbar.h> |
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
21 | #include <qpe/qcopenvelope_qws.h> | 21 | #include <qpe/qcopenvelope_qws.h> |
22 | 22 | ||
23 | #include <qtextstream.h> | 23 | #include <qtextstream.h> |
24 | #include <qtoolbutton.h> | 24 | #include <qtoolbutton.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qdir.h> | 26 | #include <qdir.h> |
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
30 | #include <qpopupmenu.h> | 30 | #include <qpopupmenu.h> |
31 | #include <qlistview.h> | 31 | #include <qlistview.h> |
32 | #include <qmainwindow.h> | 32 | #include <qmainwindow.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qprogressbar.h> | 34 | #include <qprogressbar.h> |
35 | #include <qspinbox.h> | 35 | #include <qspinbox.h> |
36 | #include <qtabwidget.h> | 36 | #include <qtabwidget.h> |
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | #include <qimage.h> | 39 | #include <qimage.h> |
40 | #include <qpixmap.h> | 40 | #include <qpixmap.h> |
41 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
42 | #include <qlineedit.h> | 42 | #include <qlineedit.h> |
43 | #include <qregexp.h> | ||
43 | 44 | ||
44 | #include <unistd.h> | 45 | #include <unistd.h> |
45 | #include <stdlib.h> | 46 | #include <stdlib.h> |
46 | 47 | ||
47 | QProgressBar *ProgressBar; | 48 | QProgressBar *ProgressBar; |
48 | static netbuf *conn=NULL; | 49 | static netbuf *conn=NULL; |
49 | 50 | ||
50 | static int log_progress(netbuf *ctl, int xfered, void *arg) | 51 | static int log_progress(netbuf *ctl, int xfered, void *arg) |
51 | { | 52 | { |
52 | int fsz = *(int *)arg; | 53 | int fsz = *(int *)arg; |
53 | int pct = (xfered * 100) / fsz; | 54 | int pct = (xfered * 100) / fsz; |
54 | // printf("%3d%%\r", pct); | 55 | // printf("%3d%%\r", pct); |
55 | // fflush(stdout); | 56 | // fflush(stdout); |
56 | ProgressBar->setProgress(xfered); | 57 | ProgressBar->setProgress(xfered); |
57 | qApp->processEvents(); | 58 | qApp->processEvents(); |
58 | return 1; | 59 | return 1; |
59 | } | 60 | } |
60 | 61 | ||
61 | OpieFtp::OpieFtp( ) | 62 | OpieFtp::OpieFtp( ) |
62 | : QMainWindow( ) | 63 | : QMainWindow( ) |
63 | { | 64 | { |
64 | resize( 236, 290 ); | 65 | resize( 236, 290 ); |
65 | setMaximumSize( QSize( 240, 320 ) ); | 66 | setMaximumSize( QSize( 240, 320 ) ); |
66 | setCaption( tr( "OpieFtp" ) ); | 67 | setCaption( tr( "OpieFtp" ) ); |
67 | 68 | ||
68 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 69 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
69 | 70 | ||
70 | QPEMenuBar *menuBar = new QPEMenuBar( this ); | 71 | QPEMenuBar *menuBar = new QPEMenuBar( this ); |
71 | connectionMenu = new QPopupMenu( this ); | 72 | connectionMenu = new QPopupMenu( this ); |
72 | localMenu = new QPopupMenu( this ); | 73 | localMenu = new QPopupMenu( this ); |
73 | remoteMenu = new QPopupMenu( this ); | 74 | remoteMenu = new QPopupMenu( this ); |
74 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 75 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
75 | menuBar->insertItem( tr( "Local" ), localMenu); | 76 | menuBar->insertItem( tr( "Local" ), localMenu); |
76 | menuBar->insertItem( tr( "Remote" ), remoteMenu); | 77 | menuBar->insertItem( tr( "Remote" ), remoteMenu); |
77 | 78 | ||
78 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 79 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
79 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 80 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
80 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 81 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
81 | 82 | ||
82 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 83 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
83 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 84 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
84 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 85 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
85 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 86 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
86 | localMenu->insertSeparator(); | 87 | localMenu->insertSeparator(); |
87 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 88 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
88 | 89 | ||
89 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 90 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
90 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 91 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
91 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 92 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
92 | remoteMenu->insertSeparator(); | 93 | remoteMenu->insertSeparator(); |
93 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 94 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
94 | 95 | ||
95 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 96 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
96 | ProgressBar->setGeometry( QRect( 5, 268, 231, 15 ) ); | 97 | ProgressBar->setGeometry( QRect( 5, 268, 231, 15 ) ); |
97 | 98 | ||
98 | TabWidget = new QTabWidget( this, "TabWidget2" ); | 99 | TabWidget = new QTabWidget( this, "TabWidget2" ); |
99 | TabWidget->setGeometry( QRect( 3, 25, 240, 220 ) ); | 100 | TabWidget->setGeometry( QRect( 3, 25, 240, 220 ) ); |
100 | TabWidget->setTabShape(QTabWidget::Triangular); | 101 | TabWidget->setTabShape(QTabWidget::Triangular); |
101 | 102 | ||
102 | tab = new QWidget( TabWidget, "tab" ); | 103 | tab = new QWidget( TabWidget, "tab" ); |
103 | 104 | ||
104 | Local_View = new QListView( tab, "Local_View" ); | 105 | Local_View = new QListView( tab, "Local_View" ); |
105 | Local_View->setGeometry( QRect( 3, 2, 225, 195 ) ); | 106 | Local_View->setGeometry( QRect( 3, 2, 225, 195 ) ); |
106 | Local_View->addColumn( "File",120); | 107 | Local_View->addColumn( "File",120); |
107 | Local_View->addColumn( "Size",-1); | 108 | Local_View->addColumn( "Size",-1); |
108 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 109 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
109 | Local_View->addColumn( "Date",-1); | 110 | Local_View->addColumn( "Date",-1); |
110 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 111 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
111 | Local_View->setAllColumnsShowFocus(TRUE); | 112 | Local_View->setAllColumnsShowFocus(TRUE); |
112 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 113 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
113 | 114 | ||
114 | connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 115 | connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
115 | this,SLOT( localListClicked(QListViewItem *)) ); | 116 | this,SLOT( localListClicked(QListViewItem *)) ); |
116 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 117 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
117 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 118 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
118 | 119 | ||
119 | TabWidget->insertTab( tab, tr( "Local" ) ); | 120 | TabWidget->insertTab( tab, tr( "Local" ) ); |
120 | 121 | ||
121 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 122 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
122 | 123 | ||
123 | Remote_View = new QListView( tab_2, "Remote_View" ); | 124 | Remote_View = new QListView( tab_2, "Remote_View" ); |
124 | Remote_View->setGeometry( QRect( 3, 2, 225, 195 ) ); | 125 | Remote_View->setGeometry( QRect( 3, 2, 225, 195 ) ); |
125 | Remote_View->addColumn( "File",120); | 126 | Remote_View->addColumn( "File",120); |
126 | Remote_View->addColumn( "Size",-1); | 127 | Remote_View->addColumn( "Size",-1); |
127 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 128 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
128 | Remote_View->addColumn( "Date",-1); | 129 | Remote_View->addColumn( "Date",-1); |
129 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 130 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
130 | Remote_View->setAllColumnsShowFocus(TRUE); | 131 | Remote_View->setAllColumnsShowFocus(TRUE); |
131 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 132 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
132 | 133 | ||
133 | connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), | 134 | connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), |
134 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 135 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
135 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 136 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
136 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 137 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
137 | 138 | ||
138 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 139 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
139 | 140 | ||
140 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 141 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
141 | 142 | ||
142 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 143 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
143 | TextLabel1->setGeometry( QRect( 10, 10, 60, 16 ) ); | 144 | TextLabel1->setGeometry( QRect( 10, 10, 60, 16 ) ); |
144 | TextLabel1->setText( tr( "Username" ) ); | 145 | TextLabel1->setText( tr( "Username" ) ); |
145 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 146 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
146 | UsernameComboBox->setGeometry( QRect( 10, 25, 196, 21 ) ); | 147 | UsernameComboBox->setGeometry( QRect( 10, 25, 196, 21 ) ); |
147 | UsernameComboBox->setEditable(TRUE); | 148 | UsernameComboBox->setEditable(TRUE); |
148 | UsernameComboBox->lineEdit()->setText("root"); | 149 | UsernameComboBox->lineEdit()->setText("llornkcor"); |
149 | 150 | ||
150 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 151 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
151 | TextLabel2->setGeometry( QRect( 10, 50, 65, 16 ) ); | 152 | TextLabel2->setGeometry( QRect( 10, 50, 65, 16 ) ); |
152 | TextLabel2->setText( tr( "Password" ) ); | 153 | TextLabel2->setText( tr( "Password" ) ); |
153 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 154 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
154 | PasswordEdit->setGeometry( QRect( 10, 65, 195, 16 ) ); | 155 | PasswordEdit->setGeometry( QRect( 10, 65, 195, 16 ) ); |
155 | PasswordEdit->setEchoMode(QLineEdit::Password); | 156 | PasswordEdit->setEchoMode(QLineEdit::Password); |
156 | 157 | ||
157 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 158 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
158 | TextLabel3->setGeometry( QRect( 10, 90, 95, 16 ) ); | 159 | TextLabel3->setGeometry( QRect( 10, 90, 95, 16 ) ); |
159 | TextLabel3->setText( tr( "Remote server" ) ); | 160 | TextLabel3->setText( tr( "Remote server" ) ); |
160 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 161 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
161 | ServerComboBox->setGeometry( QRect( 10, 105, 195, 21 ) ); | 162 | ServerComboBox->setGeometry( QRect( 10, 105, 195, 21 ) ); |
162 | ServerComboBox->setEditable(TRUE); | 163 | ServerComboBox->setEditable(TRUE); |
163 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | 164 | ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); |
164 | 165 | ||
165 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 166 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
166 | TextLabel5->setGeometry( QRect( 10, 130, 95, 16 ) ); | 167 | TextLabel5->setGeometry( QRect( 10, 130, 95, 16 ) ); |
167 | TextLabel5->setText( tr( "Remote path" ) ); | 168 | TextLabel5->setText( tr( "Remote path" ) ); |
168 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 169 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
169 | remotePath->setGeometry( QRect( 10, 145, 195, 16 ) ); | 170 | remotePath->setGeometry( QRect( 10, 145, 195, 16 ) ); |
170 | remotePath->setText( currentRemoteDir = "/"); | 171 | remotePath->setText( currentRemoteDir = "/home/llornkcor/"); |
171 | 172 | ||
172 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 173 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
173 | TextLabel4->setGeometry( QRect( 10, 170, 30, 21 ) ); | 174 | TextLabel4->setGeometry( QRect( 10, 170, 30, 21 ) ); |
174 | TextLabel4->setText( tr( "Port" ) ); | 175 | TextLabel4->setText( tr( "Port" ) ); |
175 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 176 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
176 | PortSpinBox->setGeometry( QRect( 40, 175, 75, 20 ) ); | 177 | PortSpinBox->setGeometry( QRect( 40, 175, 75, 20 ) ); |
177 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 178 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
178 | PortSpinBox->setMaxValue(32786); | 179 | PortSpinBox->setMaxValue(32786); |
179 | PortSpinBox->setValue( 4242 ); | 180 | PortSpinBox->setValue( 21); |
181 | |||
180 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 182 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
181 | 183 | ||
182 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 184 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
183 | this,SLOT(tabChanged(QWidget*))); | 185 | this,SLOT(tabChanged(QWidget*))); |
184 | 186 | ||
185 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 187 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
186 | currentDir.setPath( QDir::currentDirPath()); | 188 | currentDir.setPath( QDir::currentDirPath()); |
187 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 189 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
188 | currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); | 190 | currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); |
189 | currentPathEdit->setGeometry( QRect( 5, 248, 220, 18 ) ); | 191 | currentPathEdit->setGeometry( QRect( 5, 248, 220, 18 ) ); |
190 | currentPathEdit->setText( currentDir.canonicalPath()); | 192 | currentPathEdit->setText( currentDir.canonicalPath()); |
191 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); | 193 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); |
192 | 194 | ||
193 | filterStr="*"; | 195 | filterStr="*"; |
194 | populateLocalView(); | 196 | populateLocalView(); |
195 | } | 197 | } |
196 | 198 | ||
197 | OpieFtp::~OpieFtp() | 199 | OpieFtp::~OpieFtp() |
198 | { | 200 | { |
199 | } | 201 | } |
200 | 202 | ||
201 | void OpieFtp::cleanUp() | 203 | void OpieFtp::cleanUp() |
202 | { | 204 | { |
203 | if(conn) | 205 | if(conn) |
204 | FtpQuit(conn); | 206 | FtpQuit(conn); |
205 | QFile f("./._temp"); | 207 | QFile f("./._temp"); |
206 | if(f.exists()) | 208 | if(f.exists()) |
207 | f. remove(); | 209 | f. remove(); |
208 | } | 210 | } |
209 | 211 | ||
210 | void OpieFtp::tabChanged(QWidget *w) | 212 | void OpieFtp::tabChanged(QWidget *w) |
211 | { | 213 | { |
212 | if (TabWidget->currentPageIndex() == 0) { | 214 | if (TabWidget->currentPageIndex() == 0) { |
213 | currentPathEdit->setText( currentDir.canonicalPath()); | 215 | currentPathEdit->setText( currentDir.canonicalPath()); |
214 | } else if (TabWidget->currentPageIndex() == 1) { | 216 | } else if (TabWidget->currentPageIndex() == 1) { |
215 | currentPathEdit->setText( currentRemoteDir ); | 217 | currentPathEdit->setText( currentRemoteDir ); |
216 | } | 218 | } |
217 | } | 219 | } |
218 | 220 | ||
219 | void OpieFtp::localUpload() | 221 | void OpieFtp::localUpload() |
220 | { | 222 | { |
221 | int fsz; | 223 | int fsz; |
222 | QCopEnvelope ( "QPE/System", "busy()" ); | 224 | QCopEnvelope ( "QPE/System", "busy()" ); |
223 | qApp->processEvents(); | 225 | qApp->processEvents(); |
224 | QString strItem = Local_View->currentItem()->text(0); | 226 | QString strItem = Local_View->currentItem()->text(0); |
225 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 227 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
226 | QString remoteFile= currentRemoteDir+strItem; | 228 | QString remoteFile= currentRemoteDir+strItem; |
227 | QFileInfo fi(localFile); | 229 | QFileInfo fi(localFile); |
228 | if( !fi.isDir()) { | 230 | if( !fi.isDir()) { |
229 | fsz=fi.size(); | 231 | fsz=fi.size(); |
230 | ProgressBar->setTotalSteps(fsz); | 232 | ProgressBar->setTotalSteps(fsz); |
231 | 233 | ||
232 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 234 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
233 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 235 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
234 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 236 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
235 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 237 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
236 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); | 238 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); |
237 | 239 | ||
238 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 240 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
239 | QString msg; | 241 | QString msg; |
240 | msg.sprintf("Unable to upload\n%s",FtpLastResponse(conn)); | 242 | msg.sprintf("Unable to upload\n%s",FtpLastResponse(conn)); |
241 | QMessageBox::message("Note",msg); | 243 | msg.replace(QRegExp(":"),"\n"); |
242 | FtpQuit(conn); | 244 | QMessageBox::message("Note",msg); |
243 | } | 245 | // FtpQuit(conn); |
244 | ProgressBar->reset(); | 246 | } |
247 | ProgressBar->reset(); | ||
248 | nullifyCallBack(); | ||
245 | } else { | 249 | } else { |
246 | QMessageBox::message("Note","Cannot upload directories"); | 250 | QMessageBox::message("Note","Cannot upload directories"); |
247 | } | 251 | } |
248 | TabWidget->setCurrentPage(1); | 252 | TabWidget->setCurrentPage(1); |
249 | populateRemoteView(); | 253 | populateRemoteView(); |
250 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 254 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
251 | } | 255 | } |
252 | 256 | ||
257 | void OpieFtp::nullifyCallBack() { | ||
258 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); | ||
259 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); | ||
260 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); | ||
261 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); | ||
262 | |||
263 | } | ||
264 | |||
253 | void OpieFtp::remoteDownload() | 265 | void OpieFtp::remoteDownload() |
254 | { | 266 | { |
255 | int fsz; | 267 | int fsz; |
256 | QCopEnvelope ( "QPE/System", "busy()" ); | 268 | QCopEnvelope ( "QPE/System", "busy()" ); |
257 | qApp->processEvents(); | 269 | qApp->processEvents(); |
258 | QString strItem = Remote_View->currentItem()->text(0); | 270 | QString strItem = Remote_View->currentItem()->text(0); |
259 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 271 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
260 | QString remoteFile= currentRemoteDir+strItem; | 272 | QString remoteFile= currentRemoteDir+strItem; |
261 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 273 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
262 | fsz = 0; | 274 | fsz = 0; |
263 | QString temp; | 275 | QString temp; |
264 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 276 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
265 | 277 | ||
266 | ProgressBar->setTotalSteps(fsz); | 278 | ProgressBar->setTotalSteps(fsz); |
267 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 279 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
268 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 280 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
269 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 281 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
270 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 282 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
271 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 283 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); |
272 | 284 | ||
273 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 285 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
274 | QString msg; | 286 | QString msg; |
275 | msg.sprintf("Unable to download \n%s",FtpLastResponse(conn)); | 287 | msg.sprintf("Unable to download \n%s",FtpLastResponse(conn)); |
288 | msg.replace(QRegExp(":"),"\n"); | ||
276 | QMessageBox::message("Note",msg); | 289 | QMessageBox::message("Note",msg); |
277 | FtpQuit(conn); | 290 | // FtpQuit(conn); |
278 | } | 291 | } |
279 | ProgressBar->reset(); | 292 | ProgressBar->reset(); |
293 | nullifyCallBack(); | ||
280 | TabWidget->setCurrentPage(0); | 294 | TabWidget->setCurrentPage(0); |
281 | populateLocalView(); | 295 | populateLocalView(); |
282 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 296 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
283 | } | 297 | } |
284 | 298 | ||
285 | 299 | ||
286 | void OpieFtp::newConnection() | 300 | void OpieFtp::newConnection() |
287 | { | 301 | { |
288 | TabWidget->setCurrentPage(2); | 302 | TabWidget->setCurrentPage(2); |
289 | } | 303 | } |
290 | 304 | ||
291 | void OpieFtp::connector() | 305 | void OpieFtp::connector() |
292 | { | 306 | { |
293 | QCopEnvelope ( "QPE/System", "busy()" ); | 307 | QCopEnvelope ( "QPE/System", "busy()" ); |
294 | qApp->processEvents(); | 308 | qApp->processEvents(); |
295 | currentRemoteDir=remotePath->text(); | 309 | currentRemoteDir=remotePath->text(); |
296 | if(ServerComboBox->currentText().isEmpty()) { | 310 | if(ServerComboBox->currentText().isEmpty()) { |
297 | QMessageBox::warning(this,"Ftp","Please set the server info","Ok",0,0); | 311 | QMessageBox::warning(this,"Ftp","Please set the server info","Ok",0,0); |
298 | TabWidget->setCurrentPage(2); | 312 | TabWidget->setCurrentPage(2); |
299 | ServerComboBox->setFocus(); | 313 | ServerComboBox->setFocus(); |
300 | return; | 314 | return; |
301 | } | 315 | } |
302 | FtpInit(); | 316 | FtpInit(); |
303 | TabWidget->setCurrentPage(1); | 317 | TabWidget->setCurrentPage(1); |
304 | QString ftp_host = ServerComboBox->currentText(); | 318 | QString ftp_host = ServerComboBox->currentText(); |
305 | QString ftp_user = UsernameComboBox->currentText(); | 319 | QString ftp_user = UsernameComboBox->currentText(); |
306 | QString ftp_pass = PasswordEdit->text(); | 320 | QString ftp_pass = PasswordEdit->text(); |
307 | QString port=PortSpinBox->cleanText(); | 321 | QString port=PortSpinBox->cleanText(); |
308 | port.stripWhiteSpace(); | 322 | port.stripWhiteSpace(); |
309 | 323 | ||
310 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) | 324 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) |
311 | ftp_host=ftp_host.right(ftp_host.length()-6); | 325 | ftp_host=ftp_host.right(ftp_host.length()-6); |
312 | ftp_host+=":"+port; | 326 | ftp_host+=":"+port; |
313 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | 327 | if (!FtpConnect( ftp_host.latin1(), &conn)) { |
314 | QMessageBox::message("Note","Unable to connect to\n"+ftp_host); | 328 | QMessageBox::message("Note","Unable to connect to\n"+ftp_host); |
315 | return ; | 329 | return ; |
316 | } | 330 | } |
317 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 331 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
318 | QString msg; | 332 | QString msg; |
319 | msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn)); | 333 | msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn)); |
334 | msg.replace(QRegExp(":"),"\n"); | ||
320 | QMessageBox::message("Note",msg); | 335 | QMessageBox::message("Note",msg); |
321 | FtpQuit(conn); | 336 | FtpQuit(conn); |
322 | return ; | 337 | return ; |
323 | } | 338 | } |
324 | remoteDirList("/") ; | 339 | remoteDirList("/") ; |
325 | setCaption(ftp_host); | 340 | setCaption(ftp_host); |
326 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 341 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
327 | } | 342 | } |
328 | 343 | ||
329 | void OpieFtp::disConnector() | 344 | void OpieFtp::disConnector() |
330 | { | 345 | { |
331 | FtpQuit(conn); | 346 | FtpQuit(conn); |
332 | setCaption("OpieFtp"); | 347 | setCaption("OpieFtp"); |
333 | currentRemoteDir="/"; | 348 | currentRemoteDir="/"; |
334 | Remote_View->clear(); | 349 | Remote_View->clear(); |
335 | } | 350 | } |
336 | 351 | ||
337 | bool OpieFtp::remoteDirList(const QString &dir) | 352 | bool OpieFtp::remoteDirList(const QString &dir) |
338 | { | 353 | { |
339 | QCopEnvelope ( "QPE/System", "busy()" ); | 354 | QCopEnvelope ( "QPE/System", "busy()" ); |
340 | if (!FtpDir( "./._temp", dir.latin1(), conn) ) { | 355 | if (!FtpDir( "./._temp", dir.latin1(), conn) ) { |
341 | QString msg; | 356 | QString msg; |
342 | msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn) ); | 357 | msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn) ); |
358 | msg.replace(QRegExp(":"),"\n"); | ||
343 | QMessageBox::message("Note",msg); | 359 | QMessageBox::message("Note",msg); |
344 | FtpQuit(conn); | 360 | // FtpQuit(conn); |
345 | return false; | 361 | return false; |
346 | } | 362 | } |
347 | populateRemoteView(); | 363 | populateRemoteView(); |
348 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 364 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
349 | return true; | 365 | return true; |
350 | } | 366 | } |
351 | 367 | ||
352 | bool OpieFtp::remoteChDir(const QString &dir) | 368 | bool OpieFtp::remoteChDir(const QString &dir) |
353 | { | 369 | { |
354 | QCopEnvelope ( "QPE/System", "busy()" ); | 370 | QCopEnvelope ( "QPE/System", "busy()" ); |
355 | if (!FtpChdir( dir.latin1(), conn )) { | 371 | if (!FtpChdir( dir.latin1(), conn )) { |
356 | QString msg; | 372 | QString msg; |
357 | msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); | 373 | msg.sprintf("Unable to change directories\n"+dir+"\n%s",FtpLastResponse(conn)); |
374 | msg.replace(QRegExp(":"),"\n"); | ||
358 | QMessageBox::message("Note",msg); | 375 | QMessageBox::message("Note",msg); |
359 | FtpQuit(conn); | 376 | qDebug(msg); |
377 | // FtpQuit(conn); | ||
360 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 378 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
361 | return FALSE; | 379 | return FALSE; |
362 | } | 380 | } |
363 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 381 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
364 | return TRUE; | 382 | return TRUE; |
365 | } | 383 | } |
366 | 384 | ||
367 | void OpieFtp::populateLocalView() | 385 | void OpieFtp::populateLocalView() |
368 | { | 386 | { |
369 | Local_View->clear(); | 387 | Local_View->clear(); |
370 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 388 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
371 | currentDir.setMatchAllDirs(TRUE); | 389 | currentDir.setMatchAllDirs(TRUE); |
372 | currentDir.setNameFilter(filterStr); | 390 | currentDir.setNameFilter(filterStr); |
373 | QString fileL, fileS, fileDate; | 391 | QString fileL, fileS, fileDate; |
374 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 392 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
375 | QFileInfoListIterator it(*list); | 393 | QFileInfoListIterator it(*list); |
376 | QFileInfo *fi; | 394 | QFileInfo *fi; |
377 | while ( (fi=it.current()) ) { | 395 | while ( (fi=it.current()) ) { |
378 | if (fi->isSymLink() ){ | 396 | if (fi->isSymLink() ){ |
379 | QString symLink=fi->readLink(); | 397 | QString symLink=fi->readLink(); |
380 | // qDebug("Symlink detected "+symLink); | 398 | // qDebug("Symlink detected "+symLink); |
381 | QFileInfo sym( symLink); | 399 | QFileInfo sym( symLink); |
382 | fileS.sprintf( "%10li", sym.size() ); | 400 | fileS.sprintf( "%10li", sym.size() ); |
383 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 401 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
384 | fileDate = sym.lastModified().toString(); | 402 | fileDate = sym.lastModified().toString(); |
385 | } else { | 403 | } else { |
386 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 404 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
387 | fileS.sprintf( "%10li", fi->size() ); | 405 | fileS.sprintf( "%10li", fi->size() ); |
388 | fileL.sprintf( "%s",fi->fileName().data() ); | 406 | fileL.sprintf( "%s",fi->fileName().data() ); |
389 | fileDate= fi->lastModified().toString(); | 407 | fileDate= fi->lastModified().toString(); |
390 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 408 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
391 | fileL+="/"; | 409 | fileL+="/"; |
392 | // qDebug( fileL); | 410 | // qDebug( fileL); |
393 | } | 411 | } |
394 | } | 412 | } |
395 | item= new QListViewItem( Local_View,fileL,fileS, fileDate); | 413 | item= new QListViewItem( Local_View,fileL,fileS, fileDate); |
396 | ++it; | 414 | ++it; |
397 | } | 415 | } |
398 | Local_View->setSorting( 3,FALSE); | 416 | Local_View->setSorting( 3,FALSE); |
399 | currentPathEdit->setText( currentDir.canonicalPath() ); | 417 | currentPathEdit->setText( currentDir.canonicalPath() ); |
400 | } | 418 | } |
401 | 419 | ||
402 | bool OpieFtp::populateRemoteView() | 420 | bool OpieFtp::populateRemoteView() |
403 | { | 421 | { |
404 | Remote_View->clear(); | 422 | Remote_View->clear(); |
405 | QFile tmp("./._temp"); | 423 | QFile tmp("./._temp"); |
406 | QString s, File_Name; | 424 | QString s, File_Name; |
407 | QString fileL, fileS, fileDate; | 425 | QString fileL, fileS, fileDate; |
408 | new QListViewItem( Remote_View, "../"); | 426 | new QListViewItem( Remote_View, "../"); |
409 | if (tmp.open(IO_ReadOnly)) { | 427 | if (tmp.open(IO_ReadOnly)) { |
410 | QTextStream t( &tmp ); // use a text stream | 428 | QTextStream t( &tmp ); // use a text stream |
411 | while ( !t.eof()) { | 429 | while ( !t.eof()) { |
412 | s = t.readLine(); | 430 | s = t.readLine(); |
413 | fileL = s.right(s.length()-55); | 431 | fileL = s.right(s.length()-55); |
414 | fileL = fileL.stripWhiteSpace(); | 432 | fileL = fileL.stripWhiteSpace(); |
415 | if(s.left(1) == "d") | 433 | if(s.left(1) == "d") |
416 | fileL = fileL+"/"; | 434 | fileL = fileL+"/"; |
417 | fileS = s.mid( 30, 42-30); | 435 | fileS = s.mid( 30, 42-30); |
418 | fileS = fileS.stripWhiteSpace(); | 436 | fileS = fileS.stripWhiteSpace(); |
419 | fileDate = s.mid( 42, 55-42); | 437 | fileDate = s.mid( 42, 55-42); |
420 | fileDate = fileDate.stripWhiteSpace(); | 438 | fileDate = fileDate.stripWhiteSpace(); |
421 | if(fileL.find("total",0,TRUE) == -1) | 439 | if(fileL.find("total",0,TRUE) == -1) |
422 | new QListViewItem( Remote_View, fileL, fileS, fileDate); | 440 | new QListViewItem( Remote_View, fileL, fileS, fileDate); |
423 | } | 441 | } |
424 | tmp.close(); | 442 | tmp.close(); |
425 | } | 443 | } |
426 | return true; | 444 | return true; |
427 | } | 445 | } |
428 | 446 | ||
429 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 447 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
430 | { | 448 | { |
431 | QCopEnvelope ( "QPE/System", "busy()" ); | 449 | QCopEnvelope ( "QPE/System", "busy()" ); |
450 | QString oldRemoteCurrentDir = currentRemoteDir; | ||
432 | QString strItem=selectedItem->text(0); | 451 | QString strItem=selectedItem->text(0); |
433 | strItem=strItem.simplifyWhiteSpace(); | 452 | strItem=strItem.simplifyWhiteSpace(); |
434 | if(strItem == "../") { | 453 | if(strItem == "../") { // the user wants to go ^ |
435 | if( FtpCDUp( conn) == 0) { | 454 | if( FtpCDUp( conn) == 0) { |
436 | QString msg; | 455 | QString msg; |
437 | msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn)); | 456 | msg.sprintf("Unable to cd up\n%s",FtpLastResponse(conn)); |
457 | msg.replace(QRegExp(":"),"\n"); | ||
438 | QMessageBox::message("Note",msg); | 458 | QMessageBox::message("Note",msg); |
459 | qDebug(msg); | ||
439 | } | 460 | } |
440 | char path[256]; | 461 | char path[256]; |
441 | if( FtpPwd( path,sizeof(path),conn) == 0) { | 462 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
442 | QString msg; | 463 | QString msg; |
443 | msg.sprintf("Unable to get working dir\n%s",FtpLastResponse(conn)); | 464 | msg.sprintf("Unable to get working dir\n%s",FtpLastResponse(conn)); |
465 | msg.replace(QRegExp(":"),"\n"); | ||
444 | QMessageBox::message("Note",msg); | 466 | QMessageBox::message("Note",msg); |
467 | qDebug(msg); | ||
445 | } | 468 | } |
446 | currentRemoteDir=path; | 469 | currentRemoteDir=path; |
447 | } else { | 470 | } else { |
448 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | 471 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers |
449 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE)-3 ); | 472 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); |
450 | strItem = strItem.stripWhiteSpace(); | 473 | strItem = strItem.stripWhiteSpace(); |
451 | currentRemoteDir = strItem; | 474 | currentRemoteDir = strItem; |
452 | if( remoteChDir( (const QString &)strItem) ==0) { | 475 | if( !remoteChDir( (const QString &)strItem)) { |
453 | QString msg; | 476 | currentRemoteDir = oldRemoteCurrentDir; |
454 | msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn)); | 477 | strItem=""; |
455 | QMessageBox::message("Note",msg); | 478 | populateRemoteView(); |
456 | } | 479 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
457 | } else if(strItem.find("/",0,TRUE) != -1) { | ||
458 | if( remoteChDir( (const QString &)currentRemoteDir+strItem) ==0) { | ||
459 | QString msg; | ||
460 | msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn)); | ||
461 | QMessageBox::message("Note",msg); | ||
462 | } | 480 | } |
481 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | ||
482 | qDebug("trying directory"); | ||
483 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | ||
484 | currentRemoteDir = oldRemoteCurrentDir; | ||
485 | strItem=""; | ||
486 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | ||
487 | |||
488 | populateRemoteView(); | ||
489 | } else { | ||
463 | currentRemoteDir = currentRemoteDir+strItem; | 490 | currentRemoteDir = currentRemoteDir+strItem; |
491 | } | ||
464 | } else { | 492 | } else { |
465 | qDebug("download "+strItem); | 493 | qDebug("download "+strItem); |
466 | } | 494 | } |
467 | } | 495 | } |
468 | if(currentRemoteDir.right(1) !="/") | 496 | if(currentRemoteDir.right(1) !="/") |
469 | currentRemoteDir +="/"; | 497 | currentRemoteDir +="/"; |
470 | currentPathEdit->setText( currentRemoteDir ); | 498 | currentPathEdit->setText( currentRemoteDir ); |
471 | remoteDirList( (const QString &)currentRemoteDir); | 499 | remoteDirList( (const QString &)currentRemoteDir); |
472 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 500 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
473 | } | 501 | } |
474 | 502 | ||
475 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 503 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
476 | { | 504 | { |
477 | QString strItem=selectedItem->text(0); | 505 | QString strItem=selectedItem->text(0); |
478 | QString strSize=selectedItem->text(1); | 506 | QString strSize=selectedItem->text(1); |
479 | strSize=strSize.stripWhiteSpace(); | 507 | strSize=strSize.stripWhiteSpace(); |
480 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 508 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
481 | // is symlink | 509 | // is symlink |
482 | QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); | 510 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
483 | if(QDir(strItem2).exists() ) { | 511 | if(QDir(strItem2).exists() ) { |
484 | currentDir.cd(strItem2, TRUE); | 512 | currentDir.cd(strItem2, TRUE); |
485 | populateLocalView(); | 513 | populateLocalView(); |
486 | } | 514 | } |
487 | } else { // not a symlink | 515 | } else { // not a symlink |
488 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 516 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
489 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 517 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
490 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 518 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
491 | currentDir.cd(strItem,FALSE); | 519 | currentDir.cd(strItem,FALSE); |
492 | populateLocalView(); | 520 | populateLocalView(); |
493 | } else { | 521 | } else { |
494 | currentDir.cdUp(); | 522 | currentDir.cdUp(); |
495 | populateLocalView(); | 523 | populateLocalView(); |
496 | } | 524 | } |
497 | if(QDir(strItem).exists()){ | 525 | if(QDir(strItem).exists()){ |
498 | currentDir.cd(strItem, TRUE); | 526 | currentDir.cd(strItem, TRUE); |
499 | populateLocalView(); | 527 | populateLocalView(); |
500 | } | 528 | } |
501 | } else { | 529 | } else { |
502 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 530 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
503 | if( QFile::exists(strItem ) ) { | 531 | if( QFile::exists(strItem ) ) { |
504 | qDebug("upload "+strItem); | 532 | qDebug("upload "+strItem); |
505 | } | 533 | } |
506 | } //end not symlink | 534 | } //end not symlink |
507 | chdir(strItem.latin1()); | 535 | chdir(strItem.latin1()); |
508 | } | 536 | } |
509 | } | 537 | } |
510 | 538 | ||
511 | void OpieFtp::showHidden() | 539 | void OpieFtp::showHidden() |
512 | { | 540 | { |
513 | if (!b) { | 541 | if (!b) { |
514 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 542 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
515 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 543 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
516 | b=TRUE; | 544 | b=TRUE; |
517 | 545 | ||
518 | } else { | 546 | } else { |
519 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 547 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
520 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 548 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
521 | b=FALSE; | 549 | b=FALSE; |
522 | } | 550 | } |
523 | populateLocalView(); | 551 | populateLocalView(); |
524 | } | 552 | } |
525 | 553 | ||
526 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 554 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
527 | { | 555 | { |
528 | switch (mouse) { | 556 | switch (mouse) { |
529 | case 1: | 557 | case 1: |
530 | break; | 558 | break; |
531 | case 2: | 559 | case 2: |
532 | showLocalMenu(); | 560 | showLocalMenu(); |
533 | break; | 561 | break; |
534 | }; | 562 | }; |
535 | } | 563 | } |
536 | 564 | ||
537 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 565 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
538 | { | 566 | { |
539 | switch (mouse) { | 567 | switch (mouse) { |
540 | case 1: | 568 | case 1: |
541 | break; | 569 | break; |
542 | case 2: | 570 | case 2: |
543 | showRemoteMenu(); | 571 | showRemoteMenu(); |
544 | break; | 572 | break; |
545 | }; | 573 | }; |
546 | } | 574 | } |
547 | 575 | ||
548 | void OpieFtp::showRemoteMenu() | 576 | void OpieFtp::showRemoteMenu() |
549 | { | 577 | { |
550 | QPopupMenu m;// = new QPopupMenu( Local_View ); | 578 | QPopupMenu m;// = new QPopupMenu( Local_View ); |
551 | m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 579 | m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
552 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 580 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
553 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 581 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
554 | m.insertSeparator(); | 582 | m.insertSeparator(); |
555 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 583 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
556 | m.exec( QCursor::pos() ); | 584 | m.exec( QCursor::pos() ); |
557 | } | 585 | } |
558 | 586 | ||
559 | void OpieFtp::showLocalMenu() | 587 | void OpieFtp::showLocalMenu() |
560 | { | 588 | { |
561 | QPopupMenu m; | 589 | QPopupMenu m; |
562 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 590 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
563 | m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 591 | m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
564 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 592 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
565 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 593 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
566 | m.insertSeparator(); | 594 | m.insertSeparator(); |
567 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 595 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
568 | m.exec( QCursor::pos() ); | 596 | m.exec( QCursor::pos() ); |
569 | } | 597 | } |
570 | 598 | ||
571 | void OpieFtp::localMakDir() | 599 | void OpieFtp::localMakDir() |
572 | { | 600 | { |
573 | InputDialog *fileDlg; | 601 | InputDialog *fileDlg; |
574 | fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); | 602 | fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); |
575 | fileDlg->exec(); | 603 | fileDlg->exec(); |
576 | if( fileDlg->result() == 1 ) { | 604 | if( fileDlg->result() == 1 ) { |
577 | QString filename = fileDlg->LineEdit1->text(); | 605 | QString filename = fileDlg->LineEdit1->text(); |
578 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 606 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
579 | } | 607 | } |
580 | populateLocalView(); | 608 | populateLocalView(); |
581 | } | 609 | } |
582 | 610 | ||
583 | void OpieFtp::localDelete() | 611 | void OpieFtp::localDelete() |
584 | { | 612 | { |
585 | QString f = Local_View->currentItem()->text(0); | 613 | QString f = Local_View->currentItem()->text(0); |
586 | if(QDir(f).exists() ) { | 614 | if(QDir(f).exists() ) { |
587 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+ | 615 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+ |
588 | " ?\nIt must be empty","Yes","No",0,0,1) ) { | 616 | " ?\nIt must be empty","Yes","No",0,0,1) ) { |
589 | case 0: { | 617 | case 0: { |
590 | f=currentDir.canonicalPath()+"/"+f; | 618 | f=currentDir.canonicalPath()+"/"+f; |
591 | QString cmd="rmdir "+f; | 619 | QString cmd="rmdir "+f; |
592 | system( cmd.latin1()); | 620 | system( cmd.latin1()); |
593 | populateLocalView(); | 621 | populateLocalView(); |
594 | } | 622 | } |
595 | break; | 623 | break; |
596 | case 1: | 624 | case 1: |
597 | // exit | 625 | // exit |
598 | break; | 626 | break; |
599 | }; | 627 | }; |
600 | 628 | ||
601 | } else { | 629 | } else { |
602 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f | 630 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f |
603 | +" ?","Yes","No",0,0,1) ) { | 631 | +" ?","Yes","No",0,0,1) ) { |
604 | case 0: { | 632 | case 0: { |
605 | f=currentDir.canonicalPath()+"/"+f; | 633 | f=currentDir.canonicalPath()+"/"+f; |
606 | QString cmd="rm "+f; | 634 | QString cmd="rm "+f; |
607 | system( cmd.latin1()); | 635 | system( cmd.latin1()); |
608 | populateLocalView(); | 636 | populateLocalView(); |
609 | } | 637 | } |
610 | break; | 638 | break; |
611 | case 1: | 639 | case 1: |
612 | // exit | 640 | // exit |
613 | break; | 641 | break; |
614 | }; | 642 | }; |
615 | } | 643 | } |
616 | } | 644 | } |
617 | 645 | ||
618 | void OpieFtp::remoteMakDir() | 646 | void OpieFtp::remoteMakDir() |
619 | { | 647 | { |
620 | InputDialog *fileDlg; | 648 | InputDialog *fileDlg; |
621 | fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); | 649 | fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); |
622 | fileDlg->exec(); | 650 | fileDlg->exec(); |
623 | if( fileDlg->result() == 1 ) { | 651 | if( fileDlg->result() == 1 ) { |
624 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; | 652 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; |
625 | QString tmp=currentRemoteDir+filename; | 653 | QString tmp=currentRemoteDir+filename; |
626 | QCopEnvelope ( "QPE/System", "busy()" ); | 654 | QCopEnvelope ( "QPE/System", "busy()" ); |
627 | if(FtpMkdir( tmp.latin1(), conn) == 0) { | 655 | if(FtpMkdir( tmp.latin1(), conn) == 0) { |
628 | QString msg; | 656 | QString msg; |
629 | msg.sprintf("Unable to make directory\n%s",FtpLastResponse(conn)); | 657 | msg.sprintf("Unable to make directory\n%s",FtpLastResponse(conn)); |
658 | msg.replace(QRegExp(":"),"\n"); | ||
630 | QMessageBox::message("Note",msg); | 659 | QMessageBox::message("Note",msg); |
631 | } | 660 | } |
632 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 661 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
633 | } | 662 | } |
634 | populateRemoteView(); | 663 | populateRemoteView(); |
635 | } | 664 | } |
636 | 665 | ||
637 | void OpieFtp::remoteDelete() | 666 | void OpieFtp::remoteDelete() |
638 | { | 667 | { |
639 | QString f = Remote_View->currentItem()->text(0); | 668 | QString f = Remote_View->currentItem()->text(0); |
640 | QCopEnvelope ( "QPE/System", "busy()" ); | 669 | QCopEnvelope ( "QPE/System", "busy()" ); |
641 | if( f.right(1) =="/") { | 670 | if( f.right(1) =="/") { |
642 | QString path= currentRemoteDir+f; | 671 | QString path= currentRemoteDir+f; |
643 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?" | 672 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?" |
644 | ,"Yes","No",0,0,1) ) { | 673 | ,"Yes","No",0,0,1) ) { |
645 | case 0: { | 674 | case 0: { |
646 | f=currentDir.canonicalPath()+"/"+f; | 675 | f=currentDir.canonicalPath()+"/"+f; |
647 | if(FtpRmdir( path.latin1(), conn) ==0) { | 676 | if(FtpRmdir( path.latin1(), conn) ==0) { |
648 | QString msg; | 677 | QString msg; |
649 | msg.sprintf("Unable to remove directory\n%s",FtpLastResponse(conn)); | 678 | msg.sprintf("Unable to remove directory\n%s",FtpLastResponse(conn)); |
679 | msg.replace(QRegExp(":"),"\n"); | ||
650 | QMessageBox::message("Note",msg); | 680 | QMessageBox::message("Note",msg); |
651 | } | 681 | } |
652 | } | 682 | } |
653 | break; | 683 | break; |
654 | }; | 684 | }; |
655 | } else { | 685 | } else { |
656 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?" | 686 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?" |
657 | ,"Yes","No",0,0,1) ) { | 687 | ,"Yes","No",0,0,1) ) { |
658 | case 0: { | 688 | case 0: { |
659 | QString path= currentRemoteDir+f; | 689 | QString path= currentRemoteDir+f; |
660 | if(FtpDelete( path.latin1(), conn)==0) { | 690 | if(FtpDelete( path.latin1(), conn)==0) { |
661 | QString msg; | 691 | QString msg; |
662 | msg.sprintf("Unable to delete file\n%s",FtpLastResponse(conn)); | 692 | msg.sprintf("Unable to delete file\n%s",FtpLastResponse(conn)); |
693 | msg.replace(QRegExp(":"),"\n"); | ||
663 | QMessageBox::message("Note",msg); | 694 | QMessageBox::message("Note",msg); |
664 | } | 695 | } |
665 | } | 696 | } |
666 | break; | 697 | break; |
667 | }; | 698 | }; |
668 | } | 699 | } |
669 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 700 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
670 | } | 701 | } |
671 | 702 | ||
672 | void OpieFtp::remoteRename() | 703 | void OpieFtp::remoteRename() |
673 | { | 704 | { |
674 | QString curFile = Remote_View->currentItem()->text(0); | 705 | QString curFile = Remote_View->currentItem()->text(0); |
675 | InputDialog *fileDlg; | 706 | InputDialog *fileDlg; |
676 | fileDlg = new InputDialog(this,"Rename",TRUE, 0); | 707 | fileDlg = new InputDialog(this,"Rename",TRUE, 0); |
677 | fileDlg->inputText = curFile; | 708 | fileDlg->inputText = curFile; |
678 | fileDlg->exec(); | 709 | fileDlg->exec(); |
679 | if( fileDlg->result() == 1 ) { | 710 | if( fileDlg->result() == 1 ) { |
680 | QString oldName = currentRemoteDir +"/"+ curFile; | 711 | QString oldName = currentRemoteDir +"/"+ curFile; |
681 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; | 712 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; |
682 | QCopEnvelope ( "QPE/System", "busy()" ); | 713 | QCopEnvelope ( "QPE/System", "busy()" ); |
683 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { | 714 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { |
684 | QString msg; | 715 | QString msg; |
685 | msg.sprintf("Unable to rename file\n%s",FtpLastResponse(conn)); | 716 | msg.sprintf("Unable to rename file\n%s",FtpLastResponse(conn)); |
717 | msg.replace(QRegExp(":"),"\n"); | ||
686 | QMessageBox::message("Note",msg); | 718 | QMessageBox::message("Note",msg); |
687 | } | 719 | } |
688 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 720 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
689 | } | 721 | } |
690 | populateRemoteView(); | 722 | populateRemoteView(); |
691 | } | 723 | } |
692 | 724 | ||
693 | void OpieFtp::localRename() | 725 | void OpieFtp::localRename() |
694 | { | 726 | { |
695 | QString curFile = Local_View->currentItem()->text(0); | 727 | QString curFile = Local_View->currentItem()->text(0); |
696 | InputDialog *fileDlg; | 728 | InputDialog *fileDlg; |
697 | fileDlg = new InputDialog(this,"Rename",TRUE, 0); | 729 | fileDlg = new InputDialog(this,"Rename",TRUE, 0); |
698 | fileDlg->inputText = curFile; | 730 | fileDlg->inputText = curFile; |
699 | fileDlg->exec(); | 731 | fileDlg->exec(); |
700 | if( fileDlg->result() == 1 ) { | 732 | if( fileDlg->result() == 1 ) { |
701 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 733 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
702 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 734 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
703 | if( rename(oldname.latin1(), newName.latin1())== -1) | 735 | if( rename(oldname.latin1(), newName.latin1())== -1) |
704 | QMessageBox::message("Note","Could not rename"); | 736 | QMessageBox::message("Note","Could not rename"); |
705 | } | 737 | } |
706 | populateLocalView(); | 738 | populateLocalView(); |
707 | } | 739 | } |
708 | 740 | ||
709 | void OpieFtp::currentPathEditChanged() | 741 | void OpieFtp::currentPathEditChanged() |
710 | { | 742 | { |
743 | QString oldRemoteCurrentDir = currentRemoteDir; | ||
744 | qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); | ||
711 | if (TabWidget->currentPageIndex() == 0) { | 745 | if (TabWidget->currentPageIndex() == 0) { |
712 | if(QDir( currentPathEdit->text()).exists()) { | 746 | if(QDir( currentPathEdit->text()).exists()) { |
713 | currentDir.setPath( currentPathEdit->text() ); | 747 | currentDir.setPath( currentPathEdit->text() ); |
714 | populateLocalView(); | 748 | populateLocalView(); |
715 | } else { | 749 | } else { |
716 | QMessageBox::message("Note","That directory does not exist"); | 750 | QMessageBox::message("Note","That directory does not exist"); |
717 | } | 751 | } |
718 | } | 752 | } |
719 | if (TabWidget->currentPageIndex() == 1) { | 753 | if (TabWidget->currentPageIndex() == 1) { |
720 | currentRemoteDir = currentPathEdit->text(); | 754 | currentRemoteDir = currentPathEdit->text(); |
721 | if(currentRemoteDir.right(1) !="/") { | 755 | if(currentRemoteDir.right(1) !="/") { |
722 | currentRemoteDir = currentRemoteDir +"/"; | 756 | currentRemoteDir = currentRemoteDir +"/"; |
723 | currentPathEdit->setText( currentRemoteDir ); | 757 | currentPathEdit->setText( currentRemoteDir ); |
724 | } | 758 | } |
725 | remoteChDir( (const QString &)currentRemoteDir); | 759 | if( !remoteChDir( (const QString &)currentRemoteDir) ) { |
760 | currentRemoteDir = oldRemoteCurrentDir; | ||
761 | currentPathEdit->setText( currentRemoteDir ); | ||
762 | } | ||
763 | |||
726 | remoteDirList( (const QString &)currentRemoteDir); | 764 | remoteDirList( (const QString &)currentRemoteDir); |
727 | } | 765 | } |
728 | } | 766 | } |
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index 20dd0d0..e00a398 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -1,92 +1,95 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | opieftp.h | 2 | opieftp.h |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #ifndef OPIEFTP_H | 12 | #ifndef OPIEFTP_H |
13 | #define OPIEFTP_H | 13 | #define OPIEFTP_H |
14 | 14 | ||
15 | #include <qvariant.h> | 15 | #include <qvariant.h> |
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | #include <qmainwindow.h> | 17 | #include <qmainwindow.h> |
18 | #include <qdir.h> | 18 | #include <qdir.h> |
19 | #include <qstring.h> | 19 | #include <qstring.h> |
20 | #include <qpoint.h> | 20 | #include <qpoint.h> |
21 | 21 | ||
22 | class QVBoxLayout; | 22 | class QVBoxLayout; |
23 | class QHBoxLayout; | 23 | class QHBoxLayout; |
24 | class QGridLayout; | 24 | class QGridLayout; |
25 | class QComboBox; | 25 | class QComboBox; |
26 | class QListView; | 26 | class QListView; |
27 | class QListviewItem; | 27 | class QListviewItem; |
28 | class QLabel; | 28 | class QLabel; |
29 | class QProgressBar; | 29 | class QProgressBar; |
30 | class QSpinBox; | 30 | class QSpinBox; |
31 | class QTabWidget; | 31 | class QTabWidget; |
32 | class QWidget; | 32 | class QWidget; |
33 | class QPEToolBar; | 33 | class QPEToolBar; |
34 | class QPEMenuBar; | 34 | class QPEMenuBar; |
35 | class QPopupMenu; | 35 | class QPopupMenu; |
36 | class QFile; | 36 | class QFile; |
37 | class QListViewItem; | 37 | class QListViewItem; |
38 | class QLineEdit; | 38 | class QLineEdit; |
39 | 39 | ||
40 | class OpieFtp : public QMainWindow | 40 | class OpieFtp : public QMainWindow |
41 | { | 41 | { |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | 43 | ||
44 | public: | 44 | public: |
45 | OpieFtp( ); | 45 | OpieFtp( ); |
46 | ~OpieFtp(); | 46 | ~OpieFtp(); |
47 | 47 | ||
48 | QTabWidget *TabWidget; | 48 | QTabWidget *TabWidget; |
49 | QWidget *tab, *tab_2, *tab_3;; | 49 | QWidget *tab, *tab_2, *tab_3;; |
50 | QListView *Local_View, *Remote_View; | 50 | QListView *Local_View, *Remote_View; |
51 | 51 | ||
52 | QComboBox *UsernameComboBox, *ServerComboBox; | 52 | QComboBox *UsernameComboBox, *ServerComboBox; |
53 | QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; | 53 | QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; |
54 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; | 54 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; |
55 | QSpinBox* PortSpinBox; | 55 | QSpinBox* PortSpinBox; |
56 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu; | 56 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu; |
57 | QDir currentDir; | 57 | QDir currentDir; |
58 | QString currentRemoteDir; | 58 | QString currentRemoteDir; |
59 | QString filterStr; | 59 | QString filterStr; |
60 | QListViewItem * item; | 60 | QListViewItem * item; |
61 | bool b; | 61 | bool b; |
62 | 62 | ||
63 | protected slots: | 63 | protected slots: |
64 | void showLocalMenu( ); | 64 | void showLocalMenu( ); |
65 | void showRemoteMenu( ); | 65 | void showRemoteMenu( ); |
66 | void localUpload(); | 66 | void localUpload(); |
67 | void remoteDownload(); | 67 | void remoteDownload(); |
68 | void newConnection(); | 68 | void newConnection(); |
69 | void connector(); | 69 | void connector(); |
70 | void disConnector(); | 70 | void disConnector(); |
71 | void populateLocalView(); | 71 | void populateLocalView(); |
72 | bool populateRemoteView(); | 72 | bool populateRemoteView(); |
73 | void showHidden(); | 73 | void showHidden(); |
74 | 74 | ||
75 | void localListClicked(QListViewItem *); | 75 | void localListClicked(QListViewItem *); |
76 | void remoteListClicked(QListViewItem *); | 76 | void remoteListClicked(QListViewItem *); |
77 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 77 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
78 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); | 78 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); |
79 | void localMakDir(); | 79 | void localMakDir(); |
80 | void localDelete(); | 80 | void localDelete(); |
81 | void remoteMakDir(); | 81 | void remoteMakDir(); |
82 | void remoteDelete(); | 82 | void remoteDelete(); |
83 | bool remoteDirList(const QString &); | 83 | bool remoteDirList(const QString &); |
84 | bool remoteChDir(const QString &); | 84 | bool remoteChDir(const QString &); |
85 | void tabChanged(QWidget*); | 85 | void tabChanged(QWidget*); |
86 | void cleanUp(); | 86 | void cleanUp(); |
87 | void remoteRename(); | 87 | void remoteRename(); |
88 | void localRename(); | 88 | void localRename(); |
89 | void currentPathEditChanged(); | 89 | void currentPathEditChanged(); |
90 | protected: | ||
91 | void nullifyCallBack(); | ||
92 | |||
90 | }; | 93 | }; |
91 | 94 | ||
92 | #endif // OPIEFTP_H | 95 | #endif // OPIEFTP_H |