author | drw <drw> | 2005-05-04 23:07:10 (UTC) |
---|---|---|
committer | drw <drw> | 2005-05-04 23:07:10 (UTC) |
commit | d89cbf4ba511beaf228ce87d4e21a2a6a49767f2 (patch) (unidiff) | |
tree | d7c1518bfa0550b99d73fe85630cebe351155a37 | |
parent | 5db2256e7e342f290e17096cf70b8b318bfcd987 (diff) | |
download | opie-d89cbf4ba511beaf228ce87d4e21a2a6a49767f2.zip opie-d89cbf4ba511beaf228ce87d4e21a2a6a49767f2.tar.gz opie-d89cbf4ba511beaf228ce87d4e21a2a6a49767f2.tar.bz2 |
Resource -> OResource
-rw-r--r-- | noncore/net/opieftp/opie-ftp.control | 2 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 71 |
2 files changed, 32 insertions, 41 deletions
diff --git a/noncore/net/opieftp/opie-ftp.control b/noncore/net/opieftp/opie-ftp.control index 32cc7a6..82f774f 100644 --- a/noncore/net/opieftp/opie-ftp.control +++ b/noncore/net/opieftp/opie-ftp.control | |||
@@ -1,11 +1,11 @@ | |||
1 | Package: opie-ftp | 1 | Package: opie-ftp |
2 | Files: plugins/application/libopieftp.so* bin/opieftp pics/opieftp apps/Applications/opieftp.desktop | 2 | Files: plugins/application/libopieftp.so* bin/opieftp pics/opieftp apps/Applications/opieftp.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: L.J. Potter <ljp@llornkcor.com> | 5 | Maintainer: L.J. Potter <ljp@llornkcor.com> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, ftplib | 7 | Depends: task-opie-minimal, ftplib, libopiecore2 |
8 | Replaces: opieftp | 8 | Replaces: opieftp |
9 | Description: Opie-Ftp | 9 | Description: Opie-Ftp |
10 | The ftp client for the Opie environment. | 10 | The ftp client for the Opie environment. |
11 | Version: $QPE_VERSION$EXTRAVERSION | 11 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 4f0ca29..14fd859 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,472 +1,464 @@ | |||
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 | 15 | ||
16 | extern "C" { | 16 | extern "C" { |
17 | #include <ftplib.h> | 17 | #include <ftplib.h> |
18 | } | 18 | } |
19 | 19 | ||
20 | #include "inputDialog.h" | 20 | #include "inputDialog.h" |
21 | 21 | ||
22 | /* OPIE */ | 22 | /* OPIE */ |
23 | //#include <opie2/odebug.h> | 23 | //#include <opie2/odebug.h> |
24 | //using namespace Opie::Core; | 24 | //using namespace Opie::Core; |
25 | 25 | ||
26 | #include <qpe/qpeapplication.h> | 26 | #include <opie2/oresource.h> |
27 | #include <qpe/resource.h> | 27 | |
28 | #include <qpe/applnk.h> | ||
28 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
29 | #include <qpe/mimetype.h> | 30 | #include <qpe/mimetype.h> |
31 | #include <qpe/qpeapplication.h> | ||
32 | #include <qpe/qpemenubar.h> | ||
30 | 33 | ||
31 | #include <qtextstream.h> | 34 | #include <qbitmap.h> |
32 | #include <qpushbutton.h> | ||
33 | #include <qtoolbutton.h> | ||
34 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
35 | #include <qlistview.h> | ||
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qlayout.h> | ||
38 | #include <qlistview.h> | ||
39 | #include <qmenubar.h> | ||
40 | #include <qmessagebox.h> | ||
37 | #include <qprogressbar.h> | 41 | #include <qprogressbar.h> |
42 | #include <qpushbutton.h> | ||
38 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
39 | #include <qtabwidget.h> | 44 | #include <qtabwidget.h> |
40 | #include <qlayout.h> | 45 | #include <qtextstream.h> |
41 | #include <qmessagebox.h> | 46 | #include <qtoolbutton.h> |
42 | #include <qmenubar.h> | ||
43 | #include <qpe/qpemenubar.h> | ||
44 | 47 | ||
45 | #include <qlineedit.h> | 48 | #include <qlineedit.h> |
46 | #include <qlistbox.h> | 49 | #include <qlistbox.h> |
47 | #include <qvbox.h> | 50 | #include <qvbox.h> |
48 | /* STD */ | 51 | /* STD */ |
49 | #include <unistd.h> | 52 | #include <unistd.h> |
50 | #include <stdlib.h> | 53 | #include <stdlib.h> |
51 | 54 | ||
52 | QProgressBar *ProgressBar; | 55 | QProgressBar *ProgressBar; |
53 | static netbuf *conn = NULL; | 56 | static netbuf *conn = NULL; |
54 | 57 | ||
55 | static int log_progress(netbuf *, int xfered, void *) | 58 | static int log_progress(netbuf *, int xfered, void *) |
56 | { | 59 | { |
57 | // int fsz = *(int *)arg; | 60 | // int fsz = *(int *)arg; |
58 | // int pct = (xfered * 100) / fsz; | 61 | // int pct = (xfered * 100) / fsz; |
59 | // printf("%3d%%\r", pct); | 62 | // printf("%3d%%\r", pct); |
60 | // fflush(stdout); | 63 | // fflush(stdout); |
61 | ProgressBar->setProgress(xfered); | 64 | ProgressBar->setProgress(xfered); |
62 | qApp->processEvents(); | 65 | qApp->processEvents(); |
63 | return 1; | 66 | return 1; |
64 | } | 67 | } |
65 | 68 | ||
66 | OpieFtp::OpieFtp( QWidget* , const char*, WFlags) | 69 | OpieFtp::OpieFtp( QWidget* , const char*, WFlags) |
67 | : QMainWindow( ) | 70 | : QMainWindow( ) |
68 | { | 71 | { |
69 | qDebug("OpieFtp constructor"); | 72 | qDebug("OpieFtp constructor"); |
70 | setCaption( tr( "OpieFtp" ) ); | 73 | setCaption( tr( "OpieFtp" ) ); |
71 | // initializeGui(); | 74 | // initializeGui(); |
72 | QTimer::singleShot( 50, this, SLOT(initializeGui() )); | 75 | QTimer::singleShot( 50, this, SLOT(initializeGui() )); |
73 | } | 76 | } |
74 | 77 | ||
75 | void OpieFtp::initializeGui() { | 78 | void OpieFtp::initializeGui() { |
76 | fuckeduphack=FALSE; | 79 | fuckeduphack=FALSE; |
77 | 80 | ||
78 | QVBox* wrapperBox = new QVBox( this ); | 81 | QVBox* wrapperBox = new QVBox( this ); |
79 | setCentralWidget( wrapperBox ); | 82 | setCentralWidget( wrapperBox ); |
80 | 83 | ||
81 | QWidget *view = new QWidget( wrapperBox ); | 84 | QWidget *view = new QWidget( wrapperBox ); |
82 | 85 | ||
83 | QGridLayout *layout = new QGridLayout( view ); | 86 | QGridLayout *layout = new QGridLayout( view ); |
84 | layout->setSpacing( 1); | 87 | layout->setSpacing( 1); |
85 | layout->setMargin( 1); | 88 | layout->setMargin( 1); |
86 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 89 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
87 | 90 | ||
88 | QPEMenuBar *menuBar = new QPEMenuBar(view); | 91 | QPEMenuBar *menuBar = new QPEMenuBar(view); |
89 | // QMenuBar *menuBar = new QMenuBar(this); | 92 | // QMenuBar *menuBar = new QMenuBar(this); |
90 | // QPEToolBar *menuBar = new QPEToolBar(this); | 93 | // QPEToolBar *menuBar = new QPEToolBar(this); |
91 | // menuBar->setHorizontalStretchable( TRUE ); | 94 | // menuBar->setHorizontalStretchable( TRUE ); |
92 | 95 | ||
93 | QWMatrix matrix; | 96 | unknownXpm = Opie::Core::OResource::loadPixmap( "UnknownDocument", Opie::Core::OResource::SmallIcon ); |
94 | QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); | ||
95 | matrix.scale( .4, .4); | ||
96 | unknownXpm = pix.xForm(matrix); | ||
97 | 97 | ||
98 | connectionMenu = new QPopupMenu( this ); | 98 | connectionMenu = new QPopupMenu( this ); |
99 | localMenu = new QPopupMenu( this ); | 99 | localMenu = new QPopupMenu( this ); |
100 | remoteMenu = new QPopupMenu( this ); | 100 | remoteMenu = new QPopupMenu( this ); |
101 | tabMenu = new QPopupMenu( this ); | 101 | tabMenu = new QPopupMenu( this ); |
102 | 102 | ||
103 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); | 103 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); |
104 | 104 | ||
105 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 105 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
106 | // menuBar->insertItem( tr( "Local" ), localMenu); | 106 | // menuBar->insertItem( tr( "Local" ), localMenu); |
107 | // menuBar->insertItem( tr( "Remote" ), remoteMenu); | 107 | // menuBar->insertItem( tr( "Remote" ), remoteMenu); |
108 | menuBar->insertItem( tr( "View" ), tabMenu); | 108 | menuBar->insertItem( tr( "View" ), tabMenu); |
109 | 109 | ||
110 | tabMenu->insertItem( tr( "Local" ), localMenu); | 110 | tabMenu->insertItem( tr( "Local" ), localMenu); |
111 | tabMenu->insertItem( tr( "Remote" ), remoteMenu); | 111 | tabMenu->insertItem( tr( "Remote" ), remoteMenu); |
112 | 112 | ||
113 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 113 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
114 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 114 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
115 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 115 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
116 | 116 | ||
117 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 117 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
118 | localMenu->insertSeparator(); | 118 | localMenu->insertSeparator(); |
119 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 119 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
120 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 120 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
121 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 121 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
122 | localMenu->insertSeparator(); | 122 | localMenu->insertSeparator(); |
123 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 123 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
124 | localMenu->setCheckable(TRUE); | 124 | localMenu->setCheckable(TRUE); |
125 | 125 | ||
126 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 126 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
127 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 127 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
128 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 128 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
129 | remoteMenu->insertSeparator(); | 129 | remoteMenu->insertSeparator(); |
130 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 130 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
131 | 131 | ||
132 | tabMenu->insertSeparator(); | 132 | tabMenu->insertSeparator(); |
133 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 133 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
134 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 134 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
135 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 135 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
136 | tabMenu->insertSeparator(); | ||
137 | // tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | ||
138 | tabMenu->setCheckable(TRUE); | 136 | tabMenu->setCheckable(TRUE); |
139 | 137 | ||
140 | 138 | bool useBigPix = qApp->desktop()->size().width() > 330; | |
141 | cdUpButton = new QToolButton( view,"cdUpButton"); | 139 | cdUpButton = new QToolButton( view,"cdUpButton"); |
142 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 140 | cdUpButton->setUsesBigPixmap( useBigPix ); |
143 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 141 | cdUpButton->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ); |
142 | cdUpButton->setFixedSize( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | ||
144 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 143 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
145 | layout->addMultiCellWidget( cdUpButton, 0, 0, 4, 4 ); | 144 | layout->addMultiCellWidget( cdUpButton, 0, 0, 4, 4 ); |
146 | cdUpButton->hide(); | 145 | cdUpButton->hide(); |
147 | 146 | ||
148 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton"); | ||
149 | // docButton->setFixedSize( QSize( 20, 20 ) ); | ||
150 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | ||
151 | // docButton->setFlat(TRUE); | ||
152 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); | ||
153 | |||
154 | homeButton = new QToolButton( view,"homeButton"); | 147 | homeButton = new QToolButton( view,"homeButton"); |
155 | homeButton->setPixmap( Resource::loadPixmap("home")); | 148 | homeButton->setUsesBigPixmap( useBigPix ); |
156 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 149 | homeButton->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) ); |
150 | homeButton->setFixedSize( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | ||
157 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 151 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
158 | layout->addMultiCellWidget( homeButton, 0, 0, 3, 3); | 152 | layout->addMultiCellWidget( homeButton, 0, 0, 3, 3); |
159 | homeButton->hide(); | 153 | homeButton->hide(); |
160 | 154 | ||
161 | TabWidget = new QTabWidget( view, "TabWidget" ); | 155 | TabWidget = new QTabWidget( view, "TabWidget" ); |
162 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); | 156 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); |
163 | 157 | ||
164 | // TabWidget->setTabShape(QTabWidget::Triangular); | ||
165 | |||
166 | tab = new QWidget( TabWidget, "tab" ); | 158 | tab = new QWidget( TabWidget, "tab" ); |
167 | tabLayout = new QGridLayout( tab ); | 159 | tabLayout = new QGridLayout( tab ); |
168 | tabLayout->setSpacing( 2); | 160 | tabLayout->setSpacing( 2); |
169 | tabLayout->setMargin( 2); | 161 | tabLayout->setMargin( 2); |
170 | 162 | ||
171 | Local_View = new QListView( tab, "Local_View" ); | 163 | Local_View = new QListView( tab, "Local_View" ); |
172 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 164 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
173 | Local_View->addColumn( tr("File"),150); | 165 | Local_View->addColumn( tr("File"),150); |
174 | Local_View->addColumn( tr("Date"),-1); | 166 | Local_View->addColumn( tr("Date"),-1); |
175 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 167 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
176 | Local_View->addColumn( tr("Size"),-1); | 168 | Local_View->addColumn( tr("Size"),-1); |
177 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 169 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
178 | Local_View->setAllColumnsShowFocus(TRUE); | 170 | Local_View->setAllColumnsShowFocus(TRUE); |
179 | 171 | ||
180 | Local_View->setMultiSelection( TRUE); | 172 | Local_View->setMultiSelection( TRUE); |
181 | Local_View->setSelectionMode(QListView::Extended); | 173 | Local_View->setSelectionMode(QListView::Extended); |
182 | Local_View->setFocusPolicy(QWidget::ClickFocus); | 174 | Local_View->setFocusPolicy(QWidget::ClickFocus); |
183 | 175 | ||
184 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 176 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
185 | 177 | ||
186 | tabLayout->addWidget( Local_View, 0, 0 ); | 178 | tabLayout->addWidget( Local_View, 0, 0 ); |
187 | 179 | ||
188 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), | 180 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), |
189 | this,SLOT( localListClicked(QListViewItem*)) ); | 181 | this,SLOT( localListClicked(QListViewItem*)) ); |
190 | // connect( Local_View, SIGNAL( doubleClicked(QListViewItem*)), | 182 | // connect( Local_View, SIGNAL( doubleClicked(QListViewItem*)), |
191 | // this,SLOT( localListClicked(QListViewItem*)) ); | 183 | // this,SLOT( localListClicked(QListViewItem*)) ); |
192 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 184 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
193 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); | 185 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
194 | 186 | ||
195 | TabWidget->insertTab( tab, tr( "Local" ) ); | 187 | TabWidget->insertTab( tab, tr( "Local" ) ); |
196 | 188 | ||
197 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 189 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
198 | tabLayout_2 = new QGridLayout( tab_2 ); | 190 | tabLayout_2 = new QGridLayout( tab_2 ); |
199 | tabLayout_2->setSpacing( 2); | 191 | tabLayout_2->setSpacing( 2); |
200 | tabLayout_2->setMargin( 2); | 192 | tabLayout_2->setMargin( 2); |
201 | 193 | ||
202 | Remote_View = new QListView( tab_2, "Remote_View" ); | 194 | Remote_View = new QListView( tab_2, "Remote_View" ); |
203 | Remote_View->addColumn( tr("File"),150); | 195 | Remote_View->addColumn( tr("File"),150); |
204 | Remote_View->addColumn( tr("Date"),-1); | 196 | Remote_View->addColumn( tr("Date"),-1); |
205 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); | 197 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); |
206 | Remote_View->addColumn( tr("Size"),-1); | 198 | Remote_View->addColumn( tr("Size"),-1); |
207 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 199 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
208 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); | 200 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); |
209 | Remote_View->addColumn( tr("Dir"),-1); | 201 | Remote_View->addColumn( tr("Dir"),-1); |
210 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 202 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
211 | Remote_View->setAllColumnsShowFocus(TRUE); | 203 | Remote_View->setAllColumnsShowFocus(TRUE); |
212 | 204 | ||
213 | Remote_View->setMultiSelection( FALSE); | 205 | Remote_View->setMultiSelection( FALSE); |
214 | Remote_View->setSelectionMode(QListView::Extended); | 206 | Remote_View->setSelectionMode(QListView::Extended); |
215 | Remote_View->setFocusPolicy(QWidget::ClickFocus); | 207 | Remote_View->setFocusPolicy(QWidget::ClickFocus); |
216 | 208 | ||
217 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 209 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
218 | 210 | ||
219 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), | 211 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), |
220 | this,SLOT( remoteListClicked(QListViewItem*)) ); | 212 | this,SLOT( remoteListClicked(QListViewItem*)) ); |
221 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 213 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
222 | this,SLOT( RemoteListPressed(int,QListViewItem*,const QPoint&,int)) ); | 214 | this,SLOT( RemoteListPressed(int,QListViewItem*,const QPoint&,int)) ); |
223 | 215 | ||
224 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 216 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
225 | 217 | ||
226 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 218 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
227 | 219 | ||
228 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 220 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
229 | tabLayout_3 = new QGridLayout( tab_3 ); | 221 | tabLayout_3 = new QGridLayout( tab_3 ); |
230 | tabLayout_3->setSpacing( 2); | 222 | tabLayout_3->setSpacing( 2); |
231 | tabLayout_3->setMargin( 2); | 223 | tabLayout_3->setMargin( 2); |
232 | 224 | ||
233 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 225 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
234 | TextLabel1->setText( tr( "Username" ) ); | 226 | TextLabel1->setText( tr( "Username" ) ); |
235 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 227 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
236 | 228 | ||
237 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 229 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
238 | UsernameComboBox->setEditable(TRUE); | 230 | UsernameComboBox->setEditable(TRUE); |
239 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 231 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
240 | 232 | ||
241 | connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this, | 233 | connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this, |
242 | SLOT( UsernameComboBoxEdited(const QString&) )); | 234 | SLOT( UsernameComboBoxEdited(const QString&) )); |
243 | 235 | ||
244 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 236 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
245 | TextLabel2->setText( tr( "Password" ) ); | 237 | TextLabel2->setText( tr( "Password" ) ); |
246 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 238 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
247 | 239 | ||
248 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 240 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
249 | PasswordEdit->setEchoMode(QLineEdit::Password); | 241 | PasswordEdit->setEchoMode(QLineEdit::Password); |
250 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 242 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
251 | 243 | ||
252 | connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this, | 244 | connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this, |
253 | SLOT( PasswordEditEdited(const QString&) )); | 245 | SLOT( PasswordEditEdited(const QString&) )); |
254 | 246 | ||
255 | //PasswordEdit->setFixedWidth(85); | 247 | //PasswordEdit->setFixedWidth(85); |
256 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 248 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
257 | TextLabel3->setText( tr( "Remote server" ) ); | 249 | TextLabel3->setText( tr( "Remote server" ) ); |
258 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 250 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
259 | 251 | ||
260 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 252 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
261 | ServerComboBox->setEditable(TRUE); | 253 | ServerComboBox->setEditable(TRUE); |
262 | ServerComboBox->setAutoCompletion(true); | 254 | ServerComboBox->setAutoCompletion(true); |
263 | // ServerComboBox->blockSignals(true); | 255 | // ServerComboBox->blockSignals(true); |
264 | 256 | ||
265 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 257 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
266 | 258 | ||
267 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) )); | 259 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) )); |
268 | connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this, | 260 | connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this, |
269 | SLOT(serverComboEdited(const QString&) )); | 261 | SLOT(serverComboEdited(const QString&) )); |
270 | 262 | ||
271 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 263 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
272 | TextLabel5->setText( tr( "Remote path" ) ); | 264 | TextLabel5->setText( tr( "Remote path" ) ); |
273 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 265 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
274 | 266 | ||
275 | 267 | ||
276 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 268 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
277 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 269 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
278 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 270 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
279 | TextLabel4->setText( tr( "Port" ) ); | 271 | TextLabel4->setText( tr( "Port" ) ); |
280 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 272 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
281 | 273 | ||
282 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 274 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
283 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 275 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
284 | PortSpinBox->setMaxValue(32786); | 276 | PortSpinBox->setMaxValue(32786); |
285 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 277 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
286 | 278 | ||
287 | serverListView = new QListBox( tab_3, "ServerListView" ); | 279 | serverListView = new QListBox( tab_3, "ServerListView" ); |
288 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); | 280 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); |
289 | 281 | ||
290 | connect( serverListView, SIGNAL( highlighted(const QString&)), | 282 | connect( serverListView, SIGNAL( highlighted(const QString&)), |
291 | this,SLOT( serverListClicked(const QString&) ) ); | 283 | this,SLOT( serverListClicked(const QString&) ) ); |
292 | 284 | ||
293 | connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); | 285 | connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); |
294 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); | 286 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); |
295 | connectServerBtn->setToggleButton(TRUE); | 287 | connectServerBtn->setToggleButton(TRUE); |
296 | connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) )); | 288 | connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) )); |
297 | 289 | ||
298 | newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); | 290 | newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); |
299 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); | 291 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); |
300 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); | 292 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); |
301 | 293 | ||
302 | QPushButton *deleteServerBtn; | 294 | QPushButton *deleteServerBtn; |
303 | deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); | 295 | deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); |
304 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); | 296 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); |
305 | 297 | ||
306 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 298 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
307 | 299 | ||
308 | 300 | ||
309 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 301 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
310 | tabLayout_3->addItem( spacer, 5, 0 ); | 302 | tabLayout_3->addItem( spacer, 5, 0 ); |
311 | 303 | ||
312 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 304 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
313 | 305 | ||
314 | connect(TabWidget,SIGNAL(currentChanged(QWidget*)), | 306 | connect(TabWidget,SIGNAL(currentChanged(QWidget*)), |
315 | this,SLOT(tabChanged(QWidget*))); | 307 | this,SLOT(tabChanged(QWidget*))); |
316 | 308 | ||
317 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 309 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
318 | currentDir.setPath( QDir::currentDirPath()); | 310 | currentDir.setPath( QDir::currentDirPath()); |
319 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 311 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
320 | 312 | ||
321 | currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); | 313 | currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); |
322 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); | 314 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); |
323 | 315 | ||
324 | currentPathCombo ->setFixedWidth(220); | 316 | currentPathCombo ->setFixedWidth(220); |
325 | currentPathCombo->setEditable(TRUE); | 317 | currentPathCombo->setEditable(TRUE); |
326 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 318 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
327 | 319 | ||
328 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), | 320 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), |
329 | this, SLOT( currentPathComboActivated(const QString&) ) ); | 321 | this, SLOT( currentPathComboActivated(const QString&) ) ); |
330 | 322 | ||
331 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 323 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
332 | this,SLOT(currentPathComboChanged())); | 324 | this,SLOT(currentPathComboChanged())); |
333 | ProgressBar = new QProgressBar( view, "ProgressBar" ); | 325 | ProgressBar = new QProgressBar( view, "ProgressBar" ); |
334 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 326 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
335 | ProgressBar->setMaximumHeight(10); | 327 | ProgressBar->setMaximumHeight(10); |
336 | filterStr="*"; | 328 | filterStr="*"; |
337 | b=FALSE; | 329 | b=FALSE; |
338 | populateLocalView(); | 330 | populateLocalView(); |
339 | readConfig(); | 331 | readConfig(); |
340 | 332 | ||
341 | // ServerComboBox->setCurrentItem(currentServerConfig); | 333 | // ServerComboBox->setCurrentItem(currentServerConfig); |
342 | 334 | ||
343 | TabWidget->setCurrentPage(2); | 335 | TabWidget->setCurrentPage(2); |
344 | qDebug("XXXXXXXXXXXX Constructor done"); | 336 | // qDebug("XXXXXXXXXXXX Constructor done"); |
345 | 337 | ||
346 | } | 338 | } |
347 | 339 | ||
348 | OpieFtp::~OpieFtp() | 340 | OpieFtp::~OpieFtp() |
349 | { | 341 | { |
350 | } | 342 | } |
351 | 343 | ||
352 | void OpieFtp::cleanUp() | 344 | void OpieFtp::cleanUp() |
353 | { | 345 | { |
354 | if(conn) | 346 | if(conn) |
355 | FtpQuit(conn); | 347 | FtpQuit(conn); |
356 | QString sfile=QDir::homeDirPath(); | 348 | QString sfile=QDir::homeDirPath(); |
357 | if(sfile.right(1) != "/") | 349 | if(sfile.right(1) != "/") |
358 | sfile+="/._temp"; | 350 | sfile+="/._temp"; |
359 | else | 351 | else |
360 | sfile+="._temp"; | 352 | sfile+="._temp"; |
361 | QFile file( sfile); | 353 | QFile file( sfile); |
362 | if(file.exists()) | 354 | if(file.exists()) |
363 | file.remove(); | 355 | file.remove(); |
364 | Config cfg("opieftp"); | 356 | Config cfg("opieftp"); |
365 | cfg.setGroup("Server"); | 357 | cfg.setGroup("Server"); |
366 | cfg.writeEntry("currentServer", currentServerConfig); | 358 | cfg.writeEntry("currentServer", currentServerConfig); |
367 | 359 | ||
368 | exit(0); | 360 | exit(0); |
369 | } | 361 | } |
370 | 362 | ||
371 | void OpieFtp::tabChanged(QWidget *) | 363 | void OpieFtp::tabChanged(QWidget *) |
372 | { | 364 | { |
373 | if (TabWidget->currentPageIndex() == 0) { | 365 | if (TabWidget->currentPageIndex() == 0) { |
374 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 366 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
375 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 367 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
376 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 368 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
377 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 369 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
378 | if(cdUpButton->isHidden()) | 370 | if(cdUpButton->isHidden()) |
379 | cdUpButton->show(); | 371 | cdUpButton->show(); |
380 | if(homeButton->isHidden()) | 372 | if(homeButton->isHidden()) |
381 | homeButton->show(); | 373 | homeButton->show(); |
382 | if(currentPathCombo->isHidden()) currentPathCombo->show(); | 374 | if(currentPathCombo->isHidden()) currentPathCombo->show(); |
383 | 375 | ||
384 | } | 376 | } |
385 | if (TabWidget->currentPageIndex() == 1) { | 377 | if (TabWidget->currentPageIndex() == 1) { |
386 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 378 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
387 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 379 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
388 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 380 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
389 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 381 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
390 | if(cdUpButton->isHidden()) | 382 | if(cdUpButton->isHidden()) |
391 | cdUpButton->show(); | 383 | cdUpButton->show(); |
392 | homeButton->hide(); | 384 | homeButton->hide(); |
393 | if(currentPathCombo->isHidden()) currentPathCombo->show(); | 385 | if(currentPathCombo->isHidden()) currentPathCombo->show(); |
394 | 386 | ||
395 | } | 387 | } |
396 | if (TabWidget->currentPageIndex() == 2) { | 388 | if (TabWidget->currentPageIndex() == 2) { |
397 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 389 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
398 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 390 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
399 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 391 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
400 | cdUpButton->hide(); | 392 | cdUpButton->hide(); |
401 | homeButton->hide(); | 393 | homeButton->hide(); |
402 | if(!currentPathCombo->isHidden()) currentPathCombo->hide(); | 394 | if(!currentPathCombo->isHidden()) currentPathCombo->hide(); |
403 | } | 395 | } |
404 | } | 396 | } |
405 | 397 | ||
406 | void OpieFtp::newConnection() | 398 | void OpieFtp::newConnection() |
407 | { | 399 | { |
408 | UsernameComboBox->lineEdit()->setText(""); | 400 | UsernameComboBox->lineEdit()->setText(""); |
409 | PasswordEdit->setText( "" ); | 401 | PasswordEdit->setText( "" ); |
410 | ServerComboBox->lineEdit()->setText( ""); | 402 | ServerComboBox->lineEdit()->setText( ""); |
411 | remotePath->setText( currentRemoteDir = "/"); | 403 | remotePath->setText( currentRemoteDir = "/"); |
412 | PortSpinBox->setValue( 21); | 404 | PortSpinBox->setValue( 21); |
413 | TabWidget->setCurrentPage(2); | 405 | TabWidget->setCurrentPage(2); |
414 | } | 406 | } |
415 | 407 | ||
416 | void OpieFtp::serverComboEdited(const QString & ) | 408 | void OpieFtp::serverComboEdited(const QString & ) |
417 | { | 409 | { |
418 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { | 410 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { |
419 | // odebug << "ServerComboEdited" << oendl; | 411 | // odebug << "ServerComboEdited" << oendl; |
420 | // // currentServerConfig = -1; | 412 | // // currentServerConfig = -1; |
421 | // } | 413 | // } |
422 | } | 414 | } |
423 | 415 | ||
424 | void OpieFtp::UsernameComboBoxEdited(const QString &) { | 416 | void OpieFtp::UsernameComboBoxEdited(const QString &) { |
425 | // currentServerConfig = -1; | 417 | // currentServerConfig = -1; |
426 | } | 418 | } |
427 | 419 | ||
428 | void OpieFtp::PasswordEditEdited(const QString & ) { | 420 | void OpieFtp::PasswordEditEdited(const QString & ) { |
429 | // currentServerConfig = -1; | 421 | // currentServerConfig = -1; |
430 | } | 422 | } |
431 | 423 | ||
432 | void OpieFtp::connectorBtnToggled(bool On) | 424 | void OpieFtp::connectorBtnToggled(bool On) |
433 | { | 425 | { |
434 | if(On) { | 426 | if(On) { |
435 | connector(); | 427 | connector(); |
436 | } else { | 428 | } else { |
437 | disConnector(); | 429 | disConnector(); |
438 | } | 430 | } |
439 | 431 | ||
440 | } | 432 | } |
441 | 433 | ||
442 | void OpieFtp::connector() | 434 | void OpieFtp::connector() |
443 | { | 435 | { |
444 | // QCopEnvelope ( "QPE/System", "busy()" ); | 436 | // QCopEnvelope ( "QPE/System", "busy()" ); |
445 | // qApp->processEvents(); | 437 | // qApp->processEvents(); |
446 | currentRemoteDir=remotePath->text(); | 438 | currentRemoteDir=remotePath->text(); |
447 | 439 | ||
448 | if( ServerComboBox->currentText().isEmpty()) { | 440 | if( ServerComboBox->currentText().isEmpty()) { |
449 | 441 | ||
450 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 442 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
451 | TabWidget->setCurrentPage(2); | 443 | TabWidget->setCurrentPage(2); |
452 | ServerComboBox->setFocus(); | 444 | ServerComboBox->setFocus(); |
453 | connectServerBtn->setOn(FALSE); | 445 | connectServerBtn->setOn(FALSE); |
454 | connectServerBtn->setText( tr("Connect")); | 446 | connectServerBtn->setText( tr("Connect")); |
455 | return; | 447 | return; |
456 | } | 448 | } |
457 | 449 | ||
458 | FtpInit(); | 450 | FtpInit(); |
459 | 451 | ||
460 | TabWidget->setCurrentPage(1); | 452 | TabWidget->setCurrentPage(1); |
461 | QString ftp_host = ServerComboBox->currentText(); | 453 | QString ftp_host = ServerComboBox->currentText(); |
462 | QString ftp_user = UsernameComboBox->currentText(); | 454 | QString ftp_user = UsernameComboBox->currentText(); |
463 | QString ftp_pass = PasswordEdit->text(); | 455 | QString ftp_pass = PasswordEdit->text(); |
464 | QString port=PortSpinBox->cleanText(); | 456 | QString port=PortSpinBox->cleanText(); |
465 | port.stripWhiteSpace(); | 457 | port.stripWhiteSpace(); |
466 | 458 | ||
467 | Config cfg("opieftp"); | 459 | Config cfg("opieftp"); |
468 | cfg.setGroup("Server"); | 460 | cfg.setGroup("Server"); |
469 | // int current=cfg.readNumEntry("currentServer", 1); | 461 | // int current=cfg.readNumEntry("currentServer", 1); |
470 | 462 | ||
471 | // if(ftp_host!= cfg.readEntry(QString::number( current))) | 463 | // if(ftp_host!= cfg.readEntry(QString::number( current))) |
472 | // currentServerConfig=-1; | 464 | // currentServerConfig=-1; |
@@ -574,335 +566,334 @@ void OpieFtp::nullifyCallBack() | |||
574 | FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn); | 566 | FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn); |
575 | } | 567 | } |
576 | 568 | ||
577 | void OpieFtp::remoteDownload() | 569 | void OpieFtp::remoteDownload() |
578 | { | 570 | { |
579 | // qApp->processEvents(); | 571 | // qApp->processEvents(); |
580 | int fsz; | 572 | int fsz; |
581 | // QCopEnvelope ( "QPE/System", "busy()" ); | 573 | // QCopEnvelope ( "QPE/System", "busy()" ); |
582 | 574 | ||
583 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 575 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
584 | QListViewItemIterator it( Remote_View ); | 576 | QListViewItemIterator it( Remote_View ); |
585 | for ( ; it.current(); ++it ) { | 577 | for ( ; it.current(); ++it ) { |
586 | if ( it.current()->isSelected() ) { | 578 | if ( it.current()->isSelected() ) { |
587 | QString strItem = it.current()->text(0); | 579 | QString strItem = it.current()->text(0); |
588 | // strItem=strItem.right(strItem.length()-1); | 580 | // strItem=strItem.right(strItem.length()-1); |
589 | QString localFile = currentDir.canonicalPath(); | 581 | QString localFile = currentDir.canonicalPath(); |
590 | if(localFile.right(1).find("/",0,TRUE) == -1) | 582 | if(localFile.right(1).find("/",0,TRUE) == -1) |
591 | localFile += "/"; | 583 | localFile += "/"; |
592 | localFile += strItem; | 584 | localFile += strItem; |
593 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 585 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
594 | QString remoteFile= currentRemoteDir+strItem; | 586 | QString remoteFile= currentRemoteDir+strItem; |
595 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 587 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
596 | fsz = 0; | 588 | fsz = 0; |
597 | QString temp; | 589 | QString temp; |
598 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 590 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
599 | 591 | ||
600 | ProgressBar->setTotalSteps(fsz); | 592 | ProgressBar->setTotalSteps(fsz); |
601 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 593 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
602 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 594 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
603 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 595 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
604 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 596 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
605 | // odebug << "Get: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; | 597 | // odebug << "Get: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; |
606 | 598 | ||
607 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 599 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
608 | QString msg; | 600 | QString msg; |
609 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 601 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
610 | msg.replace(QRegExp(":"),"\n"); | 602 | msg.replace(QRegExp(":"),"\n"); |
611 | QMessageBox::message(tr("Note"),msg); | 603 | QMessageBox::message(tr("Note"),msg); |
612 | } | 604 | } |
613 | ProgressBar->reset(); | 605 | ProgressBar->reset(); |
614 | nullifyCallBack(); | 606 | nullifyCallBack(); |
615 | it.current()->setSelected(FALSE); | 607 | it.current()->setSelected(FALSE); |
616 | } | 608 | } |
617 | } | 609 | } |
618 | for ( ; it.current(); ++it ) { | 610 | for ( ; it.current(); ++it ) { |
619 | Remote_View->clearSelection(); | 611 | Remote_View->clearSelection(); |
620 | } | 612 | } |
621 | Remote_View->setFocus(); | 613 | Remote_View->setFocus(); |
622 | TabWidget->setCurrentPage(0); | 614 | TabWidget->setCurrentPage(0); |
623 | populateLocalView(); | 615 | populateLocalView(); |
624 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 616 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
625 | } | 617 | } |
626 | 618 | ||
627 | bool OpieFtp::remoteDirList(const QString &dir) | 619 | bool OpieFtp::remoteDirList(const QString &dir) |
628 | { | 620 | { |
629 | QString tmp = QDir::homeDirPath(); | 621 | QString tmp = QDir::homeDirPath(); |
630 | if(tmp.right(1) != "/") | 622 | if(tmp.right(1) != "/") |
631 | tmp+="/._temp"; | 623 | tmp+="/._temp"; |
632 | else | 624 | else |
633 | tmp+="._temp"; | 625 | tmp+="._temp"; |
634 | // odebug << "Listing remote dir "+tmp << oendl; | 626 | // odebug << "Listing remote dir "+tmp << oendl; |
635 | // QCopEnvelope ( "QPE/System", "busy()" ); | 627 | // QCopEnvelope ( "QPE/System", "busy()" ); |
636 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 628 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
637 | QString msg; | 629 | QString msg; |
638 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 630 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
639 | msg.replace(QRegExp(":"),"\n"); | 631 | msg.replace(QRegExp(":"),"\n"); |
640 | QMessageBox::message(tr("Note"),msg); | 632 | QMessageBox::message(tr("Note"),msg); |
641 | return false; | 633 | return false; |
642 | } | 634 | } |
643 | populateRemoteView() ; | 635 | populateRemoteView() ; |
644 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 636 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
645 | return true; | 637 | return true; |
646 | } | 638 | } |
647 | 639 | ||
648 | bool OpieFtp::remoteChDir(const QString &dir) | 640 | bool OpieFtp::remoteChDir(const QString &dir) |
649 | { | 641 | { |
650 | // QCopEnvelope ( "QPE/System", "busy()" ); | 642 | // QCopEnvelope ( "QPE/System", "busy()" ); |
651 | if (!FtpChdir( dir.latin1(), conn )) { | 643 | if (!FtpChdir( dir.latin1(), conn )) { |
652 | QString msg; | 644 | QString msg; |
653 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 645 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
654 | msg.replace(QRegExp(":"),"\n"); | 646 | msg.replace(QRegExp(":"),"\n"); |
655 | QMessageBox::message(tr("Note"),msg); | 647 | QMessageBox::message(tr("Note"),msg); |
656 | // odebug << msg << oendl; | 648 | // odebug << msg << oendl; |
657 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 649 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
658 | return FALSE; | 650 | return FALSE; |
659 | } | 651 | } |
660 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 652 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
661 | return TRUE; | 653 | return TRUE; |
662 | } | 654 | } |
663 | 655 | ||
664 | void OpieFtp::populateLocalView() | 656 | void OpieFtp::populateLocalView() |
665 | { | 657 | { |
666 | Local_View->clear(); | 658 | Local_View->clear(); |
667 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 659 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
668 | currentDir.setMatchAllDirs(TRUE); | 660 | currentDir.setMatchAllDirs(TRUE); |
669 | currentDir.setNameFilter(filterStr); | 661 | currentDir.setNameFilter(filterStr); |
670 | QString fileL, fileS, fileDate; | 662 | QString fileL, fileS, fileDate; |
671 | bool isDir=FALSE; | 663 | bool isDir=FALSE; |
672 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 664 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
673 | QFileInfoListIterator it(*list); | 665 | QFileInfoListIterator it(*list); |
674 | QFileInfo *fi; | 666 | QFileInfo *fi; |
675 | while ( (fi=it.current()) ) { | 667 | while ( (fi=it.current()) ) { |
676 | if (fi->isSymLink() ){ | 668 | if (fi->isSymLink() ){ |
677 | QString symLink=fi->readLink(); | 669 | QString symLink=fi->readLink(); |
678 | // odebug << "Symlink detected "+symLink << oendl; | 670 | // odebug << "Symlink detected "+symLink << oendl; |
679 | QFileInfo sym( symLink); | 671 | QFileInfo sym( symLink); |
680 | fileS.sprintf( "%10i", sym.size() ); | 672 | fileS.sprintf( "%10i", sym.size() ); |
681 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 673 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
682 | fileDate = sym.lastModified().toString(); | 674 | fileDate = sym.lastModified().toString(); |
683 | } else { | 675 | } else { |
684 | // odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl; | 676 | // odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl; |
685 | fileS.sprintf( "%10i", fi->size() ); | 677 | fileS.sprintf( "%10i", fi->size() ); |
686 | fileL.sprintf( "%s",fi->fileName().data() ); | 678 | fileL.sprintf( "%s",fi->fileName().data() ); |
687 | fileDate= fi->lastModified().toString(); | 679 | fileDate= fi->lastModified().toString(); |
688 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 680 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
689 | fileL+="/"; | 681 | fileL+="/"; |
690 | isDir=TRUE; | 682 | isDir=TRUE; |
691 | // odebug << fileL << oendl; | 683 | // odebug << fileL << oendl; |
692 | } | 684 | } |
693 | } | 685 | } |
694 | 686 | ||
695 | 687 | ||
696 | if(fileL !="./" && fi->exists()) { | 688 | if(fileL !="./" && fi->exists()) { |
697 | item = new QListViewItem( Local_View,fileL, fileDate, fileS ); | 689 | item = new QListViewItem( Local_View,fileL, fileDate, fileS ); |
698 | QPixmap pm; | 690 | QPixmap pm; |
699 | 691 | ||
700 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 692 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
701 | if( !QDir( fi->filePath() ).isReadable()) | 693 | if( !QDir( fi->filePath() ).isReadable()) |
702 | pm = Resource::loadPixmap( "lockedfolder" ); | 694 | pm = Opie::Core::OResource::loadPixmap( "lockedfolder", Opie::Core::OResource::SmallIcon ); |
703 | else | 695 | else |
704 | pm= Resource::loadPixmap( "folder" ); | 696 | pm = Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ); |
705 | item->setPixmap( 0,pm ); | 697 | item->setPixmap( 0,pm ); |
706 | } else { | 698 | } else { |
707 | if( !fi->isReadable() ) | 699 | if( !fi->isReadable() ) |
708 | pm = Resource::loadPixmap( "locked" ); | 700 | pm = Opie::Core::OResource::loadPixmap( "locked", Opie::Core::OResource::SmallIcon ); |
709 | else { | 701 | else { |
710 | MimeType mt(fi->filePath()); | 702 | MimeType mt(fi->filePath()); |
711 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 703 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
712 | if(pm.isNull()) | 704 | if(pm.isNull()) |
713 | pm = unknownXpm; | 705 | pm = unknownXpm; |
714 | } | 706 | } |
715 | } | 707 | } |
716 | if( fileL.find("->",0,TRUE) != -1) { | 708 | if( fileL.find("->",0,TRUE) != -1) { |
717 | // overlay link image | 709 | // overlay link image |
718 | pm= Resource::loadPixmap( "folder" ); | 710 | pm = Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ); |
719 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 711 | QPixmap lnk = Opie::Core::OResource::loadPixmap( "opie/symlink" ); |
720 | QPainter painter( &pm ); | 712 | QPainter painter( &pm ); |
721 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 713 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
722 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | ||
723 | } | 714 | } |
724 | item->setPixmap( 0,pm); | 715 | item->setPixmap( 0,pm); |
725 | } | 716 | } |
726 | isDir=FALSE; | 717 | isDir=FALSE; |
727 | ++it; | 718 | ++it; |
728 | } | 719 | } |
729 | Local_View->setSorting( 3,FALSE); | 720 | Local_View->setSorting( 3,FALSE); |
730 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 721 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
731 | fillCombo( (const QString &)currentDir.canonicalPath()); | 722 | fillCombo( (const QString &)currentDir.canonicalPath()); |
732 | } | 723 | } |
733 | 724 | ||
734 | bool OpieFtp::populateRemoteView( ) | 725 | bool OpieFtp::populateRemoteView( ) |
735 | { | 726 | { |
736 | // odebug << "populate remoteview" << oendl; | 727 | // odebug << "populate remoteview" << oendl; |
737 | QString sfile=QDir::homeDirPath(); | 728 | QString sfile=QDir::homeDirPath(); |
738 | if(sfile.right(1) != "/") | 729 | if(sfile.right(1) != "/") |
739 | sfile+="/._temp"; | 730 | sfile+="/._temp"; |
740 | else | 731 | else |
741 | sfile+="._temp"; | 732 | sfile+="._temp"; |
742 | QFile file( sfile); | 733 | QFile file( sfile); |
743 | Remote_View->clear(); | 734 | Remote_View->clear(); |
744 | QString s, File_Name; | 735 | QString s, File_Name; |
745 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 736 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
746 | QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); | 737 | QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); |
747 | QString fileL, fileS, fileDate; | 738 | QString fileL, fileS, fileDate; |
748 | if ( file.open(IO_ReadOnly)) { | 739 | if ( file.open(IO_ReadOnly)) { |
749 | QTextStream t( &file ); // use a text stream | 740 | QTextStream t( &file ); // use a text stream |
750 | while ( !t.eof()) { | 741 | while ( !t.eof()) { |
751 | s = t.readLine(); | 742 | s = t.readLine(); |
752 | 743 | ||
753 | if(s.find("total",0,TRUE) == 0) | 744 | if(s.find("total",0,TRUE) == 0) |
754 | continue; | 745 | continue; |
755 | 746 | ||
756 | int len, month = monthRe.match(s, 0, &len); | 747 | int len, month = monthRe.match(s, 0, &len); |
757 | fileDate = s.mid(month + 1, len - 2); // minus spaces | 748 | fileDate = s.mid(month + 1, len - 2); // minus spaces |
758 | fileL = s.right(s.length() - month - len); | 749 | fileL = s.right(s.length() - month - len); |
759 | if(s.left(1) == "d") | 750 | if(s.left(1) == "d") |
760 | fileL = fileL+"/"; | 751 | fileL = fileL+"/"; |
761 | fileS = s.mid(month - 8, 8); // FIXME | 752 | fileS = s.mid(month - 8, 8); // FIXME |
762 | fileS = fileS.stripWhiteSpace(); | 753 | fileS = fileS.stripWhiteSpace(); |
763 | 754 | ||
764 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { | 755 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { |
765 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); | 756 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); |
766 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | 757 | item->setPixmap( 0, Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon )); |
767 | // if(itemDir) | 758 | // if(itemDir) |
768 | item->moveItem(itemDir); | 759 | item->moveItem(itemDir); |
769 | itemDir=item; | 760 | itemDir=item; |
770 | } else { | 761 | } else { |
771 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); | 762 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); |
772 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 763 | item->setPixmap( 0, Opie::Core::OResource::loadPixmap( "fileopen", Opie::Core::OResource::SmallIcon )); |
773 | // if(itemFile) | 764 | // if(itemFile) |
774 | item->moveItem(itemDir); | 765 | item->moveItem(itemDir); |
775 | item->moveItem(itemFile); | 766 | item->moveItem(itemFile); |
776 | itemFile=item; | 767 | itemFile=item; |
777 | } | 768 | } |
778 | } | 769 | } |
779 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 770 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
780 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 771 | item1->setPixmap( 0, Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon )); |
781 | file.close(); | 772 | file.close(); |
782 | if( file.exists()) | 773 | if( file.exists()) |
783 | file. remove(); | 774 | file. remove(); |
784 | } | 775 | } |
785 | // odebug << "temp file not opened successfully "+sfile << oendl; | 776 | // odebug << "temp file not opened successfully "+sfile << oendl; |
786 | Remote_View->setSorting( 4,TRUE); | 777 | Remote_View->setSorting( 4,TRUE); |
787 | return true; | 778 | return true; |
788 | } | 779 | } |
789 | 780 | ||
790 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 781 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
791 | { | 782 | { |
792 | if( selectedItem) { | 783 | if( selectedItem) { |
793 | // if(selectedItem!= NULL) { | 784 | // if(selectedItem!= NULL) { |
794 | // QCopEnvelope ( "QPE/System", "busy()" ); | 785 | // QCopEnvelope ( "QPE/System", "busy()" ); |
795 | QString oldRemoteCurrentDir = currentRemoteDir; | 786 | QString oldRemoteCurrentDir = currentRemoteDir; |
796 | QString strItem=selectedItem->text(0); | 787 | QString strItem=selectedItem->text(0); |
797 | strItem=strItem.simplifyWhiteSpace(); | 788 | strItem=strItem.simplifyWhiteSpace(); |
798 | if(strItem == "../") { // the user wants to go ^ | 789 | if(strItem == "../") { // the user wants to go ^ |
799 | if( FtpCDUp( conn) == 0) { | 790 | if( FtpCDUp( conn) == 0) { |
800 | QString msg; | 791 | QString msg; |
801 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 792 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
802 | msg.replace(QRegExp(":"),"\n"); | 793 | msg.replace(QRegExp(":"),"\n"); |
803 | QMessageBox::message(tr("Note"),msg); | 794 | QMessageBox::message(tr("Note"),msg); |
804 | // odebug << msg << oendl; | 795 | // odebug << msg << oendl; |
805 | } | 796 | } |
806 | char path[256]; | 797 | char path[256]; |
807 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 798 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
808 | QString msg; | 799 | QString msg; |
809 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 800 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
810 | msg.replace(QRegExp(":"),"\n"); | 801 | msg.replace(QRegExp(":"),"\n"); |
811 | QMessageBox::message(tr("Note"),msg); | 802 | QMessageBox::message(tr("Note"),msg); |
812 | // odebug << msg << oendl; | 803 | // odebug << msg << oendl; |
813 | } | 804 | } |
814 | currentRemoteDir=path; | 805 | currentRemoteDir=path; |
815 | } else { | 806 | } else { |
816 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | 807 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers |
817 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | 808 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); |
818 | strItem = strItem.stripWhiteSpace(); | 809 | strItem = strItem.stripWhiteSpace(); |
819 | currentRemoteDir = strItem; | 810 | currentRemoteDir = strItem; |
820 | if( !remoteChDir( (const QString &)strItem)) { | 811 | if( !remoteChDir( (const QString &)strItem)) { |
821 | currentRemoteDir = oldRemoteCurrentDir; | 812 | currentRemoteDir = oldRemoteCurrentDir; |
822 | strItem=""; | 813 | strItem=""; |
823 | // odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl; | 814 | // odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl; |
824 | } | 815 | } |
825 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 816 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory |
826 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 817 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
827 | currentRemoteDir = oldRemoteCurrentDir; | 818 | currentRemoteDir = oldRemoteCurrentDir; |
828 | strItem=""; | 819 | strItem=""; |
829 | // odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl; | 820 | // odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl; |
830 | 821 | ||
831 | } else { | 822 | } else { |
832 | currentRemoteDir = currentRemoteDir+strItem; | 823 | currentRemoteDir = currentRemoteDir+strItem; |
833 | } | 824 | } |
834 | } else { | 825 | } else { |
835 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 826 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
836 | return; | 827 | return; |
837 | } | 828 | } |
838 | } | 829 | } |
839 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 830 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
840 | if(currentRemoteDir.right(1) !="/") | 831 | if(currentRemoteDir.right(1) !="/") |
841 | currentRemoteDir +="/"; | 832 | currentRemoteDir +="/"; |
842 | currentPathCombo->lineEdit()->setText( currentRemoteDir); | 833 | currentPathCombo->lineEdit()->setText( currentRemoteDir); |
843 | fillRemoteCombo( (const QString &)currentRemoteDir); | 834 | fillRemoteCombo( (const QString &)currentRemoteDir); |
844 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 835 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
845 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 836 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
846 | 837 | ||
847 | } | 838 | } |
848 | } | 839 | } |
849 | 840 | ||
850 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 841 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
851 | { | 842 | { |
852 | if(selectedItem!= NULL) { | 843 | if(selectedItem!= NULL) { |
853 | 844 | ||
854 | QString strItem=selectedItem->text(0); | 845 | QString strItem=selectedItem->text(0); |
855 | QString strSize=selectedItem->text(1); | 846 | QString strSize=selectedItem->text(1); |
856 | strSize=strSize.stripWhiteSpace(); | 847 | strSize=strSize.stripWhiteSpace(); |
857 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 848 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
858 | // is symlink | 849 | // is symlink |
859 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 850 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
860 | if(QDir(strItem2).exists() ) { | 851 | if(QDir(strItem2).exists() ) { |
861 | currentDir.cd(strItem2, TRUE); | 852 | currentDir.cd(strItem2, TRUE); |
862 | populateLocalView(); | 853 | populateLocalView(); |
863 | } | 854 | } |
864 | } else { // not a symlink | 855 | } else { // not a symlink |
865 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 856 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
866 | 857 | ||
867 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 858 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
868 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 859 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
869 | currentDir.cd(strItem,FALSE); | 860 | currentDir.cd(strItem,FALSE); |
870 | populateLocalView(); | 861 | populateLocalView(); |
871 | } else { | 862 | } else { |
872 | currentDir.cdUp(); | 863 | currentDir.cdUp(); |
873 | populateLocalView(); | 864 | populateLocalView(); |
874 | } | 865 | } |
875 | if(QDir(strItem).exists()){ | 866 | if(QDir(strItem).exists()){ |
876 | currentDir.cd(strItem, TRUE); | 867 | currentDir.cd(strItem, TRUE); |
877 | populateLocalView(); | 868 | populateLocalView(); |
878 | } | 869 | } |
879 | } else { | 870 | } else { |
880 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 871 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
881 | if( QFile::exists(strItem ) ) { | 872 | if( QFile::exists(strItem ) ) { |
882 | // odebug << "upload "+strItem << oendl; | 873 | // odebug << "upload "+strItem << oendl; |
883 | return; | 874 | return; |
884 | } | 875 | } |
885 | } //end not symlink | 876 | } //end not symlink |
886 | chdir(strItem.latin1()); | 877 | chdir(strItem.latin1()); |
887 | } | 878 | } |
888 | Local_View->ensureItemVisible(Local_View->firstChild()); | 879 | Local_View->ensureItemVisible(Local_View->firstChild()); |
889 | } | 880 | } |
890 | } | 881 | } |
891 | 882 | ||
892 | void OpieFtp::doLocalCd() | 883 | void OpieFtp::doLocalCd() |
893 | { | 884 | { |
894 | localListClicked( Local_View->currentItem()); | 885 | localListClicked( Local_View->currentItem()); |
895 | } | 886 | } |
896 | 887 | ||
897 | void OpieFtp:: doRemoteCd() | 888 | void OpieFtp:: doRemoteCd() |
898 | { | 889 | { |
899 | remoteListClicked( Remote_View->currentItem()); | 890 | remoteListClicked( Remote_View->currentItem()); |
900 | 891 | ||
901 | } | 892 | } |
902 | 893 | ||
903 | void OpieFtp::showHidden() | 894 | void OpieFtp::showHidden() |
904 | { | 895 | { |
905 | if (!b) { | 896 | if (!b) { |
906 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 897 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
907 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 898 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
908 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 899 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |