-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 28 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 4 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.pro | 4 |
3 files changed, 24 insertions, 12 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 7f5d71c..e15bbef 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,249 +1,253 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | opieftp.cpp | 2 | opieftp.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | //#define DEVELOPERS_VERSION | 12 | //#define DEVELOPERS_VERSION |
13 | 13 | ||
14 | #include "opieftp.h" | 14 | #include "opieftp.h" |
15 | #include "ftplib.h" | 15 | #include "ftplib.h" |
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | 17 | ||
18 | #include <qpe/qpemenubar.h> | 18 | #include <qpe/qpemenubar.h> |
19 | #include <qpe/qpetoolbar.h> | 19 | #include <qpe/qpetoolbar.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | #include <qpe/mimetype.h> | 24 | #include <qpe/mimetype.h> |
25 | #include <qpe/qpemessagebox.h> | ||
25 | 26 | ||
26 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
27 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
28 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
29 | #include <qtoolbutton.h> | 30 | #include <qtoolbutton.h> |
30 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
31 | #include <qdir.h> | 32 | #include <qdir.h> |
32 | #include <qfile.h> | 33 | #include <qfile.h> |
33 | #include <qstring.h> | 34 | #include <qstring.h> |
34 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
35 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
36 | #include <qlistview.h> | 37 | #include <qlistview.h> |
37 | #include <qmainwindow.h> | 38 | #include <qmainwindow.h> |
38 | #include <qlabel.h> | 39 | #include <qlabel.h> |
39 | #include <qprogressbar.h> | 40 | #include <qprogressbar.h> |
40 | #include <qspinbox.h> | 41 | #include <qspinbox.h> |
41 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
42 | #include <qwidget.h> | 43 | #include <qwidget.h> |
43 | #include <qlayout.h> | 44 | #include <qlayout.h> |
44 | #include <qimage.h> | 45 | #include <qimage.h> |
45 | #include <qpixmap.h> | 46 | #include <qpixmap.h> |
46 | #include <qmessagebox.h> | 47 | #include <qmessagebox.h> |
47 | #include <qlineedit.h> | 48 | #include <qlineedit.h> |
48 | #include <qregexp.h> | 49 | #include <qregexp.h> |
49 | 50 | ||
50 | #include <unistd.h> | 51 | #include <unistd.h> |
51 | #include <stdlib.h> | 52 | #include <stdlib.h> |
52 | 53 | ||
53 | 54 | ||
54 | QProgressBar *ProgressBar; | 55 | QProgressBar *ProgressBar; |
55 | static netbuf *conn=NULL; | 56 | static netbuf *conn=NULL; |
56 | 57 | ||
57 | static int log_progress(netbuf *ctl, int xfered, void *arg) | 58 | static int log_progress(netbuf *ctl, int xfered, void *arg) |
58 | { | 59 | { |
59 | int fsz = *(int *)arg; | 60 | int fsz = *(int *)arg; |
60 | int pct = (xfered * 100) / fsz; | 61 | int pct = (xfered * 100) / fsz; |
61 | // printf("%3d%%\r", pct); | 62 | // printf("%3d%%\r", pct); |
62 | // fflush(stdout); | 63 | // fflush(stdout); |
63 | ProgressBar->setProgress(xfered); | 64 | ProgressBar->setProgress(xfered); |
64 | qApp->processEvents(); | 65 | qApp->processEvents(); |
65 | return 1; | 66 | return 1; |
66 | } | 67 | } |
67 | 68 | ||
68 | OpieFtp::OpieFtp( ) | 69 | OpieFtp::OpieFtp( ) |
69 | : QMainWindow( ) | 70 | : QMainWindow( ) |
70 | { | 71 | { |
71 | setCaption( tr( "OpieFtp" ) ); | 72 | setCaption( tr( "OpieFtp" ) ); |
72 | 73 | ||
73 | QGridLayout *layout = new QGridLayout( this ); | 74 | QGridLayout *layout = new QGridLayout( this ); |
74 | layout->setSpacing( 2); | 75 | layout->setSpacing( 2); |
75 | layout->setMargin( 2); | 76 | layout->setMargin( 2); |
76 | 77 | ||
77 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 78 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
78 | 79 | ||
79 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 80 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
80 | // QPEToolBar *menuBar = new QPEToolBar(this); | 81 | // QPEToolBar *menuBar = new QPEToolBar(this); |
81 | // menuBar->setHorizontalStretchable( TRUE ); | 82 | // menuBar->setHorizontalStretchable( TRUE ); |
82 | 83 | ||
83 | connectionMenu = new QPopupMenu( this ); | 84 | connectionMenu = new QPopupMenu( this ); |
84 | localMenu = new QPopupMenu( this ); | 85 | localMenu = new QPopupMenu( this ); |
85 | remoteMenu = new QPopupMenu( this ); | 86 | remoteMenu = new QPopupMenu( this ); |
86 | tabMenu = new QPopupMenu( this ); | 87 | tabMenu = new QPopupMenu( this ); |
87 | 88 | ||
88 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); | 89 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); |
89 | 90 | ||
90 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 91 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
91 | menuBar->insertItem( tr( "Local" ), localMenu); | 92 | menuBar->insertItem( tr( "Local" ), localMenu); |
92 | menuBar->insertItem( tr( "Remote" ), remoteMenu); | 93 | menuBar->insertItem( tr( "Remote" ), remoteMenu); |
93 | menuBar->insertItem( tr( "View" ), tabMenu); | 94 | menuBar->insertItem( tr( "View" ), tabMenu); |
94 | 95 | ||
95 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 96 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
96 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 97 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
97 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 98 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
98 | 99 | ||
99 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 100 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
100 | localMenu->insertSeparator(); | 101 | localMenu->insertSeparator(); |
101 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 102 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
102 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 103 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
103 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 104 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
104 | localMenu->insertSeparator(); | 105 | localMenu->insertSeparator(); |
105 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 106 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
106 | localMenu->setCheckable(TRUE); | 107 | localMenu->setCheckable(TRUE); |
107 | 108 | ||
108 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 109 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
109 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 110 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
110 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 111 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
111 | remoteMenu->insertSeparator(); | 112 | remoteMenu->insertSeparator(); |
112 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 113 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
113 | 114 | ||
114 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 115 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
115 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 116 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
116 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 117 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
118 | tabMenu->insertSeparator(); | ||
119 | tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | ||
117 | tabMenu->setCheckable(TRUE); | 120 | tabMenu->setCheckable(TRUE); |
118 | 121 | ||
119 | 122 | ||
123 | |||
120 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | 124 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); |
121 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 125 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
122 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 126 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
123 | cdUpButton ->setFlat(TRUE); | 127 | cdUpButton ->setFlat(TRUE); |
124 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); | 128 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); |
125 | cdUpButton->hide(); | 129 | cdUpButton->hide(); |
126 | 130 | ||
127 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 131 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
128 | // docButton->setFixedSize( QSize( 20, 20 ) ); | 132 | // docButton->setFixedSize( QSize( 20, 20 ) ); |
129 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 133 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
130 | // docButton->setFlat(TRUE); | 134 | // docButton->setFlat(TRUE); |
131 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); | 135 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); |
132 | 136 | ||
133 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 137 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); |
134 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 138 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
135 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 139 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
136 | homeButton->setFlat(TRUE); | 140 | homeButton->setFlat(TRUE); |
137 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); | 141 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); |
138 | homeButton->hide(); | 142 | homeButton->hide(); |
139 | 143 | ||
140 | TabWidget = new QTabWidget( this, "TabWidget" ); | 144 | TabWidget = new QTabWidget( this, "TabWidget" ); |
141 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); | 145 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); |
142 | 146 | ||
143 | // TabWidget->setTabShape(QTabWidget::Triangular); | 147 | // TabWidget->setTabShape(QTabWidget::Triangular); |
144 | 148 | ||
145 | tab = new QWidget( TabWidget, "tab" ); | 149 | tab = new QWidget( TabWidget, "tab" ); |
146 | tabLayout = new QGridLayout( tab ); | 150 | tabLayout = new QGridLayout( tab ); |
147 | tabLayout->setSpacing( 2); | 151 | tabLayout->setSpacing( 2); |
148 | tabLayout->setMargin( 2); | 152 | tabLayout->setMargin( 2); |
149 | 153 | ||
150 | Local_View = new QListView( tab, "Local_View" ); | 154 | Local_View = new QListView( tab, "Local_View" ); |
151 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 155 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
152 | Local_View->addColumn( tr("File"),150); | 156 | Local_View->addColumn( tr("File"),150); |
153 | Local_View->addColumn( tr("Size"),-1); | ||
154 | Local_View->setColumnAlignment(1,QListView::AlignRight); | ||
155 | Local_View->addColumn( tr("Date"),-1); | 157 | Local_View->addColumn( tr("Date"),-1); |
158 | Local_View->setColumnAlignment(1,QListView::AlignRight); | ||
159 | Local_View->addColumn( tr("Size"),-1); | ||
156 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 160 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
157 | Local_View->setAllColumnsShowFocus(TRUE); | 161 | Local_View->setAllColumnsShowFocus(TRUE); |
158 | 162 | ||
159 | Local_View->setMultiSelection( TRUE); | 163 | Local_View->setMultiSelection( TRUE); |
160 | Local_View->setSelectionMode(QListView::Extended); | 164 | Local_View->setSelectionMode(QListView::Extended); |
161 | Local_View->setFocusPolicy(QWidget::ClickFocus); | 165 | Local_View->setFocusPolicy(QWidget::ClickFocus); |
162 | 166 | ||
163 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 167 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
164 | 168 | ||
165 | tabLayout->addWidget( Local_View, 0, 0 ); | 169 | tabLayout->addWidget( Local_View, 0, 0 ); |
166 | 170 | ||
167 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 171 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
168 | this,SLOT( localListClicked(QListViewItem *)) ); | 172 | this,SLOT( localListClicked(QListViewItem *)) ); |
169 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 173 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
170 | // this,SLOT( localListClicked(QListViewItem *)) ); | 174 | // this,SLOT( localListClicked(QListViewItem *)) ); |
171 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 175 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
172 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 176 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
173 | 177 | ||
174 | TabWidget->insertTab( tab, tr( "Local" ) ); | 178 | TabWidget->insertTab( tab, tr( "Local" ) ); |
175 | 179 | ||
176 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 180 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
177 | tabLayout_2 = new QGridLayout( tab_2 ); | 181 | tabLayout_2 = new QGridLayout( tab_2 ); |
178 | tabLayout_2->setSpacing( 2); | 182 | tabLayout_2->setSpacing( 2); |
179 | tabLayout_2->setMargin( 2); | 183 | tabLayout_2->setMargin( 2); |
180 | 184 | ||
181 | Remote_View = new QListView( tab_2, "Remote_View" ); | 185 | Remote_View = new QListView( tab_2, "Remote_View" ); |
182 | Remote_View->addColumn( tr("File"),150); | 186 | Remote_View->addColumn( tr("File"),150); |
183 | Remote_View->addColumn( tr("Size"),-1); | ||
184 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | ||
185 | Remote_View->addColumn( tr("Date"),-1); | 187 | Remote_View->addColumn( tr("Date"),-1); |
188 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | ||
189 | Remote_View->addColumn( tr("Size"),-1); | ||
186 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 190 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
187 | Remote_View->addColumn( tr("Dir"),-1); | 191 | Remote_View->addColumn( tr("Dir"),-1); |
188 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 192 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
189 | Remote_View->setAllColumnsShowFocus(TRUE); | 193 | Remote_View->setAllColumnsShowFocus(TRUE); |
190 | 194 | ||
191 | Remote_View->setMultiSelection( FALSE); | 195 | Remote_View->setMultiSelection( FALSE); |
192 | Remote_View->setSelectionMode(QListView::Extended); | 196 | Remote_View->setSelectionMode(QListView::Extended); |
193 | Remote_View->setFocusPolicy(QWidget::ClickFocus); | 197 | Remote_View->setFocusPolicy(QWidget::ClickFocus); |
194 | 198 | ||
195 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 199 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
196 | 200 | ||
197 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 201 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
198 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 202 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
199 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 203 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
200 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 204 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
201 | 205 | ||
202 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 206 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
203 | 207 | ||
204 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 208 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
205 | 209 | ||
206 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 210 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
207 | tabLayout_3 = new QGridLayout( tab_3 ); | 211 | tabLayout_3 = new QGridLayout( tab_3 ); |
208 | tabLayout_3->setSpacing( 2); | 212 | tabLayout_3->setSpacing( 2); |
209 | tabLayout_3->setMargin( 2); | 213 | tabLayout_3->setMargin( 2); |
210 | 214 | ||
211 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 215 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
212 | TextLabel1->setText( tr( "Username" ) ); | 216 | TextLabel1->setText( tr( "Username" ) ); |
213 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 217 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
214 | 218 | ||
215 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 219 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
216 | UsernameComboBox->setEditable(TRUE); | 220 | UsernameComboBox->setEditable(TRUE); |
217 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 221 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
218 | 222 | ||
219 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 223 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
220 | TextLabel2->setText( tr( "Password" ) ); | 224 | TextLabel2->setText( tr( "Password" ) ); |
221 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 225 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
222 | 226 | ||
223 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 227 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
224 | PasswordEdit->setEchoMode(QLineEdit::Password); | 228 | PasswordEdit->setEchoMode(QLineEdit::Password); |
225 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 229 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
226 | 230 | ||
227 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 231 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
228 | TextLabel3->setText( tr( "Remote server" ) ); | 232 | TextLabel3->setText( tr( "Remote server" ) ); |
229 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 233 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
230 | 234 | ||
231 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 235 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
232 | ServerComboBox->setEditable(TRUE); | 236 | ServerComboBox->setEditable(TRUE); |
233 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 237 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
234 | 238 | ||
235 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); | 239 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); |
236 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); | 240 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); |
237 | 241 | ||
238 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 242 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
239 | TextLabel5->setText( tr( "Remote path" ) ); | 243 | TextLabel5->setText( tr( "Remote path" ) ); |
240 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 244 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
241 | 245 | ||
242 | 246 | ||
243 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 247 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
244 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 248 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
245 | 249 | ||
246 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 250 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
247 | TextLabel4->setText( tr( "Port" ) ); | 251 | TextLabel4->setText( tr( "Port" ) ); |
248 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 252 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
249 | 253 | ||
@@ -550,201 +554,201 @@ bool OpieFtp::remoteDirList(const QString &dir) | |||
550 | tmp+="/._temp"; | 554 | tmp+="/._temp"; |
551 | else | 555 | else |
552 | tmp+="._temp"; | 556 | tmp+="._temp"; |
553 | // qDebug("Listing remote dir "+tmp); | 557 | // qDebug("Listing remote dir "+tmp); |
554 | QCopEnvelope ( "QPE/System", "busy()" ); | 558 | QCopEnvelope ( "QPE/System", "busy()" ); |
555 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 559 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
556 | QString msg; | 560 | QString msg; |
557 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 561 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
558 | msg.replace(QRegExp(":"),"\n"); | 562 | msg.replace(QRegExp(":"),"\n"); |
559 | QMessageBox::message(tr("Note"),msg); | 563 | QMessageBox::message(tr("Note"),msg); |
560 | return false; | 564 | return false; |
561 | } | 565 | } |
562 | populateRemoteView() ; | 566 | populateRemoteView() ; |
563 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 567 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
564 | return true; | 568 | return true; |
565 | } | 569 | } |
566 | 570 | ||
567 | bool OpieFtp::remoteChDir(const QString &dir) | 571 | bool OpieFtp::remoteChDir(const QString &dir) |
568 | { | 572 | { |
569 | QCopEnvelope ( "QPE/System", "busy()" ); | 573 | QCopEnvelope ( "QPE/System", "busy()" ); |
570 | if (!FtpChdir( dir.latin1(), conn )) { | 574 | if (!FtpChdir( dir.latin1(), conn )) { |
571 | QString msg; | 575 | QString msg; |
572 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 576 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
573 | msg.replace(QRegExp(":"),"\n"); | 577 | msg.replace(QRegExp(":"),"\n"); |
574 | QMessageBox::message(tr("Note"),msg); | 578 | QMessageBox::message(tr("Note"),msg); |
575 | // qDebug(msg); | 579 | // qDebug(msg); |
576 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 580 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
577 | return FALSE; | 581 | return FALSE; |
578 | } | 582 | } |
579 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 583 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
580 | return TRUE; | 584 | return TRUE; |
581 | } | 585 | } |
582 | 586 | ||
583 | void OpieFtp::populateLocalView() | 587 | void OpieFtp::populateLocalView() |
584 | { | 588 | { |
585 | Local_View->clear(); | 589 | Local_View->clear(); |
586 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 590 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
587 | currentDir.setMatchAllDirs(TRUE); | 591 | currentDir.setMatchAllDirs(TRUE); |
588 | currentDir.setNameFilter(filterStr); | 592 | currentDir.setNameFilter(filterStr); |
589 | QString fileL, fileS, fileDate; | 593 | QString fileL, fileS, fileDate; |
590 | bool isDir=FALSE; | 594 | bool isDir=FALSE; |
591 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 595 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
592 | QFileInfoListIterator it(*list); | 596 | QFileInfoListIterator it(*list); |
593 | QFileInfo *fi; | 597 | QFileInfo *fi; |
594 | while ( (fi=it.current()) ) { | 598 | while ( (fi=it.current()) ) { |
595 | if (fi->isSymLink() ){ | 599 | if (fi->isSymLink() ){ |
596 | QString symLink=fi->readLink(); | 600 | QString symLink=fi->readLink(); |
597 | // qDebug("Symlink detected "+symLink); | 601 | // qDebug("Symlink detected "+symLink); |
598 | QFileInfo sym( symLink); | 602 | QFileInfo sym( symLink); |
599 | fileS.sprintf( "%10li", sym.size() ); | 603 | fileS.sprintf( "%10li", sym.size() ); |
600 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 604 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
601 | fileDate = sym.lastModified().toString(); | 605 | fileDate = sym.lastModified().toString(); |
602 | } else { | 606 | } else { |
603 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 607 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
604 | fileS.sprintf( "%10li", fi->size() ); | 608 | fileS.sprintf( "%10li", fi->size() ); |
605 | fileL.sprintf( "%s",fi->fileName().data() ); | 609 | fileL.sprintf( "%s",fi->fileName().data() ); |
606 | fileDate= fi->lastModified().toString(); | 610 | fileDate= fi->lastModified().toString(); |
607 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 611 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
608 | fileL+="/"; | 612 | fileL+="/"; |
609 | isDir=TRUE; | 613 | isDir=TRUE; |
610 | // qDebug( fileL); | 614 | // qDebug( fileL); |
611 | } | 615 | } |
612 | } | 616 | } |
613 | if(fileL !="./" && fi->exists()) { | 617 | if(fileL !="./" && fi->exists()) { |
614 | item= new QListViewItem( Local_View,fileL,fileS , fileDate); | 618 | item= new QListViewItem( Local_View,fileL, fileDate, fileS ); |
615 | QPixmap pm; | 619 | QPixmap pm; |
616 | 620 | ||
617 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 621 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
618 | if( !QDir( fi->filePath() ).isReadable()) | 622 | if( !QDir( fi->filePath() ).isReadable()) |
619 | pm = Resource::loadPixmap( "lockedfolder" ); | 623 | pm = Resource::loadPixmap( "lockedfolder" ); |
620 | else | 624 | else |
621 | pm= Resource::loadPixmap( "folder" ); | 625 | pm= Resource::loadPixmap( "folder" ); |
622 | item->setPixmap( 0,pm ); | 626 | item->setPixmap( 0,pm ); |
623 | } else { | 627 | } else { |
624 | if( !fi->isReadable() ) | 628 | if( !fi->isReadable() ) |
625 | pm = Resource::loadPixmap( "locked" ); | 629 | pm = Resource::loadPixmap( "locked" ); |
626 | else { | 630 | else { |
627 | MimeType mt(fi->filePath()); | 631 | MimeType mt(fi->filePath()); |
628 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 632 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
629 | if(pm.isNull()) | 633 | if(pm.isNull()) |
630 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 634 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
631 | item->setPixmap( 0,pm); | 635 | item->setPixmap( 0,pm); |
632 | } | 636 | } |
633 | } | 637 | } |
634 | if( fileL.find("->",0,TRUE) != -1) { | 638 | if( fileL.find("->",0,TRUE) != -1) { |
635 | // overlay link image | 639 | // overlay link image |
636 | pm= Resource::loadPixmap( "folder" ); | 640 | pm= Resource::loadPixmap( "folder" ); |
637 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | 641 | QPixmap lnk = Resource::loadPixmap( "symlink" ); |
638 | QPainter painter( &pm ); | 642 | QPainter painter( &pm ); |
639 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 643 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
640 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 644 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
641 | item->setPixmap( 0, pm); | 645 | item->setPixmap( 0, pm); |
642 | } | 646 | } |
643 | } | 647 | } |
644 | isDir=FALSE; | 648 | isDir=FALSE; |
645 | ++it; | 649 | ++it; |
646 | } | 650 | } |
647 | Local_View->setSorting( 3,FALSE); | 651 | Local_View->setSorting( 3,FALSE); |
648 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 652 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
649 | fillCombo( (const QString &)currentDir); | 653 | fillCombo( (const QString &)currentDir); |
650 | } | 654 | } |
651 | 655 | ||
652 | bool OpieFtp::populateRemoteView( ) | 656 | bool OpieFtp::populateRemoteView( ) |
653 | { | 657 | { |
654 | // qDebug("populate remoteview"); | 658 | // qDebug("populate remoteview"); |
655 | QString sfile=QDir::homeDirPath(); | 659 | QString sfile=QDir::homeDirPath(); |
656 | if(sfile.right(1) != "/") | 660 | if(sfile.right(1) != "/") |
657 | sfile+="/._temp"; | 661 | sfile+="/._temp"; |
658 | else | 662 | else |
659 | sfile+="._temp"; | 663 | sfile+="._temp"; |
660 | QFile file( sfile); | 664 | QFile file( sfile); |
661 | Remote_View->clear(); | 665 | Remote_View->clear(); |
662 | QString s, File_Name; | 666 | QString s, File_Name; |
663 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 667 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
664 | QString fileL, fileS, fileDate; | 668 | QString fileL, fileS, fileDate; |
665 | if ( file.open(IO_ReadOnly)) { | 669 | if ( file.open(IO_ReadOnly)) { |
666 | QTextStream t( &file ); // use a text stream | 670 | QTextStream t( &file ); // use a text stream |
667 | while ( !t.eof()) { | 671 | while ( !t.eof()) { |
668 | s = t.readLine(); | 672 | s = t.readLine(); |
669 | fileL = s.right(s.length()-55); | 673 | fileL = s.right(s.length()-55); |
670 | fileL = fileL.stripWhiteSpace(); | 674 | fileL = fileL.stripWhiteSpace(); |
671 | if(s.left(1) == "d") | 675 | if(s.left(1) == "d") |
672 | fileL = fileL+"/"; | 676 | fileL = fileL+"/"; |
673 | // fileL = "/"+fileL+"/"; | 677 | // fileL = "/"+fileL+"/"; |
674 | fileS = s.mid( 30, 42-30); | 678 | fileS = s.mid( 30, 42-30); |
675 | fileS = fileS.stripWhiteSpace(); | 679 | fileS = fileS.stripWhiteSpace(); |
676 | fileDate = s.mid( 42, 55-42); | 680 | fileDate = s.mid( 42, 55-42); |
677 | fileDate = fileDate.stripWhiteSpace(); | 681 | fileDate = fileDate.stripWhiteSpace(); |
678 | if(fileL.find("total",0,TRUE) == -1) { | 682 | if(fileL.find("total",0,TRUE) == -1) { |
679 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { | 683 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { |
680 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"d"); | 684 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); |
681 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | 685 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); |
682 | // if(itemDir) | 686 | // if(itemDir) |
683 | item->moveItem(itemDir); | 687 | item->moveItem(itemDir); |
684 | itemDir=item; | 688 | itemDir=item; |
685 | } else { | 689 | } else { |
686 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"f"); | 690 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); |
687 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 691 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); |
688 | // if(itemFile) | 692 | // if(itemFile) |
689 | item->moveItem(itemDir); | 693 | item->moveItem(itemDir); |
690 | item->moveItem(itemFile); | 694 | item->moveItem(itemFile); |
691 | itemFile=item; | 695 | itemFile=item; |
692 | } | 696 | } |
693 | } | 697 | } |
694 | } | 698 | } |
695 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 699 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
696 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 700 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |
697 | file.close(); | 701 | file.close(); |
698 | if( file.exists()) | 702 | if( file.exists()) |
699 | file. remove(); | 703 | file. remove(); |
700 | } else | 704 | } else |
701 | qDebug("temp file not opened successfullly "+sfile); | 705 | qDebug("temp file not opened successfullly "+sfile); |
702 | Remote_View->setSorting( 4,TRUE); | 706 | Remote_View->setSorting( 4,TRUE); |
703 | return true; | 707 | return true; |
704 | } | 708 | } |
705 | 709 | ||
706 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 710 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
707 | { | 711 | { |
708 | if( selectedItem) { | 712 | if( selectedItem) { |
709 | // QCopEnvelope ( "QPE/System", "busy()" ); | 713 | // QCopEnvelope ( "QPE/System", "busy()" ); |
710 | QString oldRemoteCurrentDir = currentRemoteDir; | 714 | QString oldRemoteCurrentDir = currentRemoteDir; |
711 | QString strItem=selectedItem->text(0); | 715 | QString strItem=selectedItem->text(0); |
712 | strItem=strItem.simplifyWhiteSpace(); | 716 | strItem=strItem.simplifyWhiteSpace(); |
713 | if(strItem == "../") { // the user wants to go ^ | 717 | if(strItem == "../") { // the user wants to go ^ |
714 | if( FtpCDUp( conn) == 0) { | 718 | if( FtpCDUp( conn) == 0) { |
715 | QString msg; | 719 | QString msg; |
716 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 720 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
717 | msg.replace(QRegExp(":"),"\n"); | 721 | msg.replace(QRegExp(":"),"\n"); |
718 | QMessageBox::message(tr("Note"),msg); | 722 | QMessageBox::message(tr("Note"),msg); |
719 | // qDebug(msg); | 723 | // qDebug(msg); |
720 | } | 724 | } |
721 | char path[256]; | 725 | char path[256]; |
722 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 726 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
723 | QString msg; | 727 | QString msg; |
724 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 728 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
725 | msg.replace(QRegExp(":"),"\n"); | 729 | msg.replace(QRegExp(":"),"\n"); |
726 | QMessageBox::message(tr("Note"),msg); | 730 | QMessageBox::message(tr("Note"),msg); |
727 | // qDebug(msg); | 731 | // qDebug(msg); |
728 | } | 732 | } |
729 | currentRemoteDir=path; | 733 | currentRemoteDir=path; |
730 | } else { | 734 | } else { |
731 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | 735 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers |
732 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | 736 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); |
733 | strItem = strItem.stripWhiteSpace(); | 737 | strItem = strItem.stripWhiteSpace(); |
734 | currentRemoteDir = strItem; | 738 | currentRemoteDir = strItem; |
735 | if( !remoteChDir( (const QString &)strItem)) { | 739 | if( !remoteChDir( (const QString &)strItem)) { |
736 | currentRemoteDir = oldRemoteCurrentDir; | 740 | currentRemoteDir = oldRemoteCurrentDir; |
737 | strItem=""; | 741 | strItem=""; |
738 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 742 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
739 | } | 743 | } |
740 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 744 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory |
741 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 745 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
742 | currentRemoteDir = oldRemoteCurrentDir; | 746 | currentRemoteDir = oldRemoteCurrentDir; |
743 | strItem=""; | 747 | strItem=""; |
744 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 748 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
745 | 749 | ||
746 | } else { | 750 | } else { |
747 | currentRemoteDir = currentRemoteDir+strItem; | 751 | currentRemoteDir = currentRemoteDir+strItem; |
748 | } | 752 | } |
749 | } else { | 753 | } else { |
750 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 754 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
@@ -1252,64 +1256,72 @@ void OpieFtp::deleteServer() | |||
1252 | for (int i = 0; i <= numberOfEntries; i++) { | 1256 | for (int i = 0; i <= numberOfEntries; i++) { |
1253 | temp.setNum(i+1); | 1257 | temp.setNum(i+1); |
1254 | cfg.setGroup("Server"); | 1258 | cfg.setGroup("Server"); |
1255 | if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1 | 1259 | if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1 |
1256 | && cfg.readEntry(temp).find(username,0,TRUE) != -1 | 1260 | && cfg.readEntry(temp).find(username,0,TRUE) != -1 |
1257 | && !remoteServerStr.isEmpty()) { | 1261 | && !remoteServerStr.isEmpty()) { |
1258 | qDebug(temp); | 1262 | qDebug(temp); |
1259 | } | 1263 | } |
1260 | } | 1264 | } |
1261 | } | 1265 | } |
1262 | 1266 | ||
1263 | void OpieFtp::upDir() | 1267 | void OpieFtp::upDir() |
1264 | { | 1268 | { |
1265 | if (TabWidget->currentPageIndex() == 0) { | 1269 | if (TabWidget->currentPageIndex() == 0) { |
1266 | QString current = currentDir.canonicalPath(); | 1270 | QString current = currentDir.canonicalPath(); |
1267 | QDir dir(current); | 1271 | QDir dir(current); |
1268 | dir.cdUp(); | 1272 | dir.cdUp(); |
1269 | current = dir.canonicalPath(); | 1273 | current = dir.canonicalPath(); |
1270 | chdir( current.latin1() ); | 1274 | chdir( current.latin1() ); |
1271 | currentDir.cd( current, TRUE); | 1275 | currentDir.cd( current, TRUE); |
1272 | populateLocalView(); | 1276 | populateLocalView(); |
1273 | update(); | 1277 | update(); |
1274 | } else { | 1278 | } else { |
1275 | if( FtpCDUp( conn) == 0) { | 1279 | if( FtpCDUp( conn) == 0) { |
1276 | QString msg; | 1280 | QString msg; |
1277 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 1281 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
1278 | msg.replace(QRegExp(":"),"\n"); | 1282 | msg.replace(QRegExp(":"),"\n"); |
1279 | QMessageBox::message(tr("Note"),msg); | 1283 | QMessageBox::message(tr("Note"),msg); |
1280 | // qDebug(msg); | 1284 | // qDebug(msg); |
1281 | } | 1285 | } |
1282 | char path[256]; | 1286 | char path[256]; |
1283 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 1287 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
1284 | QString msg; | 1288 | QString msg; |
1285 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 1289 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
1286 | msg.replace(QRegExp(":"),"\n"); | 1290 | msg.replace(QRegExp(":"),"\n"); |
1287 | QMessageBox::message(tr("Note"),msg); | 1291 | QMessageBox::message(tr("Note"),msg); |
1288 | // qDebug(msg); | 1292 | // qDebug(msg); |
1289 | } | 1293 | } |
1290 | currentRemoteDir=path; | 1294 | currentRemoteDir=path; |
1291 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 1295 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
1292 | if(currentRemoteDir.right(1) !="/") | 1296 | if(currentRemoteDir.right(1) !="/") |
1293 | currentRemoteDir +="/"; | 1297 | currentRemoteDir +="/"; |
1294 | currentPathCombo->lineEdit()->setText( currentRemoteDir); | 1298 | currentPathCombo->lineEdit()->setText( currentRemoteDir); |
1295 | fillRemoteCombo( (const QString &)currentRemoteDir); | 1299 | fillRemoteCombo( (const QString &)currentRemoteDir); |
1296 | 1300 | ||
1297 | } | 1301 | } |
1298 | } | 1302 | } |
1299 | 1303 | ||
1300 | void OpieFtp::docButtonPushed() { | 1304 | void OpieFtp::docButtonPushed() { |
1301 | QString current = QPEApplication::documentDir(); | 1305 | QString current = QPEApplication::documentDir(); |
1302 | chdir( current.latin1() ); | 1306 | chdir( current.latin1() ); |
1303 | currentDir.cd( current, TRUE); | 1307 | currentDir.cd( current, TRUE); |
1304 | populateLocalView(); | 1308 | populateLocalView(); |
1305 | update(); | 1309 | update(); |
1306 | 1310 | ||
1307 | } | 1311 | } |
1308 | 1312 | ||
1309 | void OpieFtp::homeButtonPushed() { | 1313 | void OpieFtp::homeButtonPushed() { |
1310 | QString current = QDir::homeDirPath(); | 1314 | QString current = QDir::homeDirPath(); |
1311 | chdir( current.latin1() ); | 1315 | chdir( current.latin1() ); |
1312 | currentDir.cd( current, TRUE); | 1316 | currentDir.cd( current, TRUE); |
1313 | populateLocalView(); | 1317 | populateLocalView(); |
1314 | update(); | 1318 | update(); |
1315 | } | 1319 | } |
1320 | |||
1321 | void OpieFtp::doAbout() { | ||
1322 | QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n" | ||
1323 | "L.J.Potter<llornkcor@handhelds.org>\n" | ||
1324 | "and uses ftplib copyright 1996-2000\n" | ||
1325 | "by Thomas Pfau, pfau@cnj.digex.net\n\n" | ||
1326 | "and is licensed by the GPL"); | ||
1327 | } | ||
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index 6852b1c..218a958 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -1,120 +1,120 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | opieftp.h | 2 | opieftp.h |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #ifndef OPIEFTP_H | 12 | #ifndef OPIEFTP_H |
13 | #define OPIEFTP_H | 13 | #define OPIEFTP_H |
14 | 14 | ||
15 | #include <qvariant.h> | 15 | #include <qvariant.h> |
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | #include <qmainwindow.h> | 17 | #include <qmainwindow.h> |
18 | #include <qdir.h> | 18 | #include <qdir.h> |
19 | #include <qstring.h> | 19 | #include <qstring.h> |
20 | #include <qpoint.h> | 20 | #include <qpoint.h> |
21 | 21 | ||
22 | class QVBoxLayout; | 22 | class QVBoxLayout; |
23 | class QHBoxLayout; | 23 | class QHBoxLayout; |
24 | class QGridLayout; | 24 | class QGridLayout; |
25 | class QComboBox; | 25 | class QComboBox; |
26 | class QListView; | 26 | class QListView; |
27 | class QListviewItem; | 27 | class QListviewItem; |
28 | class QLabel; | 28 | class QLabel; |
29 | class QProgressBar; | 29 | class QProgressBar; |
30 | class QSpinBox; | 30 | class QSpinBox; |
31 | class QTabWidget; | 31 | class QTabWidget; |
32 | class QWidget; | 32 | class QWidget; |
33 | class QPEToolBar; | 33 | class QPEToolBar; |
34 | class QPEMenuBar; | 34 | class QPEMenuBar; |
35 | class QPopupMenu; | 35 | class QPopupMenu; |
36 | class QFile; | 36 | class QFile; |
37 | class QListViewItem; | 37 | class QListViewItem; |
38 | class QLineEdit; | 38 | class QLineEdit; |
39 | class QPushButton; | 39 | class QPushButton; |
40 | class QStringList; | 40 | class QStringList; |
41 | 41 | ||
42 | class OpieFtp : public QMainWindow | 42 | class OpieFtp : public QMainWindow |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | 45 | ||
46 | public: | 46 | public: |
47 | OpieFtp( ); | 47 | OpieFtp( ); |
48 | ~OpieFtp(); | 48 | ~OpieFtp(); |
49 | 49 | ||
50 | QTabWidget *TabWidget; | 50 | QTabWidget *TabWidget; |
51 | QWidget *tab, *tab_2, *tab_3; | 51 | QWidget *tab, *tab_2, *tab_3; |
52 | QListView *Local_View, *Remote_View; | 52 | QListView *Local_View, *Remote_View; |
53 | 53 | ||
54 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; | 54 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; |
55 | QLineEdit *PasswordEdit, *remotePath; | 55 | QLineEdit *PasswordEdit, *remotePath; |
56 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; | 56 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; |
57 | QSpinBox* PortSpinBox; | 57 | QSpinBox* PortSpinBox; |
58 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; | 58 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu; |
59 | QDir currentDir; | 59 | QDir currentDir; |
60 | QString currentRemoteDir; | 60 | QString currentRemoteDir; |
61 | QString filterStr; | 61 | QString filterStr; |
62 | QListViewItem * item; | 62 | QListViewItem * item; |
63 | QPushButton *connectServerBtn, *cdUpButton, *homeButton, *docButton; | 63 | QPushButton *connectServerBtn, *cdUpButton, *homeButton, *docButton; |
64 | bool b; | 64 | bool b; |
65 | int currentServerConfig; | 65 | int currentServerConfig; |
66 | protected slots: | 66 | protected slots: |
67 | void upDir(); | 67 | void upDir(); |
68 | void homeButtonPushed(); | 68 | void homeButtonPushed(); |
69 | void docButtonPushed(); | 69 | void docButtonPushed(); |
70 | 70 | void doAbout(); | |
71 | void serverComboEdited(const QString & ); | 71 | void serverComboEdited(const QString & ); |
72 | void showLocalMenu( QListViewItem *); | 72 | void showLocalMenu( QListViewItem *); |
73 | void showRemoteMenu( QListViewItem *); | 73 | void showRemoteMenu( QListViewItem *); |
74 | void doLocalCd(); | 74 | void doLocalCd(); |
75 | void doRemoteCd(); | 75 | void doRemoteCd(); |
76 | void localUpload(); | 76 | void localUpload(); |
77 | void remoteDownload(); | 77 | void remoteDownload(); |
78 | void newConnection(); | 78 | void newConnection(); |
79 | void connector(); | 79 | void connector(); |
80 | void disConnector(); | 80 | void disConnector(); |
81 | void populateLocalView(); | 81 | void populateLocalView(); |
82 | bool populateRemoteView(); | 82 | bool populateRemoteView(); |
83 | void showHidden(); | 83 | void showHidden(); |
84 | void writeConfig(); | 84 | void writeConfig(); |
85 | void readConfig(); | 85 | void readConfig(); |
86 | void localListClicked(QListViewItem *); | 86 | void localListClicked(QListViewItem *); |
87 | void remoteListClicked(QListViewItem *); | 87 | void remoteListClicked(QListViewItem *); |
88 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 88 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
89 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); | 89 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); |
90 | void localMakDir(); | 90 | void localMakDir(); |
91 | void localDelete(); | 91 | void localDelete(); |
92 | void remoteMakDir(); | 92 | void remoteMakDir(); |
93 | void remoteDelete(); | 93 | void remoteDelete(); |
94 | bool remoteDirList(const QString &); | 94 | bool remoteDirList(const QString &); |
95 | bool remoteChDir(const QString &); | 95 | bool remoteChDir(const QString &); |
96 | void tabChanged(QWidget*); | 96 | void tabChanged(QWidget*); |
97 | void cleanUp(); | 97 | void cleanUp(); |
98 | void remoteRename(); | 98 | void remoteRename(); |
99 | void localRename(); | 99 | void localRename(); |
100 | void currentPathComboChanged(); | 100 | void currentPathComboChanged(); |
101 | void currentPathComboActivated(const QString &); | 101 | void currentPathComboActivated(const QString &); |
102 | void switchToLocalTab(); | 102 | void switchToLocalTab(); |
103 | void switchToRemoteTab(); | 103 | void switchToRemoteTab(); |
104 | void switchToConfigTab(); | 104 | void switchToConfigTab(); |
105 | void fillCombos(); | 105 | void fillCombos(); |
106 | void fillRemoteCombo(const QString&); | 106 | void fillRemoteCombo(const QString&); |
107 | void fillCombo(const QString &); | 107 | void fillCombo(const QString &); |
108 | void serverComboSelected(int); | 108 | void serverComboSelected(int); |
109 | void deleteServer(); | 109 | void deleteServer(); |
110 | void connectorBtnToggled(bool); | 110 | void connectorBtnToggled(bool); |
111 | protected: | 111 | protected: |
112 | QStringList remoteDirPathStringList, localDirPathStringList; | 112 | QStringList remoteDirPathStringList, localDirPathStringList; |
113 | void nullifyCallBack(); | 113 | void nullifyCallBack(); |
114 | QGridLayout* tabLayout; | 114 | QGridLayout* tabLayout; |
115 | QGridLayout* tabLayout_2; | 115 | QGridLayout* tabLayout_2; |
116 | QGridLayout* tabLayout_3; | 116 | QGridLayout* tabLayout_3; |
117 | 117 | ||
118 | }; | 118 | }; |
119 | 119 | ||
120 | #endif // OPIEFTP_H | 120 | #endif // OPIEFTP_H |
diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro index f25d15f..7aead00 100644 --- a/noncore/net/opieftp/opieftp.pro +++ b/noncore/net/opieftp/opieftp.pro | |||
@@ -1,23 +1,23 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS = opieftp.h inputDialog.h ftplib.h | 3 | HEADERS = opieftp.h inputDialog.h ftplib.h filePermissions.h |
4 | SOURCES = opieftp.cpp inputDialog.cpp ftplib.c main.cpp | 4 | SOURCES = opieftp.cpp inputDialog.cpp ftplib.c filePermissions.cpp main.cpp |
5 | TARGET = opieftp | 5 | TARGET = opieftp |
6 | REQUIRES=medium-config | 6 | REQUIRES=medium-config |
7 | DESTDIR = $(OPIEDIR)/bin | 7 | DESTDIR = $(OPIEDIR)/bin |
8 | INCLUDEPATH += $(OPIEDIR)/include | 8 | INCLUDEPATH += $(OPIEDIR)/include |
9 | DEPENDPATH += $(OPIEDIR)/include | 9 | DEPENDPATH += $(OPIEDIR)/include |
10 | LIBS += -lqpe | 10 | LIBS += -lqpe |
11 | 11 | ||
12 | TRANSLATIONS = ../../i18n/pt_BR/opieftp.ts | 12 | TRANSLATIONS = ../../i18n/pt_BR/opieftp.ts |
13 | TRANSLATIONS += ../../i18n/de/opieftp.ts | 13 | TRANSLATIONS += ../../i18n/de/opieftp.ts |
14 | TRANSLATIONS += ../../i18n/en/opieftp.ts | 14 | TRANSLATIONS += ../../i18n/en/opieftp.ts |
15 | TRANSLATIONS += ../../i18n/hu/opieftp.ts | 15 | TRANSLATIONS += ../../i18n/hu/opieftp.ts |
16 | TRANSLATIONS += ../../i18n/sl/opieftp.ts | 16 | TRANSLATIONS += ../../i18n/sl/opieftp.ts |
17 | TRANSLATIONS += ../../i18n/pl/opieftp.ts | 17 | TRANSLATIONS += ../../i18n/pl/opieftp.ts |
18 | TRANSLATIONS += ../../i18n/ja/opieftp.ts | 18 | TRANSLATIONS += ../../i18n/ja/opieftp.ts |
19 | TRANSLATIONS += ../../i18n/ko/opieftp.ts | 19 | TRANSLATIONS += ../../i18n/ko/opieftp.ts |
20 | TRANSLATIONS += ../../i18n/no/opieftp.ts | 20 | TRANSLATIONS += ../../i18n/no/opieftp.ts |
21 | TRANSLATIONS += ../../i18n/zh_CN/opieftp.ts | 21 | TRANSLATIONS += ../../i18n/zh_CN/opieftp.ts |
22 | TRANSLATIONS += ../../i18n/zh_TW/opieftp.ts | 22 | TRANSLATIONS += ../../i18n/zh_TW/opieftp.ts |
23 | TRANSLATIONS += ../../i18n/fr/opieftp.ts | 23 | TRANSLATIONS += ../../i18n/fr/opieftp.ts |