summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-04-28 10:29:22 (UTC)
committer mickeyl <mickeyl>2004-04-28 10:29:22 (UTC)
commit7784d05b07dc65eab1754497e71fbf56d714b048 (patch) (unidiff)
treed9b4dbde4b1e4efa3e2c3ba7ae9c37fda9780c26
parent1343398e0df890b2e8bd5f1d9a0867b291d42691 (diff)
downloadopie-7784d05b07dc65eab1754497e71fbf56d714b048.zip
opie-7784d05b07dc65eab1754497e71fbf56d714b048.tar.gz
opie-7784d05b07dc65eab1754497e71fbf56d714b048.tar.bz2
CLEANUP: remove relative includes over the source tree
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Rules.make1
-rw-r--r--noncore/apps/opie-gutenbrowser/NetworkDialog.cpp4
-rw-r--r--noncore/net/opieftp/opieftp.cpp2
3 files changed, 4 insertions, 3 deletions
diff --git a/Rules.make b/Rules.make
index e86f662..f0e463b 100644
--- a/Rules.make
+++ b/Rules.make
@@ -1,299 +1,300 @@
1.phony: force 1.phony: force
2force: 2force:
3 3
4$(configs) : 4$(configs) :
5 $(call makecfg,$@) 5 $(call makecfg,$@)
6 6
7$(TOPDIR)/gen.pro : $(TOPDIR)/.config 7$(TOPDIR)/gen.pro : $(TOPDIR)/.config
8 echo > $@ 8 echo > $@
9# added for threaded version 9# added for threaded version
10ifneq ($(CONFIG_THREADED),) 10ifneq ($(CONFIG_THREADED),)
11 echo CONFIG += thread >> $@ 11 echo CONFIG += thread >> $@
12else 12else
13 echo CONFIG -= thread >> $@ 13 echo CONFIG -= thread >> $@
14endif 14endif
15ifneq ($(CONFIG_DEBUG),) 15ifneq ($(CONFIG_DEBUG),)
16 echo CONFIG += debug >> $@ 16 echo CONFIG += debug >> $@
17 echo CONFIG -= release >> $@ 17 echo CONFIG -= release >> $@
18 echo DEFINES += "QT_COMPONENT_DEBUG=2" >> $@ 18 echo DEFINES += "QT_COMPONENT_DEBUG=2" >> $@
19 echo DEFINES += QT_DEBUG >> $@ 19 echo DEFINES += QT_DEBUG >> $@
20else 20else
21 echo CONFIG -= debug >> $@ 21 echo CONFIG -= debug >> $@
22 echo CONFIG += release >> $@ 22 echo CONFIG += release >> $@
23 echo DEFINES += "OPIE_NO_DEBUG" >> $@ 23 echo DEFINES += "OPIE_NO_DEBUG" >> $@
24endif 24endif
25 25
26ifeq ($(filter 3.%,$(QTE_VERSION)),) # not qt3 26ifeq ($(filter 3.%,$(QTE_VERSION)),) # not qt3
27 echo CONFIG -= qt3 >> $@ 27 echo CONFIG -= qt3 >> $@
28else 28else
29 echo CONFIG += qt3 >> $@ 29 echo CONFIG += qt3 >> $@
30endif 30endif
31ifneq ($(CONFIG_QUICK_LAUNCH),) 31ifneq ($(CONFIG_QUICK_LAUNCH),)
32 echo contains\( CONFIG, quick-app \) \{ >> $@ 32 echo contains\( CONFIG, quick-app \) \{ >> $@
33 echo CONFIG -= quick-app >> $@ 33 echo CONFIG -= quick-app >> $@
34 echo CONFIG += quick-app-lib >> $@ 34 echo CONFIG += quick-app-lib >> $@
35 echo QUICKLAUNCH_PATH = $(CONFIG_QUICKLAUNCH_PATH) >> $@ 35 echo QUICKLAUNCH_PATH = $(CONFIG_QUICKLAUNCH_PATH) >> $@
36 echo \} >> $@ 36 echo \} >> $@
37else 37else
38 echo contains\( CONFIG, quick-app \) \{ >> $@ 38 echo contains\( CONFIG, quick-app \) \{ >> $@
39 echo CONFIG -= quick-app >> $@ 39 echo CONFIG -= quick-app >> $@
40 echo CONFIG += quick-app-bin >> $@ 40 echo CONFIG += quick-app-bin >> $@
41 echo \} >> $@ 41 echo \} >> $@
42endif 42endif
43ifeq ($(CONFIG_SQL_PIM_BACKEND),y) 43ifeq ($(CONFIG_SQL_PIM_BACKEND),y)
44 echo ENABLE_SQL_PIM_BACKEND=$(CONFIG_SQL_PIM_BACKEND) >> $@ 44 echo ENABLE_SQL_PIM_BACKEND=$(CONFIG_SQL_PIM_BACKEND) >> $@
45else 45else
46 echo ENABLE_SQL_PIM_BACKEND=n >> $@ 46 echo ENABLE_SQL_PIM_BACKEND=n >> $@
47endif 47endif
48ifeq ($(CONFIG_OPIE_NO_OVERRIDE_QT),y) 48ifeq ($(CONFIG_OPIE_NO_OVERRIDE_QT),y)
49 echo CONFIG += no-override >> $@ 49 echo CONFIG += no-override >> $@
50endif 50endif
51ifeq ($(CONFIG_OPIE_NO_BUILTIN_SHUTDOWN),y) 51ifeq ($(CONFIG_OPIE_NO_BUILTIN_SHUTDOWN),y)
52 echo DEFINES += OPIE_NO_BUILTIN_SHUTDOWN >> $@ 52 echo DEFINES += OPIE_NO_BUILTIN_SHUTDOWN >> $@
53endif 53endif
54ifeq ($(CONFIG_OPIE_NO_BUILTIN_CALIBRATE),y) 54ifeq ($(CONFIG_OPIE_NO_BUILTIN_CALIBRATE),y)
55 echo DEFINES += OPIE_NO_BUILTIN_CALIBRATE >> $@ 55 echo DEFINES += OPIE_NO_BUILTIN_CALIBRATE >> $@
56endif 56endif
57ifeq ($(CONFIG_USE_REALTIME_AUDIO_THREAD),y) 57ifeq ($(CONFIG_USE_REALTIME_AUDIO_THREAD),y)
58 echo DEFINES += USE_REALTIME_AUDIO_THREAD >> $@ 58 echo DEFINES += USE_REALTIME_AUDIO_THREAD >> $@
59endif 59endif
60ifeq ($(CONFIG_USE_FILE_NOTIFICATION),y) 60ifeq ($(CONFIG_USE_FILE_NOTIFICATION),y)
61 echo DEFINES += USE_FILE_NOTIFICATION >> $@ 61 echo DEFINES += USE_FILE_NOTIFICATION >> $@
62endif 62endif
63ifeq ($(CONFIG_QT_QWS_ALLOW_CLOCK),y) 63ifeq ($(CONFIG_QT_QWS_ALLOW_CLOCK),y)
64 echo DEFINES += QT_QWS_ALLOW_OVERCLOCK >> $@ 64 echo DEFINES += QT_QWS_ALLOW_OVERCLOCK >> $@
65endif 65endif
66ifeq ($(CONFIG_OPIE_HIGH_RES_SMALL_PHY),y) 66ifeq ($(CONFIG_OPIE_HIGH_RES_SMALL_PHY),y)
67 echo DEFINES += OPIE_HIGH_RES_SMALL_PHY >> $@ 67 echo DEFINES += OPIE_HIGH_RES_SMALL_PHY >> $@
68endif 68endif
69ifeq ($(CONFIG_OPIE_NEW_ALLOC),y) 69ifeq ($(CONFIG_OPIE_NEW_ALLOC),y)
70 echo DEFINES += OPIE_NEW_MALLOC >> $@ 70 echo DEFINES += OPIE_NEW_MALLOC >> $@
71endif 71endif
72ifeq ($(CONFIG_OPIE_NO_SOUND_PCM_READ_BITS),y) 72ifeq ($(CONFIG_OPIE_NO_SOUND_PCM_READ_BITS),y)
73 echo DEFINES += OPIE_NO_SOUND_PCM_READ_BITS >> $@ 73 echo DEFINES += OPIE_NO_SOUND_PCM_READ_BITS >> $@
74endif 74endif
75 echo DEFINES += OPIE_SOUND_FRAGMENT_SHIFT=$(CONFIG_OPIE_SOUND_FRAGMENT_SHIFT) >> $@ 75 echo DEFINES += OPIE_SOUND_FRAGMENT_SHIFT=$(CONFIG_OPIE_SOUND_FRAGMENT_SHIFT) >> $@
76ifeq ($(CONFIG_OPIE_WE_VERSION_OVERRIDE),y) 76ifeq ($(CONFIG_OPIE_WE_VERSION_OVERRIDE),y)
77 echo DEFINES += OPIE_WE_VERSION=$(CONFIG_OPIE_WE_VERSION) >> $@ 77 echo DEFINES += OPIE_WE_VERSION=$(CONFIG_OPIE_WE_VERSION) >> $@
78endif 78endif
79# Write LIB dirs and INC dirs... 79# Write LIB dirs and INC dirs...
80ifeq ($(CONFIG_LIBETPAN_DEP),y) 80ifeq ($(CONFIG_LIBETPAN_DEP),y)
81 echo LIBETPAN_LIB_DIR = $(CONFIG_LIBETPAN_LIB_DIR) >> $@ 81 echo LIBETPAN_LIB_DIR = $(CONFIG_LIBETPAN_LIB_DIR) >> $@
82 echo LIBETPAN_INC_DIR = $(CONFIG_LIBETPAN_INC_DIR) >> $@ 82 echo LIBETPAN_INC_DIR = $(CONFIG_LIBETPAN_INC_DIR) >> $@
83endif 83endif
84ifeq ($(CONFIG_LIBPCAP_DEP),y) 84ifeq ($(CONFIG_LIBPCAP_DEP),y)
85 echo LIBPCAP_LIB_DIR = $(CONFIG_LIBPCAP_LIB_DIR) >> $@ 85 echo LIBPCAP_LIB_DIR = $(CONFIG_LIBPCAP_LIB_DIR) >> $@
86 echo LIBPCAP_INC_DIR = $(CONFIG_LIBPCAP_INC_DIR) >> $@ 86 echo LIBPCAP_INC_DIR = $(CONFIG_LIBPCAP_INC_DIR) >> $@
87endif 87endif
88ifeq ($(CONFIG_LIBSQLITE_DEP),y) 88ifeq ($(CONFIG_LIBSQLITE_DEP),y)
89 echo LIBSQLITE_LIB_DIR = $(CONFIG_LIBSQLITE_LIB_DIR) >> $@ 89 echo LIBSQLITE_LIB_DIR = $(CONFIG_LIBSQLITE_LIB_DIR) >> $@
90 echo LIBSQLITE_INC_DIR = $(CONFIG_LIBSQLITE_INC_DIR) >> $@ 90 echo LIBSQLITE_INC_DIR = $(CONFIG_LIBSQLITE_INC_DIR) >> $@
91endif 91endif
92ifeq ($(CONFIG_LIBXINE_DEP),y) 92ifeq ($(CONFIG_LIBXINE_DEP),y)
93 echo LIBXINE_LIB_DIR = $(CONFIG_LIBXINE_LIB_DIR) >> $@ 93 echo LIBXINE_LIB_DIR = $(CONFIG_LIBXINE_LIB_DIR) >> $@
94 echo LIBXINE_INC_DIR = $(CONFIG_LIBXINE_INC_DIR) >> $@ 94 echo LIBXINE_INC_DIR = $(CONFIG_LIBXINE_INC_DIR) >> $@
95endif 95endif
96ifeq ($(CONFIG_LIBIPK_DEP),y) 96ifeq ($(CONFIG_LIBIPK_DEP),y)
97 echo LIBIPK_LIB_DIR = $(CONFIG_LIBIPK_LIB_DIR) >> $@ 97 echo LIBIPK_LIB_DIR = $(CONFIG_LIBIPK_LIB_DIR) >> $@
98 echo LIBIPK_INC_DIR = $(CONFIG_LIBIPK_INC_DIR) >> $@ 98 echo LIBIPK_INC_DIR = $(CONFIG_LIBIPK_INC_DIR) >> $@
99endif 99endif
100ifeq ($(CONFIG_LIBSDK_DEP),y) 100ifeq ($(CONFIG_LIBSDK_DEP),y)
101 echo LIBSDL_LIB_DIR = $(CONFIG_LIBSDL_LIB_DIR) >> $@ 101 echo LIBSDL_LIB_DIR = $(CONFIG_LIBSDL_LIB_DIR) >> $@
102 echo LIBSDL_INC_DIR = $(CONFIG_LIBSDL_INC_DIR) >> $@ 102 echo LIBSDL_INC_DIR = $(CONFIG_LIBSDL_INC_DIR) >> $@
103endif 103endif
104ifeq ($(CONFIG_LIBSWORD_DEP),y) 104ifeq ($(CONFIG_LIBSWORD_DEP),y)
105 echo LIBSWORD_LIB_DIR = $(CONFIG_LIBSWORD_LIB_DIR) >> $@ 105 echo LIBSWORD_LIB_DIR = $(CONFIG_LIBSWORD_LIB_DIR) >> $@
106 echo LIBSWORD_INC_DIR = $(CONFIG_LIBSWORD_INC_DIR) >> $@ 106 echo LIBSWORD_INC_DIR = $(CONFIG_LIBSWORD_INC_DIR) >> $@
107endif 107endif
108$(TOPDIR)/.depends : $(shell if [ -e $(TOPDIR)/config.in ]\; then echo $(TOPDIR)/config.in\; fi\;) $(TOPDIR)/.config $(TOPDIR)/packages 108$(TOPDIR)/.depends : $(shell if [ -e $(TOPDIR)/config.in ]\; then echo $(TOPDIR)/config.in\; fi\;) $(TOPDIR)/.config $(TOPDIR)/packages
109 @echo Generating dependency information... 109 @echo Generating dependency information...
110# add to subdir-y, and add descend rules 110# add to subdir-y, and add descend rules
111 @cat $(TOPDIR)/packages | grep -v '^#' | \ 111 @cat $(TOPDIR)/packages | grep -v '^#' | \
112 awk '{print \ 112 awk '{print \
113 ".PHONY : " $$2 "\n" \ 113 ".PHONY : " $$2 "\n" \
114 "subdir-$$(" $$1 ") += " $$2 "\n\n"; \ 114 "subdir-$$(" $$1 ") += " $$2 "\n\n"; \
115 print $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@,$(filter-out $$@,$$(filter-out $$@,$$(MAKECMDGOALS))))\n"; }' > $(TOPDIR)/.depends 115 print $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@,$(filter-out $$@,$$(filter-out $$@,$$(MAKECMDGOALS))))\n"; }' > $(TOPDIR)/.depends
116 cat $(TOPDIR)/packages | grep -v '^#' | \ 116 cat $(TOPDIR)/packages | grep -v '^#' | \
117 perl -ne '($$cfg, $$dir, $$pro) = $$_ =~ /^(\S+)\s+(\S+)\s+(\S+)/; if ( -e "$$dir/$$pro" ) { print "$$dir/Makefile : $$dir/$$pro \$$(QMAKE) \$$(OPIEDIR)/gen.pro \$$(OPIEDIR)/.config\n\t\$$(call makefilegen,\$$@)\n\n"; }' \ 117 perl -ne '($$cfg, $$dir, $$pro) = $$_ =~ /^(\S+)\s+(\S+)\s+(\S+)/; if ( -e "$$dir/$$pro" ) { print "$$dir/Makefile : $$dir/$$pro \$$(QMAKE) \$$(OPIEDIR)/gen.pro \$$(OPIEDIR)/.config\n\t\$$(call makefilegen,\$$@)\n\n"; }' \
118 >> $(TOPDIR)/.depends 118 >> $(TOPDIR)/.depends
119# interpackage dependency generation 119# interpackage dependency generation
120 @cat $(TOPDIR)/packages | \ 120 @cat $(TOPDIR)/packages | \
121 $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends 121 $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends
122 122
123$(TOPDIR)/.depends.cfgs: 123$(TOPDIR)/.depends.cfgs:
124# config.in interdependencies 124# config.in interdependencies
125 @echo $(configs) | sed -e 's,/config.in,,g' | ( for i in `cat`; do echo $$i; done ) > dirs 125 @echo $(configs) | sed -e 's,/config.in,,g' | ( for i in `cat`; do echo $$i; done ) > dirs
126 @cat dirs | ( for i in `cat`; do if [ "`cat dirs|grep $$i 2>/dev/null|wc -l`" -ne "1" ]; then deps=`cat dirs|grep $$i| grep -v "^$$i$$"|for i in \`cat|sed -e's,^$(TOPDIR)/,$$(TOPDIR)/,g'\`; do echo $$i/config.in; done`; echo `echo $$i/config.in|sed -e 's,^$(TOPDIR)/,$$(TOPDIR)/,'` : $$deps; fi; done ) >> $@ 126 @cat dirs | ( for i in `cat`; do if [ "`cat dirs|grep $$i 2>/dev/null|wc -l`" -ne "1" ]; then deps=`cat dirs|grep $$i| grep -v "^$$i$$"|for i in \`cat|sed -e's,^$(TOPDIR)/,$$(TOPDIR)/,g'\`; do echo $$i/config.in; done`; echo `echo $$i/config.in|sed -e 's,^$(TOPDIR)/,$$(TOPDIR)/,'` : $$deps; fi; done ) >> $@
127 @-rm -f dirs 127 @-rm -f dirs
128 128
129$(QTDIR)/stamp-headers : 129$(QTDIR)/stamp-headers :
130 @-rm -f $(QTDIR)/stamp-headers* 130 @-rm -f $(QTDIR)/stamp-headers*
131 ( cd $(QTDIR)/include; \ 131 ( cd $(QTDIR)/include; \
132 $(patsubst %,ln -sf ../src/kernel/%;,qgfx_qws.h qwsmouse_qws.h \ 132 $(patsubst %,ln -sf ../src/kernel/%;,qgfx_qws.h qwsmouse_qws.h \
133 qcopchannel_qws.h qwindowsystem_qws.h \ 133 qcopchannel_qws.h qwindowsystem_qws.h \
134 qfontmanager_qws.h qwsdefaultdecoration_qws.h)) 134 qfontmanager_qws.h qwsdefaultdecoration_qws.h))
135 touch $@ 135 touch $@
136 136
137$(QTDIR)/stamp-headers-x11 : 137$(QTDIR)/stamp-headers-x11 :
138 @-rm -f $(QTDIR)/stamp-headers* 138 @-rm -f $(QTDIR)/stamp-headers*
139 cd $(QTDIR)/include; $(patsubst %,ln -sf $(OPIEDIR)/x11/libqpe-x11/qt/%;,qgfx_qws.h qwsmouse_qws.h qcopchannel_qws.h qwindowsystem_qws.h qfontmanager_qws.h qwsdefaultdecoration_qws.h) 139 cd $(QTDIR)/include; $(patsubst %,ln -sf $(OPIEDIR)/x11/libqpe-x11/qt/%;,qgfx_qws.h qwsmouse_qws.h qcopchannel_qws.h qwindowsystem_qws.h qfontmanager_qws.h qwsdefaultdecoration_qws.h)
140 touch $@ 140 touch $@
141 141
142$(OPIEDIR)/stamp-headers : 142$(OPIEDIR)/stamp-headers :
143 @-rm -f $(OPIEDIR)/stamp-headers* 143 @-rm -f $(OPIEDIR)/stamp-headers*
144 mkdir -p $(TOPDIR)/include/qpe \ 144 mkdir -p $(TOPDIR)/include/qpe \
145 $(TOPDIR)/include/qtopia \ 145 $(TOPDIR)/include/qtopia \
146 $(TOPDIR)/include/opie \ 146 $(TOPDIR)/include/opie \
147 $(TOPDIR)/include/opie2 \ 147 $(TOPDIR)/include/opie2 \
148 $(TOPDIR)/include/qtopia/private \ 148 $(TOPDIR)/include/qtopia/private \
149 $(TOPDIR)/include/sl 149 $(TOPDIR)/include/sl
150 ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) 150 ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; )
151 ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) 151 ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; )
152 ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) 152 ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; )
153ifeq ($(CONFIG_LIBOPIE),y) 153ifeq ($(CONFIG_LIBOPIE),y)
154 # libopie1 154 # libopie1
155 ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) 155 ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; )
156 ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) 156 ( cd include/opie && ln -sf ../../libopie/pim/*.h .; )
157 ( cd include/opie && ln -sf ../../libopie/big-screen/*.h .; ) 157 ( cd include/opie && ln -sf ../../libopie/big-screen/*.h .; )
158endif 158endif
159 # libopie2 159 # libopie2
160 ( cd include/opie2 && ln -sf ../../libopie2/opiecore/*.h .; ) 160 ( cd include/opie2 && ln -sf ../../libopie2/opiecore/*.h .; )
161 ( cd include/opie2 && ln -sf ../../libopie2/opiecore/device/*.h .; ) 161 ( cd include/opie2 && ln -sf ../../libopie2/opiecore/device/*.h .; )
162 ( cd include/opie2 && ln -sf ../../libopie2/opiemm/*.h .; ) 162 ( cd include/opie2 && ln -sf ../../libopie2/opiemm/*.h .; )
163 ( cd include/opie2 && ln -sf ../../libopie2/opiedb/*.h .; ) 163 ( cd include/opie2 && ln -sf ../../libopie2/opiedb/*.h .; )
164 ( cd include/opie2 && ln -sf ../../libopie2/opienet/*.h .; ) 164 ( cd include/opie2 && ln -sf ../../libopie2/opienet/*.h .; )
165 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/*.h .; ) 165 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/*.h .; )
166 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/core/*.h .; ) 166 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/core/*.h .; )
167 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/core/backends/*.h .; ) 167 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/core/backends/*.h .; )
168 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/ui/*.h .; ) 168 ( cd include/opie2 && ln -sf ../../libopie2/opiepim/ui/*.h .; )
169 ( cd include/opie2 && ln -sf ../../libopie2/opieui/*.h .; ) 169 ( cd include/opie2 && ln -sf ../../libopie2/opieui/*.h .; )
170 ( cd include/opie2 && ln -sf ../../libopie2/opieui/fileselector/*.h .; ) 170 ( cd include/opie2 && ln -sf ../../libopie2/opieui/fileselector/*.h .; )
171 ( cd include/opie2 && ln -sf ../../libopie2/opieui/big-screen/*.h .; ) 171 ( cd include/opie2 && ln -sf ../../libopie2/opieui/big-screen/*.h .; )
172 # auxilliary libraries 172 # auxilliary libraries
173 ( cd include/opie2 && ln -sf ../../libqtaux/*.h .; ) 173 ( cd include/opie2 && ln -sf ../../libqtaux/*.h .; )
174 ( cd include/sl && ln -sf ../../libslcompat/*.h .; ) 174 ( cd include/sl && ln -sf ../../libslcompat/*.h .; )
175 ( cd include/ && ln -sf ../noncore/net/ftplib/*.h .; )
175 # all 176 # all
176ifeq ($(CONFIG_LIBOPIE),y) 177ifeq ($(CONFIG_LIBOPIE),y)
177 ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ 178 ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \
178 ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) 179 ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done )
179endif 180endif
180 ( cd include/opie2; for generatedHeader in `cd ../../libopie2/opieui; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ 181 ( cd include/opie2; for generatedHeader in `cd ../../libopie2/opieui; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \
181 ln -sf ../../libopie2/opieui/$$generatedHeader $$generatedHeader; done ) 182 ln -sf ../../libopie2/opieui/$$generatedHeader $$generatedHeader; done )
182 ( cd include/opie2; for generatedHeader in `cd ../../libopie2/opiepim/ui; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ 183 ( cd include/opie2; for generatedHeader in `cd ../../libopie2/opiepim/ui; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \
183 ln -sf ../../libopie2/opiepim/ui/$$generatedHeader $$generatedHeader; done ) 184 ln -sf ../../libopie2/opiepim/ui/$$generatedHeader $$generatedHeader; done )
184 ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h 185 ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h
185 touch $@ 186 touch $@
186 187
187$(OPIEDIR)/stamp-headers-x11 : 188$(OPIEDIR)/stamp-headers-x11 :
188 @-rm -f $(OPIEDIR)/stamp-headers* 189 @-rm -f $(OPIEDIR)/stamp-headers*
189 mkdir -p $(TOPDIR)/include/qpe $(TOPDIR)/include/qtopia \ 190 mkdir -p $(TOPDIR)/include/qpe $(TOPDIR)/include/qtopia \
190 $(TOPDIR)/include/opie $(TOPDIR)/include/qtopia/private 191 $(TOPDIR)/include/opie $(TOPDIR)/include/qtopia/private
191 ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) 192 ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; )
192 ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) 193 ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; )
193 ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) 194 ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; )
194 ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) 195 ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; )
195 ( cd include/opie && ln -sf ../../libsql/*.h .; ) 196 ( cd include/opie && ln -sf ../../libsql/*.h .; )
196 ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) 197 ( cd include/opie && ln -sf ../../libopie/pim/*.h .; )
197 ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ 198 ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \
198 ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) 199 ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done )
199 ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h 200 ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h
200 ( cd include/qpe; ln -sf ../../x11/libqpe-x11/qpe/*.h .; ) 201 ( cd include/qpe; ln -sf ../../x11/libqpe-x11/qpe/*.h .; )
201 touch $@ 202 touch $@
202 203
203$(TOPDIR)/library/custom.h : $(TOPDIR)/.config 204$(TOPDIR)/library/custom.h : $(TOPDIR)/.config
204 @-rm -f $@ 205 @-rm -f $@
205 @$(if $(patsubst "%",%,$(CONFIG_CUSTOMFILE)),\ 206 @$(if $(patsubst "%",%,$(CONFIG_CUSTOMFILE)),\
206 ln -sf $(patsubst "%",%,$(CONFIG_CUSTOMFILE)) $@) 207 ln -sf $(patsubst "%",%,$(CONFIG_CUSTOMFILE)) $@)
207 @touch $@ 208 @touch $@
208 209
209$(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf $(TOPDIR)/scripts/kconfig/conf $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/qmake/qmake: 210$(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf $(TOPDIR)/scripts/kconfig/conf $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/qmake/qmake:
210 @$(call descend,$(shell dirname $@),$(shell basename $@)) 211 @$(call descend,$(shell dirname $@),$(shell basename $@))
211 212
212menuconfig: $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf ./config.in 213menuconfig: $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf ./config.in
213 $(TOPDIR)/scripts/kconfig/mconf ./config.in 214 $(TOPDIR)/scripts/kconfig/mconf ./config.in
214 @touch ./.config.stamp 215 @touch ./.config.stamp
215 216
216xconfig: $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in 217xconfig: $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in
217 $(TOPDIR)/scripts/kconfig/qconf ./config.in 218 $(TOPDIR)/scripts/kconfig/qconf ./config.in
218 @touch .config.stamp 219 @touch .config.stamp
219 220
220gconfig: $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in 221gconfig: $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in
221 $(TOPDIR)/scripts/kconfig/gconf ./config.in 222 $(TOPDIR)/scripts/kconfig/gconf ./config.in
222 @touch .config.stamp 223 @touch .config.stamp
223 224
224config: $(TOPDIR)/scripts/kconfig/conf ./config.in 225config: $(TOPDIR)/scripts/kconfig/conf ./config.in
225 $(TOPDIR)/scripts/kconfig/conf ./config.in 226 $(TOPDIR)/scripts/kconfig/conf ./config.in
226 @touch .config.stamp 227 @touch .config.stamp
227 228
228oldconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in 229oldconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in
229 $(TOPDIR)/scripts/kconfig/conf -o ./config.in 230 $(TOPDIR)/scripts/kconfig/conf -o ./config.in
230 @touch .config.stamp 231 @touch .config.stamp
231 232
232randconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in 233randconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in
233 $(TOPDIR)/scripts/kconfig/conf -r ./config.in 234 $(TOPDIR)/scripts/kconfig/conf -r ./config.in
234 @touch .config.stamp 235 @touch .config.stamp
235 236
236allyesconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in 237allyesconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in
237 $(TOPDIR)/scripts/kconfig/conf -y ./config.in 238 $(TOPDIR)/scripts/kconfig/conf -y ./config.in
238 @touch .config.stamp 239 @touch .config.stamp
239 240
240allnoconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in 241allnoconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in
241 $(TOPDIR)/scripts/kconfig/conf -n ./config.in 242 $(TOPDIR)/scripts/kconfig/conf -n ./config.in
242 @touch .config.stamp 243 @touch .config.stamp
243 244
244defconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in 245defconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in
245 $(TOPDIR)/scripts/kconfig/conf -d ./config.in 246 $(TOPDIR)/scripts/kconfig/conf -d ./config.in
246 @touch .config.stamp 247 @touch .config.stamp
247 248
248$(TOPDIR)/qmake/qmake : $(TOPDIR)/mkspecs/default 249$(TOPDIR)/qmake/qmake : $(TOPDIR)/mkspecs/default
249 250
250$(TOPDIR)/mkspecs/default : 251$(TOPDIR)/mkspecs/default :
251 ln -sf linux-g++ $@ 252 ln -sf linux-g++ $@
252 253
253$(TOPDIR)/scripts/subst : force 254$(TOPDIR)/scripts/subst : force
254 @( \ 255 @( \
255 echo 's,\$$QPE_VERSION,$(QPE_VERSION),g'; \ 256 echo 's,\$$QPE_VERSION,$(QPE_VERSION),g'; \
256 echo 's,\$$OPIE_VERSION,$(OPIE_VERSION),g'; \ 257 echo 's,\$$OPIE_VERSION,$(OPIE_VERSION),g'; \
257 echo 's,\$$QTE_VERSION,$(QTE_VERSION),g'; \ 258 echo 's,\$$QTE_VERSION,$(QTE_VERSION),g'; \
258 echo 's,\$$QTE_REVISION,$(QTE_REVISION),g'; \ 259 echo 's,\$$QTE_REVISION,$(QTE_REVISION),g'; \
259 echo 's,\$$SUB_VERSION,$(SUB_VERSION),g'; \ 260 echo 's,\$$SUB_VERSION,$(SUB_VERSION),g'; \
260 echo 's,\$$EXTRAVERSION,$(EXTRAVERSION),g'; \ 261 echo 's,\$$EXTRAVERSION,$(EXTRAVERSION),g'; \
261 echo 's,\$$QTE_BASEVERSION,$(QTE_BASEVERSION),g'; \ 262 echo 's,\$$QTE_BASEVERSION,$(QTE_BASEVERSION),g'; \
262 ) > $@ || ( rm -f $@; exit 1 ) 263 ) > $@ || ( rm -f $@; exit 1 )
263 264
264$(TOPDIR)/scripts/filesubst : force 265$(TOPDIR)/scripts/filesubst : force
265 @( \ 266 @( \
266 echo 's,\$$OPIEDIR/root/,/,g'; \ 267 echo 's,\$$OPIEDIR/root/,/,g'; \
267 echo 's,$(OPIEDIR)/root/,/,g'; \ 268 echo 's,$(OPIEDIR)/root/,/,g'; \
268 echo 's,\$$OPIEDIR,$(prefix),g'; \ 269 echo 's,\$$OPIEDIR,$(prefix),g'; \
269 echo 's,$(OPIEDIR),$(prefix),g'; \ 270 echo 's,$(OPIEDIR),$(prefix),g'; \
270 echo 's,\$$QTDIR,$(prefix),g'; \ 271 echo 's,\$$QTDIR,$(prefix),g'; \
271 echo 's,$(QTDIR),$(prefix),g'; \ 272 echo 's,$(QTDIR),$(prefix),g'; \
272 echo 's,^\(\./\)*root/,/,g'; \ 273 echo 's,^\(\./\)*root/,/,g'; \
273 echo 's,^\(\./\)*etc/,$(prefix)/etc/,g'; \ 274 echo 's,^\(\./\)*etc/,$(prefix)/etc/,g'; \
274 echo 's,^\(\./\)*lib/,$(prefix)/lib/,g'; \ 275 echo 's,^\(\./\)*lib/,$(prefix)/lib/,g'; \
275 echo 's,^\(\./\)*bin/,$(prefix)/bin/,g'; \ 276 echo 's,^\(\./\)*bin/,$(prefix)/bin/,g'; \
276 echo 's,^\(\./\)*pics/,$(prefix)/pics/,g'; \ 277 echo 's,^\(\./\)*pics/,$(prefix)/pics/,g'; \
277 echo 's,^\(\./\)*sounds/,$(prefix)/sounds/,g'; \ 278 echo 's,^\(\./\)*sounds/,$(prefix)/sounds/,g'; \
278 echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ 279 echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \
279 echo 's,^\(\./\)*plugins/,$(prefix)/plugins/,g'; \ 280 echo 's,^\(\./\)*plugins/,$(prefix)/plugins/,g'; \
280 echo 's,^\(\./\)*apps/,$(prefix)/apps/,g'; \ 281 echo 's,^\(\./\)*apps/,$(prefix)/apps/,g'; \
281 echo 's,^\(\./\)*share/,$(prefix)/share/,g'; \ 282 echo 's,^\(\./\)*share/,$(prefix)/share/,g'; \
282 echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ 283 echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \
283 echo 's,^\(\./\)*help/,$(prefix)/help/,g'; \ 284 echo 's,^\(\./\)*help/,$(prefix)/help/,g'; \
284 ) > $@ || ( rm -f $@; exit 1 ) 285 ) > $@ || ( rm -f $@; exit 1 )
285 286
286## general rules ## 287## general rules ##
287 288
288define descend 289define descend
289 $(MAKE) $(if $(QMAKE),QMAKE=$(QMAKE)) -C $(1) $(2) 290 $(MAKE) $(if $(QMAKE),QMAKE=$(QMAKE)) -C $(1) $(2)
290endef 291endef
291 292
292define makefilegen 293define makefilegen
293 cd $(if $(1),$(shell dirname $(1))); $(TOPDIR)/qmake/qmake $(3) -o $(if $(1),$(shell basename $(1))) `cat $(OPIEDIR)/packages | grep " \`echo $(1)|sed -e 's,/Makefile$$,,'\`" | \ 294 cd $(if $(1),$(shell dirname $(1))); $(TOPDIR)/qmake/qmake $(3) -o $(if $(1),$(shell basename $(1))) `cat $(OPIEDIR)/packages | grep " \`echo $(1)|sed -e 's,/Makefile$$,,'\`" | \
294 head -1 | awk '{print $$3}'` 295 head -1 | awk '{print $$3}'`
295endef 296endef
296 297
297define makecfg 298define makecfg
298 $(TOPDIR)/scripts/makecfg.pl $1 $(OPIEDIR) 299 $(TOPDIR)/scripts/makecfg.pl $1 $(OPIEDIR)
299endef 300endef
diff --git a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
index e8ade87..aed53c6 100644
--- a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp
@@ -1,329 +1,329 @@
1// /*************************************************************************** 1// /***************************************************************************
2// NetworkDialog.cpp - description 2// NetworkDialog.cpp - description
3// begin : Sun Aug 27 2000 3// begin : Sun Aug 27 2000
4// copyright : (C) 2000 - 2004 by L.J. Potter 4// copyright : (C) 2000 - 2004 by L.J. Potter
5// email : ljp@llornkcor.com 5// email : ljp@llornkcor.com
6// * This program is free software; you can redistribute it and/or modify * 6// * This program is free software; you can redistribute it and/or modify *
7// * it under the terms of the GNU General Public License as published by * 7// * it under the terms of the GNU General Public License as published by *
8// * the Free Software Foundation; either version 2 of the License, or * 8// * the Free Software Foundation; either version 2 of the License, or *
9// * (at your option) any later version. * 9// * (at your option) any later version. *
10// ***************************************************************************/ 10// ***************************************************************************/
11// // half-assed attempt at providing a network dialog. 11// // half-assed attempt at providing a network dialog.
12// /* Created: Sun Aug 27 15:24:52 2000*/ 12// /* Created: Sun Aug 27 15:24:52 2000*/
13#include <unistd.h> 13#include <unistd.h>
14
14extern "C" { 15extern "C" {
15#include "../../net/ftplib/ftplib.h" 16#include <ftplib.h>
16} 17}
17 18
18
19#include "NetworkDialog.h" 19#include "NetworkDialog.h"
20#include "gutenbrowser.h" 20#include "gutenbrowser.h"
21 21
22#include <qprogressbar.h> 22#include <qprogressbar.h>
23#include <qstringlist.h> 23#include <qstringlist.h>
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qvaluelist.h> 25#include <qvaluelist.h>
26#include <qapplication.h> 26#include <qapplication.h>
27#include <qfile.h> 27#include <qfile.h>
28#include <qstringlist.h> 28#include <qstringlist.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qlayout.h> 31#include <qlayout.h>
32 32
33QProgressBar* ProgressBar1; 33QProgressBar* ProgressBar1;
34QPushButton* buttonCancel; 34QPushButton* buttonCancel;
35static netbuf *conn = NULL; 35static netbuf *conn = NULL;
36 36
37static int log_progress(netbuf *ctl, int xfered, void *arg) { 37static int log_progress(netbuf *ctl, int xfered, void *arg) {
38 int fsz = *(int *)arg; 38 int fsz = *(int *)arg;
39 int pct = (xfered * 100) / fsz; 39 int pct = (xfered * 100) / fsz;
40 printf("%3d%%\r", pct); 40 printf("%3d%%\r", pct);
41 fflush(stdout); 41 fflush(stdout);
42 ProgressBar1->setProgress(xfered); 42 ProgressBar1->setProgress(xfered);
43 qApp->processEvents(); 43 qApp->processEvents();
44 44
45 return 1; 45 return 1;
46} 46}
47 47
48NetworkDialog::NetworkDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QStringList netL) 48NetworkDialog::NetworkDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QStringList netL)
49 : QDialog( parent, name, modal, fl ) 49 : QDialog( parent, name, modal, fl )
50{ 50{
51 51
52 ftp_host = netL[0]; 52 ftp_host = netL[0];
53 networkUrl = strUrl = netL[0]; 53 networkUrl = strUrl = netL[0];
54 54
55 dir = ftp_base_dir = netL[1]; 55 dir = ftp_base_dir = netL[1];
56 localFileName = netL[2]; 56 localFileName = netL[2];
57 s_partialFileName = netL[3]; 57 s_partialFileName = netL[3];
58 58
59 resize(240,110); 59 resize(240,110);
60 60
61 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; 61 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
62 // autoOk = autoDownload; 62 // autoOk = autoDownload;
63// if( networkUrl.find("ftp",0,false)== -1 ) { 63// if( networkUrl.find("ftp",0,false)== -1 ) {
64// if ( !name ) 64// if ( !name )
65// setName( "HTTP NetworkDialog" ); 65// setName( "HTTP NetworkDialog" );
66// setCaption( tr( "HTTP Download ) ); 66// setCaption( tr( "HTTP Download ) );
67// qInitNetworkProtocols(); // registers ftp protocol // for now 67// qInitNetworkProtocols(); // registers ftp protocol // for now
68// QNetworkProtocol::registerNetworkProtocol( "http", new QNetworkProtocolFactory<Http> ); 68// QNetworkProtocol::registerNetworkProtocol( "http", new QNetworkProtocolFactory<Http> );
69// } else { 69// } else {
70 if ( !name ) 70 if ( !name )
71 setName( "FTP NetworkDialog" ); 71 setName( "FTP NetworkDialog" );
72 setCaption(tr("FTP Download")); 72 setCaption(tr("FTP Download"));
73// } 73// }
74 initDialog(); //opens file to be written 74 initDialog(); //opens file to be written
75} 75}
76 76
77NetworkDialog::~NetworkDialog() { 77NetworkDialog::~NetworkDialog() {
78} 78}
79 79
80void NetworkDialog::initDialog() { 80void NetworkDialog::initDialog() {
81 81
82 totalBytesDownloaded=0; 82 totalBytesDownloaded=0;
83 warnLabel = new QLabel( this, "TextLabel" ); 83 warnLabel = new QLabel( this, "TextLabel" );
84 warnLabel ->setText( tr( "Push Ok to download file...." ) ); 84 warnLabel ->setText( tr( "Push Ok to download file...." ) );
85 TextLabel3 = new QLabel( this, "TextLabel3" ); 85 TextLabel3 = new QLabel( this, "TextLabel3" );
86 TextLabel3->setText( ""); 86 TextLabel3->setText( "");
87 QWidget* Layout1 = new QWidget( this, "Layout1" ); 87 QWidget* Layout1 = new QWidget( this, "Layout1" );
88 88
89 hbox = new QHBoxLayout(Layout1); 89 hbox = new QHBoxLayout(Layout1);
90 hbox->setMargin(4); 90 hbox->setMargin(4);
91 91
92 ProgressBar1 = new QProgressBar( Layout1, "ProgressBar1" ); 92 ProgressBar1 = new QProgressBar( Layout1, "ProgressBar1" );
93 ProgressBar1->setProgress(0); 93 ProgressBar1->setProgress(0);
94 hbox->addWidget(ProgressBar1,10,AlignCenter); 94 hbox->addWidget(ProgressBar1,10,AlignCenter);
95 95
96 hbox->addStretch(1); 96 hbox->addStretch(1);
97 buttonOk = new QPushButton( Layout1, "buttonOk" ); 97 buttonOk = new QPushButton( Layout1, "buttonOk" );
98 buttonOk->setText( tr( "&OK" ) ); 98 buttonOk->setText( tr( "&OK" ) );
99 hbox->addWidget(buttonOk,0,AlignRight); 99 hbox->addWidget(buttonOk,0,AlignRight);
100 hbox->addSpacing(5); 100 hbox->addSpacing(5);
101 buttonCancel = new QPushButton( Layout1, "buttonCancel" ); 101 buttonCancel = new QPushButton( Layout1, "buttonCancel" );
102 buttonCancel->setText( tr( "&Cancel" ) ); 102 buttonCancel->setText( tr( "&Cancel" ) );
103 buttonCancel->setAutoDefault( TRUE ); 103 buttonCancel->setAutoDefault( TRUE );
104 buttonCancel->setDefault( TRUE ); 104 buttonCancel->setDefault( TRUE );
105 hbox->addWidget(buttonCancel,0,AlignRight); 105 hbox->addWidget(buttonCancel,0,AlignRight);
106 106
107 ProgressBar1->setFixedSize(140,22); 107 ProgressBar1->setFixedSize(140,22);
108 buttonOk->setFixedSize(35,22); 108 buttonOk->setFixedSize(35,22);
109 buttonCancel->setFixedSize(35,22); 109 buttonCancel->setFixedSize(35,22);
110 warnLabel ->setGeometry( QRect( 5,1,230,25)); 110 warnLabel ->setGeometry( QRect( 5,1,230,25));
111 TextLabel3->setGeometry( QRect( 5,20,230,25)); 111 TextLabel3->setGeometry( QRect( 5,20,230,25));
112 Layout1->setGeometry( QRect(1,60,235,50)); //TODO check these!! 112 Layout1->setGeometry( QRect(1,60,235,50)); //TODO check these!!
113 113
114// timer= new QTimer(this,"vu timer"); 114// timer= new QTimer(this,"vu timer");
115// connectionTimer=new QTimer(this,"connectionTimeout"); 115// connectionTimer=new QTimer(this,"connectionTimeout");
116 116
117 connect(buttonOk,SIGNAL(clicked()),this,SLOT(doOk())); 117 connect(buttonOk,SIGNAL(clicked()),this,SLOT(doOk()));
118 connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject())); 118 connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject()));
119// connect( timer, SIGNAL(timeout()), this , SLOT(timeSlot())); 119// connect( timer, SIGNAL(timeout()), this , SLOT(timeSlot()));
120// connect( connectionTimer,SIGNAL( timeout()),this,SLOT( connectionTimeSlot())); 120// connect( connectionTimer,SIGNAL( timeout()),this,SLOT( connectionTimeSlot()));
121 if(autoOk) { 121 if(autoOk) {
122 qWarning("XXXXXXXXXXXXXXXXXXXXXXXX"); 122 qWarning("XXXXXXXXXXXXXXXXXXXXXXXX");
123 buttonOk->setDown(true); 123 buttonOk->setDown(true);
124 doOk(); 124 doOk();
125 } 125 }
126} 126}
127 127
128void NetworkDialog::timeSlot() { 128void NetworkDialog::timeSlot() {
129 129
130// if(timerProgess < 19 && posTimer) { 130// if(timerProgess < 19 && posTimer) {
131// ProgressBar1->setProgress(timerProgess); 131// ProgressBar1->setProgress(timerProgess);
132// timerProgess++; 132// timerProgess++;
133// } else if(timerProgess > 19 && posTimer) { 133// } else if(timerProgess > 19 && posTimer) {
134// ProgressBar1->setProgress(timerProgess); 134// ProgressBar1->setProgress(timerProgess);
135// timerProgess++; 135// timerProgess++;
136// posTimer=FALSE; 136// posTimer=FALSE;
137// } 137// }
138// if(timerProgess > 1 &&!posTimer) { 138// if(timerProgess > 1 &&!posTimer) {
139// ProgressBar1->setProgress(timerProgess); 139// ProgressBar1->setProgress(timerProgess);
140// timerProgess--; 140// timerProgess--;
141// } else if(timerProgess > 1 &&!posTimer){ 141// } else if(timerProgess > 1 &&!posTimer){
142// ProgressBar1->setProgress(timerProgess); 142// ProgressBar1->setProgress(timerProgess);
143// timerProgess--; 143// timerProgess--;
144// posTimer=TRUE; 144// posTimer=TRUE;
145// } 145// }
146// // qDebug("timer event"); 146// // qDebug("timer event");
147// qApp->processEvents(); 147// qApp->processEvents();
148// repaint(); 148// repaint();
149} 149}
150 150
151void NetworkDialog::connectionTimeSlot() { 151void NetworkDialog::connectionTimeSlot() {
152// qDebug("Connections timed out"); 152// qDebug("Connections timed out");
153// ftpQuit(); 153// ftpQuit();
154// qApp->processEvents(); 154// qApp->processEvents();
155// repaint(); 155// repaint();
156// reject(); 156// reject();
157} 157}
158 158
159 159
160/* 160/*
161downloads the file networkUrl */ 161downloads the file networkUrl */
162bool NetworkDialog::downloadFile( QString networkUrl ) 162bool NetworkDialog::downloadFile( QString networkUrl )
163{ 163{
164 int fsz; 164 int fsz;
165// timer->start( 250 , FALSE); 165// timer->start( 250 , FALSE);
166// posTimer=TRUE; 166// posTimer=TRUE;
167// connectionTimer->start( 600 , FALSE); 167// connectionTimer->start( 600 , FALSE);
168 warnLabel ->setText( ""); 168 warnLabel ->setText( "");
169 qApp->processEvents(); 169 qApp->processEvents();
170 qDebug("Downloading: %s",networkUrl.latin1()); 170 qDebug("Downloading: %s",networkUrl.latin1());
171 qDebug("Into: %s",localFileName.latin1()); 171 qDebug("Into: %s",localFileName.latin1());
172 if( networkUrl.length() > 5) { 172 if( networkUrl.length() > 5) {
173 QString ftp_user = "anonymous"; 173 QString ftp_user = "anonymous";
174 QString ftp_pass = "zaurus@gutenbrowser.com"; 174 QString ftp_pass = "zaurus@gutenbrowser.com";
175// ftp_host= networkUrl.mid(networkUrl.find("ftp://",0, TRUE), 175// ftp_host= networkUrl.mid(networkUrl.find("ftp://",0, TRUE),
176 if(ftp_host.length() < 2) { 176 if(ftp_host.length() < 2) {
177 qDebug("Please select an ftp host" ); 177 qDebug("Please select an ftp host" );
178 successDownload=false; 178 successDownload=false;
179 QMessageBox::message("Note","You need to select an ftp host"); 179 QMessageBox::message("Note","You need to select an ftp host");
180 return false; 180 return false;
181 } 181 }
182 QString msg; 182 QString msg;
183 qDebug(ftp_host); 183 qDebug(ftp_host);
184 qDebug("Opening ftp connection."); 184 qDebug("Opening ftp connection.");
185 warnLabel->setText("connecting to: "+ftp_host ); 185 warnLabel->setText("connecting to: "+ftp_host );
186 qApp->processEvents(); 186 qApp->processEvents();
187 /////////// Open FTP connection 187 /////////// Open FTP connection
188 if (!FtpConnect( ftp_host.latin1(), &conn)) { 188 if (!FtpConnect( ftp_host.latin1(), &conn)) {
189 i=0; 189 i=0;
190 successDownload=false; 190 successDownload=false;
191 QMessageBox::message("Note","Unable to connect to\n"+ftp_host); 191 QMessageBox::message("Note","Unable to connect to\n"+ftp_host);
192 return false; 192 return false;
193 } 193 }
194 TextLabel3->setText("Opening ftp connection."); 194 TextLabel3->setText("Opening ftp connection.");
195 qApp->processEvents(); 195 qApp->processEvents();
196 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { 196 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
197 FtpQuit(conn); 197 FtpQuit(conn);
198 successDownload=false; 198 successDownload=false;
199 msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn)); 199 msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn));
200 QMessageBox::message("Note",msg); 200 QMessageBox::message("Note",msg);
201 return false; 201 return false;
202 } 202 }
203 qDebug("Changing directories."); 203 qDebug("Changing directories.");
204 TextLabel3->setText("Changing directories."); 204 TextLabel3->setText("Changing directories.");
205 qApp->processEvents(); 205 qApp->processEvents();
206 if (!FtpChdir( dir.latin1(), conn )) { 206 if (!FtpChdir( dir.latin1(), conn )) {
207 successDownload=false; 207 successDownload=false;
208 msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); 208 msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn));
209 QMessageBox::message("Note",msg); 209 QMessageBox::message("Note",msg);
210 FtpQuit(conn); 210 FtpQuit(conn);
211 return false; 211 return false;
212 } 212 }
213// if (!FtpNlst( "./.guten_temp", dir, conn)) { 213// if (!FtpNlst( "./.guten_temp", dir, conn)) {
214// successDownload=false; 214// successDownload=false;
215// msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); 215// msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn));
216// QMessageBox::message("Note",msg); 216// QMessageBox::message("Note",msg);
217// FtpQuit(conn); 217// FtpQuit(conn);
218// return false; 218// return false;
219// } 219// }
220 qDebug("Requesting directory list."); 220 qDebug("Requesting directory list.");
221 TextLabel3->setText("Getting directory list."); 221 TextLabel3->setText("Getting directory list.");
222 qApp->processEvents(); 222 qApp->processEvents();
223 if (!FtpDir( "./.guten_temp", dir.latin1(), conn) ) { 223 if (!FtpDir( "./.guten_temp", dir.latin1(), conn) ) {
224 msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn)); 224 msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn));
225 QMessageBox::message("Note",msg); 225 QMessageBox::message("Note",msg);
226 successDownload=false; 226 successDownload=false;
227 FtpQuit(conn); 227 FtpQuit(conn);
228 return false; 228 return false;
229 } 229 }
230 QFile tmp("./.guten_temp"); 230 QFile tmp("./.guten_temp");
231 QString s, File_Name; 231 QString s, File_Name;
232 232
233 if (tmp.open(IO_ReadOnly)) { 233 if (tmp.open(IO_ReadOnly)) {
234 QTextStream t( &tmp ); // use a text stream 234 QTextStream t( &tmp ); // use a text stream
235 qDebug("Finding partial filename "+s_partialFileName); 235 qDebug("Finding partial filename "+s_partialFileName);
236 while ( !t.eof()) { 236 while ( !t.eof()) {
237 s = t.readLine(); 237 s = t.readLine();
238 238
239 if (s.contains(s_partialFileName, FALSE)) { 239 if (s.contains(s_partialFileName, FALSE)) {
240 QString str = s.right( (s.length()) - (s.find(s_partialFileName, FALSE)) ); 240 QString str = s.right( (s.length()) - (s.find(s_partialFileName, FALSE)) );
241 241
242 if (str.contains(".txt")) { 242 if (str.contains(".txt")) {
243 File_Name = str; 243 File_Name = str;
244 qDebug("Found file_name "+ File_Name); 244 qDebug("Found file_name "+ File_Name);
245 break; 245 break;
246 } 246 }
247// if (str.contains(".zip")) { 247// if (str.contains(".zip")) {
248// File_Name = str; 248// File_Name = str;
249// qDebug("Found file_name "+ File_Name); 249// qDebug("Found file_name "+ File_Name);
250// break; 250// break;
251// } 251// }
252 252
253 } 253 }
254 } //end of while loop 254 } //end of while loop
255 tmp.close(); 255 tmp.close();
256// tmp.remove(); ///TODO this is for release version Zaurus 256// tmp.remove(); ///TODO this is for release version Zaurus
257 } 257 }
258 else 258 else
259 qDebug("Error opening temp file."); 259 qDebug("Error opening temp file.");
260 260
261 Config cfg("Gutenbrowser"); 261 Config cfg("Gutenbrowser");
262 cfg.setGroup("General"); 262 cfg.setGroup("General");
263 QString temp=cfg.readEntry("DownloadDirectory",local_library); 263 QString temp=cfg.readEntry("DownloadDirectory",local_library);
264 264
265 localFileName = temp+File_Name; 265 localFileName = temp+File_Name;
266 qDebug("Requesting file "+ File_Name); 266 qDebug("Requesting file "+ File_Name);
267 qDebug( "Saving as "+localFileName); 267 qDebug( "Saving as "+localFileName);
268 msg="Requesting file "+ File_Name; 268 msg="Requesting file "+ File_Name;
269 TextLabel3->setText(msg); 269 TextLabel3->setText(msg);
270 qApp->processEvents(); 270 qApp->processEvents();
271 if( File_Name.length()>3) { 271 if( File_Name.length()>3) {
272 if (!FtpSize( File_Name.latin1(), &fsz, FTPLIB_ASCII, conn)) 272 if (!FtpSize( File_Name.latin1(), &fsz, FTPLIB_ASCII, conn))
273 fsz = 0; 273 fsz = 0;
274 QString temp; 274 QString temp;
275 temp.sprintf( File_Name+" "+" %dkb", fsz); 275 temp.sprintf( File_Name+" "+" %dkb", fsz);
276 TextLabel3->setText(temp); 276 TextLabel3->setText(temp);
277 277
278 ProgressBar1->setTotalSteps(fsz); 278 ProgressBar1->setTotalSteps(fsz);
279 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 279 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
280 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 280 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
281 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 281 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
282 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 282 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
283 283
284 if (!FtpGet( localFileName.latin1(), File_Name.latin1(), FTPLIB_ASCII, conn)) { 284 if (!FtpGet( localFileName.latin1(), File_Name.latin1(), FTPLIB_ASCII, conn)) {
285 msg.sprintf("Could not download "+ File_Name+"\n%s",FtpLastResponse(conn)); 285 msg.sprintf("Could not download "+ File_Name+"\n%s",FtpLastResponse(conn));
286 successDownload=false; 286 successDownload=false;
287 QMessageBox::message("Note",msg); 287 QMessageBox::message("Note",msg);
288 update(); 288 update();
289 } 289 }
290 } else { 290 } else {
291 QMessageBox::message("Note","Could not download file "+ File_Name); 291 QMessageBox::message("Note","Could not download file "+ File_Name);
292 successDownload=false; 292 successDownload=false;
293 FtpQuit(conn); 293 FtpQuit(conn);
294 return false; 294 return false;
295 } 295 }
296 qDebug("Ftp session successful"); 296 qDebug("Ftp session successful");
297 successDownload=TRUE; 297 successDownload=TRUE;
298 FtpQuit(conn); 298 FtpQuit(conn);
299 return true; 299 return true;
300 } //no network url 300 } //no network url
301 return false; 301 return false;
302} 302}
303 303
304void NetworkDialog::doOk() { 304void NetworkDialog::doOk() {
305 qWarning("Do OK"); 305 qWarning("Do OK");
306 QString loginStr; 306 QString loginStr;
307 loginStr = "gutenbrowser"; 307 loginStr = "gutenbrowser";
308 if ( !ftp_host.isEmpty() ) { 308 if ( !ftp_host.isEmpty() ) {
309 if( ftp_host.find( "/", ftp_host.length() - 1,TRUE) != -1 && ftp_host.find("ftp://",0, TRUE) != -1) { 309 if( ftp_host.find( "/", ftp_host.length() - 1,TRUE) != -1 && ftp_host.find("ftp://",0, TRUE) != -1) {
310 TextLabel3->setText( tr( "List remote dir:\n" + ftp_host) ); 310 TextLabel3->setText( tr( "List remote dir:\n" + ftp_host) );
311// TextLabel2->setText( tr( "local file to download into: " +localFileName ) ); 311// TextLabel2->setText( tr( "local file to download into: " +localFileName ) );
312 312
313 if( downloadFile(ftp_host)) 313 if( downloadFile(ftp_host))
314 successDownload = true; 314 successDownload = true;
315 else { 315 else {
316 successDownload = false; 316 successDownload = false;
317 reject(); 317 reject();
318 } 318 }
319 } else { 319 } else {
320 if(downloadFile(ftp_host)) 320 if(downloadFile(ftp_host))
321 successDownload = true; 321 successDownload = true;
322 else { 322 else {
323 successDownload = false; 323 successDownload = false;
324 reject(); 324 reject();
325 } 325 }
326 } 326 }
327 } 327 }
328 accept(); 328 accept();
329} 329}
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index fe96103..aa4314a 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -1,1041 +1,1041 @@
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
16extern "C" { 16extern "C" {
17#include "../ftplib/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#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/mimetype.h> 27#include <qpe/mimetype.h>
28using namespace Opie::Core; 28using namespace Opie::Core;
29 29
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qtoolbutton.h> 32#include <qtoolbutton.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlistview.h> 34#include <qlistview.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qprogressbar.h> 36#include <qprogressbar.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qtabwidget.h> 38#include <qtabwidget.h>
39#include <qlayout.h> 39#include <qlayout.h>
40#include <qmessagebox.h> 40#include <qmessagebox.h>
41#include <qmenubar.h> 41#include <qmenubar.h>
42#include <qlineedit.h> 42#include <qlineedit.h>
43#include <qlistbox.h> 43#include <qlistbox.h>
44#include <qvbox.h> 44#include <qvbox.h>
45 45
46/* STD */ 46/* STD */
47#include <unistd.h> 47#include <unistd.h>
48#include <stdlib.h> 48#include <stdlib.h>
49 49
50QProgressBar *ProgressBar; 50QProgressBar *ProgressBar;
51static netbuf *conn=NULL; 51static netbuf *conn=NULL;
52 52
53static int log_progress(netbuf *, int xfered, void *) 53static int log_progress(netbuf *, int xfered, void *)
54{ 54{
55// int fsz = *(int *)arg; 55// int fsz = *(int *)arg;
56// int pct = (xfered * 100) / fsz; 56// int pct = (xfered * 100) / fsz;
57// printf("%3d%%\r", pct); 57// printf("%3d%%\r", pct);
58// fflush(stdout); 58// fflush(stdout);
59 ProgressBar->setProgress(xfered); 59 ProgressBar->setProgress(xfered);
60 qApp->processEvents(); 60 qApp->processEvents();
61 return 1; 61 return 1;
62} 62}
63 63
64OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) 64OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
65 : QMainWindow( parent, name, fl ) 65 : QMainWindow( parent, name, fl )
66{ 66{
67 odebug << "OpieFtp constructor" << oendl; 67 odebug << "OpieFtp constructor" << oendl;
68 setCaption( tr( "OpieFtp" ) ); 68 setCaption( tr( "OpieFtp" ) );
69 fuckeduphack=FALSE; 69 fuckeduphack=FALSE;
70 70
71 QVBox* wrapperBox = new QVBox( this ); 71 QVBox* wrapperBox = new QVBox( this );
72 setCentralWidget( wrapperBox ); 72 setCentralWidget( wrapperBox );
73 73
74 QWidget *view = new QWidget( wrapperBox ); 74 QWidget *view = new QWidget( wrapperBox );
75 75
76 QGridLayout *layout = new QGridLayout( view ); 76 QGridLayout *layout = new QGridLayout( view );
77 layout->setSpacing( 2); 77 layout->setSpacing( 2);
78 layout->setMargin( 2); 78 layout->setMargin( 2);
79 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 79 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
80 80
81 QMenuBar *menuBar = new QMenuBar(this); 81 QMenuBar *menuBar = new QMenuBar(this);
82// QToolBar *menuBar = new QToolBar(this); 82// QToolBar *menuBar = new QToolBar(this);
83// menuBar->setHorizontalStretchable( TRUE ); 83// menuBar->setHorizontalStretchable( TRUE );
84 84
85 QWMatrix matrix; 85 QWMatrix matrix;
86 QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); 86 QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
87 matrix.scale( .4, .4); 87 matrix.scale( .4, .4);
88 unknownXpm = pix.xForm(matrix); 88 unknownXpm = pix.xForm(matrix);
89 89
90 connectionMenu = new QPopupMenu( this ); 90 connectionMenu = new QPopupMenu( this );
91 localMenu = new QPopupMenu( this ); 91 localMenu = new QPopupMenu( this );
92 remoteMenu = new QPopupMenu( this ); 92 remoteMenu = new QPopupMenu( this );
93 tabMenu = new QPopupMenu( this ); 93 tabMenu = new QPopupMenu( this );
94 94
95//#if 0 95//#if 0
96 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); 96 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
97//#endif 97//#endif
98 98
99 menuBar->insertItem( tr( "Connection" ), connectionMenu); 99 menuBar->insertItem( tr( "Connection" ), connectionMenu);
100// menuBar->insertItem( tr( "Local" ), localMenu); 100// menuBar->insertItem( tr( "Local" ), localMenu);
101// menuBar->insertItem( tr( "Remote" ), remoteMenu); 101// menuBar->insertItem( tr( "Remote" ), remoteMenu);
102 menuBar->insertItem( tr( "View" ), tabMenu); 102 menuBar->insertItem( tr( "View" ), tabMenu);
103 103
104 tabMenu->insertItem( tr( "Local" ), localMenu); 104 tabMenu->insertItem( tr( "Local" ), localMenu);
105 tabMenu->insertItem( tr( "Remote" ), remoteMenu); 105 tabMenu->insertItem( tr( "Remote" ), remoteMenu);
106 106
107 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 107 connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
108 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 108 connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
109 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 109 connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
110 110
111 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 111 localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
112 localMenu->insertSeparator(); 112 localMenu->insertSeparator();
113 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 113 localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
114 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 114 localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
115 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 115 localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
116 localMenu->insertSeparator(); 116 localMenu->insertSeparator();
117 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 117 localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
118 localMenu->setCheckable(TRUE); 118 localMenu->setCheckable(TRUE);
119 119
120 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 120 remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
121 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 121 remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
122 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 122 remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
123 remoteMenu->insertSeparator(); 123 remoteMenu->insertSeparator();
124 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 124 remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
125 125
126 tabMenu->insertSeparator(); 126 tabMenu->insertSeparator();
127 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 127 tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
128 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 128 tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
129 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); 129 tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
130 tabMenu->insertSeparator(); 130 tabMenu->insertSeparator();
131// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 131// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
132 tabMenu->setCheckable(TRUE); 132 tabMenu->setCheckable(TRUE);
133 133
134 134
135 cdUpButton = new QToolButton( view,"cdUpButton"); 135 cdUpButton = new QToolButton( view,"cdUpButton");
136 cdUpButton->setPixmap(Resource::loadPixmap("up")); 136 cdUpButton->setPixmap(Resource::loadPixmap("up"));
137 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 137 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
138 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 138 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
139 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 ); 139 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
140 cdUpButton->hide(); 140 cdUpButton->hide();
141 141
142// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton"); 142// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",view,"docsButton");
143// docButton->setFixedSize( QSize( 20, 20 ) ); 143// docButton->setFixedSize( QSize( 20, 20 ) );
144// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 144// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
145// docButton->setFlat(TRUE); 145// docButton->setFlat(TRUE);
146// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 ); 146// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
147 147
148 homeButton = new QToolButton(view,"homeButton"); 148 homeButton = new QToolButton(view,"homeButton");
149 homeButton->setPixmap( Resource::loadPixmap("home")); 149 homeButton->setPixmap( Resource::loadPixmap("home"));
150 homeButton->setFixedSize( QSize( 20, 20 ) ); 150 homeButton->setFixedSize( QSize( 20, 20 ) );
151 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 151 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
152 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4); 152 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
153 homeButton->hide(); 153 homeButton->hide();
154 154
155 TabWidget = new QTabWidget( view, "TabWidget" ); 155 TabWidget = new QTabWidget( view, "TabWidget" );
156 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 ); 156 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
157 157
158// TabWidget->setTabShape(QTabWidget::Triangular); 158// TabWidget->setTabShape(QTabWidget::Triangular);
159 159
160 tab = new QWidget( TabWidget, "tab" ); 160 tab = new QWidget( TabWidget, "tab" );
161 tabLayout = new QGridLayout( tab ); 161 tabLayout = new QGridLayout( tab );
162 tabLayout->setSpacing( 2); 162 tabLayout->setSpacing( 2);
163 tabLayout->setMargin( 2); 163 tabLayout->setMargin( 2);
164 164
165 Local_View = new QListView( tab, "Local_View" ); 165 Local_View = new QListView( tab, "Local_View" );
166// Local_View->setResizePolicy( QListView::AutoOneFit ); 166// Local_View->setResizePolicy( QListView::AutoOneFit );
167 Local_View->addColumn( tr("File"),150); 167 Local_View->addColumn( tr("File"),150);
168 Local_View->addColumn( tr("Date"),-1); 168 Local_View->addColumn( tr("Date"),-1);
169 Local_View->setColumnAlignment(1,QListView::AlignRight); 169 Local_View->setColumnAlignment(1,QListView::AlignRight);
170 Local_View->addColumn( tr("Size"),-1); 170 Local_View->addColumn( tr("Size"),-1);
171 Local_View->setColumnAlignment(2,QListView::AlignRight); 171 Local_View->setColumnAlignment(2,QListView::AlignRight);
172 Local_View->setAllColumnsShowFocus(TRUE); 172 Local_View->setAllColumnsShowFocus(TRUE);
173 173
174 Local_View->setMultiSelection( TRUE); 174 Local_View->setMultiSelection( TRUE);
175 Local_View->setSelectionMode(QListView::Extended); 175 Local_View->setSelectionMode(QListView::Extended);
176 Local_View->setFocusPolicy(QWidget::ClickFocus); 176 Local_View->setFocusPolicy(QWidget::ClickFocus);
177 177
178 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 178 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
179 179
180 tabLayout->addWidget( Local_View, 0, 0 ); 180 tabLayout->addWidget( Local_View, 0, 0 );
181 181
182 connect( Local_View, SIGNAL( clicked(QListViewItem*)), 182 connect( Local_View, SIGNAL( clicked(QListViewItem*)),
183 this,SLOT( localListClicked(QListViewItem*)) ); 183 this,SLOT( localListClicked(QListViewItem*)) );
184// connect( Local_View, SIGNAL( doubleClicked(QListViewItem*)), 184// connect( Local_View, SIGNAL( doubleClicked(QListViewItem*)),
185// this,SLOT( localListClicked(QListViewItem*)) ); 185// this,SLOT( localListClicked(QListViewItem*)) );
186 connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), 186 connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
187 this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); 187 this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) );
188 188
189 TabWidget->insertTab( tab, tr( "Local" ) ); 189 TabWidget->insertTab( tab, tr( "Local" ) );
190 190
191 tab_2 = new QWidget( TabWidget, "tab_2" ); 191 tab_2 = new QWidget( TabWidget, "tab_2" );
192 tabLayout_2 = new QGridLayout( tab_2 ); 192 tabLayout_2 = new QGridLayout( tab_2 );
193 tabLayout_2->setSpacing( 2); 193 tabLayout_2->setSpacing( 2);
194 tabLayout_2->setMargin( 2); 194 tabLayout_2->setMargin( 2);
195 195
196 Remote_View = new QListView( tab_2, "Remote_View" ); 196 Remote_View = new QListView( tab_2, "Remote_View" );
197 Remote_View->addColumn( tr("File"),150); 197 Remote_View->addColumn( tr("File"),150);
198 Remote_View->addColumn( tr("Date"),-1); 198 Remote_View->addColumn( tr("Date"),-1);
199// Remote_View->setColumnAlignment(1,QListView::AlignRight); 199// Remote_View->setColumnAlignment(1,QListView::AlignRight);
200 Remote_View->addColumn( tr("Size"),-1); 200 Remote_View->addColumn( tr("Size"),-1);
201 Remote_View->setColumnAlignment(2,QListView::AlignRight); 201 Remote_View->setColumnAlignment(2,QListView::AlignRight);
202 Remote_View->setColumnAlignment(3,QListView::AlignCenter); 202 Remote_View->setColumnAlignment(3,QListView::AlignCenter);
203 Remote_View->addColumn( tr("Dir"),-1); 203 Remote_View->addColumn( tr("Dir"),-1);
204 Remote_View->setColumnAlignment(4,QListView::AlignRight); 204 Remote_View->setColumnAlignment(4,QListView::AlignRight);
205 Remote_View->setAllColumnsShowFocus(TRUE); 205 Remote_View->setAllColumnsShowFocus(TRUE);
206 206
207 Remote_View->setMultiSelection( FALSE); 207 Remote_View->setMultiSelection( FALSE);
208 Remote_View->setSelectionMode(QListView::Extended); 208 Remote_View->setSelectionMode(QListView::Extended);
209 Remote_View->setFocusPolicy(QWidget::ClickFocus); 209 Remote_View->setFocusPolicy(QWidget::ClickFocus);
210 210
211 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 211 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
212 212
213 connect( Remote_View, SIGNAL( clicked(QListViewItem*)), 213 connect( Remote_View, SIGNAL( clicked(QListViewItem*)),
214 this,SLOT( remoteListClicked(QListViewItem*)) ); 214 this,SLOT( remoteListClicked(QListViewItem*)) );
215 connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), 215 connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
216 this,SLOT( RemoteListPressed(int,QListViewItem*,const QPoint&,int)) ); 216 this,SLOT( RemoteListPressed(int,QListViewItem*,const QPoint&,int)) );
217 217
218 tabLayout_2->addWidget( Remote_View, 0, 0 ); 218 tabLayout_2->addWidget( Remote_View, 0, 0 );
219 219
220 TabWidget->insertTab( tab_2, tr( "Remote" ) ); 220 TabWidget->insertTab( tab_2, tr( "Remote" ) );
221 221
222 tab_3 = new QWidget( TabWidget, "tab_3" ); 222 tab_3 = new QWidget( TabWidget, "tab_3" );
223 tabLayout_3 = new QGridLayout( tab_3 ); 223 tabLayout_3 = new QGridLayout( tab_3 );
224 tabLayout_3->setSpacing( 2); 224 tabLayout_3->setSpacing( 2);
225 tabLayout_3->setMargin( 2); 225 tabLayout_3->setMargin( 2);
226 226
227 TextLabel1 = new QLabel( tab_3, "TextLabel1" ); 227 TextLabel1 = new QLabel( tab_3, "TextLabel1" );
228 TextLabel1->setText( tr( "Username" ) ); 228 TextLabel1->setText( tr( "Username" ) );
229 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); 229 tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
230 230
231 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); 231 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
232 UsernameComboBox->setEditable(TRUE); 232 UsernameComboBox->setEditable(TRUE);
233 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); 233 tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
234 234
235 connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this, 235 connect( UsernameComboBox,SIGNAL(textChanged(const QString&)),this,
236 SLOT( UsernameComboBoxEdited(const QString&) )); 236 SLOT( UsernameComboBoxEdited(const QString&) ));
237 237
238 TextLabel2 = new QLabel( tab_3, "TextLabel2" ); 238 TextLabel2 = new QLabel( tab_3, "TextLabel2" );
239 TextLabel2->setText( tr( "Password" ) ); 239 TextLabel2->setText( tr( "Password" ) );
240 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); 240 tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
241 241
242 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); 242 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
243 PasswordEdit->setEchoMode(QLineEdit::Password); 243 PasswordEdit->setEchoMode(QLineEdit::Password);
244 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); 244 tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
245 245
246 connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this, 246 connect( PasswordEdit,SIGNAL(textChanged(const QString&)),this,
247 SLOT( PasswordEditEdited(const QString&) )); 247 SLOT( PasswordEditEdited(const QString&) ));
248 248
249//PasswordEdit->setFixedWidth(85); 249//PasswordEdit->setFixedWidth(85);
250 TextLabel3 = new QLabel( tab_3, "TextLabel3" ); 250 TextLabel3 = new QLabel( tab_3, "TextLabel3" );
251 TextLabel3->setText( tr( "Remote server" ) ); 251 TextLabel3->setText( tr( "Remote server" ) );
252 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); 252 tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
253 253
254 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); 254 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
255 ServerComboBox->setEditable(TRUE); 255 ServerComboBox->setEditable(TRUE);
256 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); 256 tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
257 257
258 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) )); 258 connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int) ));
259 connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this, 259 connect(ServerComboBox,SIGNAL(textChanged(const QString&)),this,
260 SLOT(serverComboEdited(const QString&) )); 260 SLOT(serverComboEdited(const QString&) ));
261 261
262 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 262 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
263 TextLabel5->setText( tr( "Remote path" ) ); 263 TextLabel5->setText( tr( "Remote path" ) );
264 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); 264 tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
265 265
266 266
267 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 267 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
268 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); 268 tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
269 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 269 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
270 TextLabel4->setText( tr( "Port" ) ); 270 TextLabel4->setText( tr( "Port" ) );
271 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); 271 tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
272 272
273 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 273 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
274 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 274 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
275 PortSpinBox->setMaxValue(32786); 275 PortSpinBox->setMaxValue(32786);
276 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); 276 tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
277 277
278 serverListView = new QListBox( tab_3, "ServerListView" ); 278 serverListView = new QListBox( tab_3, "ServerListView" );
279 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); 279 tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5);
280 280
281 connect( serverListView, SIGNAL( highlighted(const QString&)), 281 connect( serverListView, SIGNAL( highlighted(const QString&)),
282 this,SLOT( serverListClicked(const QString&) ) ); 282 this,SLOT( serverListClicked(const QString&) ) );
283 283
284 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); 284 connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" );
285 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); 285 tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1);
286 connectServerBtn->setToggleButton(TRUE); 286 connectServerBtn->setToggleButton(TRUE);
287 connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) )); 287 connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) ));
288 288
289 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); 289 newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" );
290 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); 290 tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2);
291 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); 291 connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() ));
292 292
293 QPushButton *deleteServerBtn; 293 QPushButton *deleteServerBtn;
294 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); 294 deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" );
295 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); 295 tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3);
296 296
297 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); 297 connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer()));
298 298
299 299
300 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 300 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
301 tabLayout_3->addItem( spacer, 5, 0 ); 301 tabLayout_3->addItem( spacer, 5, 0 );
302 302
303 TabWidget->insertTab( tab_3, tr( "Config" ) ); 303 TabWidget->insertTab( tab_3, tr( "Config" ) );
304 304
305#if 0 305#if 0
306 connect(TabWidget,SIGNAL(currentChanged(QWidget*)), 306 connect(TabWidget,SIGNAL(currentChanged(QWidget*)),
307 this,SLOT(tabChanged(QWidget*))); 307 this,SLOT(tabChanged(QWidget*)));
308#endif 308#endif
309 309
310 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 310 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
311 currentDir.setPath( QDir::currentDirPath()); 311 currentDir.setPath( QDir::currentDirPath());
312// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 312// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
313 313
314 currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); 314 currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" );
315 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); 315 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
316 currentPathCombo ->setFixedWidth(220); 316 currentPathCombo ->setFixedWidth(220);
317 currentPathCombo->setEditable(TRUE); 317 currentPathCombo->setEditable(TRUE);
318 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 318 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
319 319
320#if 0 320#if 0
321 connect( currentPathCombo, SIGNAL( activated(const QString&) ), 321 connect( currentPathCombo, SIGNAL( activated(const QString&) ),
322 this, SLOT( currentPathComboActivated(const QString&) ) ); 322 this, SLOT( currentPathComboActivated(const QString&) ) );
323 323
324 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 324 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
325 this,SLOT(currentPathComboChanged())); 325 this,SLOT(currentPathComboChanged()));
326#endif 326#endif
327 ProgressBar = new QProgressBar( view, "ProgressBar" ); 327 ProgressBar = new QProgressBar( view, "ProgressBar" );
328 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); 328 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
329 ProgressBar->setMaximumHeight(10); 329 ProgressBar->setMaximumHeight(10);
330 filterStr="*"; 330 filterStr="*";
331 b=FALSE; 331 b=FALSE;
332#if 0 332#if 0
333 populateLocalView(); 333 populateLocalView();
334#endif 334#endif
335 readConfig(); 335 readConfig();
336 336
337// ServerComboBox->setCurrentItem(currentServerConfig); 337// ServerComboBox->setCurrentItem(currentServerConfig);
338 338
339 TabWidget->setCurrentPage(2); 339 TabWidget->setCurrentPage(2);
340 odebug << "Constructor done" << oendl; 340 odebug << "Constructor done" << oendl;
341} 341}
342 342
343OpieFtp::~OpieFtp() 343OpieFtp::~OpieFtp()
344{ 344{
345} 345}
346 346
347void OpieFtp::cleanUp() 347void OpieFtp::cleanUp()
348{ 348{
349 if(conn) 349 if(conn)
350 FtpQuit(conn); 350 FtpQuit(conn);
351 QString sfile=QDir::homeDirPath(); 351 QString sfile=QDir::homeDirPath();
352 if(sfile.right(1) != "/") 352 if(sfile.right(1) != "/")
353 sfile+="/._temp"; 353 sfile+="/._temp";
354 else 354 else
355 sfile+="._temp"; 355 sfile+="._temp";
356 QFile file( sfile); 356 QFile file( sfile);
357 if(file.exists()) 357 if(file.exists())
358 file.remove(); 358 file.remove();
359 Config cfg("opieftp"); 359 Config cfg("opieftp");
360 cfg.setGroup("Server"); 360 cfg.setGroup("Server");
361 cfg.writeEntry("currentServer", currentServerConfig); 361 cfg.writeEntry("currentServer", currentServerConfig);
362 362
363 exit(0); 363 exit(0);
364} 364}
365 365
366void OpieFtp::tabChanged(QWidget *) 366void OpieFtp::tabChanged(QWidget *)
367{ 367{
368 if (TabWidget->currentPageIndex() == 0) { 368 if (TabWidget->currentPageIndex() == 0) {
369 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 369 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
370 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 370 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
371 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 371 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
372 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 372 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
373 if(cdUpButton->isHidden()) 373 if(cdUpButton->isHidden())
374 cdUpButton->show(); 374 cdUpButton->show();
375 if(homeButton->isHidden()) 375 if(homeButton->isHidden())
376 homeButton->show(); 376 homeButton->show();
377 377
378 } 378 }
379 if (TabWidget->currentPageIndex() == 1) { 379 if (TabWidget->currentPageIndex() == 1) {
380 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 380 currentPathCombo->lineEdit()->setText( currentRemoteDir );
381 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); 381 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
382 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 382 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
383 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 383 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
384 if(cdUpButton->isHidden()) 384 if(cdUpButton->isHidden())
385 cdUpButton->show(); 385 cdUpButton->show();
386 homeButton->hide(); 386 homeButton->hide();
387 387
388 } 388 }
389 if (TabWidget->currentPageIndex() == 2) { 389 if (TabWidget->currentPageIndex() == 2) {
390 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); 390 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
391 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 391 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
392 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 392 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
393 cdUpButton->hide(); 393 cdUpButton->hide();
394 homeButton->hide(); 394 homeButton->hide();
395 } 395 }
396} 396}
397 397
398void OpieFtp::newConnection() 398void OpieFtp::newConnection()
399{ 399{
400 UsernameComboBox->lineEdit()->setText(""); 400 UsernameComboBox->lineEdit()->setText("");
401 PasswordEdit->setText( "" ); 401 PasswordEdit->setText( "" );
402 ServerComboBox->lineEdit()->setText( ""); 402 ServerComboBox->lineEdit()->setText( "");
403 remotePath->setText( currentRemoteDir = "/"); 403 remotePath->setText( currentRemoteDir = "/");
404 PortSpinBox->setValue( 21); 404 PortSpinBox->setValue( 21);
405 TabWidget->setCurrentPage(2); 405 TabWidget->setCurrentPage(2);
406} 406}
407 407
408void OpieFtp::serverComboEdited(const QString & ) 408void OpieFtp::serverComboEdited(const QString & )
409{ 409{
410// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { 410// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) {
411// odebug << "ServerComboEdited" << oendl; 411// odebug << "ServerComboEdited" << oendl;
412// // currentServerConfig = -1; 412// // currentServerConfig = -1;
413// } 413// }
414} 414}
415 415
416void OpieFtp::UsernameComboBoxEdited(const QString &) { 416void OpieFtp::UsernameComboBoxEdited(const QString &) {
417// currentServerConfig = -1; 417// currentServerConfig = -1;
418} 418}
419 419
420void OpieFtp::PasswordEditEdited(const QString & ) { 420void OpieFtp::PasswordEditEdited(const QString & ) {
421// currentServerConfig = -1; 421// currentServerConfig = -1;
422} 422}
423 423
424void OpieFtp::connectorBtnToggled(bool On) 424void OpieFtp::connectorBtnToggled(bool On)
425{ 425{
426 if(On) { 426 if(On) {
427 connector(); 427 connector();
428 } else { 428 } else {
429 disConnector(); 429 disConnector();
430 } 430 }
431 431
432} 432}
433 433
434void OpieFtp::connector() 434void OpieFtp::connector()
435{ 435{
436// QCopEnvelope ( "QPE/System", "busy()" ); 436// QCopEnvelope ( "QPE/System", "busy()" );
437// qApp->processEvents(); 437// qApp->processEvents();
438 currentRemoteDir=remotePath->text(); 438 currentRemoteDir=remotePath->text();
439 439
440 if( ServerComboBox->currentText().isEmpty()) { 440 if( ServerComboBox->currentText().isEmpty()) {
441 441
442 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);
443 TabWidget->setCurrentPage(2); 443 TabWidget->setCurrentPage(2);
444 ServerComboBox->setFocus(); 444 ServerComboBox->setFocus();
445 connectServerBtn->setOn(FALSE); 445 connectServerBtn->setOn(FALSE);
446 connectServerBtn->setText( tr("Connect")); 446 connectServerBtn->setText( tr("Connect"));
447 return; 447 return;
448 } 448 }
449 449
450 FtpInit(); 450 FtpInit();
451 451
452 TabWidget->setCurrentPage(1); 452 TabWidget->setCurrentPage(1);
453 QString ftp_host = ServerComboBox->currentText(); 453 QString ftp_host = ServerComboBox->currentText();
454 QString ftp_user = UsernameComboBox->currentText(); 454 QString ftp_user = UsernameComboBox->currentText();
455 QString ftp_pass = PasswordEdit->text(); 455 QString ftp_pass = PasswordEdit->text();
456 QString port=PortSpinBox->cleanText(); 456 QString port=PortSpinBox->cleanText();
457 port.stripWhiteSpace(); 457 port.stripWhiteSpace();
458 458
459 Config cfg("opieftp"); 459 Config cfg("opieftp");
460 cfg.setGroup("Server"); 460 cfg.setGroup("Server");
461// int current=cfg.readNumEntry("currentServer", 1); 461// int current=cfg.readNumEntry("currentServer", 1);
462 462
463// if(ftp_host!= cfg.readEntry(QString::number( current))) 463// if(ftp_host!= cfg.readEntry(QString::number( current)))
464// currentServerConfig=-1; 464// currentServerConfig=-1;
465// cfg.setGroup(QString::number(current)); 465// cfg.setGroup(QString::number(current));
466// if( ftp_user != cfg.readEntry("Username")) 466// if( ftp_user != cfg.readEntry("Username"))
467// currentServerConfig=-1; 467// currentServerConfig=-1;
468// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) 468// if(ftp_pass != cfg.readEntry(cfg.readEntry("Username")))
469// currentServerConfig=-1; 469// currentServerConfig=-1;
470 470
471 471
472 if(ftp_host.find("ftp://",0, TRUE) != -1 ) 472 if(ftp_host.find("ftp://",0, TRUE) != -1 )
473 ftp_host=ftp_host.right(ftp_host.length()-6); 473 ftp_host=ftp_host.right(ftp_host.length()-6);
474 ftp_host+=":"+port; 474 ftp_host+=":"+port;
475 475
476 if (!FtpConnect( ftp_host.latin1(), &conn)) { 476 if (!FtpConnect( ftp_host.latin1(), &conn)) {
477 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); 477 QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host);
478 connectServerBtn->setOn(FALSE); 478 connectServerBtn->setOn(FALSE);
479 connectServerBtn->setText( tr("Connect")); 479 connectServerBtn->setText( tr("Connect"));
480 return ; 480 return ;
481 } 481 }
482 482
483 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { 483 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
484 QString msg; 484 QString msg;
485 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); 485 msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn));
486 msg.replace(QRegExp(":"),"\n"); 486 msg.replace(QRegExp(":"),"\n");
487 QMessageBox::message(tr("Note"),msg); 487 QMessageBox::message(tr("Note"),msg);
488 if(conn) 488 if(conn)
489 FtpQuit(conn); 489 FtpQuit(conn);
490 connectServerBtn->setOn(FALSE); 490 connectServerBtn->setOn(FALSE);
491 connectServerBtn->setText( tr("Connect")); 491 connectServerBtn->setText( tr("Connect"));
492 return ; 492 return ;
493 } 493 }
494 494
495 remoteDirList("/") ; 495 remoteDirList("/") ;
496 setCaption(ftp_host); 496 setCaption(ftp_host);
497 if( currentServerConfig == -1) 497 if( currentServerConfig == -1)
498 writeConfig(); 498 writeConfig();
499 connectServerBtn->setText( tr("Disconnect")); 499 connectServerBtn->setText( tr("Disconnect"));
500// QCopEnvelope ( "QPE/System", "notBusy()" ); 500// QCopEnvelope ( "QPE/System", "notBusy()" );
501} 501}
502 502
503void OpieFtp::disConnector() 503void OpieFtp::disConnector()
504{ 504{
505 if(conn) 505 if(conn)
506 FtpQuit(conn); 506 FtpQuit(conn);
507 setCaption("OpieFtp"); 507 setCaption("OpieFtp");
508 currentRemoteDir="/"; 508 currentRemoteDir="/";
509 Remote_View->clear(); 509 Remote_View->clear();
510 connectServerBtn->setText( tr("Connect")); 510 connectServerBtn->setText( tr("Connect"));
511 connectServerBtn->setOn(FALSE); 511 connectServerBtn->setOn(FALSE);
512 setCaption("OpieFtp"); 512 setCaption("OpieFtp");
513} 513}
514 514
515void OpieFtp::localUpload() 515void OpieFtp::localUpload()
516{ 516{
517 int fsz; 517 int fsz;
518// QCopEnvelope ( "QPE/System", "busy()" ); 518// QCopEnvelope ( "QPE/System", "busy()" );
519// qApp->processEvents(); 519// qApp->processEvents();
520 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 520 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
521 QListViewItemIterator it( Local_View ); 521 QListViewItemIterator it( Local_View );
522 for ( ; it.current(); ++it ) { 522 for ( ; it.current(); ++it ) {
523 if ( it.current()->isSelected() ) { 523 if ( it.current()->isSelected() ) {
524 QString strItem = it.current()->text(0); 524 QString strItem = it.current()->text(0);
525 QString localFile = currentDir.canonicalPath()+"/"+strItem; 525 QString localFile = currentDir.canonicalPath()+"/"+strItem;
526 QString remoteFile= currentRemoteDir+strItem; 526 QString remoteFile= currentRemoteDir+strItem;
527 QFileInfo fi(localFile); 527 QFileInfo fi(localFile);
528 if( !fi.isDir()) { 528 if( !fi.isDir()) {
529 fsz=fi.size(); 529 fsz=fi.size();
530 ProgressBar->setTotalSteps(fsz); 530 ProgressBar->setTotalSteps(fsz);
531 531
532 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 532 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
533 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 533 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
534 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 534 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
535 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 535 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
536 odebug << "Put: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; 536 odebug << "Put: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl;
537 537
538 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 538 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
539 QString msg; 539 QString msg;
540 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); 540 msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
541 msg.replace(QRegExp(":"),"\n"); 541 msg.replace(QRegExp(":"),"\n");
542 QMessageBox::message(tr("Note"),msg); 542 QMessageBox::message(tr("Note"),msg);
543 } 543 }
544 } else { 544 } else {
545 QMessageBox::message(tr("Note"),tr("Cannot upload directories")); 545 QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
546 } 546 }
547 ProgressBar->reset(); 547 ProgressBar->reset();
548 nullifyCallBack(); 548 nullifyCallBack();
549 it.current()->setSelected(FALSE); 549 it.current()->setSelected(FALSE);
550 } //end currentSelected 550 } //end currentSelected
551 } 551 }
552 for ( ; it.current(); ++it ) { 552 for ( ; it.current(); ++it ) {
553 Local_View->clearSelection(); 553 Local_View->clearSelection();
554 } 554 }
555 Local_View->clearFocus(); 555 Local_View->clearFocus();
556 TabWidget->setCurrentPage(1); 556 TabWidget->setCurrentPage(1);
557 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 557 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
558// QCopEnvelope ( "QPE/System", "notBusy()" ); 558// QCopEnvelope ( "QPE/System", "notBusy()" );
559} 559}
560 560
561void OpieFtp::nullifyCallBack() 561void OpieFtp::nullifyCallBack()
562{ 562{
563 FtpOptions(FTPLIB_CALLBACK, 0, conn); 563 FtpOptions(FTPLIB_CALLBACK, 0, conn);
564 FtpOptions(FTPLIB_IDLETIME, 0, conn); 564 FtpOptions(FTPLIB_IDLETIME, 0, conn);
565 FtpOptions(FTPLIB_CALLBACKARG, 0, conn); 565 FtpOptions(FTPLIB_CALLBACKARG, 0, conn);
566 FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn); 566 FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn);
567} 567}
568 568
569void OpieFtp::remoteDownload() 569void OpieFtp::remoteDownload()
570{ 570{
571// qApp->processEvents(); 571// qApp->processEvents();
572 int fsz; 572 int fsz;
573// QCopEnvelope ( "QPE/System", "busy()" ); 573// QCopEnvelope ( "QPE/System", "busy()" );
574 574
575 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 575 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
576 QListViewItemIterator it( Remote_View ); 576 QListViewItemIterator it( Remote_View );
577 for ( ; it.current(); ++it ) { 577 for ( ; it.current(); ++it ) {
578 if ( it.current()->isSelected() ) { 578 if ( it.current()->isSelected() ) {
579 QString strItem = it.current()->text(0); 579 QString strItem = it.current()->text(0);
580// strItem=strItem.right(strItem.length()-1); 580// strItem=strItem.right(strItem.length()-1);
581 QString localFile = currentDir.canonicalPath(); 581 QString localFile = currentDir.canonicalPath();
582 if(localFile.right(1).find("/",0,TRUE) == -1) 582 if(localFile.right(1).find("/",0,TRUE) == -1)
583 localFile += "/"; 583 localFile += "/";
584 localFile += strItem; 584 localFile += strItem;
585// QString localFile = currentDir.canonicalPath()+"/"+strItem; 585// QString localFile = currentDir.canonicalPath()+"/"+strItem;
586 QString remoteFile= currentRemoteDir+strItem; 586 QString remoteFile= currentRemoteDir+strItem;
587 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) 587 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
588 fsz = 0; 588 fsz = 0;
589 QString temp; 589 QString temp;
590 temp.sprintf( remoteFile+" "+" %dkb", fsz); 590 temp.sprintf( remoteFile+" "+" %dkb", fsz);
591 591
592 ProgressBar->setTotalSteps(fsz); 592 ProgressBar->setTotalSteps(fsz);
593 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 593 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
594 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 594 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
595 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 595 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
596 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 596 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
597 odebug << "Get: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; 597 odebug << "Get: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl;
598 598
599 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 599 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
600 QString msg; 600 QString msg;
601 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); 601 msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
602 msg.replace(QRegExp(":"),"\n"); 602 msg.replace(QRegExp(":"),"\n");
603 QMessageBox::message(tr("Note"),msg); 603 QMessageBox::message(tr("Note"),msg);
604 } 604 }
605 ProgressBar->reset(); 605 ProgressBar->reset();
606 nullifyCallBack(); 606 nullifyCallBack();
607 it.current()->setSelected(FALSE); 607 it.current()->setSelected(FALSE);
608 } 608 }
609 } 609 }
610 for ( ; it.current(); ++it ) { 610 for ( ; it.current(); ++it ) {
611 Remote_View->clearSelection(); 611 Remote_View->clearSelection();
612 } 612 }
613 Remote_View->setFocus(); 613 Remote_View->setFocus();
614 TabWidget->setCurrentPage(0); 614 TabWidget->setCurrentPage(0);
615 populateLocalView(); 615 populateLocalView();
616// QCopEnvelope ( "QPE/System", "notBusy()" ); 616// QCopEnvelope ( "QPE/System", "notBusy()" );
617} 617}
618 618
619bool OpieFtp::remoteDirList(const QString &dir) 619bool OpieFtp::remoteDirList(const QString &dir)
620{ 620{
621 QString tmp = QDir::homeDirPath(); 621 QString tmp = QDir::homeDirPath();
622 if(tmp.right(1) != "/") 622 if(tmp.right(1) != "/")
623 tmp+="/._temp"; 623 tmp+="/._temp";
624 else 624 else
625 tmp+="._temp"; 625 tmp+="._temp";
626// odebug << "Listing remote dir "+tmp << oendl; 626// odebug << "Listing remote dir "+tmp << oendl;
627// QCopEnvelope ( "QPE/System", "busy()" ); 627// QCopEnvelope ( "QPE/System", "busy()" );
628 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 628 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
629 QString msg; 629 QString msg;
630 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) );
631 msg.replace(QRegExp(":"),"\n"); 631 msg.replace(QRegExp(":"),"\n");
632 QMessageBox::message(tr("Note"),msg); 632 QMessageBox::message(tr("Note"),msg);
633 return false; 633 return false;
634 } 634 }
635 populateRemoteView() ; 635 populateRemoteView() ;
636// QCopEnvelope ( "QPE/System", "notBusy()" ); 636// QCopEnvelope ( "QPE/System", "notBusy()" );
637 return true; 637 return true;
638} 638}
639 639
640bool OpieFtp::remoteChDir(const QString &dir) 640bool OpieFtp::remoteChDir(const QString &dir)
641{ 641{
642// QCopEnvelope ( "QPE/System", "busy()" ); 642// QCopEnvelope ( "QPE/System", "busy()" );
643 if (!FtpChdir( dir.latin1(), conn )) { 643 if (!FtpChdir( dir.latin1(), conn )) {
644 QString msg; 644 QString msg;
645 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));
646 msg.replace(QRegExp(":"),"\n"); 646 msg.replace(QRegExp(":"),"\n");
647 QMessageBox::message(tr("Note"),msg); 647 QMessageBox::message(tr("Note"),msg);
648// odebug << msg << oendl; 648// odebug << msg << oendl;
649// QCopEnvelope ( "QPE/System", "notBusy()" ); 649// QCopEnvelope ( "QPE/System", "notBusy()" );
650 return FALSE; 650 return FALSE;
651 } 651 }
652// QCopEnvelope ( "QPE/System", "notBusy()" ); 652// QCopEnvelope ( "QPE/System", "notBusy()" );
653 return TRUE; 653 return TRUE;
654} 654}
655 655
656void OpieFtp::populateLocalView() 656void OpieFtp::populateLocalView()
657{ 657{
658 Local_View->clear(); 658 Local_View->clear();
659 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 659 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
660 currentDir.setMatchAllDirs(TRUE); 660 currentDir.setMatchAllDirs(TRUE);
661 currentDir.setNameFilter(filterStr); 661 currentDir.setNameFilter(filterStr);
662 QString fileL, fileS, fileDate; 662 QString fileL, fileS, fileDate;
663 bool isDir=FALSE; 663 bool isDir=FALSE;
664 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 664 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
665 QFileInfoListIterator it(*list); 665 QFileInfoListIterator it(*list);
666 QFileInfo *fi; 666 QFileInfo *fi;
667 while ( (fi=it.current()) ) { 667 while ( (fi=it.current()) ) {
668 if (fi->isSymLink() ){ 668 if (fi->isSymLink() ){
669 QString symLink=fi->readLink(); 669 QString symLink=fi->readLink();
670 odebug << "Symlink detected "+symLink << oendl; 670 odebug << "Symlink detected "+symLink << oendl;
671 QFileInfo sym( symLink); 671 QFileInfo sym( symLink);
672 fileS.sprintf( "%10i", sym.size() ); 672 fileS.sprintf( "%10i", sym.size() );
673 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 673 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
674 fileDate = sym.lastModified().toString(); 674 fileDate = sym.lastModified().toString();
675 } else { 675 } else {
676 odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl; 676 odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl;
677 fileS.sprintf( "%10i", fi->size() ); 677 fileS.sprintf( "%10i", fi->size() );
678 fileL.sprintf( "%s",fi->fileName().data() ); 678 fileL.sprintf( "%s",fi->fileName().data() );
679 fileDate= fi->lastModified().toString(); 679 fileDate= fi->lastModified().toString();
680 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 680 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
681 fileL+="/"; 681 fileL+="/";
682 isDir=TRUE; 682 isDir=TRUE;
683 odebug << fileL << oendl; 683 odebug << fileL << oendl;
684 } 684 }
685 } 685 }
686 if(fileL !="./" && fi->exists()) { 686 if(fileL !="./" && fi->exists()) {
687 item = new QListViewItem( Local_View,fileL, fileDate, fileS ); 687 item = new QListViewItem( Local_View,fileL, fileDate, fileS );
688 QPixmap pm; 688 QPixmap pm;
689 689
690 if(isDir || fileL.find("/",0,TRUE) != -1) { 690 if(isDir || fileL.find("/",0,TRUE) != -1) {
691 if( !QDir( fi->filePath() ).isReadable()) 691 if( !QDir( fi->filePath() ).isReadable())
692 pm = Resource::loadPixmap( "lockedfolder" ); 692 pm = Resource::loadPixmap( "lockedfolder" );
693 else 693 else
694 pm= Resource::loadPixmap( "folder" ); 694 pm= Resource::loadPixmap( "folder" );
695 item->setPixmap( 0,pm ); 695 item->setPixmap( 0,pm );
696 } else { 696 } else {
697 if( !fi->isReadable() ) 697 if( !fi->isReadable() )
698 pm = Resource::loadPixmap( "locked" ); 698 pm = Resource::loadPixmap( "locked" );
699 else { 699 else {
700 MimeType mt(fi->filePath()); 700 MimeType mt(fi->filePath());
701 pm=mt.pixmap(); //sets the correct pixmap for mimetype 701 pm=mt.pixmap(); //sets the correct pixmap for mimetype
702 if(pm.isNull()) 702 if(pm.isNull())
703 pm = unknownXpm; 703 pm = unknownXpm;
704 } 704 }
705 } 705 }
706 if( fileL.find("->",0,TRUE) != -1) { 706 if( fileL.find("->",0,TRUE) != -1) {
707 // overlay link image 707 // overlay link image
708 pm= Resource::loadPixmap( "folder" ); 708 pm= Resource::loadPixmap( "folder" );
709 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 709 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
710 QPainter painter( &pm ); 710 QPainter painter( &pm );
711 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 711 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
712 pm.setMask( pm.createHeuristicMask( FALSE ) ); 712 pm.setMask( pm.createHeuristicMask( FALSE ) );
713 } 713 }
714 item->setPixmap( 0,pm); 714 item->setPixmap( 0,pm);
715 } 715 }
716 isDir=FALSE; 716 isDir=FALSE;
717 ++it; 717 ++it;
718 } 718 }
719 Local_View->setSorting( 3,FALSE); 719 Local_View->setSorting( 3,FALSE);
720 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); 720 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
721 fillCombo( (const QString &)currentDir); 721 fillCombo( (const QString &)currentDir);
722} 722}
723 723
724bool OpieFtp::populateRemoteView( ) 724bool OpieFtp::populateRemoteView( )
725{ 725{
726// odebug << "populate remoteview" << oendl; 726// odebug << "populate remoteview" << oendl;
727 QString sfile=QDir::homeDirPath(); 727 QString sfile=QDir::homeDirPath();
728 if(sfile.right(1) != "/") 728 if(sfile.right(1) != "/")
729 sfile+="/._temp"; 729 sfile+="/._temp";
730 else 730 else
731 sfile+="._temp"; 731 sfile+="._temp";
732 QFile file( sfile); 732 QFile file( sfile);
733 Remote_View->clear(); 733 Remote_View->clear();
734 QString s, File_Name; 734 QString s, File_Name;
735 QListViewItem *itemDir=NULL, *itemFile=NULL; 735 QListViewItem *itemDir=NULL, *itemFile=NULL;
736 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); 736 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] ");
737 QString fileL, fileS, fileDate; 737 QString fileL, fileS, fileDate;
738 if ( file.open(IO_ReadOnly)) { 738 if ( file.open(IO_ReadOnly)) {
739 QTextStream t( &file ); // use a text stream 739 QTextStream t( &file ); // use a text stream
740 while ( !t.eof()) { 740 while ( !t.eof()) {
741 s = t.readLine(); 741 s = t.readLine();
742 742
743 if(s.find("total",0,TRUE) == 0) 743 if(s.find("total",0,TRUE) == 0)
744 continue; 744 continue;
745 745
746 int len, month = monthRe.match(s, 0, &len); 746 int len, month = monthRe.match(s, 0, &len);
747 fileDate = s.mid(month + 1, len - 2); // minus spaces 747 fileDate = s.mid(month + 1, len - 2); // minus spaces
748 fileL = s.right(s.length() - month - len); 748 fileL = s.right(s.length() - month - len);
749 if(s.left(1) == "d") 749 if(s.left(1) == "d")
750 fileL = fileL+"/"; 750 fileL = fileL+"/";
751 fileS = s.mid(month - 8, 8); // FIXME 751 fileS = s.mid(month - 8, 8); // FIXME
752 fileS = fileS.stripWhiteSpace(); 752 fileS = fileS.stripWhiteSpace();
753 753
754 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { 754 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
755 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); 755 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d");
756 item->setPixmap( 0, Resource::loadPixmap( "folder" )); 756 item->setPixmap( 0, Resource::loadPixmap( "folder" ));
757// if(itemDir) 757// if(itemDir)
758 item->moveItem(itemDir); 758 item->moveItem(itemDir);
759 itemDir=item; 759 itemDir=item;
760 } else { 760 } else {
761 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); 761 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f");
762 item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); 762 item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
763// if(itemFile) 763// if(itemFile)
764 item->moveItem(itemDir); 764 item->moveItem(itemDir);
765 item->moveItem(itemFile); 765 item->moveItem(itemFile);
766 itemFile=item; 766 itemFile=item;
767 } 767 }
768 } 768 }
769 QListViewItem * item1 = new QListViewItem( Remote_View, "../"); 769 QListViewItem * item1 = new QListViewItem( Remote_View, "../");
770 item1->setPixmap( 0, Resource::loadPixmap( "folder" )); 770 item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
771 file.close(); 771 file.close();
772 if( file.exists()) 772 if( file.exists())
773 file. remove(); 773 file. remove();
774 } else 774 } else
775 odebug << "temp file not opened successfully "+sfile << oendl; 775 odebug << "temp file not opened successfully "+sfile << oendl;
776 Remote_View->setSorting( 4,TRUE); 776 Remote_View->setSorting( 4,TRUE);
777 return true; 777 return true;
778} 778}
779 779
780void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 780void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
781{ 781{
782 if( selectedItem) { 782 if( selectedItem) {
783 // if(selectedItem!= NULL) { 783 // if(selectedItem!= NULL) {
784// QCopEnvelope ( "QPE/System", "busy()" ); 784// QCopEnvelope ( "QPE/System", "busy()" );
785 QString oldRemoteCurrentDir = currentRemoteDir; 785 QString oldRemoteCurrentDir = currentRemoteDir;
786 QString strItem=selectedItem->text(0); 786 QString strItem=selectedItem->text(0);
787 strItem=strItem.simplifyWhiteSpace(); 787 strItem=strItem.simplifyWhiteSpace();
788 if(strItem == "../") { // the user wants to go ^ 788 if(strItem == "../") { // the user wants to go ^
789 if( FtpCDUp( conn) == 0) { 789 if( FtpCDUp( conn) == 0) {
790 QString msg; 790 QString msg;
791 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 791 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
792 msg.replace(QRegExp(":"),"\n"); 792 msg.replace(QRegExp(":"),"\n");
793 QMessageBox::message(tr("Note"),msg); 793 QMessageBox::message(tr("Note"),msg);
794// odebug << msg << oendl; 794// odebug << msg << oendl;
795 } 795 }
796 char path[256]; 796 char path[256];
797 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 797 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
798 QString msg; 798 QString msg;
799 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 799 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
800 msg.replace(QRegExp(":"),"\n"); 800 msg.replace(QRegExp(":"),"\n");
801 QMessageBox::message(tr("Note"),msg); 801 QMessageBox::message(tr("Note"),msg);
802// odebug << msg << oendl; 802// odebug << msg << oendl;
803 } 803 }
804 currentRemoteDir=path; 804 currentRemoteDir=path;
805 } else { 805 } else {
806 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers 806 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
807 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); 807 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
808 strItem = strItem.stripWhiteSpace(); 808 strItem = strItem.stripWhiteSpace();
809 currentRemoteDir = strItem; 809 currentRemoteDir = strItem;
810 if( !remoteChDir( (const QString &)strItem)) { 810 if( !remoteChDir( (const QString &)strItem)) {
811 currentRemoteDir = oldRemoteCurrentDir; 811 currentRemoteDir = oldRemoteCurrentDir;
812 strItem=""; 812 strItem="";
813// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl; 813// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl;
814 } 814 }
815 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory 815 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
816 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { 816 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
817 currentRemoteDir = oldRemoteCurrentDir; 817 currentRemoteDir = oldRemoteCurrentDir;
818 strItem=""; 818 strItem="";
819// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl; 819// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl;
820 820
821 } else { 821 } else {
822 currentRemoteDir = currentRemoteDir+strItem; 822 currentRemoteDir = currentRemoteDir+strItem;
823 } 823 }
824 } else { 824 } else {
825// QCopEnvelope ( "QPE/System", "notBusy()" ); 825// QCopEnvelope ( "QPE/System", "notBusy()" );
826 return; 826 return;
827 } 827 }
828 } 828 }
829 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 829 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
830 if(currentRemoteDir.right(1) !="/") 830 if(currentRemoteDir.right(1) !="/")
831 currentRemoteDir +="/"; 831 currentRemoteDir +="/";
832 currentPathCombo->lineEdit()->setText( currentRemoteDir); 832 currentPathCombo->lineEdit()->setText( currentRemoteDir);
833 fillRemoteCombo( (const QString &)currentRemoteDir); 833 fillRemoteCombo( (const QString &)currentRemoteDir);
834// QCopEnvelope ( "QPE/System", "notBusy()" ); 834// QCopEnvelope ( "QPE/System", "notBusy()" );
835 Remote_View->ensureItemVisible(Remote_View->firstChild()); 835 Remote_View->ensureItemVisible(Remote_View->firstChild());
836 836
837 } 837 }
838} 838}
839 839
840void OpieFtp::localListClicked(QListViewItem *selectedItem) 840void OpieFtp::localListClicked(QListViewItem *selectedItem)
841{ 841{
842 if(selectedItem!= NULL) { 842 if(selectedItem!= NULL) {
843 843
844 QString strItem=selectedItem->text(0); 844 QString strItem=selectedItem->text(0);
845 QString strSize=selectedItem->text(1); 845 QString strSize=selectedItem->text(1);
846 strSize=strSize.stripWhiteSpace(); 846 strSize=strSize.stripWhiteSpace();
847 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 847 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
848 // is symlink 848 // is symlink
849 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 849 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
850 if(QDir(strItem2).exists() ) { 850 if(QDir(strItem2).exists() ) {
851 currentDir.cd(strItem2, TRUE); 851 currentDir.cd(strItem2, TRUE);
852 populateLocalView(); 852 populateLocalView();
853 } 853 }
854 } else { // not a symlink 854 } else { // not a symlink
855 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 855 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
856 856
857 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 857 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
858 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 858 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
859 currentDir.cd(strItem,FALSE); 859 currentDir.cd(strItem,FALSE);
860 populateLocalView(); 860 populateLocalView();
861 } else { 861 } else {
862 currentDir.cdUp(); 862 currentDir.cdUp();
863 populateLocalView(); 863 populateLocalView();
864 } 864 }
865 if(QDir(strItem).exists()){ 865 if(QDir(strItem).exists()){
866 currentDir.cd(strItem, TRUE); 866 currentDir.cd(strItem, TRUE);
867 populateLocalView(); 867 populateLocalView();
868 } 868 }
869 } else { 869 } else {
870 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 870 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
871 if( QFile::exists(strItem ) ) { 871 if( QFile::exists(strItem ) ) {
872 // odebug << "upload "+strItem << oendl; 872 // odebug << "upload "+strItem << oendl;
873 return; 873 return;
874 } 874 }
875 } //end not symlink 875 } //end not symlink
876 chdir(strItem.latin1()); 876 chdir(strItem.latin1());
877 } 877 }
878 Local_View->ensureItemVisible(Local_View->firstChild()); 878 Local_View->ensureItemVisible(Local_View->firstChild());
879 } 879 }
880} 880}
881 881
882void OpieFtp::doLocalCd() 882void OpieFtp::doLocalCd()
883{ 883{
884 localListClicked( Local_View->currentItem()); 884 localListClicked( Local_View->currentItem());
885} 885}
886 886
887void OpieFtp:: doRemoteCd() 887void OpieFtp:: doRemoteCd()
888{ 888{
889 remoteListClicked( Remote_View->currentItem()); 889 remoteListClicked( Remote_View->currentItem());
890 890
891} 891}
892 892
893void OpieFtp::showHidden() 893void OpieFtp::showHidden()
894{ 894{
895 if (!b) { 895 if (!b) {
896 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 896 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
897 localMenu->setItemChecked(localMenu->idAt(0),TRUE); 897 localMenu->setItemChecked(localMenu->idAt(0),TRUE);
898// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 898// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
899 b=TRUE; 899 b=TRUE;
900 900
901 } else { 901 } else {
902 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 902 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
903 localMenu->setItemChecked(localMenu->idAt(0),FALSE); 903 localMenu->setItemChecked(localMenu->idAt(0),FALSE);
904// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 904// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
905 b=FALSE; 905 b=FALSE;
906 } 906 }
907 populateLocalView(); 907 populateLocalView();
908} 908}
909 909
910void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &, int) 910void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &, int)
911{ 911{
912// if(item) 912// if(item)
913 if (mouse == 2) { 913 if (mouse == 2) {
914 showLocalMenu(item); 914 showLocalMenu(item);
915 } 915 }
916} 916}
917 917
918void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &, int ) 918void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &, int )
919{ 919{
920 if(mouse == 2) { 920 if(mouse == 2) {
921 showRemoteMenu(item); 921 showRemoteMenu(item);
922 } 922 }
923} 923}
924 924
925void OpieFtp::showRemoteMenu(QListViewItem * item) 925void OpieFtp::showRemoteMenu(QListViewItem * item)
926{ 926{
927 QPopupMenu * m;// = new QPopupMenu( Local_View ); 927 QPopupMenu * m;// = new QPopupMenu( Local_View );
928 m = new QPopupMenu(this); 928 m = new QPopupMenu(this);
929 if(item != NULL ) { 929 if(item != NULL ) {
930 if( item->text(0).find("/",0,TRUE) != -1) 930 if( item->text(0).find("/",0,TRUE) != -1)
931 m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 931 m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
932 else 932 else
933 m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 933 m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
934 } 934 }
935 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 935 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
936 m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() )); 936 m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() ));
937 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 937 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
938 m->insertSeparator(); 938 m->insertSeparator();
939 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 939 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
940 m->exec( QCursor::pos() ); 940 m->exec( QCursor::pos() );
941 delete m; 941 delete m;
942} 942}
943 943
944void OpieFtp::showLocalMenu(QListViewItem * item) 944void OpieFtp::showLocalMenu(QListViewItem * item)
945{ 945{
946 946
947 QPopupMenu *m; 947 QPopupMenu *m;
948 m = new QPopupMenu( this); 948 m = new QPopupMenu( this);
949 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 949 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
950 m->insertSeparator(); 950 m->insertSeparator();
951 if(item != NULL ) { 951 if(item != NULL ) {
952 if( item->text(0).find("/",0,TRUE) !=-1) 952 if( item->text(0).find("/",0,TRUE) !=-1)
953 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 953 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
954 else 954 else
955 m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 955 m->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
956 } 956 }
957 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 957 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
958 m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() )); 958 m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() ));
959 m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 959 m->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
960 m->insertSeparator(); 960 m->insertSeparator();
961 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 961 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
962 m->setCheckable(TRUE); 962 m->setCheckable(TRUE);
963 if (b) 963 if (b)
964 m->setItemChecked(m->idAt(0),TRUE); 964 m->setItemChecked(m->idAt(0),TRUE);
965 else 965 else
966 m->setItemChecked(m->idAt(0),FALSE); 966 m->setItemChecked(m->idAt(0),FALSE);
967 967
968 m->exec( QCursor::pos() ); 968 m->exec( QCursor::pos() );
969 delete m; 969 delete m;
970} 970}
971 971
972void OpieFtp::localMakDir() 972void OpieFtp::localMakDir()
973{ 973{
974 InputDialog *fileDlg; 974 InputDialog *fileDlg;
975 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 975 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
976 fileDlg->exec(); 976 fileDlg->exec();
977 if( fileDlg->result() == 1 ) { 977 if( fileDlg->result() == 1 ) {
978 QString filename = fileDlg->LineEdit1->text(); 978 QString filename = fileDlg->LineEdit1->text();
979 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 979 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
980 } 980 }
981 populateLocalView(); 981 populateLocalView();
982} 982}
983 983
984void OpieFtp::localDelete() 984void OpieFtp::localDelete()
985{ 985{
986 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 986 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
987 QListViewItemIterator it( Local_View ); 987 QListViewItemIterator it( Local_View );
988 for ( ; it.current(); ++it ) { 988 for ( ; it.current(); ++it ) {
989 if ( it.current()->isSelected() ) { 989 if ( it.current()->isSelected() ) {
990 QString f = it.current()->text(0); 990 QString f = it.current()->text(0);
991 it.current()->setSelected(FALSE); 991 it.current()->setSelected(FALSE);
992 992
993// QString f = Local_View->currentItem()->text(0); 993// QString f = Local_View->currentItem()->text(0);
994 if(QDir(f).exists() ) { 994 if(QDir(f).exists() ) {
995 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 995 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
996 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { 996 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
997 case 0: { 997 case 0: {
998 f=currentDir.canonicalPath()+"/"+f; 998 f=currentDir.canonicalPath()+"/"+f;
999 QString cmd="rmdir "+f; 999 QString cmd="rmdir "+f;
1000 system( cmd.latin1()); 1000 system( cmd.latin1());
1001 } 1001 }
1002 break; 1002 break;
1003 case 1: 1003 case 1:
1004 // exit 1004 // exit
1005 break; 1005 break;
1006 }; 1006 };
1007 1007
1008 } else { 1008 } else {
1009 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 1009 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
1010 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 1010 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
1011 case 0: { 1011 case 0: {
1012 f=currentDir.canonicalPath()+"/"+f; 1012 f=currentDir.canonicalPath()+"/"+f;
1013 QString cmd="rm "+f; 1013 QString cmd="rm "+f;
1014 system( cmd.latin1()); 1014 system( cmd.latin1());
1015 } 1015 }
1016 break; 1016 break;
1017 case 1: 1017 case 1:
1018 // exit 1018 // exit
1019 break; 1019 break;
1020 }; 1020 };
1021 } 1021 }
1022 } 1022 }
1023 } 1023 }
1024 populateLocalView(); 1024 populateLocalView();
1025 1025
1026} 1026}
1027 1027
1028void OpieFtp::remoteMakDir() 1028void OpieFtp::remoteMakDir()
1029{ 1029{
1030 InputDialog *fileDlg; 1030 InputDialog *fileDlg;
1031 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 1031 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
1032 fileDlg->exec(); 1032 fileDlg->exec();
1033 if( fileDlg->result() == 1 ) { 1033 if( fileDlg->result() == 1 ) {
1034 QString filename = fileDlg->LineEdit1->text();//+".playlist"; 1034 QString filename = fileDlg->LineEdit1->text();//+".playlist";
1035 QString tmp=currentRemoteDir+filename; 1035 QString tmp=currentRemoteDir+filename;
1036// QCopEnvelope ( "QPE/System", "busy()" ); 1036// QCopEnvelope ( "QPE/System", "busy()" );
1037 if(FtpMkdir( tmp.latin1(), conn) == 0) { 1037 if(FtpMkdir( tmp.latin1(), conn) == 0) {
1038 QString msg; 1038 QString msg;
1039 msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); 1039 msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn));
1040 msg.replace(QRegExp(":"),"\n"); 1040 msg.replace(QRegExp(":"),"\n");
1041 QMessageBox::message(tr("Note"),msg); 1041 QMessageBox::message(tr("Note"),msg);