-rw-r--r-- | noncore/apps/advancedfm/Makefile | 214 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 41 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/output.cpp | 148 | ||||
-rw-r--r-- | noncore/apps/advancedfm/output.h | 2 |
5 files changed, 338 insertions, 68 deletions
diff --git a/noncore/apps/advancedfm/Makefile b/noncore/apps/advancedfm/Makefile index 4622c6e..8799b03 100644 --- a/noncore/apps/advancedfm/Makefile +++ b/noncore/apps/advancedfm/Makefile | |||
@@ -1,159 +1,277 @@ | |||
1 | ############################################################################# | 1 | ############################################################################# |
2 | # Makefile for building $(OPIEDIR)/bin/advancedfm | 2 | # Automatically generated from noncore/advancedfm/Makefile.in |
3 | # Generated by tmake at 18:31, 2002/04/15 | 3 | # Build options from |
4 | # Project: advancedfm | ||
5 | # Template: app | ||
6 | ############################################################################# | 4 | ############################################################################# |
7 | 5 | ||
8 | ####### Compiler, tools and options | 6 | # Compiling |
7 | INTERFACE_DECL_PATH = . | ||
8 | SYSCONF_CXX = g++ | ||
9 | SYSCONF_CC = gcc | ||
10 | DASHCROSS = | ||
11 | |||
12 | # Compiling with support libraries | ||
13 | SYSCONF_CXXFLAGS_X11= | ||
14 | SYSCONF_CXXFLAGS_QT= -I$(QTDIR)/include | ||
15 | SYSCONF_CXXFLAGS_OPENGL= -I/usr/X11R6/include | ||
16 | |||
17 | # Compiling YACC output | ||
18 | SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses | ||
19 | |||
20 | # Linking with support libraries | ||
21 | SYSCONF_RPATH_X11= | ||
22 | SYSCONF_RPATH_QT= -Wl,-rpath,$(QTDIR)/lib | ||
23 | SYSCONF_RPATH_OPENGL= -Wl,-rpath,/usr/X11R6/lib | ||
24 | |||
25 | # Linking with support libraries | ||
26 | # X11 | ||
27 | SYSCONF_LFLAGS_X11= | ||
28 | SYSCONF_LIBS_X11= | ||
29 | # Qt, Qt+OpenGL | ||
30 | SYSCONF_LFLAGS_QT= -L$(QTDIR)/lib | ||
31 | SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX) | ||
32 | SYSCONF_LIBS_QT_OPENGL= | ||
33 | # OpenGL | ||
34 | SYSCONF_LFLAGS_OPENGL= -L/usr/X11R6/lib | ||
35 | SYSCONF_LIBS_OPENGL= | ||
36 | # Yacc | ||
37 | SYSCONF_LIBS_YACC= | ||
38 | |||
39 | # Linking applications | ||
40 | SYSCONF_LINK = gcc | ||
41 | SYSCONF_LFLAGS = | ||
42 | SYSCONF_LIBS = | ||
43 | |||
44 | # Link flags for shared objects | ||
45 | SYSCONF_LFLAGS_SHOBJ= -shared | ||
46 | |||
47 | # Flags for threading | ||
48 | SYSCONF_CFLAGS_THREAD= -D_REENTRANT | ||
49 | SYSCONF_CXXFLAGS_THREAD= -D_REENTRANT | ||
50 | SYSCONF_LFLAGS_THREAD= | ||
51 | SYSCONF_LIBS_THREAD= -lpthread | ||
52 | |||
53 | # Meta-object compiler | ||
54 | SYSCONF_MOC = $(QTDIR)/bin/moc | ||
55 | |||
56 | # UI compiler | ||
57 | SYSCONF_UIC = $(QTDIR)/bin/uic | ||
58 | |||
59 | # Linking shared libraries | ||
60 | # - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2 | ||
61 | # - Place target in $(DESTDIR) - which has a trailing / | ||
62 | # - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH) | ||
63 | # | ||
64 | SYSCONF_LINK_SHLIB= gcc | ||
65 | SYSCONF_LINK_TARGET_SHARED= lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH) | ||
66 | SYSCONF_LINK_LIB_SHARED= $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \ | ||
67 | $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \ | ||
68 | $(OBJECTS) $(OBJMOC) $(LIBS) && \ | ||
69 | mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \ | ||
70 | cd $(DESTDIR) && \ | ||
71 | rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \ | ||
72 | ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \ | ||
73 | ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \ | ||
74 | ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN) | ||
75 | |||
76 | # Linking static libraries | ||
77 | # - Build the $(TARGET) library, eg. lib$(TARGET).a | ||
78 | # - Place target in $(DESTDIR) - which has a trailing / | ||
79 | # | ||
80 | SYSCONF_AR = ar cqs | ||
81 | SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a | ||
82 | SYSCONF_LINK_LIB_STATIC= rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \ | ||
83 | $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC) | ||
84 | # Compiling application source | ||
85 | SYSCONF_CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W | ||
86 | SYSCONF_CFLAGS = -pipe -O2 -Wall -W | ||
87 | # Default link type (static linking is still be used where required) | ||
88 | SYSCONF_LINK_LIB= $(SYSCONF_LINK_LIB_SHARED) | ||
89 | SYSCONF_LINK_TARGET= $(SYSCONF_LINK_TARGET_SHARED) | ||
90 | # Compiling library source | ||
91 | SYSCONF_CXXFLAGS_LIB= -fPIC | ||
92 | SYSCONF_CFLAGS_LIB= -fPIC | ||
93 | # Compiling shared-object source | ||
94 | SYSCONF_CXXFLAGS_SHOBJ= -fPIC | ||
95 | SYSCONF_CFLAGS_SHOBJ= -fPIC | ||
96 | # Linking Qt | ||
97 | SYSCONF_LIBS_QTLIB= $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) | ||
98 | # Linking Qt applications | ||
99 | SYSCONF_LIBS_QTAPP= | ||
100 | ############################################################################# | ||
9 | 101 | ||
10 | CC =gcc | 102 | ####### Compiler, tools and options |
11 | CXX =g++ | ||
12 | CFLAGS =-pipe -Wall -W -O2 -fno-default-inline -DNO_DEBUG | ||
13 | CXXFLAGS=-pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fno-default-inline -DNO_DEBUG | ||
14 | INCPATH =-I$(OPIEDIR)/include -I$(QTDIR)/include | ||
15 | LINK =g++ | ||
16 | LFLAGS = | ||
17 | LIBS =$(SUBLIBS) -L$(QTDIR)/lib -lqpe -lqte | ||
18 | MOC =$(QTDIR)/bin/moc | ||
19 | UIC =$(QTDIR)/bin/uic | ||
20 | 103 | ||
21 | TAR =tar -cf | 104 | CXX =$(SYSCONF_CXX) $(QT_CXX_MT) |
22 | GZIP =gzip -9f | 105 | CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) |
106 | CC =$(SYSCONF_CC) $(QT_C_MT) | ||
107 | CFLAGS =$(SYSCONF_CFLAGS) | ||
108 | INCPATH =-I$(OPIEDIR)/include | ||
109 | LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) | ||
110 | LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) | ||
111 | MOC =$(SYSCONF_MOC) | ||
112 | UIC =$(SYSCONF_UIC) | ||
113 | |||
114 | ####### Target | ||
115 | |||
116 | DESTDIR = $(OPIEDIR)/bin/ | ||
117 | VER_MAJ = 1 | ||
118 | VER_MIN = 0 | ||
119 | VER_PATCH = 0 | ||
120 | TARGET= advancedfm | ||
121 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) | ||
23 | 122 | ||
24 | ####### Files | 123 | ####### Files |
25 | 124 | ||
26 | HEADERS =advancedfm.h \ | 125 | HEADERS =advancedfm.h \ |
27 | inputDialog.h \ | 126 | inputDialog.h \ |
28 | filePermissions.h \ | 127 | filePermissions.h \ |
29 | output.h | 128 | output.h |
30 | SOURCES =advancedfm.cpp \ | 129 | SOURCES =advancedfm.cpp \ |
31 | inputDialog.cpp \ | 130 | inputDialog.cpp \ |
32 | filePermissions.cpp \ | 131 | filePermissions.cpp \ |
33 | output.cpp \ | 132 | output.cpp \ |
34 | main.cpp | 133 | main.cpp |
35 | OBJECTS =advancedfm.o \ | 134 | OBJECTS =advancedfm.o \ |
36 | inputDialog.o \ | 135 | inputDialog.o \ |
37 | filePermissions.o \ | 136 | filePermissions.o \ |
38 | output.o \ | 137 | output.o \ |
39 | main.o | 138 | main.o |
40 | INTERFACES = | 139 | INTERFACES = |
41 | UICDECLS = | 140 | UICDECLS = |
42 | UICIMPLS = | 141 | UICIMPLS = |
43 | SRCMOC =moc_advancedfm.cpp \ | 142 | SRCMOC =moc_advancedfm.cpp \ |
44 | moc_inputDialog.cpp \ | 143 | moc_inputDialog.cpp \ |
45 | moc_filePermissions.cpp \ | 144 | moc_filePermissions.cpp \ |
46 | moc_output.cpp | 145 | moc_output.cpp |
47 | OBJMOC =moc_advancedfm.o \ | 146 | OBJMOC =moc_advancedfm.o \ |
48 | moc_inputDialog.o \ | 147 | moc_inputDialog.o \ |
49 | moc_filePermissions.o \ | 148 | moc_filePermissions.o \ |
50 | moc_output.o | 149 | moc_output.o |
51 | DIST = | 150 | |
52 | TARGET =$(OPIEDIR)/bin/advancedfm | ||
53 | INTERFACE_DECL_PATH = . | ||
54 | 151 | ||
55 | ####### Implicit rules | 152 | ####### Implicit rules |
56 | 153 | ||
57 | .SUFFIXES: .cpp .cxx .cc .C .c | 154 | .SUFFIXES: .cpp .cxx .cc .C .c |
58 | 155 | ||
59 | .cpp.o: | 156 | .cpp.o: |
60 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 157 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
61 | 158 | ||
62 | .cxx.o: | 159 | .cxx.o: |
63 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 160 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
64 | 161 | ||
65 | .cc.o: | 162 | .cc.o: |
66 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 163 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
67 | 164 | ||
68 | .C.o: | 165 | .C.o: |
69 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | 166 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< |
70 | 167 | ||
71 | .c.o: | 168 | .c.o: |
72 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | 169 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< |
73 | 170 | ||
74 | ####### Build rules | 171 | ####### Build rules |
75 | 172 | ||
76 | 173 | ||
77 | all: $(TARGET) | 174 | all: $(DESTDIR)$(TARGET) |
78 | 175 | ||
79 | $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) | 176 | $(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) |
80 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | 177 | $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) |
81 | 178 | ||
82 | moc: $(SRCMOC) | 179 | moc: $(SRCMOC) |
83 | 180 | ||
84 | tmake: Makefile | 181 | tmake: |
85 | 182 | tmake advancedfm.pro | |
86 | Makefile: advancedfm.pro | ||
87 | tmake advancedfm.pro -o Makefile | ||
88 | |||
89 | dist: | ||
90 | $(TAR) advancedfm.tar advancedfm.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) | ||
91 | $(GZIP) advancedfm.tar | ||
92 | 183 | ||
93 | clean: | 184 | clean: |
94 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) | 185 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) |
95 | -rm -f *~ core | 186 | -rm -f *~ core |
187 | -rm -f allmoc.cpp | ||
188 | |||
189 | ####### Extension Modules | ||
190 | |||
191 | listpromodules: | ||
192 | @echo | ||
193 | |||
194 | listallmodules: | ||
195 | @echo | ||
196 | |||
197 | listaddonpromodules: | ||
198 | @echo | ||
199 | |||
200 | listaddonentmodules: | ||
201 | @echo | ||
202 | |||
203 | |||
204 | REQUIRES=medium-config | ||
96 | 205 | ||
97 | ####### Sub-libraries | 206 | ####### Sub-libraries |
98 | 207 | ||
99 | 208 | ||
100 | ###### Combined headers | 209 | ###### Combined headers |
101 | 210 | ||
102 | 211 | ||
212 | |||
103 | ####### Compile | 213 | ####### Compile |
104 | 214 | ||
105 | advancedfm.o: advancedfm.cpp \ | 215 | advancedfm.o: advancedfm.cpp \ |
106 | advancedfm.h \ | 216 | advancedfm.h \ |
107 | inputDialog.h \ | 217 | inputDialog.h \ |
108 | filePermissions.h \ | 218 | filePermissions.h \ |
109 | output.h \ | 219 | output.h \ |
110 | /usr/src/oldsrc/Opie/opie/include/qpe/lnkproperties.h \ | 220 | $(OPIEDIR)/include/qpe/lnkproperties.h \ |
111 | /usr/src/oldsrc/Opie/opie/include/qpe/filemanager.h \ | 221 | $(OPIEDIR)/include/qpe/filemanager.h \ |
112 | /usr/src/oldsrc/Opie/opie/include/qpe/qcopenvelope_qws.h \ | 222 | $(OPIEDIR)/include/qpe/qcopenvelope_qws.h \ |
113 | /usr/src/oldsrc/Opie/opie/include/qpe/qpemenubar.h \ | 223 | $(OPIEDIR)/include/qpe/qpemenubar.h \ |
114 | /usr/src/oldsrc/Opie/opie/include/qpe/qpetoolbar.h \ | 224 | $(OPIEDIR)/include/qpe/qpetoolbar.h \ |
115 | /usr/src/oldsrc/Opie/opie/include/qpe/qpeapplication.h \ | 225 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
116 | /usr/src/oldsrc/Opie/opie/include/qpe/resource.h \ | 226 | $(OPIEDIR)/include/qpe/resource.h \ |
117 | /usr/src/oldsrc/Opie/opie/include/qpe/config.h \ | 227 | $(OPIEDIR)/include/qpe/config.h \ |
118 | /usr/src/oldsrc/Opie/opie/include/qpe/mimetype.h \ | 228 | $(OPIEDIR)/include/qpe/mimetype.h \ |
119 | /usr/src/oldsrc/Opie/opie/include/qpe/applnk.h | 229 | $(OPIEDIR)/include/qpe/applnk.h |
120 | 230 | ||
121 | inputDialog.o: inputDialog.cpp \ | 231 | inputDialog.o: inputDialog.cpp \ |
122 | inputDialog.h | 232 | inputDialog.h |
123 | 233 | ||
124 | filePermissions.o: filePermissions.cpp \ | 234 | filePermissions.o: filePermissions.cpp \ |
125 | filePermissions.h | 235 | filePermissions.h |
126 | 236 | ||
127 | output.o: output.cpp \ | 237 | output.o: output.cpp \ |
128 | output.h | 238 | output.h |
129 | 239 | ||
130 | main.o: main.cpp \ | 240 | main.o: main.cpp \ |
131 | /usr/src/oldsrc/Opie/opie/include/qpe/qpeapplication.h \ | 241 | $(OPIEDIR)/include/qpe/qpeapplication.h \ |
132 | /usr/src/oldsrc/Opie/opie/include/qpe/qcopenvelope_qws.h \ | 242 | $(OPIEDIR)/include/qpe/qcopenvelope_qws.h \ |
133 | /usr/src/oldsrc/Opie/opie/include/qpe/config.h \ | 243 | $(OPIEDIR)/include/qpe/config.h \ |
134 | advancedfm.h | 244 | advancedfm.h |
135 | 245 | ||
136 | moc_advancedfm.o: moc_advancedfm.cpp \ | 246 | moc_advancedfm.o: moc_advancedfm.cpp \ |
137 | advancedfm.h | 247 | advancedfm.h |
138 | 248 | ||
139 | moc_inputDialog.o: moc_inputDialog.cpp \ | 249 | moc_inputDialog.o: moc_inputDialog.cpp \ |
140 | inputDialog.h | 250 | inputDialog.h |
141 | 251 | ||
142 | moc_filePermissions.o: moc_filePermissions.cpp \ | 252 | moc_filePermissions.o: moc_filePermissions.cpp \ |
143 | filePermissions.h | 253 | filePermissions.h |
144 | 254 | ||
145 | moc_output.o: moc_output.cpp \ | 255 | moc_output.o: moc_output.cpp \ |
146 | output.h | 256 | output.h |
147 | 257 | ||
148 | moc_advancedfm.cpp: advancedfm.h | 258 | moc_advancedfm.cpp: advancedfm.h |
149 | $(MOC) advancedfm.h -o moc_advancedfm.cpp | 259 | $(MOC) advancedfm.h -o moc_advancedfm.cpp |
150 | 260 | ||
151 | moc_inputDialog.cpp: inputDialog.h | 261 | moc_inputDialog.cpp: inputDialog.h |
152 | $(MOC) inputDialog.h -o moc_inputDialog.cpp | 262 | $(MOC) inputDialog.h -o moc_inputDialog.cpp |
153 | 263 | ||
154 | moc_filePermissions.cpp: filePermissions.h | 264 | moc_filePermissions.cpp: filePermissions.h |
155 | $(MOC) filePermissions.h -o moc_filePermissions.cpp | 265 | $(MOC) filePermissions.h -o moc_filePermissions.cpp |
156 | 266 | ||
157 | moc_output.cpp: output.h | 267 | moc_output.cpp: output.h |
158 | $(MOC) output.h -o moc_output.cpp | 268 | $(MOC) output.h -o moc_output.cpp |
159 | 269 | ||
270 | |||
271 | |||
272 | lupdate: | ||
273 | lupdate advancedfm.pro | ||
274 | |||
275 | lrelease: | ||
276 | lrelease advancedfm.pro | ||
277 | |||
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index a4ec714..8a1eeec 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -1,652 +1,654 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | AdvancedFm.cpp | 2 | AdvancedFm.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 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties | 13 | #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties |
14 | 14 | ||
15 | #include "advancedfm.h" | 15 | #include "advancedfm.h" |
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | #include "filePermissions.h" | 17 | #include "filePermissions.h" |
18 | #include "output.h" | 18 | #include "output.h" |
19 | 19 | ||
20 | #include <qpe/lnkproperties.h> | 20 | #include <qpe/lnkproperties.h> |
21 | #include <qpe/filemanager.h> | 21 | #include <qpe/filemanager.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpemenubar.h> | 23 | #include <qpe/qpemenubar.h> |
24 | #include <qpe/qpetoolbar.h> | 24 | #include <qpe/qpetoolbar.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | #include <qpe/mimetype.h> | 29 | #include <qpe/mimetype.h> |
30 | #include <qpe/applnk.h> | 30 | #include <qpe/applnk.h> |
31 | 31 | ||
32 | //#include <opie/ofileselector.h> | 32 | //#include <opie/ofileselector.h> |
33 | #include <qmultilineedit.h> | 33 | #include <qmultilineedit.h> |
34 | 34 | ||
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
37 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
43 | #include <qpopupmenu.h> | 43 | #include <qpopupmenu.h> |
44 | #include <qlistview.h> | 44 | #include <qlistview.h> |
45 | #include <qmainwindow.h> | 45 | #include <qmainwindow.h> |
46 | #include <qlabel.h> | 46 | #include <qlabel.h> |
47 | #include <qprogressbar.h> | 47 | #include <qprogressbar.h> |
48 | #include <qspinbox.h> | 48 | #include <qspinbox.h> |
49 | #include <qtabwidget.h> | 49 | #include <qtabwidget.h> |
50 | #include <qwidget.h> | 50 | #include <qwidget.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qimage.h> | 52 | #include <qimage.h> |
53 | #include <qpixmap.h> | 53 | #include <qpixmap.h> |
54 | #include <qmessagebox.h> | 54 | #include <qmessagebox.h> |
55 | #include <qlineedit.h> | 55 | #include <qlineedit.h> |
56 | #include <qregexp.h> | 56 | #include <qregexp.h> |
57 | 57 | ||
58 | #include <unistd.h> | 58 | #include <unistd.h> |
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | #include <sys/stat.h> | 60 | #include <sys/stat.h> |
61 | #include <dirent.h> | 61 | #include <dirent.h> |
62 | #include <stdio.h> | 62 | #include <stdio.h> |
63 | #include <time.h> | 63 | #include <time.h> |
64 | #include <fcntl.h> | 64 | #include <fcntl.h> |
65 | 65 | ||
66 | AdvancedFm::AdvancedFm( ) | 66 | AdvancedFm::AdvancedFm( ) |
67 | : QMainWindow( ) | 67 | : QMainWindow( ) |
68 | { | 68 | { |
69 | setCaption( tr( "AdvancedFm" ) ); | 69 | setCaption( tr( "AdvancedFm" ) ); |
70 | 70 | ||
71 | QGridLayout *layout = new QGridLayout( this ); | 71 | QGridLayout *layout = new QGridLayout( this ); |
72 | layout->setSpacing( 2); | 72 | layout->setSpacing( 2); |
73 | layout->setMargin( 2); | 73 | layout->setMargin( 2); |
74 | 74 | ||
75 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 75 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
76 | 76 | ||
77 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 77 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
78 | // fileMenu = new QPopupMenu( this ); | 78 | // fileMenu = new QPopupMenu( this ); |
79 | fileMenu = new QPopupMenu( this ); | 79 | fileMenu = new QPopupMenu( this ); |
80 | viewMenu = new QPopupMenu( this ); | 80 | viewMenu = new QPopupMenu( this ); |
81 | 81 | ||
82 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 82 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
83 | 83 | ||
84 | menuBar->insertItem( tr( "File" ), fileMenu); | 84 | menuBar->insertItem( tr( "File" ), fileMenu); |
85 | menuBar->insertItem( tr( "View" ), viewMenu); | 85 | menuBar->insertItem( tr( "View" ), viewMenu); |
86 | 86 | ||
87 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); | 87 | cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); |
88 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 88 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
89 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 89 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
90 | cfButton->setFlat(TRUE); | 90 | cfButton->setFlat(TRUE); |
91 | layout->addMultiCellWidget( cfButton , 0, 0, 2, 2); | 91 | layout->addMultiCellWidget( cfButton , 0, 0, 2, 2); |
92 | 92 | ||
93 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); | 93 | sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); |
94 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 94 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
95 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 95 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
96 | sdButton->setFlat(TRUE); | 96 | sdButton->setFlat(TRUE); |
97 | layout->addMultiCellWidget( sdButton , 0, 0, 3, 3); | 97 | layout->addMultiCellWidget( sdButton , 0, 0, 3, 3); |
98 | 98 | ||
99 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); | 99 | cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); |
100 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | 100 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); |
101 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 101 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
102 | cdUpButton ->setFlat(TRUE); | 102 | cdUpButton ->setFlat(TRUE); |
103 | layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4); | 103 | layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4); |
104 | 104 | ||
105 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 105 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
106 | docButton->setFixedSize( QSize( 20, 20 ) ); | 106 | docButton->setFixedSize( QSize( 20, 20 ) ); |
107 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 107 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
108 | docButton->setFlat(TRUE); | 108 | docButton->setFlat(TRUE); |
109 | layout->addMultiCellWidget( docButton, 0, 0, 5, 5); | 109 | layout->addMultiCellWidget( docButton, 0, 0, 5, 5); |
110 | 110 | ||
111 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 111 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); |
112 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 112 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
113 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 113 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
114 | homeButton->setFlat(TRUE); | 114 | homeButton->setFlat(TRUE); |
115 | layout->addMultiCellWidget( homeButton, 0, 0, 6, 6); | 115 | layout->addMultiCellWidget( homeButton, 0, 0, 6, 6); |
116 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 116 | // fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
117 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 117 | // fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
118 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 118 | // fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
119 | 119 | ||
120 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 120 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
121 | fileMenu->insertSeparator(); | 121 | fileMenu->insertSeparator(); |
122 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 122 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
123 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 123 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
124 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 124 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
125 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 125 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
126 | fileMenu->insertSeparator(); | 126 | fileMenu->insertSeparator(); |
127 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 127 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
128 | fileMenu->setCheckable(TRUE); | 128 | fileMenu->setCheckable(TRUE); |
129 | 129 | ||
130 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 130 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
131 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 131 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
132 | viewMenu->insertSeparator(); | ||
133 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | ||
132 | viewMenu->setCheckable(TRUE); | 134 | viewMenu->setCheckable(TRUE); |
133 | 135 | ||
134 | TabWidget = new QTabWidget( this, "TabWidget" ); | 136 | TabWidget = new QTabWidget( this, "TabWidget" ); |
135 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6); | 137 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6); |
136 | 138 | ||
137 | tab = new QWidget( TabWidget, "tab" ); | 139 | tab = new QWidget( TabWidget, "tab" ); |
138 | tabLayout = new QGridLayout( tab ); | 140 | tabLayout = new QGridLayout( tab ); |
139 | tabLayout->setSpacing( 2); | 141 | tabLayout->setSpacing( 2); |
140 | tabLayout->setMargin( 2); | 142 | tabLayout->setMargin( 2); |
141 | 143 | ||
142 | Local_View = new QListView( tab, "Local_View" ); | 144 | Local_View = new QListView( tab, "Local_View" ); |
143 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 145 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
144 | Local_View->addColumn( tr("File"),140); | 146 | Local_View->addColumn( tr("File"),140); |
145 | Local_View->addColumn( tr("Size"),-1); | ||
146 | Local_View->setColumnAlignment(1,QListView::AlignRight); | ||
147 | Local_View->addColumn( tr("Date"),-1); | 147 | Local_View->addColumn( tr("Date"),-1); |
148 | Local_View->setColumnAlignment(1,QListView::AlignRight); | ||
149 | Local_View->addColumn( tr("Size"),-1); | ||
148 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 150 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
149 | Local_View->setAllColumnsShowFocus(TRUE); | 151 | Local_View->setAllColumnsShowFocus(TRUE); |
150 | // Local_View->setMultiSelection( TRUE ); | 152 | // Local_View->setMultiSelection( TRUE ); |
151 | // Local_View->setSelectionMode(QListView::Extended); | 153 | // Local_View->setSelectionMode(QListView::Extended); |
152 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 154 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
153 | 155 | ||
154 | tabLayout->addWidget( Local_View, 0, 0 ); | 156 | tabLayout->addWidget( Local_View, 0, 0 ); |
155 | 157 | ||
156 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 158 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
157 | this,SLOT( localListClicked(QListViewItem *)) ); | 159 | this,SLOT( localListClicked(QListViewItem *)) ); |
158 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 160 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
159 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 161 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
160 | 162 | ||
161 | TabWidget->insertTab( tab, tr("1")); | 163 | TabWidget->insertTab( tab, tr("1")); |
162 | 164 | ||
163 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 165 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
164 | tabLayout_2 = new QGridLayout( tab_2 ); | 166 | tabLayout_2 = new QGridLayout( tab_2 ); |
165 | tabLayout_2->setSpacing( 2); | 167 | tabLayout_2->setSpacing( 2); |
166 | tabLayout_2->setMargin( 2); | 168 | tabLayout_2->setMargin( 2); |
167 | 169 | ||
168 | Remote_View = new QListView( tab_2, "Remote_View" ); | 170 | Remote_View = new QListView( tab_2, "Remote_View" ); |
169 | Remote_View->addColumn( tr("File"),140); | 171 | Remote_View->addColumn( tr("File"),140); |
170 | Remote_View->addColumn( tr("Size"),-1); | ||
171 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | ||
172 | Remote_View->addColumn( tr("Date"),-1); | 172 | Remote_View->addColumn( tr("Date"),-1); |
173 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | ||
174 | Remote_View->addColumn( tr("Size"),-1); | ||
173 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 175 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
174 | Remote_View->setAllColumnsShowFocus(TRUE); | 176 | Remote_View->setAllColumnsShowFocus(TRUE); |
175 | // Remote_View->setMultiSelection( TRUE ); | 177 | // Remote_View->setMultiSelection( TRUE ); |
176 | // Remote_View->setSelectionMode(QListView::Extended); | 178 | // Remote_View->setSelectionMode(QListView::Extended); |
177 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 179 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
178 | 180 | ||
179 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 181 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
180 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 182 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
181 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 183 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
182 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 184 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
183 | 185 | ||
184 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 186 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
185 | 187 | ||
186 | TabWidget->insertTab( tab_2, tr( "2")); | 188 | TabWidget->insertTab( tab_2, tr( "2")); |
187 | 189 | ||
188 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 190 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
189 | this,SLOT(tabChanged(QWidget*))); | 191 | this,SLOT(tabChanged(QWidget*))); |
190 | 192 | ||
191 | // tab_3 = new QWidget( TabWidget, "tab_3" ); | 193 | // tab_3 = new QWidget( TabWidget, "tab_3" ); |
192 | // tabLayout_3 = new QGridLayout( tab_3 ); | 194 | // tabLayout_3 = new QGridLayout( tab_3 ); |
193 | // tabLayout_3->setSpacing( 2); | 195 | // tabLayout_3->setSpacing( 2); |
194 | // tabLayout_3->setMargin( 2); | 196 | // tabLayout_3->setMargin( 2); |
195 | 197 | ||
196 | // OFileSelector *fileSelector; | 198 | // OFileSelector *fileSelector; |
197 | // fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); | 199 | // fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); |
198 | // tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); | 200 | // tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); |
199 | 201 | ||
200 | // TabWidget->insertTab( tab_3, tr( "Files" ) ); | 202 | // TabWidget->insertTab( tab_3, tr( "Files" ) ); |
201 | 203 | ||
202 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 204 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
203 | currentDir.setPath( QDir::currentDirPath()); | 205 | currentDir.setPath( QDir::currentDirPath()); |
204 | 206 | ||
205 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 207 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
206 | currentRemoteDir.setPath( QDir::currentDirPath()); | 208 | currentRemoteDir.setPath( QDir::currentDirPath()); |
207 | 209 | ||
208 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 210 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
209 | currentPathCombo->setEditable(TRUE); | 211 | currentPathCombo->setEditable(TRUE); |
210 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); | 212 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); |
211 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 213 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
212 | 214 | ||
213 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 215 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
214 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 216 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
215 | 217 | ||
216 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 218 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
217 | this,SLOT(currentPathComboChanged())); | 219 | this,SLOT(currentPathComboChanged())); |
218 | 220 | ||
219 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 221 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
220 | 222 | ||
221 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); | 223 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); |
222 | 224 | ||
223 | filterStr="*"; | 225 | filterStr="*"; |
224 | b=FALSE; | 226 | b=FALSE; |
225 | populateLocalView(); | 227 | populateLocalView(); |
226 | populateRemoteView(); | 228 | populateRemoteView(); |
227 | } | 229 | } |
228 | 230 | ||
229 | AdvancedFm::~AdvancedFm() | 231 | AdvancedFm::~AdvancedFm() |
230 | { | 232 | { |
231 | } | 233 | } |
232 | 234 | ||
233 | void AdvancedFm::cleanUp() | 235 | void AdvancedFm::cleanUp() |
234 | { | 236 | { |
235 | QString sfile=QDir::homeDirPath(); | 237 | QString sfile=QDir::homeDirPath(); |
236 | if(sfile.right(1) != "/") | 238 | if(sfile.right(1) != "/") |
237 | sfile+="/._temp"; | 239 | sfile+="/._temp"; |
238 | else | 240 | else |
239 | sfile+="._temp"; | 241 | sfile+="._temp"; |
240 | QFile file( sfile); | 242 | QFile file( sfile); |
241 | if(file.exists()) | 243 | if(file.exists()) |
242 | file.remove(); | 244 | file.remove(); |
243 | } | 245 | } |
244 | 246 | ||
245 | void AdvancedFm::tabChanged(QWidget *w) | 247 | void AdvancedFm::tabChanged(QWidget *w) |
246 | { | 248 | { |
247 | if (TabWidget->currentPageIndex() == 0) { | 249 | if (TabWidget->currentPageIndex() == 0) { |
248 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 250 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
249 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 251 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
250 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 252 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
251 | } | 253 | } |
252 | if (TabWidget->currentPageIndex() == 1) { | 254 | if (TabWidget->currentPageIndex() == 1) { |
253 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 255 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
254 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 256 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
255 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 257 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
256 | } | 258 | } |
257 | } | 259 | } |
258 | 260 | ||
259 | 261 | ||
260 | void AdvancedFm::populateLocalView() | 262 | void AdvancedFm::populateLocalView() |
261 | { | 263 | { |
262 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 264 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
263 | // QListViewItemIterator it( Local_View ); | 265 | // QListViewItemIterator it( Local_View ); |
264 | // for ( ; it.current(); ++it ) { | 266 | // for ( ; it.current(); ++it ) { |
265 | // if ( it.current()->isSelected() ) { | 267 | // if ( it.current()->isSelected() ) { |
266 | // QString strItem = it.current()->text(0); | 268 | // QString strItem = it.current()->text(0); |
267 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 269 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
268 | // QFileInfo fi(localFile); | 270 | // QFileInfo fi(localFile); |
269 | // } | 271 | // } |
270 | // } | 272 | // } |
271 | QPixmap pm; | 273 | QPixmap pm; |
272 | Local_View->clear(); | 274 | Local_View->clear(); |
273 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 275 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
274 | currentDir.setMatchAllDirs(TRUE); | 276 | currentDir.setMatchAllDirs(TRUE); |
275 | currentDir.setNameFilter(filterStr); | 277 | currentDir.setNameFilter(filterStr); |
276 | QString fileL, fileS, fileDate; | 278 | QString fileL, fileS, fileDate; |
277 | // qDebug(currentDir.canonicalPath()); | 279 | // qDebug(currentDir.canonicalPath()); |
278 | 280 | ||
279 | bool isDir=FALSE; | 281 | bool isDir=FALSE; |
280 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 282 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
281 | QFileInfoListIterator it(*list); | 283 | QFileInfoListIterator it(*list); |
282 | QFileInfo *fi; | 284 | QFileInfo *fi; |
283 | while ( (fi=it.current()) ) { | 285 | while ( (fi=it.current()) ) { |
284 | if (fi->isSymLink() ) { | 286 | if (fi->isSymLink() ) { |
285 | QString symLink=fi->readLink(); | 287 | QString symLink=fi->readLink(); |
286 | // qDebug("Symlink detected "+symLink); | 288 | // qDebug("Symlink detected "+symLink); |
287 | QFileInfo sym( symLink); | 289 | QFileInfo sym( symLink); |
288 | fileS.sprintf( "%10li", sym.size() ); | 290 | fileS.sprintf( "%10li", sym.size() ); |
289 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 291 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
290 | fileDate = sym.lastModified().toString(); | 292 | fileDate = sym.lastModified().toString(); |
291 | } else { | 293 | } else { |
292 | fileS.sprintf( "%10li", fi->size() ); | 294 | fileS.sprintf( "%10li", fi->size() ); |
293 | fileL.sprintf( "%s",fi->fileName().data() ); | 295 | fileL.sprintf( "%s",fi->fileName().data() ); |
294 | fileDate= fi->lastModified().toString(); | 296 | fileDate= fi->lastModified().toString(); |
295 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 297 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
296 | fileL+="/"; | 298 | fileL+="/"; |
297 | isDir=TRUE; | 299 | isDir=TRUE; |
298 | // qDebug( fileL); | 300 | // qDebug( fileL); |
299 | } | 301 | } |
300 | } | 302 | } |
301 | if(fileL !="./" && fi->exists()) { | 303 | if(fileL !="./" && fi->exists()) { |
302 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 304 | item= new QListViewItem( Local_View, fileL , fileDate, fileS); |
303 | 305 | ||
304 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 306 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
305 | if( !QDir( fi->filePath() ).isReadable()) | 307 | if( !QDir( fi->filePath() ).isReadable()) |
306 | pm = Resource::loadPixmap( "lockedfolder" ); | 308 | pm = Resource::loadPixmap( "lockedfolder" ); |
307 | else | 309 | else |
308 | pm= Resource::loadPixmap( "folder" ); | 310 | pm= Resource::loadPixmap( "folder" ); |
309 | item->setPixmap( 0,pm ); | 311 | item->setPixmap( 0,pm ); |
310 | } else { | 312 | } else { |
311 | if( !fi->isReadable() ) | 313 | if( !fi->isReadable() ) |
312 | pm = Resource::loadPixmap( "locked" ); | 314 | pm = Resource::loadPixmap( "locked" ); |
313 | else { | 315 | else { |
314 | MimeType mt(fi->filePath()); | 316 | MimeType mt(fi->filePath()); |
315 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 317 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
316 | if(pm.isNull()) | 318 | if(pm.isNull()) |
317 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 319 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
318 | item->setPixmap( 0,pm); | 320 | item->setPixmap( 0,pm); |
319 | } | 321 | } |
320 | } | 322 | } |
321 | if( fileL.find("->",0,TRUE) != -1) { | 323 | if( fileL.find("->",0,TRUE) != -1) { |
322 | // overlay link image | 324 | // overlay link image |
323 | pm= Resource::loadPixmap( "folder" ); | 325 | pm= Resource::loadPixmap( "folder" ); |
324 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 326 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
325 | QPainter painter( &pm ); | 327 | QPainter painter( &pm ); |
326 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 328 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
327 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 329 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
328 | item->setPixmap( 0, pm); | 330 | item->setPixmap( 0, pm); |
329 | } | 331 | } |
330 | } isDir=FALSE; | 332 | } isDir=FALSE; |
331 | ++it; | 333 | ++it; |
332 | } | 334 | } |
333 | 335 | ||
334 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 336 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
335 | struct stat buf; | 337 | struct stat buf; |
336 | struct stat st; | 338 | struct stat st; |
337 | dev_t devT; | 339 | dev_t devT; |
338 | mode_t mode; | 340 | mode_t mode; |
339 | DIR *dir; | 341 | DIR *dir; |
340 | int fd = 0; | 342 | int fd = 0; |
341 | struct dirent *mydirent; | 343 | struct dirent *mydirent; |
342 | int i = 1; | 344 | int i = 1; |
343 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 345 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
344 | while ((mydirent = readdir(dir)) != NULL) { | 346 | while ((mydirent = readdir(dir)) != NULL) { |
345 | lstat( mydirent->d_name, &buf); | 347 | lstat( mydirent->d_name, &buf); |
346 | qDebug(mydirent->d_name); | 348 | qDebug(mydirent->d_name); |
347 | // mode = buf.st_mode; | 349 | // mode = buf.st_mode; |
348 | fileL.sprintf("%s", mydirent->d_name); | 350 | fileL.sprintf("%s", mydirent->d_name); |
349 | // fileS.sprintf("%d, %d", ); //this isn't correct | 351 | // fileS.sprintf("%d, %d", ); //this isn't correct |
350 | devT = buf.st_dev; | 352 | devT = buf.st_dev; |
351 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 353 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
352 | // fileS.sprintf("%d,%d", devT, devT); | 354 | // fileS.sprintf("%d,%d", devT, devT); |
353 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 355 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
354 | if( fileL.find(".") == -1 ){ | 356 | if( fileL.find(".") == -1 ){ |
355 | item= new QListViewItem( Local_View, fileL, fileS, fileDate); | 357 | item= new QListViewItem( Local_View, fileL, fileDate, fileS); |
356 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 358 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
357 | item->setPixmap( 0,pm); | 359 | item->setPixmap( 0,pm); |
358 | } | 360 | } |
359 | } | 361 | } |
360 | 362 | ||
361 | closedir(dir); | 363 | closedir(dir); |
362 | } | 364 | } |
363 | 365 | ||
364 | Local_View->setSorting( 3,FALSE); | 366 | Local_View->setSorting( 3,FALSE); |
365 | fillCombo( (const QString &) currentDir.canonicalPath()); | 367 | fillCombo( (const QString &) currentDir.canonicalPath()); |
366 | } | 368 | } |
367 | 369 | ||
368 | void AdvancedFm::populateRemoteView() | 370 | void AdvancedFm::populateRemoteView() |
369 | { | 371 | { |
370 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 372 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
371 | // QListViewItemIterator it( Remote_View ); | 373 | // QListViewItemIterator it( Remote_View ); |
372 | // for ( ; it.current(); ++it ) { | 374 | // for ( ; it.current(); ++it ) { |
373 | // if ( it.current()->isSelected() ) { | 375 | // if ( it.current()->isSelected() ) { |
374 | // QString strItem = it.current()->text(0); | 376 | // QString strItem = it.current()->text(0); |
375 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; | 377 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; |
376 | // QFileInfo fi(localFile); | 378 | // QFileInfo fi(localFile); |
377 | // } | 379 | // } |
378 | // } | 380 | // } |
379 | QPixmap pm; | 381 | QPixmap pm; |
380 | Remote_View->clear(); | 382 | Remote_View->clear(); |
381 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 383 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
382 | currentRemoteDir.setMatchAllDirs(TRUE); | 384 | currentRemoteDir.setMatchAllDirs(TRUE); |
383 | currentRemoteDir.setNameFilter(filterStr); | 385 | currentRemoteDir.setNameFilter(filterStr); |
384 | QString fileL, fileS, fileDate; | 386 | QString fileL, fileS, fileDate; |
385 | bool isDir=FALSE; | 387 | bool isDir=FALSE; |
386 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 388 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
387 | QFileInfoListIterator it(*list); | 389 | QFileInfoListIterator it(*list); |
388 | QFileInfo *fi; | 390 | QFileInfo *fi; |
389 | while ( (fi=it.current()) ) { | 391 | while ( (fi=it.current()) ) { |
390 | if (fi->isSymLink() ){ | 392 | if (fi->isSymLink() ){ |
391 | QString symLink=fi->readLink(); | 393 | QString symLink=fi->readLink(); |
392 | // qDebug("Symlink detected "+symLink); | 394 | // qDebug("Symlink detected "+symLink); |
393 | QFileInfo sym( symLink); | 395 | QFileInfo sym( symLink); |
394 | fileS.sprintf( "%10li", sym.size() ); | 396 | fileS.sprintf( "%10li", sym.size() ); |
395 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 397 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
396 | fileDate = sym.lastModified().toString(); | 398 | fileDate = sym.lastModified().toString(); |
397 | } else { | 399 | } else { |
398 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 400 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
399 | fileS.sprintf( "%10li", fi->size() ); | 401 | fileS.sprintf( "%10li", fi->size() ); |
400 | fileL.sprintf( "%s",fi->fileName().data() ); | 402 | fileL.sprintf( "%s",fi->fileName().data() ); |
401 | fileDate= fi->lastModified().toString(); | 403 | fileDate= fi->lastModified().toString(); |
402 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 404 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
403 | fileL+="/"; | 405 | fileL+="/"; |
404 | isDir=TRUE; | 406 | isDir=TRUE; |
405 | // qDebug( fileL); | 407 | // qDebug( fileL); |
406 | } | 408 | } |
407 | } | 409 | } |
408 | if(fileL !="./" && fi->exists()) { | 410 | if(fileL !="./" && fi->exists()) { |
409 | item= new QListViewItem( Remote_View,fileL,fileS , fileDate); | 411 | item= new QListViewItem( Remote_View, fileL, fileDate, fileS); |
410 | QPixmap pm; | 412 | QPixmap pm; |
411 | 413 | ||
412 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 414 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
413 | if( !QDir( fi->filePath() ).isReadable()) | 415 | if( !QDir( fi->filePath() ).isReadable()) |
414 | pm = Resource::loadPixmap( "lockedfolder" ); | 416 | pm = Resource::loadPixmap( "lockedfolder" ); |
415 | else | 417 | else |
416 | pm= Resource::loadPixmap( "folder" ); | 418 | pm= Resource::loadPixmap( "folder" ); |
417 | item->setPixmap( 0,pm ); | 419 | item->setPixmap( 0,pm ); |
418 | } else { | 420 | } else { |
419 | if( !fi->isReadable() ) | 421 | if( !fi->isReadable() ) |
420 | pm = Resource::loadPixmap( "locked" ); | 422 | pm = Resource::loadPixmap( "locked" ); |
421 | else { | 423 | else { |
422 | MimeType mt(fi->filePath()); | 424 | MimeType mt(fi->filePath()); |
423 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 425 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
424 | if(pm.isNull()) | 426 | if(pm.isNull()) |
425 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 427 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
426 | item->setPixmap( 0,pm); | 428 | item->setPixmap( 0,pm); |
427 | } | 429 | } |
428 | } | 430 | } |
429 | if( fileL.find("->",0,TRUE) != -1) { | 431 | if( fileL.find("->",0,TRUE) != -1) { |
430 | // overlay link image | 432 | // overlay link image |
431 | pm= Resource::loadPixmap( "folder" ); | 433 | pm= Resource::loadPixmap( "folder" ); |
432 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | 434 | QPixmap lnk = Resource::loadPixmap( "symlink" ); |
433 | QPainter painter( &pm ); | 435 | QPainter painter( &pm ); |
434 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 436 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
435 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 437 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
436 | item->setPixmap( 0, pm); | 438 | item->setPixmap( 0, pm); |
437 | } | 439 | } |
438 | } isDir=FALSE; | 440 | } isDir=FALSE; |
439 | ++it; | 441 | ++it; |
440 | } | 442 | } |
441 | 443 | ||
442 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 444 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
443 | struct stat buf; | 445 | struct stat buf; |
444 | struct stat st; | 446 | struct stat st; |
445 | mode_t mode; | 447 | mode_t mode; |
446 | DIR *dir; | 448 | DIR *dir; |
447 | int fd = 0; | 449 | int fd = 0; |
448 | struct dirent *mydirent; | 450 | struct dirent *mydirent; |
449 | int i = 1; | 451 | int i = 1; |
450 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 452 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
451 | while ((mydirent = readdir(dir)) != NULL) { | 453 | while ((mydirent = readdir(dir)) != NULL) { |
452 | lstat( mydirent->d_name, &buf); | 454 | lstat( mydirent->d_name, &buf); |
453 | qDebug(mydirent->d_name); | 455 | qDebug(mydirent->d_name); |
454 | // mode = buf.st_mode; | 456 | // mode = buf.st_mode; |
455 | fileL.sprintf("%s", mydirent->d_name); | 457 | fileL.sprintf("%s", mydirent->d_name); |
456 | // fileS.sprintf("%d, %d", ); //this isn't correct | 458 | // fileS.sprintf("%d, %d", ); //this isn't correct |
457 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 459 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
458 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 460 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
459 | if( fileL.find(".") == -1 ){ | 461 | if( fileL.find(".") == -1 ){ |
460 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 462 | item= new QListViewItem( Remote_View, fileL, fileDate, fileS); |
461 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 463 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
462 | item->setPixmap( 0,pm); | 464 | item->setPixmap( 0,pm); |
463 | } | 465 | } |
464 | } | 466 | } |
465 | 467 | ||
466 | closedir(dir); | 468 | closedir(dir); |
467 | } | 469 | } |
468 | 470 | ||
469 | Remote_View->setSorting( 3,FALSE); | 471 | Remote_View->setSorting( 3,FALSE); |
470 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 472 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
471 | } | 473 | } |
472 | 474 | ||
473 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) | 475 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) |
474 | { | 476 | { |
475 | if(selectedItem) { | 477 | if(selectedItem) { |
476 | QString strItem=selectedItem->text(0); | 478 | QString strItem=selectedItem->text(0); |
477 | QString strSize=selectedItem->text(1); | 479 | QString strSize=selectedItem->text(1); |
478 | strSize=strSize.stripWhiteSpace(); | 480 | strSize=strSize.stripWhiteSpace(); |
479 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 481 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
480 | // is symlink | 482 | // is symlink |
481 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 483 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
482 | if(QDir(strItem2).exists() ) { | 484 | if(QDir(strItem2).exists() ) { |
483 | currentDir.cd(strItem2, TRUE); | 485 | currentDir.cd(strItem2, TRUE); |
484 | populateLocalView(); | 486 | populateLocalView(); |
485 | } | 487 | } |
486 | } else { // not a symlink | 488 | } else { // not a symlink |
487 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 489 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
488 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 490 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
489 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 491 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
490 | currentDir.cd(strItem,FALSE); | 492 | currentDir.cd(strItem,FALSE); |
491 | populateLocalView(); | 493 | populateLocalView(); |
492 | } else { | 494 | } else { |
493 | currentDir.cdUp(); | 495 | currentDir.cdUp(); |
494 | populateLocalView(); | 496 | populateLocalView(); |
495 | } | 497 | } |
496 | if(QDir(strItem).exists()){ | 498 | if(QDir(strItem).exists()){ |
497 | currentDir.cd(strItem, TRUE); | 499 | currentDir.cd(strItem, TRUE); |
498 | populateLocalView(); | 500 | populateLocalView(); |
499 | } | 501 | } |
500 | } else { | 502 | } else { |
501 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 503 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
502 | if( QFile::exists(strItem ) ) { | 504 | if( QFile::exists(strItem ) ) { |
503 | // qDebug("upload "+strItem); | 505 | // qDebug("upload "+strItem); |
504 | } | 506 | } |
505 | } //end not symlink | 507 | } //end not symlink |
506 | chdir(strItem.latin1()); | 508 | chdir(strItem.latin1()); |
507 | } | 509 | } |
508 | } | 510 | } |
509 | } | 511 | } |
510 | 512 | ||
511 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) | 513 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) |
512 | { | 514 | { |
513 | if(selectedItem) { | 515 | if(selectedItem) { |
514 | QString strItem=selectedItem->text(0); | 516 | QString strItem=selectedItem->text(0); |
515 | QString strSize=selectedItem->text(1); | 517 | QString strSize=selectedItem->text(1); |
516 | strSize=strSize.stripWhiteSpace(); | 518 | strSize=strSize.stripWhiteSpace(); |
517 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 519 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
518 | // is symlink | 520 | // is symlink |
519 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 521 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
520 | if(QDir(strItem2).exists() ) { | 522 | if(QDir(strItem2).exists() ) { |
521 | currentRemoteDir.cd(strItem2, TRUE); | 523 | currentRemoteDir.cd(strItem2, TRUE); |
522 | populateRemoteView(); | 524 | populateRemoteView(); |
523 | } | 525 | } |
524 | } else { // not a symlink | 526 | } else { // not a symlink |
525 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 527 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
526 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 528 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
527 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 529 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
528 | currentRemoteDir.cd(strItem,FALSE); | 530 | currentRemoteDir.cd(strItem,FALSE); |
529 | populateRemoteView(); | 531 | populateRemoteView(); |
530 | } else { | 532 | } else { |
531 | currentRemoteDir.cdUp(); | 533 | currentRemoteDir.cdUp(); |
532 | populateRemoteView(); | 534 | populateRemoteView(); |
533 | } | 535 | } |
534 | if(QDir(strItem).exists()){ | 536 | if(QDir(strItem).exists()){ |
535 | currentRemoteDir.cd(strItem, TRUE); | 537 | currentRemoteDir.cd(strItem, TRUE); |
536 | populateRemoteView(); | 538 | populateRemoteView(); |
537 | } | 539 | } |
538 | } else { | 540 | } else { |
539 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 541 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
540 | if( QFile::exists(strItem ) ) { | 542 | if( QFile::exists(strItem ) ) { |
541 | // qDebug("upload "+strItem); | 543 | // qDebug("upload "+strItem); |
542 | } | 544 | } |
543 | } //end not symlink | 545 | } //end not symlink |
544 | chdir(strItem.latin1()); | 546 | chdir(strItem.latin1()); |
545 | } | 547 | } |
546 | } | 548 | } |
547 | } | 549 | } |
548 | 550 | ||
549 | void AdvancedFm::doLocalCd() | 551 | void AdvancedFm::doLocalCd() |
550 | { | 552 | { |
551 | localListClicked( Local_View->currentItem()); | 553 | localListClicked( Local_View->currentItem()); |
552 | } | 554 | } |
553 | 555 | ||
554 | void AdvancedFm::doRemoteCd() | 556 | void AdvancedFm::doRemoteCd() |
555 | { | 557 | { |
556 | localListClicked( Remote_View->currentItem()); | 558 | localListClicked( Remote_View->currentItem()); |
557 | } | 559 | } |
558 | 560 | ||
559 | void AdvancedFm::showHidden() | 561 | void AdvancedFm::showHidden() |
560 | { | 562 | { |
561 | if (!b) { | 563 | if (!b) { |
562 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 564 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
563 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 565 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
564 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 566 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
565 | b=TRUE; | 567 | b=TRUE; |
566 | 568 | ||
567 | } else { | 569 | } else { |
568 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 570 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
569 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 571 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
570 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 572 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
571 | b=FALSE; | 573 | b=FALSE; |
572 | } | 574 | } |
573 | populateLocalView(); | 575 | populateLocalView(); |
574 | } | 576 | } |
575 | 577 | ||
576 | void AdvancedFm::showRemoteHidden() | 578 | void AdvancedFm::showRemoteHidden() |
577 | { | 579 | { |
578 | if (!b) { | 580 | if (!b) { |
579 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 581 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
580 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); | 582 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); |
581 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 583 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
582 | b=TRUE; | 584 | b=TRUE; |
583 | 585 | ||
584 | } else { | 586 | } else { |
585 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 587 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
586 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 588 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
587 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 589 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
588 | b=FALSE; | 590 | b=FALSE; |
589 | } | 591 | } |
590 | populateRemoteView(); | 592 | populateRemoteView(); |
591 | } | 593 | } |
592 | 594 | ||
593 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 595 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
594 | { | 596 | { |
595 | switch (mouse) { | 597 | switch (mouse) { |
596 | case 1: | 598 | case 1: |
597 | break; | 599 | break; |
598 | case 2: | 600 | case 2: |
599 | showLocalMenu(item); | 601 | showLocalMenu(item); |
600 | Local_View->clearSelection(); | 602 | Local_View->clearSelection(); |
601 | break; | 603 | break; |
602 | }; | 604 | }; |
603 | } | 605 | } |
604 | 606 | ||
605 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 607 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
606 | { | 608 | { |
607 | switch (mouse) { | 609 | switch (mouse) { |
608 | case 1: | 610 | case 1: |
609 | break; | 611 | break; |
610 | case 2: | 612 | case 2: |
611 | showRemoteMenu(item); | 613 | showRemoteMenu(item); |
612 | Remote_View->clearSelection(); | 614 | Remote_View->clearSelection(); |
613 | break; | 615 | break; |
614 | }; | 616 | }; |
615 | } | 617 | } |
616 | 618 | ||
617 | void AdvancedFm::showLocalMenu(QListViewItem * item) | 619 | void AdvancedFm::showLocalMenu(QListViewItem * item) |
618 | { | 620 | { |
619 | if(item) { | 621 | if(item) { |
620 | QPopupMenu m; | 622 | QPopupMenu m; |
621 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 623 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
622 | m.insertSeparator(); | 624 | m.insertSeparator(); |
623 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 625 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
624 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 626 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
625 | else | 627 | else |
626 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 628 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
627 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 629 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
628 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 630 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
629 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 631 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
630 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 632 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
631 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 633 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
632 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 634 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
633 | m.insertSeparator(); | 635 | m.insertSeparator(); |
634 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 636 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
635 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 637 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
636 | m.insertSeparator(); | 638 | m.insertSeparator(); |
637 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 639 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
638 | m.insertSeparator(); | 640 | m.insertSeparator(); |
639 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 641 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
640 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 642 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
641 | m.setCheckable(TRUE); | 643 | m.setCheckable(TRUE); |
642 | if (b) | 644 | if (b) |
643 | m.setItemChecked(m.idAt(0),TRUE); | 645 | m.setItemChecked(m.idAt(0),TRUE); |
644 | else | 646 | else |
645 | m.setItemChecked(m.idAt(0),FALSE); | 647 | m.setItemChecked(m.idAt(0),FALSE); |
646 | m.exec( QCursor::pos() ); | 648 | m.exec( QCursor::pos() ); |
647 | } | 649 | } |
648 | } | 650 | } |
649 | 651 | ||
650 | void AdvancedFm::showRemoteMenu(QListViewItem * item) | 652 | void AdvancedFm::showRemoteMenu(QListViewItem * item) |
651 | { | 653 | { |
652 | if(item) { | 654 | if(item) { |
@@ -908,356 +910,361 @@ void AdvancedFm::fillCombo(const QString ¤tPath) { | |||
908 | } | 910 | } |
909 | 911 | ||
910 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 912 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
911 | if (TabWidget->currentPageIndex() == 0) { | 913 | if (TabWidget->currentPageIndex() == 0) { |
912 | chdir( currentPath.latin1() ); | 914 | chdir( currentPath.latin1() ); |
913 | currentDir.cd( currentPath, TRUE); | 915 | currentDir.cd( currentPath, TRUE); |
914 | populateLocalView(); | 916 | populateLocalView(); |
915 | update(); | 917 | update(); |
916 | } else { | 918 | } else { |
917 | chdir( currentPath.latin1() ); | 919 | chdir( currentPath.latin1() ); |
918 | currentRemoteDir.cd( currentPath, TRUE); | 920 | currentRemoteDir.cd( currentPath, TRUE); |
919 | populateRemoteView(); | 921 | populateRemoteView(); |
920 | update(); | 922 | update(); |
921 | } | 923 | } |
922 | } | 924 | } |
923 | 925 | ||
924 | void AdvancedFm::filePerms() { | 926 | void AdvancedFm::filePerms() { |
925 | QString curFile = getPath(); | 927 | QString curFile = getPath(); |
926 | filePermissions *filePerm; | 928 | filePermissions *filePerm; |
927 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(curFile)); | 929 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(curFile)); |
928 | filePerm->showMaximized(); | 930 | filePerm->showMaximized(); |
929 | filePerm->exec(); | 931 | filePerm->exec(); |
930 | if( filePerm) | 932 | if( filePerm) |
931 | delete filePerm; | 933 | delete filePerm; |
932 | } | 934 | } |
933 | 935 | ||
934 | void AdvancedFm::doProperties() { | 936 | void AdvancedFm::doProperties() { |
935 | 937 | ||
936 | DocLnk lnk( getPath()); | 938 | DocLnk lnk( getPath()); |
937 | LnkProperties prop( &lnk ); | 939 | LnkProperties prop( &lnk ); |
938 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 940 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
939 | prop.showMaximized(); | 941 | prop.showMaximized(); |
940 | prop.exec(); | 942 | prop.exec(); |
941 | } | 943 | } |
942 | 944 | ||
943 | QString AdvancedFm::getPath() { | 945 | QString AdvancedFm::getPath() { |
944 | if (TabWidget->currentPageIndex() == 0) { | 946 | if (TabWidget->currentPageIndex() == 0) { |
945 | return currentDir.canonicalPath()+"/"+ Local_View->currentItem()->text(0); | 947 | return currentDir.canonicalPath()+"/"+ Local_View->currentItem()->text(0); |
946 | } else { | 948 | } else { |
947 | return currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); | 949 | return currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); |
948 | } | 950 | } |
949 | } | 951 | } |
950 | 952 | ||
951 | void AdvancedFm::homeButtonPushed() { | 953 | void AdvancedFm::homeButtonPushed() { |
952 | QString current = QDir::homeDirPath(); | 954 | QString current = QDir::homeDirPath(); |
953 | chdir( current.latin1() ); | 955 | chdir( current.latin1() ); |
954 | if (TabWidget->currentPageIndex() == 0) { | 956 | if (TabWidget->currentPageIndex() == 0) { |
955 | currentDir.cd( current, TRUE); | 957 | currentDir.cd( current, TRUE); |
956 | populateLocalView(); | 958 | populateLocalView(); |
957 | } else { | 959 | } else { |
958 | currentRemoteDir.cd( current, TRUE); | 960 | currentRemoteDir.cd( current, TRUE); |
959 | populateRemoteView(); | 961 | populateRemoteView(); |
960 | } | 962 | } |
961 | update(); | 963 | update(); |
962 | } | 964 | } |
963 | 965 | ||
964 | void AdvancedFm::docButtonPushed() { | 966 | void AdvancedFm::docButtonPushed() { |
965 | QString current = QPEApplication::documentDir(); | 967 | QString current = QPEApplication::documentDir(); |
966 | chdir( current.latin1() ); | 968 | chdir( current.latin1() ); |
967 | if (TabWidget->currentPageIndex() == 0) { | 969 | if (TabWidget->currentPageIndex() == 0) { |
968 | currentDir.cd( current, TRUE); | 970 | currentDir.cd( current, TRUE); |
969 | populateLocalView(); | 971 | populateLocalView(); |
970 | } else { | 972 | } else { |
971 | currentRemoteDir.cd( current, TRUE); | 973 | currentRemoteDir.cd( current, TRUE); |
972 | populateRemoteView(); | 974 | populateRemoteView(); |
973 | } | 975 | } |
974 | update(); | 976 | update(); |
975 | } | 977 | } |
976 | 978 | ||
977 | void AdvancedFm::SDButtonPushed() { | 979 | void AdvancedFm::SDButtonPushed() { |
978 | QString current = "/mnt/card"; | 980 | QString current = "/mnt/card"; |
979 | chdir( current.latin1() ); | 981 | chdir( current.latin1() ); |
980 | if (TabWidget->currentPageIndex() == 0) { | 982 | if (TabWidget->currentPageIndex() == 0) { |
981 | currentDir.cd( current, TRUE); | 983 | currentDir.cd( current, TRUE); |
982 | populateLocalView(); | 984 | populateLocalView(); |
983 | } else { | 985 | } else { |
984 | currentRemoteDir.cd( current, TRUE); | 986 | currentRemoteDir.cd( current, TRUE); |
985 | populateRemoteView(); | 987 | populateRemoteView(); |
986 | } | 988 | } |
987 | update(); | 989 | update(); |
988 | 990 | ||
989 | } | 991 | } |
990 | 992 | ||
991 | void AdvancedFm::CFButtonPushed() { | 993 | void AdvancedFm::CFButtonPushed() { |
992 | QString current = "/mnt/cf"; | 994 | QString current = "/mnt/cf"; |
993 | chdir( current.latin1() ); | 995 | chdir( current.latin1() ); |
994 | if (TabWidget->currentPageIndex() == 0) { | 996 | if (TabWidget->currentPageIndex() == 0) { |
995 | currentDir.cd( current, TRUE); | 997 | currentDir.cd( current, TRUE); |
996 | populateLocalView(); | 998 | populateLocalView(); |
997 | } else { | 999 | } else { |
998 | currentRemoteDir.cd( current, TRUE); | 1000 | currentRemoteDir.cd( current, TRUE); |
999 | populateRemoteView(); | 1001 | populateRemoteView(); |
1000 | } | 1002 | } |
1001 | update(); | 1003 | update(); |
1002 | 1004 | ||
1003 | } | 1005 | } |
1004 | 1006 | ||
1005 | 1007 | ||
1006 | void AdvancedFm::upDir() | 1008 | void AdvancedFm::upDir() |
1007 | { | 1009 | { |
1008 | if (TabWidget->currentPageIndex() == 0) { | 1010 | if (TabWidget->currentPageIndex() == 0) { |
1009 | QString current = currentDir.canonicalPath(); | 1011 | QString current = currentDir.canonicalPath(); |
1010 | QDir dir(current); | 1012 | QDir dir(current); |
1011 | dir.cdUp(); | 1013 | dir.cdUp(); |
1012 | current = dir.canonicalPath(); | 1014 | current = dir.canonicalPath(); |
1013 | chdir( current.latin1() ); | 1015 | chdir( current.latin1() ); |
1014 | currentDir.cd( current, TRUE); | 1016 | currentDir.cd( current, TRUE); |
1015 | populateLocalView(); | 1017 | populateLocalView(); |
1016 | update(); | 1018 | update(); |
1017 | } else { | 1019 | } else { |
1018 | QString current = currentRemoteDir.canonicalPath(); | 1020 | QString current = currentRemoteDir.canonicalPath(); |
1019 | QDir dir(current); | 1021 | QDir dir(current); |
1020 | dir.cdUp(); | 1022 | dir.cdUp(); |
1021 | current = dir.canonicalPath(); | 1023 | current = dir.canonicalPath(); |
1022 | chdir( current.latin1() ); | 1024 | chdir( current.latin1() ); |
1023 | currentRemoteDir.cd( current, TRUE); | 1025 | currentRemoteDir.cd( current, TRUE); |
1024 | populateRemoteView(); | 1026 | populateRemoteView(); |
1025 | update(); | 1027 | update(); |
1026 | } | 1028 | } |
1027 | } | 1029 | } |
1028 | 1030 | ||
1029 | void AdvancedFm::copy() | 1031 | void AdvancedFm::copy() |
1030 | { | 1032 | { |
1031 | QString curFile = getPath(); | 1033 | QString curFile = getPath(); |
1032 | if (TabWidget->currentPageIndex() == 0) { | 1034 | if (TabWidget->currentPageIndex() == 0) { |
1033 | QString destFile = currentRemoteDir.canonicalPath()+"/"+Local_View->currentItem()->text(0); | 1035 | QString destFile = currentRemoteDir.canonicalPath()+"/"+Local_View->currentItem()->text(0); |
1034 | QFile f(destFile); | 1036 | QFile f(destFile); |
1035 | if( f.exists()) | 1037 | if( f.exists()) |
1036 | f.remove(); | 1038 | f.remove(); |
1037 | if(!copyFile(destFile, curFile) ) | 1039 | if(!copyFile(destFile, curFile) ) |
1038 | qWarning("nothin doing"); | 1040 | qWarning("nothin doing"); |
1039 | populateRemoteView(); | 1041 | populateRemoteView(); |
1040 | TabWidget->setCurrentPage(1); | 1042 | TabWidget->setCurrentPage(1); |
1041 | } else { | 1043 | } else { |
1042 | QString destFile = currentDir.canonicalPath()+"/"+Remote_View->currentItem()->text(0); | 1044 | QString destFile = currentDir.canonicalPath()+"/"+Remote_View->currentItem()->text(0); |
1043 | QFile f(destFile); | 1045 | QFile f(destFile); |
1044 | if( f.exists()) | 1046 | if( f.exists()) |
1045 | f.remove(); | 1047 | f.remove(); |
1046 | if(!copyFile(destFile, curFile) ) | 1048 | if(!copyFile(destFile, curFile) ) |
1047 | qWarning("nothin doing"); | 1049 | qWarning("nothin doing"); |
1048 | populateLocalView(); | 1050 | populateLocalView(); |
1049 | TabWidget->setCurrentPage(0); | 1051 | TabWidget->setCurrentPage(0); |
1050 | } | 1052 | } |
1051 | } | 1053 | } |
1052 | 1054 | ||
1053 | void AdvancedFm::copyAs() | 1055 | void AdvancedFm::copyAs() |
1054 | { | 1056 | { |
1055 | QString curFile = getPath(); | 1057 | QString curFile = getPath(); |
1056 | if (TabWidget->currentPageIndex() == 0) { | 1058 | if (TabWidget->currentPageIndex() == 0) { |
1057 | QString destFile = Local_View->currentItem()->text(0); | 1059 | QString destFile = Local_View->currentItem()->text(0); |
1058 | InputDialog *fileDlg; | 1060 | InputDialog *fileDlg; |
1059 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1061 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1060 | fileDlg->setInputText((const QString &) destFile ); | 1062 | fileDlg->setInputText((const QString &) destFile ); |
1061 | fileDlg->exec(); | 1063 | fileDlg->exec(); |
1062 | if( fileDlg->result() == 1 ) { | 1064 | if( fileDlg->result() == 1 ) { |
1063 | QString filename = fileDlg->LineEdit1->text(); | 1065 | QString filename = fileDlg->LineEdit1->text(); |
1064 | destFile = currentRemoteDir.canonicalPath()+"/"+destFile; | 1066 | destFile = currentRemoteDir.canonicalPath()+"/"+destFile; |
1065 | 1067 | ||
1066 | QFile f(destFile); | 1068 | QFile f(destFile); |
1067 | if( f.exists()) | 1069 | if( f.exists()) |
1068 | f.remove(); | 1070 | f.remove(); |
1069 | if(!copyFile(destFile, curFile) ) | 1071 | if(!copyFile(destFile, curFile) ) |
1070 | qWarning("nothin doing"); | 1072 | qWarning("nothin doing"); |
1071 | } | 1073 | } |
1072 | populateRemoteView(); | 1074 | populateRemoteView(); |
1073 | TabWidget->setCurrentPage(1); | 1075 | TabWidget->setCurrentPage(1); |
1074 | } else { | 1076 | } else { |
1075 | QString destFile = Remote_View->currentItem()->text(0); | 1077 | QString destFile = Remote_View->currentItem()->text(0); |
1076 | InputDialog *fileDlg; | 1078 | InputDialog *fileDlg; |
1077 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1079 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1078 | fileDlg->setInputText((const QString &) destFile); | 1080 | fileDlg->setInputText((const QString &) destFile); |
1079 | fileDlg->exec(); | 1081 | fileDlg->exec(); |
1080 | if( fileDlg->result() == 1 ) { | 1082 | if( fileDlg->result() == 1 ) { |
1081 | QString filename = fileDlg->LineEdit1->text(); | 1083 | QString filename = fileDlg->LineEdit1->text(); |
1082 | destFile = currentDir.canonicalPath()+"/"+destFile; | 1084 | destFile = currentDir.canonicalPath()+"/"+destFile; |
1083 | 1085 | ||
1084 | QFile f(destFile); | 1086 | QFile f(destFile); |
1085 | if( f.exists()) | 1087 | if( f.exists()) |
1086 | f.remove(); | 1088 | f.remove(); |
1087 | if(!copyFile(destFile, curFile) ) | 1089 | if(!copyFile(destFile, curFile) ) |
1088 | qWarning("nothin doing"); | 1090 | qWarning("nothin doing"); |
1089 | } | 1091 | } |
1090 | populateLocalView(); | 1092 | populateLocalView(); |
1091 | TabWidget->setCurrentPage(0); | 1093 | TabWidget->setCurrentPage(0); |
1092 | } | 1094 | } |
1093 | } | 1095 | } |
1094 | 1096 | ||
1095 | void AdvancedFm::move() { | 1097 | void AdvancedFm::move() { |
1096 | QString curFile = getPath(); | 1098 | QString curFile = getPath(); |
1097 | // qDebug(curFile); | 1099 | // qDebug(curFile); |
1098 | QString destFile; | 1100 | QString destFile; |
1099 | if (TabWidget->currentPageIndex() == 0) { | 1101 | if (TabWidget->currentPageIndex() == 0) { |
1100 | QString destFile = currentRemoteDir.canonicalPath()+Local_View->currentItem()->text(0); | 1102 | QString destFile = currentRemoteDir.canonicalPath() + "/" + Local_View->currentItem()->text(0); |
1101 | // qDebug(destFile); | 1103 | qDebug("Destination file is "+destFile); |
1102 | 1104 | ||
1103 | QFile f(destFile); | 1105 | QFile f(destFile); |
1104 | if( f.exists()) | 1106 | if( f.exists()) |
1105 | f.remove(); | 1107 | f.remove(); |
1106 | if(!copyFile( destFile, curFile) ) { | 1108 | if(!copyFile( destFile, curFile) ) { |
1107 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1109 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); |
1108 | return; | 1110 | return; |
1109 | } | 1111 | } |
1110 | QFile::remove(curFile); | 1112 | QFile::remove(curFile); |
1111 | TabWidget->setCurrentPage(1); | 1113 | TabWidget->setCurrentPage(1); |
1112 | } else { | 1114 | } else { |
1113 | QString destFile = currentDir.canonicalPath()+destFile + Remote_View->currentItem()->text(0); | 1115 | QString destFile = currentDir.canonicalPath() + "/" + Remote_View->currentItem()->text(0); |
1114 | // qDebug(destFile); | 1116 | qDebug("Destination file is "+destFile); |
1115 | 1117 | ||
1116 | QFile f(destFile); | 1118 | QFile f(destFile); |
1117 | if( f.exists()) | 1119 | if( f.exists()) |
1118 | f.remove(); | 1120 | f.remove(); |
1119 | if(!copyFile(destFile, curFile) ) { | 1121 | if(!copyFile(destFile, curFile) ) { |
1120 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1122 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); |
1121 | return; | 1123 | return; |
1122 | } | 1124 | } |
1123 | QFile::remove(curFile); | 1125 | QFile::remove(curFile); |
1124 | TabWidget->setCurrentPage(0); | 1126 | TabWidget->setCurrentPage(0); |
1125 | } | 1127 | } |
1126 | populateRemoteView(); | 1128 | populateRemoteView(); |
1127 | populateLocalView(); | 1129 | populateLocalView(); |
1128 | } | 1130 | } |
1129 | 1131 | ||
1130 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) | 1132 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) |
1131 | { | 1133 | { |
1132 | char bf[ 50000 ]; | 1134 | char bf[ 50000 ]; |
1133 | int bytesRead; | 1135 | int bytesRead; |
1134 | bool success = TRUE; | 1136 | bool success = TRUE; |
1135 | struct stat status; | 1137 | struct stat status; |
1136 | 1138 | ||
1137 | QFile s( src ); | 1139 | QFile s( src ); |
1138 | QFile d( dest ); | 1140 | QFile d( dest ); |
1139 | 1141 | ||
1140 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 1142 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
1141 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 1143 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
1142 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 1144 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
1143 | success = FALSE; | 1145 | success = FALSE; |
1144 | break; | 1146 | break; |
1145 | } | 1147 | } |
1146 | } | 1148 | } |
1147 | if( success && (bytesRead > 0) ){ | 1149 | if( success && (bytesRead > 0) ){ |
1148 | d.writeBlock( bf, bytesRead ); | 1150 | d.writeBlock( bf, bytesRead ); |
1149 | } | 1151 | } |
1150 | } else { | 1152 | } else { |
1151 | success = FALSE; | 1153 | success = FALSE; |
1152 | } | 1154 | } |
1153 | 1155 | ||
1154 | // Set file permissions | 1156 | // Set file permissions |
1155 | if( stat( (const char *) src, &status ) == 0 ){ | 1157 | if( stat( (const char *) src, &status ) == 0 ){ |
1156 | chmod( (const char *) dest, status.st_mode ); | 1158 | chmod( (const char *) dest, status.st_mode ); |
1157 | } | 1159 | } |
1158 | 1160 | ||
1159 | return success; | 1161 | return success; |
1160 | } | 1162 | } |
1161 | 1163 | ||
1162 | void AdvancedFm::runCommand() { | 1164 | void AdvancedFm::runCommand() { |
1163 | QString curFile; | 1165 | QString curFile; |
1164 | if (TabWidget->currentPageIndex() == 0) { | 1166 | if (TabWidget->currentPageIndex() == 0) { |
1165 | if( Local_View->currentItem()) | 1167 | if( Local_View->currentItem()) |
1166 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); | 1168 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); |
1167 | } else { | 1169 | } else { |
1168 | if(Remote_View->currentItem()) | 1170 | if(Remote_View->currentItem()) |
1169 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); | 1171 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); |
1170 | } | 1172 | } |
1171 | 1173 | ||
1172 | InputDialog *fileDlg; | 1174 | InputDialog *fileDlg; |
1173 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1175 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1174 | fileDlg->setInputText(curFile); | 1176 | fileDlg->setInputText(curFile); |
1175 | fileDlg->exec(); | 1177 | fileDlg->exec(); |
1176 | QString command; | 1178 | QString command; |
1177 | if( fileDlg->result() == 1 ) { | 1179 | if( fileDlg->result() == 1 ) { |
1178 | command = fileDlg->LineEdit1->text(); | 1180 | command = fileDlg->LineEdit1->text(); |
1179 | 1181 | ||
1180 | int err=0; | 1182 | int err=0; |
1181 | Output *outDlg; | 1183 | Output *outDlg; |
1182 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 1184 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
1183 | outDlg->showMaximized(); | 1185 | outDlg->showMaximized(); |
1184 | outDlg->show(); | 1186 | outDlg->show(); |
1185 | qApp->processEvents(); | 1187 | qApp->processEvents(); |
1186 | FILE *fp; | 1188 | FILE *fp; |
1187 | char line[130]; | 1189 | char line[130]; |
1188 | sleep(1); | 1190 | sleep(1); |
1189 | // if(command.find("2>",0,TRUE) != -1) | 1191 | // if(command.find("2>",0,TRUE) != -1) |
1190 | command +=" 2>&1"; | 1192 | command +=" 2>&1"; |
1191 | fp = popen( (const char *) command, "r"); | 1193 | fp = popen( (const char *) command, "r"); |
1192 | if ( !fp ) { | 1194 | if ( !fp ) { |
1193 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1195 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1194 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1196 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1195 | pclose(fp); | 1197 | pclose(fp); |
1196 | return; | 1198 | return; |
1197 | } else { | 1199 | } else { |
1198 | while ( fgets( line, sizeof line, fp)) { | 1200 | while ( fgets( line, sizeof line, fp)) { |
1199 | outDlg->OutputEdit->append(line); | 1201 | QString lineStr = line; |
1202 | lineStr=lineStr.left(lineStr.length()-1); | ||
1203 | outDlg->OutputEdit->append(lineStr); | ||
1200 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1204 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1201 | |||
1202 | } | 1205 | } |
1203 | |||
1204 | } | 1206 | } |
1205 | |||
1206 | } | 1207 | } |
1207 | |||
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | void AdvancedFm::runCommandStd() { | 1210 | void AdvancedFm::runCommandStd() { |
1211 | QString curFile; | 1211 | QString curFile; |
1212 | if (TabWidget->currentPageIndex() == 0) { | 1212 | if (TabWidget->currentPageIndex() == 0) { |
1213 | if( Local_View->currentItem()) | 1213 | if( Local_View->currentItem()) |
1214 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); | 1214 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); |
1215 | } else { | 1215 | } else { |
1216 | if(Remote_View->currentItem()) | 1216 | if(Remote_View->currentItem()) |
1217 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); | 1217 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | InputDialog *fileDlg; | 1220 | InputDialog *fileDlg; |
1221 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1221 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1222 | fileDlg->setInputText(curFile); | 1222 | fileDlg->setInputText(curFile); |
1223 | fileDlg->exec(); | 1223 | fileDlg->exec(); |
1224 | QString command; | 1224 | QString command; |
1225 | if( fileDlg->result() == 1 ) { | 1225 | if( fileDlg->result() == 1 ) { |
1226 | qApp->processEvents(); | 1226 | qApp->processEvents(); |
1227 | command = fileDlg->LineEdit1->text() + " &"; | 1227 | command = fileDlg->LineEdit1->text() + " &"; |
1228 | system(command.latin1()); | 1228 | system(command.latin1()); |
1229 | } | 1229 | } |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | void AdvancedFm::fileStatus() { | 1232 | void AdvancedFm::fileStatus() { |
1233 | QString curFile; | 1233 | QString curFile; |
1234 | if (TabWidget->currentPageIndex() == 0) { | 1234 | if (TabWidget->currentPageIndex() == 0) { |
1235 | curFile = Local_View->currentItem()->text(0); | 1235 | curFile = Local_View->currentItem()->text(0); |
1236 | } else { | 1236 | } else { |
1237 | curFile = Remote_View->currentItem()->text(0); | 1237 | curFile = Remote_View->currentItem()->text(0); |
1238 | } | 1238 | } |
1239 | QString command = " stat -l "+ curFile +" 2>&1"; | 1239 | QString command = " stat -l "+ curFile +" 2>&1"; |
1240 | int err=0; | 1240 | int err=0; |
1241 | Output *outDlg; | 1241 | Output *outDlg; |
1242 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 1242 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
1243 | outDlg->showMaximized(); | 1243 | outDlg->showMaximized(); |
1244 | outDlg->show(); | 1244 | outDlg->show(); |
1245 | qApp->processEvents(); | 1245 | qApp->processEvents(); |
1246 | FILE *fp; | 1246 | FILE *fp; |
1247 | char line[130]; | 1247 | char line[130]; |
1248 | sleep(1); | 1248 | sleep(1); |
1249 | fp = popen( (const char *) command, "r"); | 1249 | fp = popen( (const char *) command, "r"); |
1250 | if ( !fp ) { | 1250 | if ( !fp ) { |
1251 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1251 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1252 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1252 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1253 | pclose(fp); | 1253 | pclose(fp); |
1254 | return; | 1254 | return; |
1255 | } else { | 1255 | } else { |
1256 | while ( fgets( line, sizeof line, fp)) { | 1256 | while ( fgets( line, sizeof line, fp)) { |
1257 | outDlg->OutputEdit->append(line); | 1257 | outDlg->OutputEdit->append(line); |
1258 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1258 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1259 | 1259 | ||
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | } | 1262 | } |
1263 | } | 1263 | } |
1264 | |||
1265 | void AdvancedFm::doAbout() { | ||
1266 | QMessageBox::message("AdvancedFm","Advanced FileManager\n" | ||
1267 | "is copyright 2002 by\n" | ||
1268 | "L.J.Potter<llornkcor@handhelds.org>\n" | ||
1269 | "and is licensed by the GPL"); | ||
1270 | } | ||
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 2ca45b1..30ff28c 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -1,118 +1,119 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | opieftp.h | 2 | opieftp.h |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #ifndef ADVANCEDFM_H | 12 | #ifndef ADVANCEDFM_H |
13 | #define ADVANCEDFM_H | 13 | #define ADVANCEDFM_H |
14 | 14 | ||
15 | #include <qvariant.h> | 15 | #include <qvariant.h> |
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | #include <qmainwindow.h> | 17 | #include <qmainwindow.h> |
18 | #include <qdir.h> | 18 | #include <qdir.h> |
19 | #include <qstring.h> | 19 | #include <qstring.h> |
20 | #include <qpoint.h> | 20 | #include <qpoint.h> |
21 | 21 | ||
22 | class QVBoxLayout; | 22 | class QVBoxLayout; |
23 | class QHBoxLayout; | 23 | class QHBoxLayout; |
24 | class QGridLayout; | 24 | class QGridLayout; |
25 | class QComboBox; | 25 | class QComboBox; |
26 | class QListView; | 26 | class QListView; |
27 | class QListviewItem; | 27 | class QListviewItem; |
28 | class QLabel; | 28 | class QLabel; |
29 | class QProgressBar; | 29 | class QProgressBar; |
30 | class QSpinBox; | 30 | class QSpinBox; |
31 | class QTabWidget; | 31 | class QTabWidget; |
32 | class QWidget; | 32 | class QWidget; |
33 | class QPEToolBar; | 33 | class QPEToolBar; |
34 | class QPEMenuBar; | 34 | class QPEMenuBar; |
35 | class QPopupMenu; | 35 | class QPopupMenu; |
36 | class QFile; | 36 | class QFile; |
37 | class QListViewItem; | 37 | class QListViewItem; |
38 | class QLineEdit; | 38 | class QLineEdit; |
39 | class QPushButton; | 39 | class QPushButton; |
40 | 40 | ||
41 | class AdvancedFm : public QMainWindow | 41 | class AdvancedFm : public QMainWindow |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
45 | AdvancedFm(); | 45 | AdvancedFm(); |
46 | ~AdvancedFm(); | 46 | ~AdvancedFm(); |
47 | 47 | ||
48 | QTabWidget *TabWidget; | 48 | QTabWidget *TabWidget; |
49 | QWidget *tab, *tab_2, *tab_3; | 49 | QWidget *tab, *tab_2, *tab_3; |
50 | QListView *Local_View, *Remote_View; | 50 | QListView *Local_View, *Remote_View; |
51 | 51 | ||
52 | QLineEdit *currentPathEdit; | 52 | QLineEdit *currentPathEdit; |
53 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; | 53 | QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; |
54 | QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton; | 54 | QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton; |
55 | QDir currentDir, currentRemoteDir; | 55 | QDir currentDir, currentRemoteDir; |
56 | QComboBox *currentPathCombo; | 56 | QComboBox *currentPathCombo; |
57 | QString filterStr; | 57 | QString filterStr; |
58 | QListViewItem * item; | 58 | QListViewItem * item; |
59 | bool b; | 59 | bool b; |
60 | int currentServerConfig; | 60 | int currentServerConfig; |
61 | protected slots: | 61 | protected slots: |
62 | void showLocalMenu( QListViewItem *); | 62 | void showLocalMenu( QListViewItem *); |
63 | void showRemoteMenu( QListViewItem *); | 63 | void showRemoteMenu( QListViewItem *); |
64 | void doLocalCd(); | 64 | void doLocalCd(); |
65 | void doRemoteCd(); | 65 | void doRemoteCd(); |
66 | // void copy(); | 66 | // void copy(); |
67 | 67 | ||
68 | void populateLocalView(); | 68 | void populateLocalView(); |
69 | void populateRemoteView(); | 69 | void populateRemoteView(); |
70 | void showHidden(); | 70 | void showHidden(); |
71 | void showRemoteHidden(); | 71 | void showRemoteHidden(); |
72 | void writeConfig(); | 72 | void writeConfig(); |
73 | void readConfig(); | 73 | void readConfig(); |
74 | void localListClicked(QListViewItem *); | 74 | void localListClicked(QListViewItem *); |
75 | void remoteListClicked(QListViewItem *); | 75 | void remoteListClicked(QListViewItem *); |
76 | void localListPressed( int, QListViewItem *, const QPoint&, int); | 76 | void localListPressed( int, QListViewItem *, const QPoint&, int); |
77 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); | 77 | void remoteListPressed( int, QListViewItem *, const QPoint&, int); |
78 | void localMakDir(); | 78 | void localMakDir(); |
79 | void localDelete(); | 79 | void localDelete(); |
80 | void remoteMakDir(); | 80 | void remoteMakDir(); |
81 | void remoteDelete(); | 81 | void remoteDelete(); |
82 | /* bool remoteDirList(const QString &); */ | 82 | /* bool remoteDirList(const QString &); */ |
83 | /* bool remoteChDir(const QString &); */ | 83 | /* bool remoteChDir(const QString &); */ |
84 | void tabChanged(QWidget*); | 84 | void tabChanged(QWidget*); |
85 | void cleanUp(); | 85 | void cleanUp(); |
86 | void remoteRename(); | 86 | void remoteRename(); |
87 | void localRename(); | 87 | void localRename(); |
88 | void runThis(); | 88 | void runThis(); |
89 | void runText(); | 89 | void runText(); |
90 | void filePerms(); | 90 | void filePerms(); |
91 | void doProperties(); | 91 | void doProperties(); |
92 | void runCommand(); | 92 | void runCommand(); |
93 | void runCommandStd(); | 93 | void runCommandStd(); |
94 | QString getPath(); | 94 | QString getPath(); |
95 | void switchToLocalTab(); | 95 | void switchToLocalTab(); |
96 | void switchToRemoteTab(); | 96 | void switchToRemoteTab(); |
97 | 97 | ||
98 | protected: | 98 | protected: |
99 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 99 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
100 | QStringList remoteDirPathStringList, localDirPathStringList; | 100 | QStringList remoteDirPathStringList, localDirPathStringList; |
101 | 101 | ||
102 | protected slots: | 102 | protected slots: |
103 | void homeButtonPushed(); | 103 | void homeButtonPushed(); |
104 | void docButtonPushed(); | 104 | void docButtonPushed(); |
105 | void SDButtonPushed(); | 105 | void SDButtonPushed(); |
106 | void CFButtonPushed(); | 106 | void CFButtonPushed(); |
107 | void upDir(); | 107 | void upDir(); |
108 | void currentPathComboChanged(); | 108 | void currentPathComboChanged(); |
109 | void copy(); | 109 | void copy(); |
110 | void copyAs(); | 110 | void copyAs(); |
111 | void currentPathComboActivated(const QString &); | 111 | void currentPathComboActivated(const QString &); |
112 | void fillCombo(const QString &); | 112 | void fillCombo(const QString &); |
113 | bool copyFile( const QString & , const QString & ); | 113 | bool copyFile( const QString & , const QString & ); |
114 | void move(); | 114 | void move(); |
115 | void fileStatus(); | 115 | void fileStatus(); |
116 | void doAbout(); | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | #endif // ADVANCEDFM_H | 119 | #endif // ADVANCEDFM_H |
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp index 6970f58..82e78a7 100644 --- a/noncore/apps/advancedfm/output.cpp +++ b/noncore/apps/advancedfm/output.cpp | |||
@@ -1,38 +1,180 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** outputEdit.cpp | 2 | ** outputEdit.cpp |
3 | ** | 3 | ** |
4 | ** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> | 4 | ** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> |
5 | ****************************************************************************/ | 5 | ****************************************************************************/ |
6 | #include "output.h" | 6 | #include "output.h" |
7 | #include "inputDialog.h" | ||
7 | 8 | ||
9 | #include <qpe/filemanager.h> | ||
10 | #include <qpe/qpeapplication.h> | ||
11 | #include <qpe/applnk.h> | ||
12 | |||
13 | #include <qfile.h> | ||
14 | |||
15 | #include <qlineedit.h> | ||
8 | #include <qmultilineedit.h> | 16 | #include <qmultilineedit.h> |
9 | #include <qpushbutton.h> | 17 | #include <qpushbutton.h> |
10 | #include <qlayout.h> | 18 | #include <qlayout.h> |
11 | #include <qvariant.h> | 19 | #include <qvariant.h> |
12 | #include <qtooltip.h> | 20 | |
13 | #include <qwhatsthis.h> | 21 | /* XPM */ |
22 | static char * filesave_xpm[] = { | ||
23 | "16 16 78 1", | ||
24 | " c None", | ||
25 | ". c #343434", | ||
26 | "+ c #A0A0A0", | ||
27 | "@ c #565656", | ||
28 | "# c #9E9E9E", | ||
29 | "$ c #525252", | ||
30 | "% c #929292", | ||
31 | "& c #676767", | ||
32 | "* c #848484", | ||
33 | "= c #666666", | ||
34 | "- c #D8D8D8", | ||
35 | "; c #FFFFFF", | ||
36 | "> c #DBDBDB", | ||
37 | ", c #636363", | ||
38 | "' c #989898", | ||
39 | ") c #2D2D2D", | ||
40 | "! c #909090", | ||
41 | "~ c #AEAEAE", | ||
42 | "{ c #EAEAEA", | ||
43 | "] c #575757", | ||
44 | "^ c #585858", | ||
45 | "/ c #8A8A8A", | ||
46 | "( c #828282", | ||
47 | "_ c #6F6F6F", | ||
48 | ": c #C9C9C9", | ||
49 | "< c #050505", | ||
50 | "[ c #292929", | ||
51 | "} c #777777", | ||
52 | "| c #616161", | ||
53 | "1 c #3A3A3A", | ||
54 | "2 c #BEBEBE", | ||
55 | "3 c #2C2C2C", | ||
56 | "4 c #7C7C7C", | ||
57 | "5 c #F6F6F6", | ||
58 | "6 c #FCFCFC", | ||
59 | "7 c #6B6B6B", | ||
60 | "8 c #959595", | ||
61 | "9 c #4F4F4F", | ||
62 | "0 c #808080", | ||
63 | "a c #767676", | ||
64 | "b c #818181", | ||
65 | "c c #B8B8B8", | ||
66 | "d c #FBFBFB", | ||
67 | "e c #F9F9F9", | ||
68 | "f c #CCCCCC", | ||
69 | "g c #030303", | ||
70 | "h c #737373", | ||
71 | "i c #7A7A7A", | ||
72 | "j c #7E7E7E", | ||
73 | "k c #6A6A6A", | ||
74 | "l c #FAFAFA", | ||
75 | "m c #505050", | ||
76 | "n c #9D9D9D", | ||
77 | "o c #333333", | ||
78 | "p c #7B7B7B", | ||
79 | "q c #787878", | ||
80 | "r c #696969", | ||
81 | "s c #494949", | ||
82 | "t c #555555", | ||
83 | "u c #949494", | ||
84 | "v c #E6E6E6", | ||
85 | "w c #424242", | ||
86 | "x c #515151", | ||
87 | "y c #535353", | ||
88 | "z c #3E3E3E", | ||
89 | "A c #D4D4D4", | ||
90 | "B c #0C0C0C", | ||
91 | "C c #353535", | ||
92 | "D c #474747", | ||
93 | "E c #ECECEC", | ||
94 | "F c #919191", | ||
95 | "G c #7D7D7D", | ||
96 | "H c #000000", | ||
97 | "I c #404040", | ||
98 | "J c #858585", | ||
99 | "K c #323232", | ||
100 | "L c #D0D0D0", | ||
101 | "M c #1C1C1C", | ||
102 | " ...+ ", | ||
103 | " @#$%&..+ ", | ||
104 | " .*=-;;>,..+ ", | ||
105 | " ')!~;;;;;;{]..", | ||
106 | " ^/(-;;;;;;;_:<", | ||
107 | " [}|;;;;;;;{12$", | ||
108 | " #34-55;;;;678$+", | ||
109 | " 90ab=c;dd;e1fg ", | ||
110 | " [ahij((kbl0mn$ ", | ||
111 | " op^q^^7r&]s/$+ ", | ||
112 | "@btu;vbwxy]zAB ", | ||
113 | "CzDEvEv;;DssF$ ", | ||
114 | "G.H{E{E{IxsJ$+ ", | ||
115 | " +...vEKxzLM ", | ||
116 | " +...z]n$ ", | ||
117 | " +... "}; | ||
14 | 118 | ||
15 | Output::Output( QWidget* parent, const char* name, bool modal, WFlags fl ) | 119 | Output::Output( QWidget* parent, const char* name, bool modal, WFlags fl ) |
16 | : QDialog( parent, name, modal, fl ) | 120 | : QDialog( parent, name, modal, fl ) |
17 | { | 121 | { |
18 | if ( !name ) | 122 | if ( !name ) |
19 | setName( "Output" ); | 123 | setName( "Output" ); |
20 | resize( 196, 269 ); | 124 | resize( 196, 269 ); |
21 | setCaption( name ); | 125 | setCaption( name ); |
22 | OutputLayout = new QGridLayout( this ); | 126 | OutputLayout = new QGridLayout( this ); |
23 | OutputLayout->setSpacing( 6 ); | 127 | OutputLayout->setSpacing( 6 ); |
24 | OutputLayout->setMargin( 11 ); | 128 | OutputLayout->setMargin( 11 ); |
25 | 129 | ||
130 | QPushButton *docButton; | ||
131 | docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); | ||
132 | docButton->setFixedSize( QSize( 20, 20 ) ); | ||
133 | connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() )); | ||
134 | // docButton->setFlat(TRUE); | ||
135 | OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 ); | ||
136 | |||
137 | |||
26 | OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); | 138 | OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); |
139 | OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 ); | ||
140 | |||
27 | 141 | ||
28 | OutputLayout->addWidget( OutputEdit, 0, 0 ); | ||
29 | } | 142 | } |
30 | 143 | ||
31 | /* | 144 | /* |
32 | * Destroys the object and frees any allocated resources | 145 | * Destroys the object and frees any allocated resources |
33 | */ | 146 | */ |
34 | Output::~Output() | 147 | Output::~Output() |
35 | { | 148 | { |
36 | // no need to delete child widgets, Qt does it all for us | 149 | // no need to delete child widgets, Qt does it all for us |
37 | } | 150 | } |
38 | 151 | ||
152 | void Output::saveOutput() { | ||
153 | |||
154 | InputDialog *fileDlg; | ||
155 | fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); | ||
156 | fileDlg->exec(); | ||
157 | if( fileDlg->result() == 1 ) { | ||
158 | QString filename = QPEApplication::documentDir(); | ||
159 | if(filename.right(1).find('/') == -1) | ||
160 | filename+="/"; | ||
161 | QString name = fileDlg->LineEdit1->text(); | ||
162 | filename+="text/plain/"+name; | ||
163 | qDebug(filename); | ||
164 | |||
165 | QFile f(filename); | ||
166 | f.open( IO_WriteOnly); | ||
167 | if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { | ||
168 | DocLnk lnk; | ||
169 | lnk.setName(name); //sets file name | ||
170 | lnk.setFile(filename); //sets File property | ||
171 | lnk.setType("text/plain"); | ||
172 | if(!lnk.writeLink()) { | ||
173 | qDebug("Writing doclink did not work"); | ||
174 | } | ||
175 | } else | ||
176 | qWarning("Could not write file"); | ||
177 | f.close(); | ||
178 | |||
179 | } | ||
180 | } | ||
diff --git a/noncore/apps/advancedfm/output.h b/noncore/apps/advancedfm/output.h index 84adccd..c1e48da 100644 --- a/noncore/apps/advancedfm/output.h +++ b/noncore/apps/advancedfm/output.h | |||
@@ -1,33 +1,35 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Form interface generated from reading ui file 'outputEdit.ui' | 2 | ** Form interface generated from reading ui file 'outputEdit.ui' |
3 | ** | 3 | ** |
4 | ** Created: Fri Apr 12 15:12:44 2002 | 4 | ** Created: Fri Apr 12 15:12:44 2002 |
5 | ** by: The User Interface Compiler (uic) | 5 | ** by: The User Interface Compiler (uic) |
6 | ** | 6 | ** |
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | #ifndef OUTPUT_H | 9 | #ifndef OUTPUT_H |
10 | #define OUTPUT_H | 10 | #define OUTPUT_H |
11 | 11 | ||
12 | #include <qvariant.h> | 12 | #include <qvariant.h> |
13 | #include <qdialog.h> | 13 | #include <qdialog.h> |
14 | class QVBoxLayout; | 14 | class QVBoxLayout; |
15 | class QHBoxLayout; | 15 | class QHBoxLayout; |
16 | class QGridLayout; | 16 | class QGridLayout; |
17 | class QMultiLineEdit; | 17 | class QMultiLineEdit; |
18 | 18 | ||
19 | class Output : public QDialog | 19 | class Output : public QDialog |
20 | { | 20 | { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | 22 | ||
23 | public: | 23 | public: |
24 | Output( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 24 | Output( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
25 | ~Output(); | 25 | ~Output(); |
26 | 26 | ||
27 | QMultiLineEdit* OutputEdit; | 27 | QMultiLineEdit* OutputEdit; |
28 | 28 | ||
29 | protected: | 29 | protected: |
30 | QGridLayout* OutputLayout; | 30 | QGridLayout* OutputLayout; |
31 | protected slots: | ||
32 | void saveOutput(); | ||
31 | }; | 33 | }; |
32 | 34 | ||
33 | #endif // OUTPUT_H | 35 | #endif // OUTPUT_H |