-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index d74c55b..4722d70 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,140 +1,140 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | opieftp.cpp | 2 | opieftp.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #define DEVELOPERS_VERSION | 12 | //#define DEVELOPERS_VERSION |
13 | 13 | ||
14 | #include "opieftp.h" | 14 | #include "opieftp.h" |
15 | #include "ftplib.h" | 15 | #include "ftplib.h" |
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | 17 | ||
18 | #include <qpe/qpemenubar.h> | 18 | #include <qpe/qpemenubar.h> |
19 | #include <qpe/qpetoolbar.h> | 19 | #include <qpe/qpetoolbar.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | 24 | ||
25 | #include <qtextstream.h> | 25 | #include <qtextstream.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qtoolbutton.h> | 27 | #include <qtoolbutton.h> |
28 | #include <qdatetime.h> | 28 | #include <qdatetime.h> |
29 | #include <qdir.h> | 29 | #include <qdir.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | #include <qpopupmenu.h> | 33 | #include <qpopupmenu.h> |
34 | #include <qlistview.h> | 34 | #include <qlistview.h> |
35 | #include <qmainwindow.h> | 35 | #include <qmainwindow.h> |
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qprogressbar.h> | 37 | #include <qprogressbar.h> |
38 | #include <qspinbox.h> | 38 | #include <qspinbox.h> |
39 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
40 | #include <qwidget.h> | 40 | #include <qwidget.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qimage.h> | 42 | #include <qimage.h> |
43 | #include <qpixmap.h> | 43 | #include <qpixmap.h> |
44 | #include <qmessagebox.h> | 44 | #include <qmessagebox.h> |
45 | #include <qlineedit.h> | 45 | #include <qlineedit.h> |
46 | #include <qregexp.h> | 46 | #include <qregexp.h> |
47 | 47 | ||
48 | #include <unistd.h> | 48 | #include <unistd.h> |
49 | #include <stdlib.h> | 49 | #include <stdlib.h> |
50 | 50 | ||
51 | 51 | ||
52 | QProgressBar *ProgressBar; | 52 | QProgressBar *ProgressBar; |
53 | static netbuf *conn=NULL; | 53 | static netbuf *conn=NULL; |
54 | 54 | ||
55 | static int log_progress(netbuf *ctl, int xfered, void *arg) | 55 | static int log_progress(netbuf *ctl, int xfered, void *arg) |
56 | { | 56 | { |
57 | int fsz = *(int *)arg; | 57 | int fsz = *(int *)arg; |
58 | int pct = (xfered * 100) / fsz; | 58 | int pct = (xfered * 100) / fsz; |
59 | // printf("%3d%%\r", pct); | 59 | // printf("%3d%%\r", pct); |
60 | // fflush(stdout); | 60 | // fflush(stdout); |
61 | ProgressBar->setProgress(xfered); | 61 | ProgressBar->setProgress(xfered); |
62 | qApp->processEvents(); | 62 | qApp->processEvents(); |
63 | return 1; | 63 | return 1; |
64 | } | 64 | } |
65 | 65 | ||
66 | OpieFtp::OpieFtp( ) | 66 | OpieFtp::OpieFtp( ) |
67 | : QMainWindow( ) | 67 | : QMainWindow( ) |
68 | { | 68 | { |
69 | setCaption( tr( "OpieFtp" ) ); | 69 | setCaption( tr( "OpieFtp" ) ); |
70 | 70 | ||
71 | QGridLayout *layout = new QGridLayout( this ); | 71 | QGridLayout *layout = new QGridLayout( this ); |
72 | layout->setSpacing( 2); | 72 | layout->setSpacing( 2); |
73 | layout->setMargin( 2); | 73 | layout->setMargin( 2); |
74 | 74 | ||
75 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 75 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
76 | 76 | ||
77 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 77 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
78 | connectionMenu = new QPopupMenu( this ); | 78 | connectionMenu = new QPopupMenu( this ); |
79 | localMenu = new QPopupMenu( this ); | 79 | localMenu = new QPopupMenu( this ); |
80 | remoteMenu = new QPopupMenu( this ); | 80 | remoteMenu = new QPopupMenu( this ); |
81 | tabMenu = new QPopupMenu( this ); | 81 | tabMenu = new QPopupMenu( this ); |
82 | 82 | ||
83 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 ); | 83 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 ); |
84 | 84 | ||
85 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 85 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
86 | menuBar->insertItem( tr( "Local" ), localMenu); | 86 | menuBar->insertItem( tr( "Local" ), localMenu); |
87 | menuBar->insertItem( tr( "Remote" ), remoteMenu); | 87 | menuBar->insertItem( tr( "Remote" ), remoteMenu); |
88 | menuBar->insertItem( tr( "View" ), tabMenu); | 88 | menuBar->insertItem( tr( "View" ), tabMenu); |
89 | 89 | ||
90 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 90 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
91 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 91 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
92 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 92 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
93 | 93 | ||
94 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 94 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
95 | localMenu->insertSeparator(); | 95 | localMenu->insertSeparator(); |
96 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 96 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
97 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 97 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
98 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 98 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
99 | localMenu->insertSeparator(); | 99 | localMenu->insertSeparator(); |
100 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 100 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
101 | localMenu->setCheckable(TRUE); | 101 | localMenu->setCheckable(TRUE); |
102 | 102 | ||
103 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 103 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
104 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 104 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
105 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 105 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
106 | remoteMenu->insertSeparator(); | 106 | remoteMenu->insertSeparator(); |
107 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 107 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
108 | 108 | ||
109 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 109 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
110 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 110 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
111 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 111 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
112 | tabMenu->setCheckable(TRUE); | 112 | tabMenu->setCheckable(TRUE); |
113 | 113 | ||
114 | TabWidget = new QTabWidget( this, "TabWidget" ); | 114 | TabWidget = new QTabWidget( this, "TabWidget" ); |
115 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); | 115 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); |
116 | 116 | ||
117 | TabWidget->setTabShape(QTabWidget::Triangular); | 117 | TabWidget->setTabShape(QTabWidget::Triangular); |
118 | 118 | ||
119 | tab = new QWidget( TabWidget, "tab" ); | 119 | tab = new QWidget( TabWidget, "tab" ); |
120 | tabLayout = new QGridLayout( tab ); | 120 | tabLayout = new QGridLayout( tab ); |
121 | tabLayout->setSpacing( 2); | 121 | tabLayout->setSpacing( 2); |
122 | tabLayout->setMargin( 2); | 122 | tabLayout->setMargin( 2); |
123 | 123 | ||
124 | Local_View = new QListView( tab, "Local_View" ); | 124 | Local_View = new QListView( tab, "Local_View" ); |
125 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 125 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
126 | Local_View->addColumn( tr("File"),120); | 126 | Local_View->addColumn( tr("File"),120); |
127 | Local_View->addColumn( tr("Size"),-1); | 127 | Local_View->addColumn( tr("Size"),-1); |
128 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 128 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
129 | Local_View->addColumn( tr("Date"),-1); | 129 | Local_View->addColumn( tr("Date"),-1); |
130 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 130 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
131 | Local_View->setAllColumnsShowFocus(TRUE); | 131 | Local_View->setAllColumnsShowFocus(TRUE); |
132 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 132 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
133 | 133 | ||
134 | tabLayout->addWidget( Local_View, 0, 0 ); | 134 | tabLayout->addWidget( Local_View, 0, 0 ); |
135 | 135 | ||
136 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 136 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
137 | this,SLOT( localListClicked(QListViewItem *)) ); | 137 | this,SLOT( localListClicked(QListViewItem *)) ); |
138 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 138 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
139 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 139 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
140 | 140 | ||