-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 10 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 7c83223..db365ca 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,216 +1,221 @@ | |||
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/ftplib.h" | 17 | #include "../ftplib/ftplib.h" |
18 | } | 18 | } |
19 | 19 | ||
20 | #include "inputDialog.h" | 20 | #include "inputDialog.h" |
21 | 21 | ||
22 | #include <qpe/qpemenubar.h> | 22 | #include <qpe/qpemenubar.h> |
23 | #include <qpe/qpetoolbar.h> | 23 | #include <qpe/qpetoolbar.h> |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #include <qpe/mimetype.h> | 28 | #include <qpe/mimetype.h> |
29 | #include <qpe/qpemessagebox.h> | 29 | #include <qpe/qpemessagebox.h> |
30 | 30 | ||
31 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
34 | #include <qtoolbutton.h> | 34 | #include <qtoolbutton.h> |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include <qdir.h> | 36 | #include <qdir.h> |
37 | #include <qfile.h> | 37 | #include <qfile.h> |
38 | #include <qstring.h> | 38 | #include <qstring.h> |
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qpopupmenu.h> | 40 | #include <qpopupmenu.h> |
41 | #include <qlistview.h> | 41 | #include <qlistview.h> |
42 | #include <qmainwindow.h> | 42 | #include <qmainwindow.h> |
43 | #include <qlabel.h> | 43 | #include <qlabel.h> |
44 | #include <qprogressbar.h> | 44 | #include <qprogressbar.h> |
45 | #include <qspinbox.h> | 45 | #include <qspinbox.h> |
46 | #include <qtabwidget.h> | 46 | #include <qtabwidget.h> |
47 | #include <qwidget.h> | 47 | #include <qwidget.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qimage.h> | 49 | #include <qimage.h> |
50 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
51 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
52 | #include <qlineedit.h> | 52 | #include <qlineedit.h> |
53 | #include <qregexp.h> | 53 | #include <qregexp.h> |
54 | #include <qlistbox.h> | 54 | #include <qlistbox.h> |
55 | 55 | ||
56 | #include <unistd.h> | 56 | #include <unistd.h> |
57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
58 | 58 | ||
59 | 59 | ||
60 | QProgressBar *ProgressBar; | 60 | QProgressBar *ProgressBar; |
61 | static netbuf *conn=NULL; | 61 | static netbuf *conn=NULL; |
62 | 62 | ||
63 | static int log_progress(netbuf *, int xfered, void *) | 63 | static int log_progress(netbuf *, int xfered, void *) |
64 | { | 64 | { |
65 | // int fsz = *(int *)arg; | 65 | // int fsz = *(int *)arg; |
66 | // int pct = (xfered * 100) / fsz; | 66 | // int pct = (xfered * 100) / fsz; |
67 | // printf("%3d%%\r", pct); | 67 | // printf("%3d%%\r", pct); |
68 | // fflush(stdout); | 68 | // fflush(stdout); |
69 | ProgressBar->setProgress(xfered); | 69 | ProgressBar->setProgress(xfered); |
70 | qApp->processEvents(); | 70 | qApp->processEvents(); |
71 | return 1; | 71 | return 1; |
72 | } | 72 | } |
73 | 73 | ||
74 | OpieFtp::OpieFtp( ) | 74 | OpieFtp::OpieFtp( ) |
75 | : QMainWindow( ) | 75 | : QMainWindow( ) |
76 | { | 76 | { |
77 | setCaption( tr( "OpieFtp" ) ); | 77 | setCaption( tr( "OpieFtp" ) ); |
78 | fuckeduphack=FALSE; | 78 | fuckeduphack=FALSE; |
79 | QGridLayout *layout = new QGridLayout( this ); | 79 | QGridLayout *layout = new QGridLayout( this ); |
80 | layout->setSpacing( 2); | 80 | layout->setSpacing( 2); |
81 | layout->setMargin( 2); | 81 | layout->setMargin( 2); |
82 | 82 | ||
83 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 83 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
84 | 84 | ||
85 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 85 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
86 | // QPEToolBar *menuBar = new QPEToolBar(this); | 86 | // QPEToolBar *menuBar = new QPEToolBar(this); |
87 | // menuBar->setHorizontalStretchable( TRUE ); | 87 | // menuBar->setHorizontalStretchable( TRUE ); |
88 | 88 | ||
89 | QWMatrix matrix; | ||
90 | QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); | ||
91 | matrix.scale( .4, .4); | ||
92 | unknownXpm = pix.xForm(matrix); | ||
93 | |||
89 | connectionMenu = new QPopupMenu( this ); | 94 | connectionMenu = new QPopupMenu( this ); |
90 | localMenu = new QPopupMenu( this ); | 95 | localMenu = new QPopupMenu( this ); |
91 | remoteMenu = new QPopupMenu( this ); | 96 | remoteMenu = new QPopupMenu( this ); |
92 | tabMenu = new QPopupMenu( this ); | 97 | tabMenu = new QPopupMenu( this ); |
93 | 98 | ||
94 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); | 99 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); |
95 | 100 | ||
96 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 101 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
97 | menuBar->insertItem( tr( "Local" ), localMenu); | 102 | menuBar->insertItem( tr( "Local" ), localMenu); |
98 | menuBar->insertItem( tr( "Remote" ), remoteMenu); | 103 | menuBar->insertItem( tr( "Remote" ), remoteMenu); |
99 | menuBar->insertItem( tr( "View" ), tabMenu); | 104 | menuBar->insertItem( tr( "View" ), tabMenu); |
100 | 105 | ||
101 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 106 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
102 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 107 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
103 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 108 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
104 | 109 | ||
105 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 110 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
106 | localMenu->insertSeparator(); | 111 | localMenu->insertSeparator(); |
107 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 112 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
108 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 113 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
109 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 114 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
110 | localMenu->insertSeparator(); | 115 | localMenu->insertSeparator(); |
111 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 116 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
112 | localMenu->setCheckable(TRUE); | 117 | localMenu->setCheckable(TRUE); |
113 | 118 | ||
114 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 119 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
115 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 120 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
116 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 121 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
117 | remoteMenu->insertSeparator(); | 122 | remoteMenu->insertSeparator(); |
118 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 123 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
119 | 124 | ||
120 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 125 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
121 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 126 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
122 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 127 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
123 | tabMenu->insertSeparator(); | 128 | tabMenu->insertSeparator(); |
124 | tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 129 | tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
125 | tabMenu->setCheckable(TRUE); | 130 | tabMenu->setCheckable(TRUE); |
126 | 131 | ||
127 | 132 | ||
128 | 133 | ||
129 | cdUpButton = new QToolButton( this,"cdUpButton"); | 134 | cdUpButton = new QToolButton( this,"cdUpButton"); |
130 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 135 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
131 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 136 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
132 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 137 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
133 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); | 138 | layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); |
134 | cdUpButton->hide(); | 139 | cdUpButton->hide(); |
135 | 140 | ||
136 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 141 | // docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
137 | // docButton->setFixedSize( QSize( 20, 20 ) ); | 142 | // docButton->setFixedSize( QSize( 20, 20 ) ); |
138 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 143 | // connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
139 | // docButton->setFlat(TRUE); | 144 | // docButton->setFlat(TRUE); |
140 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); | 145 | // layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); |
141 | 146 | ||
142 | homeButton = new QToolButton(this,"homeButton"); | 147 | homeButton = new QToolButton(this,"homeButton"); |
143 | homeButton->setPixmap( Resource::loadPixmap("home")); | 148 | homeButton->setPixmap( Resource::loadPixmap("home")); |
144 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 149 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
145 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 150 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
146 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); | 151 | layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); |
147 | homeButton->hide(); | 152 | homeButton->hide(); |
148 | 153 | ||
149 | TabWidget = new QTabWidget( this, "TabWidget" ); | 154 | TabWidget = new QTabWidget( this, "TabWidget" ); |
150 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); | 155 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); |
151 | 156 | ||
152 | // TabWidget->setTabShape(QTabWidget::Triangular); | 157 | // TabWidget->setTabShape(QTabWidget::Triangular); |
153 | 158 | ||
154 | tab = new QWidget( TabWidget, "tab" ); | 159 | tab = new QWidget( TabWidget, "tab" ); |
155 | tabLayout = new QGridLayout( tab ); | 160 | tabLayout = new QGridLayout( tab ); |
156 | tabLayout->setSpacing( 2); | 161 | tabLayout->setSpacing( 2); |
157 | tabLayout->setMargin( 2); | 162 | tabLayout->setMargin( 2); |
158 | 163 | ||
159 | Local_View = new QListView( tab, "Local_View" ); | 164 | Local_View = new QListView( tab, "Local_View" ); |
160 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 165 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
161 | Local_View->addColumn( tr("File"),150); | 166 | Local_View->addColumn( tr("File"),150); |
162 | Local_View->addColumn( tr("Date"),-1); | 167 | Local_View->addColumn( tr("Date"),-1); |
163 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 168 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
164 | Local_View->addColumn( tr("Size"),-1); | 169 | Local_View->addColumn( tr("Size"),-1); |
165 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 170 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
166 | Local_View->setAllColumnsShowFocus(TRUE); | 171 | Local_View->setAllColumnsShowFocus(TRUE); |
167 | 172 | ||
168 | Local_View->setMultiSelection( TRUE); | 173 | Local_View->setMultiSelection( TRUE); |
169 | Local_View->setSelectionMode(QListView::Extended); | 174 | Local_View->setSelectionMode(QListView::Extended); |
170 | Local_View->setFocusPolicy(QWidget::ClickFocus); | 175 | Local_View->setFocusPolicy(QWidget::ClickFocus); |
171 | 176 | ||
172 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 177 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
173 | 178 | ||
174 | tabLayout->addWidget( Local_View, 0, 0 ); | 179 | tabLayout->addWidget( Local_View, 0, 0 ); |
175 | 180 | ||
176 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 181 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
177 | this,SLOT( localListClicked(QListViewItem *)) ); | 182 | this,SLOT( localListClicked(QListViewItem *)) ); |
178 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 183 | // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
179 | // this,SLOT( localListClicked(QListViewItem *)) ); | 184 | // this,SLOT( localListClicked(QListViewItem *)) ); |
180 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 185 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
181 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 186 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
182 | 187 | ||
183 | TabWidget->insertTab( tab, tr( "Local" ) ); | 188 | TabWidget->insertTab( tab, tr( "Local" ) ); |
184 | 189 | ||
185 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 190 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
186 | tabLayout_2 = new QGridLayout( tab_2 ); | 191 | tabLayout_2 = new QGridLayout( tab_2 ); |
187 | tabLayout_2->setSpacing( 2); | 192 | tabLayout_2->setSpacing( 2); |
188 | tabLayout_2->setMargin( 2); | 193 | tabLayout_2->setMargin( 2); |
189 | 194 | ||
190 | Remote_View = new QListView( tab_2, "Remote_View" ); | 195 | Remote_View = new QListView( tab_2, "Remote_View" ); |
191 | Remote_View->addColumn( tr("File"),150); | 196 | Remote_View->addColumn( tr("File"),150); |
192 | Remote_View->addColumn( tr("Date"),-1); | 197 | Remote_View->addColumn( tr("Date"),-1); |
193 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); | 198 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); |
194 | Remote_View->addColumn( tr("Size"),-1); | 199 | Remote_View->addColumn( tr("Size"),-1); |
195 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 200 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
196 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); | 201 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); |
197 | Remote_View->addColumn( tr("Dir"),-1); | 202 | Remote_View->addColumn( tr("Dir"),-1); |
198 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 203 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
199 | Remote_View->setAllColumnsShowFocus(TRUE); | 204 | Remote_View->setAllColumnsShowFocus(TRUE); |
200 | 205 | ||
201 | Remote_View->setMultiSelection( FALSE); | 206 | Remote_View->setMultiSelection( FALSE); |
202 | Remote_View->setSelectionMode(QListView::Extended); | 207 | Remote_View->setSelectionMode(QListView::Extended); |
203 | Remote_View->setFocusPolicy(QWidget::ClickFocus); | 208 | Remote_View->setFocusPolicy(QWidget::ClickFocus); |
204 | 209 | ||
205 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 210 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
206 | 211 | ||
207 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 212 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
208 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 213 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
209 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 214 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
210 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 215 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
211 | 216 | ||
212 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 217 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
213 | 218 | ||
214 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); | 219 | TabWidget->insertTab( tab_2, tr( "Remote" ) ); |
215 | 220 | ||
216 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 221 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
@@ -563,269 +568,268 @@ void OpieFtp::remoteDownload() | |||
563 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 568 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
564 | QListViewItemIterator it( Remote_View ); | 569 | QListViewItemIterator it( Remote_View ); |
565 | for ( ; it.current(); ++it ) { | 570 | for ( ; it.current(); ++it ) { |
566 | if ( it.current()->isSelected() ) { | 571 | if ( it.current()->isSelected() ) { |
567 | QString strItem = it.current()->text(0); | 572 | QString strItem = it.current()->text(0); |
568 | // strItem=strItem.right(strItem.length()-1); | 573 | // strItem=strItem.right(strItem.length()-1); |
569 | QString localFile = currentDir.canonicalPath(); | 574 | QString localFile = currentDir.canonicalPath(); |
570 | if(localFile.right(1).find("/",0,TRUE) == -1) | 575 | if(localFile.right(1).find("/",0,TRUE) == -1) |
571 | localFile += "/"; | 576 | localFile += "/"; |
572 | localFile += strItem; | 577 | localFile += strItem; |
573 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 578 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
574 | QString remoteFile= currentRemoteDir+strItem; | 579 | QString remoteFile= currentRemoteDir+strItem; |
575 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 580 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
576 | fsz = 0; | 581 | fsz = 0; |
577 | QString temp; | 582 | QString temp; |
578 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 583 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
579 | 584 | ||
580 | ProgressBar->setTotalSteps(fsz); | 585 | ProgressBar->setTotalSteps(fsz); |
581 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 586 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
582 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 587 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
583 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 588 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
584 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 589 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
585 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 590 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); |
586 | 591 | ||
587 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 592 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
588 | QString msg; | 593 | QString msg; |
589 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 594 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
590 | msg.replace(QRegExp(":"),"\n"); | 595 | msg.replace(QRegExp(":"),"\n"); |
591 | QMessageBox::message(tr("Note"),msg); | 596 | QMessageBox::message(tr("Note"),msg); |
592 | } | 597 | } |
593 | ProgressBar->reset(); | 598 | ProgressBar->reset(); |
594 | nullifyCallBack(); | 599 | nullifyCallBack(); |
595 | it.current()->setSelected(FALSE); | 600 | it.current()->setSelected(FALSE); |
596 | } | 601 | } |
597 | } | 602 | } |
598 | for ( ; it.current(); ++it ) { | 603 | for ( ; it.current(); ++it ) { |
599 | Remote_View->clearSelection(); | 604 | Remote_View->clearSelection(); |
600 | } | 605 | } |
601 | Remote_View->setFocus(); | 606 | Remote_View->setFocus(); |
602 | TabWidget->setCurrentPage(0); | 607 | TabWidget->setCurrentPage(0); |
603 | populateLocalView(); | 608 | populateLocalView(); |
604 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 609 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
605 | } | 610 | } |
606 | 611 | ||
607 | bool OpieFtp::remoteDirList(const QString &dir) | 612 | bool OpieFtp::remoteDirList(const QString &dir) |
608 | { | 613 | { |
609 | QString tmp = QDir::homeDirPath(); | 614 | QString tmp = QDir::homeDirPath(); |
610 | if(tmp.right(1) != "/") | 615 | if(tmp.right(1) != "/") |
611 | tmp+="/._temp"; | 616 | tmp+="/._temp"; |
612 | else | 617 | else |
613 | tmp+="._temp"; | 618 | tmp+="._temp"; |
614 | // qDebug("Listing remote dir "+tmp); | 619 | // qDebug("Listing remote dir "+tmp); |
615 | // QCopEnvelope ( "QPE/System", "busy()" ); | 620 | // QCopEnvelope ( "QPE/System", "busy()" ); |
616 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 621 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
617 | QString msg; | 622 | QString msg; |
618 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 623 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
619 | msg.replace(QRegExp(":"),"\n"); | 624 | msg.replace(QRegExp(":"),"\n"); |
620 | QMessageBox::message(tr("Note"),msg); | 625 | QMessageBox::message(tr("Note"),msg); |
621 | return false; | 626 | return false; |
622 | } | 627 | } |
623 | populateRemoteView() ; | 628 | populateRemoteView() ; |
624 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 629 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
625 | return true; | 630 | return true; |
626 | } | 631 | } |
627 | 632 | ||
628 | bool OpieFtp::remoteChDir(const QString &dir) | 633 | bool OpieFtp::remoteChDir(const QString &dir) |
629 | { | 634 | { |
630 | // QCopEnvelope ( "QPE/System", "busy()" ); | 635 | // QCopEnvelope ( "QPE/System", "busy()" ); |
631 | if (!FtpChdir( dir.latin1(), conn )) { | 636 | if (!FtpChdir( dir.latin1(), conn )) { |
632 | QString msg; | 637 | QString msg; |
633 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 638 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
634 | msg.replace(QRegExp(":"),"\n"); | 639 | msg.replace(QRegExp(":"),"\n"); |
635 | QMessageBox::message(tr("Note"),msg); | 640 | QMessageBox::message(tr("Note"),msg); |
636 | // qDebug(msg); | 641 | // qDebug(msg); |
637 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 642 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
638 | return FALSE; | 643 | return FALSE; |
639 | } | 644 | } |
640 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 645 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
641 | return TRUE; | 646 | return TRUE; |
642 | } | 647 | } |
643 | 648 | ||
644 | void OpieFtp::populateLocalView() | 649 | void OpieFtp::populateLocalView() |
645 | { | 650 | { |
646 | Local_View->clear(); | 651 | Local_View->clear(); |
647 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 652 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
648 | currentDir.setMatchAllDirs(TRUE); | 653 | currentDir.setMatchAllDirs(TRUE); |
649 | currentDir.setNameFilter(filterStr); | 654 | currentDir.setNameFilter(filterStr); |
650 | QString fileL, fileS, fileDate; | 655 | QString fileL, fileS, fileDate; |
651 | bool isDir=FALSE; | 656 | bool isDir=FALSE; |
652 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 657 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
653 | QFileInfoListIterator it(*list); | 658 | QFileInfoListIterator it(*list); |
654 | QFileInfo *fi; | 659 | QFileInfo *fi; |
655 | while ( (fi=it.current()) ) { | 660 | while ( (fi=it.current()) ) { |
656 | if (fi->isSymLink() ){ | 661 | if (fi->isSymLink() ){ |
657 | QString symLink=fi->readLink(); | 662 | QString symLink=fi->readLink(); |
658 | // qDebug("Symlink detected "+symLink); | 663 | // qDebug("Symlink detected "+symLink); |
659 | QFileInfo sym( symLink); | 664 | QFileInfo sym( symLink); |
660 | fileS.sprintf( "%10i", sym.size() ); | 665 | fileS.sprintf( "%10i", sym.size() ); |
661 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 666 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
662 | fileDate = sym.lastModified().toString(); | 667 | fileDate = sym.lastModified().toString(); |
663 | } else { | 668 | } else { |
664 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 669 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
665 | fileS.sprintf( "%10i", fi->size() ); | 670 | fileS.sprintf( "%10i", fi->size() ); |
666 | fileL.sprintf( "%s",fi->fileName().data() ); | 671 | fileL.sprintf( "%s",fi->fileName().data() ); |
667 | fileDate= fi->lastModified().toString(); | 672 | fileDate= fi->lastModified().toString(); |
668 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 673 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
669 | fileL+="/"; | 674 | fileL+="/"; |
670 | isDir=TRUE; | 675 | isDir=TRUE; |
671 | // qDebug( fileL); | 676 | // qDebug( fileL); |
672 | } | 677 | } |
673 | } | 678 | } |
674 | if(fileL !="./" && fi->exists()) { | 679 | if(fileL !="./" && fi->exists()) { |
675 | item = new QListViewItem( Local_View,fileL, fileDate, fileS ); | 680 | item = new QListViewItem( Local_View,fileL, fileDate, fileS ); |
676 | QPixmap pm; | 681 | QPixmap pm; |
677 | 682 | ||
678 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 683 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
679 | if( !QDir( fi->filePath() ).isReadable()) | 684 | if( !QDir( fi->filePath() ).isReadable()) |
680 | pm = Resource::loadPixmap( "lockedfolder" ); | 685 | pm = Resource::loadPixmap( "lockedfolder" ); |
681 | else | 686 | else |
682 | pm= Resource::loadPixmap( "folder" ); | 687 | pm= Resource::loadPixmap( "folder" ); |
683 | item->setPixmap( 0,pm ); | 688 | item->setPixmap( 0,pm ); |
684 | } else { | 689 | } else { |
685 | if( !fi->isReadable() ) | 690 | if( !fi->isReadable() ) |
686 | pm = Resource::loadPixmap( "locked" ); | 691 | pm = Resource::loadPixmap( "locked" ); |
687 | else { | 692 | else { |
688 | MimeType mt(fi->filePath()); | 693 | MimeType mt(fi->filePath()); |
689 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 694 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
690 | if(pm.isNull()) | 695 | if(pm.isNull()) |
691 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 696 | pm = unknownXpm; |
692 | item->setPixmap( 0,pm); | ||
693 | } | 697 | } |
694 | } | 698 | } |
695 | if( fileL.find("->",0,TRUE) != -1) { | 699 | if( fileL.find("->",0,TRUE) != -1) { |
696 | // overlay link image | 700 | // overlay link image |
697 | pm= Resource::loadPixmap( "folder" ); | 701 | pm= Resource::loadPixmap( "folder" ); |
698 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 702 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
699 | QPainter painter( &pm ); | 703 | QPainter painter( &pm ); |
700 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 704 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
701 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 705 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
702 | item->setPixmap( 0, pm); | ||
703 | } | 706 | } |
707 | item->setPixmap( 0,pm); | ||
704 | } | 708 | } |
705 | isDir=FALSE; | 709 | isDir=FALSE; |
706 | ++it; | 710 | ++it; |
707 | } | 711 | } |
708 | Local_View->setSorting( 3,FALSE); | 712 | Local_View->setSorting( 3,FALSE); |
709 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 713 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
710 | fillCombo( (const QString &)currentDir); | 714 | fillCombo( (const QString &)currentDir); |
711 | } | 715 | } |
712 | 716 | ||
713 | bool OpieFtp::populateRemoteView( ) | 717 | bool OpieFtp::populateRemoteView( ) |
714 | { | 718 | { |
715 | // qDebug("populate remoteview"); | 719 | // qDebug("populate remoteview"); |
716 | QString sfile=QDir::homeDirPath(); | 720 | QString sfile=QDir::homeDirPath(); |
717 | if(sfile.right(1) != "/") | 721 | if(sfile.right(1) != "/") |
718 | sfile+="/._temp"; | 722 | sfile+="/._temp"; |
719 | else | 723 | else |
720 | sfile+="._temp"; | 724 | sfile+="._temp"; |
721 | QFile file( sfile); | 725 | QFile file( sfile); |
722 | Remote_View->clear(); | 726 | Remote_View->clear(); |
723 | QString s, File_Name; | 727 | QString s, File_Name; |
724 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 728 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
725 | QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); | 729 | QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); |
726 | QString fileL, fileS, fileDate; | 730 | QString fileL, fileS, fileDate; |
727 | if ( file.open(IO_ReadOnly)) { | 731 | if ( file.open(IO_ReadOnly)) { |
728 | QTextStream t( &file ); // use a text stream | 732 | QTextStream t( &file ); // use a text stream |
729 | while ( !t.eof()) { | 733 | while ( !t.eof()) { |
730 | s = t.readLine(); | 734 | s = t.readLine(); |
731 | 735 | ||
732 | if(s.find("total",0,TRUE) == 0) | 736 | if(s.find("total",0,TRUE) == 0) |
733 | continue; | 737 | continue; |
734 | 738 | ||
735 | int len, month = monthRe.match(s, 0, &len); | 739 | int len, month = monthRe.match(s, 0, &len); |
736 | fileDate = s.mid(month + 1, len - 2); // minus spaces | 740 | fileDate = s.mid(month + 1, len - 2); // minus spaces |
737 | fileL = s.right(s.length() - month - len); | 741 | fileL = s.right(s.length() - month - len); |
738 | if(s.left(1) == "d") | 742 | if(s.left(1) == "d") |
739 | fileL = fileL+"/"; | 743 | fileL = fileL+"/"; |
740 | fileS = s.mid(month - 8, 8); // FIXME | 744 | fileS = s.mid(month - 8, 8); // FIXME |
741 | fileS = fileS.stripWhiteSpace(); | 745 | fileS = fileS.stripWhiteSpace(); |
742 | 746 | ||
743 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { | 747 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { |
744 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); | 748 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); |
745 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | 749 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); |
746 | // if(itemDir) | 750 | // if(itemDir) |
747 | item->moveItem(itemDir); | 751 | item->moveItem(itemDir); |
748 | itemDir=item; | 752 | itemDir=item; |
749 | } else { | 753 | } else { |
750 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); | 754 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); |
751 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 755 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); |
752 | // if(itemFile) | 756 | // if(itemFile) |
753 | item->moveItem(itemDir); | 757 | item->moveItem(itemDir); |
754 | item->moveItem(itemFile); | 758 | item->moveItem(itemFile); |
755 | itemFile=item; | 759 | itemFile=item; |
756 | } | 760 | } |
757 | } | 761 | } |
758 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 762 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
759 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 763 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |
760 | file.close(); | 764 | file.close(); |
761 | if( file.exists()) | 765 | if( file.exists()) |
762 | file. remove(); | 766 | file. remove(); |
763 | } else | 767 | } else |
764 | qDebug("temp file not opened successfullly "+sfile); | 768 | qDebug("temp file not opened successfullly "+sfile); |
765 | Remote_View->setSorting( 4,TRUE); | 769 | Remote_View->setSorting( 4,TRUE); |
766 | return true; | 770 | return true; |
767 | } | 771 | } |
768 | 772 | ||
769 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 773 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
770 | { | 774 | { |
771 | if( selectedItem) { | 775 | if( selectedItem) { |
772 | // QCopEnvelope ( "QPE/System", "busy()" ); | 776 | // QCopEnvelope ( "QPE/System", "busy()" ); |
773 | QString oldRemoteCurrentDir = currentRemoteDir; | 777 | QString oldRemoteCurrentDir = currentRemoteDir; |
774 | QString strItem=selectedItem->text(0); | 778 | QString strItem=selectedItem->text(0); |
775 | strItem=strItem.simplifyWhiteSpace(); | 779 | strItem=strItem.simplifyWhiteSpace(); |
776 | if(strItem == "../") { // the user wants to go ^ | 780 | if(strItem == "../") { // the user wants to go ^ |
777 | if( FtpCDUp( conn) == 0) { | 781 | if( FtpCDUp( conn) == 0) { |
778 | QString msg; | 782 | QString msg; |
779 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 783 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
780 | msg.replace(QRegExp(":"),"\n"); | 784 | msg.replace(QRegExp(":"),"\n"); |
781 | QMessageBox::message(tr("Note"),msg); | 785 | QMessageBox::message(tr("Note"),msg); |
782 | // qDebug(msg); | 786 | // qDebug(msg); |
783 | } | 787 | } |
784 | char path[256]; | 788 | char path[256]; |
785 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 789 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
786 | QString msg; | 790 | QString msg; |
787 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 791 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
788 | msg.replace(QRegExp(":"),"\n"); | 792 | msg.replace(QRegExp(":"),"\n"); |
789 | QMessageBox::message(tr("Note"),msg); | 793 | QMessageBox::message(tr("Note"),msg); |
790 | // qDebug(msg); | 794 | // qDebug(msg); |
791 | } | 795 | } |
792 | currentRemoteDir=path; | 796 | currentRemoteDir=path; |
793 | } else { | 797 | } else { |
794 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | 798 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers |
795 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | 799 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); |
796 | strItem = strItem.stripWhiteSpace(); | 800 | strItem = strItem.stripWhiteSpace(); |
797 | currentRemoteDir = strItem; | 801 | currentRemoteDir = strItem; |
798 | if( !remoteChDir( (const QString &)strItem)) { | 802 | if( !remoteChDir( (const QString &)strItem)) { |
799 | currentRemoteDir = oldRemoteCurrentDir; | 803 | currentRemoteDir = oldRemoteCurrentDir; |
800 | strItem=""; | 804 | strItem=""; |
801 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 805 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
802 | } | 806 | } |
803 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 807 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory |
804 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 808 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
805 | currentRemoteDir = oldRemoteCurrentDir; | 809 | currentRemoteDir = oldRemoteCurrentDir; |
806 | strItem=""; | 810 | strItem=""; |
807 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 811 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
808 | 812 | ||
809 | } else { | 813 | } else { |
810 | currentRemoteDir = currentRemoteDir+strItem; | 814 | currentRemoteDir = currentRemoteDir+strItem; |
811 | } | 815 | } |
812 | } else { | 816 | } else { |
813 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 817 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
814 | return; | 818 | return; |
815 | } | 819 | } |
816 | } | 820 | } |
817 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 821 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
818 | if(currentRemoteDir.right(1) !="/") | 822 | if(currentRemoteDir.right(1) !="/") |
819 | currentRemoteDir +="/"; | 823 | currentRemoteDir +="/"; |
820 | currentPathCombo->lineEdit()->setText( currentRemoteDir); | 824 | currentPathCombo->lineEdit()->setText( currentRemoteDir); |
821 | fillRemoteCombo( (const QString &)currentRemoteDir); | 825 | fillRemoteCombo( (const QString &)currentRemoteDir); |
822 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 826 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
823 | Remote_View->ensureItemVisible(Remote_View->firstChild()); | 827 | Remote_View->ensureItemVisible(Remote_View->firstChild()); |
824 | 828 | ||
825 | } | 829 | } |
826 | } | 830 | } |
827 | 831 | ||
828 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 832 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
829 | { | 833 | { |
830 | if(selectedItem!= NULL) { | 834 | if(selectedItem!= NULL) { |
831 | 835 | ||
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index 109b5f8..9d5d211 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -1,140 +1,142 @@ | |||
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 | #include <qpixmap.h> | ||
21 | 22 | ||
22 | class QVBoxLayout; | 23 | class QVBoxLayout; |
23 | class QHBoxLayout; | 24 | class QHBoxLayout; |
24 | class QGridLayout; | 25 | class QGridLayout; |
25 | class QComboBox; | 26 | class QComboBox; |
26 | class QListView; | 27 | class QListView; |
27 | class QListViewItem; | 28 | class QListViewItem; |
28 | class QLabel; | 29 | class QLabel; |
29 | class QProgressBar; | 30 | class QProgressBar; |
30 | class QSpinBox; | 31 | class QSpinBox; |
31 | class QTabWidget; | 32 | class QTabWidget; |
32 | class QWidget; | 33 | class QWidget; |
33 | class QPEToolBar; | 34 | class QPEToolBar; |
34 | class QPEMenuBar; | 35 | class QPEMenuBar; |
35 | class QPopupMenu; | 36 | class QPopupMenu; |
36 | class QFile; | 37 | class QFile; |
37 | class QLineEdit; | 38 | class QLineEdit; |
38 | class QPushButton; | 39 | class QPushButton; |
39 | class QToolButton; | 40 | class QToolButton; |
40 | class QStringList; | 41 | class QStringList; |
41 | class QListBox; | 42 | class QListBox; |
42 | class QTimer; | 43 | class QTimer; |
43 | 44 | ||
44 | class OpieFtp : public QMainWindow | 45 | class OpieFtp : public QMainWindow |
45 | { | 46 | { |
46 | Q_OBJECT | 47 | Q_OBJECT |
47 | 48 | ||
48 | public: | 49 | public: |
49 | OpieFtp( ); | 50 | OpieFtp( ); |
50 | ~OpieFtp(); | 51 | ~OpieFtp(); |
51 | 52 | ||
52 | QTabWidget *TabWidget; | 53 | QTabWidget *TabWidget; |
53 | QWidget *tab, *tab_2, *tab_3; | 54 | QWidget *tab, *tab_2, *tab_3; |
54 | QListView *Local_View, *Remote_View; | 55 | QListView *Local_View, *Remote_View; |
55 | QListBox *serverListView; | 56 | QListBox *serverListView; |
56 | 57 | ||
57 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; | 58 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; |
58 | QLineEdit *PasswordEdit, *remotePath; | 59 | QLineEdit *PasswordEdit, *remotePath; |
59 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; | 60 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; |
60 | QSpinBox* PortSpinBox; | 61 | QSpinBox* PortSpinBox; |
61 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu; | 62 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu; |
62 | QDir currentDir; | 63 | QDir currentDir; |
63 | QString currentRemoteDir; | 64 | QString currentRemoteDir; |
64 | QString filterStr; | 65 | QString filterStr; |
65 | QListViewItem * item; | 66 | QListViewItem * item; |
66 | QPushButton *connectServerBtn, *newServerButton;// | 67 | QPushButton *connectServerBtn, *newServerButton;// |
67 | QToolButton *cdUpButton, *homeButton, *docButton; | 68 | QToolButton *cdUpButton, *homeButton, *docButton; |
68 | bool b; | 69 | bool b; |
69 | int currentServerConfig; | 70 | int currentServerConfig; |
70 | protected slots: | 71 | protected slots: |
71 | void timerOut(); | 72 | void timerOut(); |
72 | void upDir(); | 73 | void upDir(); |
73 | void homeButtonPushed(); | 74 | void homeButtonPushed(); |
74 | void docButtonPushed(); | 75 | void docButtonPushed(); |
75 | void doAbout(); | 76 | void doAbout(); |
76 | 77 | ||
77 | void serverComboEdited(const QString & ); | 78 | void serverComboEdited(const QString & ); |
78 | void UsernameComboBoxEdited(const QString & ); | 79 | void UsernameComboBoxEdited(const QString & ); |
79 | void PasswordEditEdited(const QString & ); | 80 | void PasswordEditEdited(const QString & ); |
80 | 81 | ||
81 | void showLocalMenu( QListViewItem *); | 82 | void showLocalMenu( QListViewItem *); |
82 | void showRemoteMenu( QListViewItem *); | 83 | void showRemoteMenu( QListViewItem *); |
83 | void doLocalCd(); | 84 | void doLocalCd(); |
84 | void doRemoteCd(); | 85 | void doRemoteCd(); |
85 | void localUpload(); | 86 | void localUpload(); |
86 | void remoteDownload(); | 87 | void remoteDownload(); |
87 | void newConnection(); | 88 | void newConnection(); |
88 | void connector(); | 89 | void connector(); |
89 | void disConnector(); | 90 | void disConnector(); |
90 | void populateLocalView(); | 91 | void populateLocalView(); |
91 | bool populateRemoteView(); | 92 | bool populateRemoteView(); |
92 | void showHidden(); | 93 | void showHidden(); |
93 | void writeConfig(); | 94 | void writeConfig(); |
94 | void readConfig(); | 95 | void readConfig(); |
95 | void localListClicked(QListViewItem *); | 96 | void localListClicked(QListViewItem *); |
96 | void remoteListClicked(QListViewItem *); | 97 | void remoteListClicked(QListViewItem *); |
97 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 98 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
98 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); | 99 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); |
99 | void localMakDir(); | 100 | void localMakDir(); |
100 | void localDelete(); | 101 | void localDelete(); |
101 | void remoteMakDir(); | 102 | void remoteMakDir(); |
102 | void remoteDelete(); | 103 | void remoteDelete(); |
103 | 104 | ||
104 | bool remoteDirList(const QString &); | 105 | bool remoteDirList(const QString &); |
105 | bool remoteChDir(const QString &); | 106 | bool remoteChDir(const QString &); |
106 | 107 | ||
107 | void tabChanged(QWidget*); | 108 | void tabChanged(QWidget*); |
108 | void cleanUp(); | 109 | void cleanUp(); |
109 | 110 | ||
110 | void remoteRename(); | 111 | void remoteRename(); |
111 | void localRename(); | 112 | void localRename(); |
112 | 113 | ||
113 | void currentPathComboChanged(); | 114 | void currentPathComboChanged(); |
114 | void currentPathComboActivated(const QString &); | 115 | void currentPathComboActivated(const QString &); |
115 | void switchToLocalTab(); | 116 | void switchToLocalTab(); |
116 | void switchToRemoteTab(); | 117 | void switchToRemoteTab(); |
117 | void switchToConfigTab(); | 118 | void switchToConfigTab(); |
118 | 119 | ||
119 | void fillCombos(); | 120 | void fillCombos(); |
120 | void clearCombos(); | 121 | void clearCombos(); |
121 | void fillRemoteCombo(const QString&); | 122 | void fillRemoteCombo(const QString&); |
122 | void fillCombo(const QString &); | 123 | void fillCombo(const QString &); |
123 | void serverComboSelected(int); | 124 | void serverComboSelected(int); |
124 | void deleteServer(); | 125 | void deleteServer(); |
125 | void connectorBtnToggled(bool); | 126 | void connectorBtnToggled(bool); |
126 | void NewServer(); | 127 | void NewServer(); |
127 | void serverListClicked( const QString &); | 128 | void serverListClicked( const QString &); |
128 | 129 | ||
129 | protected: | 130 | protected: |
131 | QPixmap unknownXpm; | ||
130 | bool fuckeduphack; | 132 | bool fuckeduphack; |
131 | QStringList remoteDirPathStringList, localDirPathStringList; | 133 | QStringList remoteDirPathStringList, localDirPathStringList; |
132 | QString newServerName; | 134 | QString newServerName; |
133 | void nullifyCallBack(); | 135 | void nullifyCallBack(); |
134 | QGridLayout* tabLayout; | 136 | QGridLayout* tabLayout; |
135 | QGridLayout* tabLayout_2; | 137 | QGridLayout* tabLayout_2; |
136 | QGridLayout* tabLayout_3; | 138 | QGridLayout* tabLayout_3; |
137 | 139 | ||
138 | }; | 140 | }; |
139 | 141 | ||
140 | #endif // OPIEFTP_H | 142 | #endif // OPIEFTP_H |