summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-27 22:49:18 (UTC)
committer zecke <zecke>2002-04-27 22:49:18 (UTC)
commitdb95cde435e507833f58111237f86cb9f9ac927a (patch) (unidiff)
treeffc8883ee58398e99d47e5209affd5a451d579ed
parent8e3c0aa915801b862f97ba7a7598ef5f3bd350aa (diff)
downloadopie-db95cde435e507833f58111237f86cb9f9ac927a.zip
opie-db95cde435e507833f58111237f86cb9f9ac927a.tar.gz
opie-db95cde435e507833f58111237f86cb9f9ac927a.tar.bz2
View Interface
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/libopie.pro2
-rw-r--r--libopie/ofileselector.cc1
-rw-r--r--libopie/ofileview.h79
3 files changed, 81 insertions, 1 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro
index b2ecd07..ba64bda 100644
--- a/libopie/libopie.pro
+++ b/libopie/libopie.pro
@@ -1,8 +1,8 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qte warn_on release 2CONFIG += qte warn_on release
3 HEADERS = ofontmenu.h ofileselector.h ofiledialog.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h colordialog.h colorpopupmenu.h 3 HEADERS = ofontmenu.h ofileselector.h ofiledialog.h ofileview.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h colordialog.h colorpopupmenu.h
4 SOURCES = ofontmenu.cc ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp colordialog.cpp colorpopupmenu.cpp 4 SOURCES = ofontmenu.cc ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp colordialog.cpp colorpopupmenu.cpp
5 TARGET = opie 5 TARGET = opie
6INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
7DESTDIR = $(QTDIR)/lib$(PROJMAK) 7DESTDIR = $(QTDIR)/lib$(PROJMAK)
8#VERSION = 1.0.0 8#VERSION = 1.0.0
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 0a6e595..0e508af 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -1,1084 +1,1085 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 3             .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 5 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include <qnamespace.h> 29#include <qnamespace.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qcombobox.h> 31#include <qcombobox.h>
32#include <qhbox.h> 32#include <qhbox.h>
33#include <qvbox.h> 33#include <qvbox.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qwidgetstack.h> 35#include <qwidgetstack.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qcheckbox.h> 37#include <qcheckbox.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qheader.h> 39#include <qheader.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qpainter.h> 41#include <qpainter.h>
42#include <qaction.h> 42#include <qaction.h>
43#include <qpopupmenu.h> 43#include <qpopupmenu.h>
44#include <qcursor.h> 44#include <qcursor.h>
45#include <qstringlist.h> 45#include <qstringlist.h>
46#include <qmessagebox.h> 46#include <qmessagebox.h>
47 47
48#include <qpe/qpeapplication.h> 48#include <qpe/qpeapplication.h>
49#include <qpe/fileselector.h> 49#include <qpe/fileselector.h>
50#include <qpe/applnk.h> 50#include <qpe/applnk.h>
51#include <qpe/global.h> 51#include <qpe/global.h>
52#include <qpe/mimetype.h> 52#include <qpe/mimetype.h>
53#include <qpe/resource.h> 53#include <qpe/resource.h>
54#include <qpe/storage.h> 54#include <qpe/storage.h>
55 55
56#include <unistd.h> 56#include <unistd.h>
57#include <stdlib.h> 57#include <stdlib.h>
58#include <sys/stat.h> 58#include <sys/stat.h>
59 59
60#include "ofileselector.h" 60#include "ofileselector.h"
61//#include "ofileview.h"
61 62
62QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; 63QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0;
63 64
64namespace { 65namespace {
65 66
66 int indexByString( const QComboBox *box, const QString &str ){ 67 int indexByString( const QComboBox *box, const QString &str ){
67 int index= -1; 68 int index= -1;
68 for(int i= 0; i < box->count(); i++ ){ 69 for(int i= 0; i < box->count(); i++ ){
69 if( str == box->text(i ) ){ 70 if( str == box->text(i ) ){
70 index= i; 71 index= i;
71 break; 72 break;
72 } 73 }
73 } 74 }
74 return index; 75 return index;
75 } 76 }
76 class OFileSelectorItem : public QListViewItem { 77 class OFileSelectorItem : public QListViewItem {
77 public: 78 public:
78 OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, 79 OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path,
79 const QString &date, const QString &size, const QString &mDir, 80 const QString &date, const QString &size, const QString &mDir,
80 bool isLocked=false, bool isDir=false ): QListViewItem(view) { 81 bool isLocked=false, bool isDir=false ): QListViewItem(view) {
81 setPixmap(0, pixmap ); 82 setPixmap(0, pixmap );
82 setText(1, path ); 83 setText(1, path );
83 setText(2, size ); 84 setText(2, size );
84 setText(3, date ); 85 setText(3, date );
85 //setText(4, mDir ); 86 //setText(4, mDir );
86 m_dir = mDir; 87 m_dir = mDir;
87 dir = isDir; 88 dir = isDir;
88 mLocked = isLocked; 89 mLocked = isLocked;
89 } 90 }
90 bool isLocked() const{ 91 bool isLocked() const{
91 return mLocked; 92 return mLocked;
92 } 93 }
93 QString directory()const{ 94 QString directory()const{
94 return m_dir; 95 return m_dir;
95 } 96 }
96 bool isDir()const{ 97 bool isDir()const{
97 return dir; 98 return dir;
98 } 99 }
99 QString path()const{ 100 QString path()const{
100 return text(1 ); 101 return text(1 );
101 } 102 }
102 QString key(int id, bool )const { 103 QString key(int id, bool )const {
103 QString ke; 104 QString ke;
104 if( id == 0 || id == 1 ){ // name 105 if( id == 0 || id == 1 ){ // name
105 if( dir ){ 106 if( dir ){
106 ke.append("0" ); 107 ke.append("0" );
107 ke.append( text(1) ); 108 ke.append( text(1) );
108 }else{ 109 }else{
109 ke.append("1" ); 110 ke.append("1" );
110 ke.append( text(1) ); 111 ke.append( text(1) );
111 } 112 }
112 }else if( id == 2 ){ // size 113 }else if( id == 2 ){ // size
113 return text(2); 114 return text(2);
114 }else if( id == 3 ){ // date 115 }else if( id == 3 ){ // date
115 return text(3); 116 return text(3);
116 } 117 }
117 return ke; 118 return ke;
118 }; 119 };
119 private: 120 private:
120 bool mLocked:1; 121 bool mLocked:1;
121 bool dir:1; 122 bool dir:1;
122 QString m_dir; 123 QString m_dir;
123 }; 124 };
124}; 125};
125 126
126 127
127OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, 128OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName,
128 const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) 129 const QString &fileName, const QStringList &mimetypes ) : QWidget( wid )
129{ 130{
130 if(wid!=0) 131 if(wid!=0)
131 resize(wid->width(),wid->height()); 132 resize(wid->width(),wid->height());
132 m_selector = selector; 133 m_selector = selector;
133 m_currentDir = dirName; 134 m_currentDir = dirName;
134 m_name = fileName; 135 m_name = fileName;
135 m_mimetypes = mimetypes; 136 m_mimetypes = mimetypes;
136 137
137 if( mimetypes.isEmpty() ) 138 if( mimetypes.isEmpty() )
138 m_autoMime = true; 139 m_autoMime = true;
139 140
140 qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() ); 141 qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() );
141 m_mode = mode; 142 m_mode = mode;
142 m_shTool = true; 143 m_shTool = true;
143 m_shPerm = true; 144 m_shPerm = true;
144 m_shLne = true; 145 m_shLne = true;
145 m_shChooser = true; 146 m_shChooser = true;
146 m_shYesNo = true; 147 m_shYesNo = true;
147 148
148 // for FILESELECTOR only view is interesting 149 // for FILESELECTOR only view is interesting
149 m_location = 0; 150 m_location = 0;
150 m_homeButton = 0; 151 m_homeButton = 0;
151 m_docButton = 0; 152 m_docButton = 0;
152 m_hideButton = 0; 153 m_hideButton = 0;
153 m_ok = 0; 154 m_ok = 0;
154 m_cancel = 0; 155 m_cancel = 0;
155 m_reread = 0; 156 m_reread = 0;
156 m_up = 0; 157 m_up = 0;
157 m_View = 0; 158 m_View = 0;
158 m_select = 0; 159 m_select = 0;
159 m_stack = 0; 160 m_stack = 0;
160 161
161 m_select = 0; 162 m_select = 0;
162 m_stack = 0; 163 m_stack = 0;
163 m_lay = 0; 164 m_lay = 0;
164 m_boxToolbar = 0; 165 m_boxToolbar = 0;
165 m_boxOk = 0; 166 m_boxOk = 0;
166 m_edit = 0; 167 m_edit = 0;
167 168
168 m_fnLabel = 0; 169 m_fnLabel = 0;
169 m_checkPerm = 0; 170 m_checkPerm = 0;
170 m_mimeCheck = 0; 171 m_mimeCheck = 0;
171 m_viewCheck = 0; 172 m_viewCheck = 0;
172 173
173 m_pseudo = 0; 174 m_pseudo = 0;
174 m_pseudoLayout = 0; 175 m_pseudoLayout = 0;
175 176
176 m_dir = true; 177 m_dir = true;
177 m_files = true; 178 m_files = true;
178 m_custom = 0; 179 m_custom = 0;
179 m_showPopup = true; 180 m_showPopup = true;
180 181
181 if(m_pixmaps == 0 ) // init the pixmaps 182 if(m_pixmaps == 0 ) // init the pixmaps
182 initPics(); 183 initPics();
183 184
184 m_lay = new QVBoxLayout(this); 185 m_lay = new QVBoxLayout(this);
185 init(); 186 init();
186 m_edit->setText( fileName ); 187 m_edit->setText( fileName );
187} 188}
188 189
189void OFileSelector::initPics() 190void OFileSelector::initPics()
190{ 191{
191 qWarning("init pics" ); 192 qWarning("init pics" );
192 m_pixmaps = new QMap<QString,QPixmap>; 193 m_pixmaps = new QMap<QString,QPixmap>;
193 QPixmap pm = Resource::loadPixmap( "folder" ); 194 QPixmap pm = Resource::loadPixmap( "folder" );
194 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 195 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
195 QPainter painter( &pm ); 196 QPainter painter( &pm );
196 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 197 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
197 pm.setMask( pm.createHeuristicMask( FALSE ) ); 198 pm.setMask( pm.createHeuristicMask( FALSE ) );
198 m_pixmaps->insert("dirsymlink", pm ); 199 m_pixmaps->insert("dirsymlink", pm );
199 200
200 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); 201 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" );
201 QPainter pen(&pm2 ); 202 QPainter pen(&pm2 );
202 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); 203 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk );
203 pm2.setMask( pm2.createHeuristicMask( FALSE ) ); 204 pm2.setMask( pm2.createHeuristicMask( FALSE ) );
204 m_pixmaps->insert("symlinkedlocked", pm2 ); 205 m_pixmaps->insert("symlinkedlocked", pm2 );
205 206
206} 207}
207 208
208// let's initialize the gui 209// let's initialize the gui
209/** 210/**
210 -------------------- 211 --------------------
211 | cmbBox Button | 212 | cmbBox Button |
212 -------------------- 213 --------------------
213 | FileSlector | 214 | FileSlector |
214 | or | 215 | or |
215 | OSelector | 216 | OSelector |
216 | | 217 | |
217 | | 218 | |
218 ____________________ 219 ____________________
219 | LineEdit | 220 | LineEdit |
220 ____________________ 221 ____________________
221 | Permission Bar | 222 | Permission Bar |
222 ____________________ 223 ____________________
223 | ViewChoose | 224 | ViewChoose |
224 ____________________ 225 ____________________
225 | Save Cancel| 226 | Save Cancel|
226 ____________________ 227 ____________________
227 */ 228 */
228void OFileSelector::delItems() 229void OFileSelector::delItems()
229{ 230{
230 QLayoutIterator it = m_lay->iterator(); 231 QLayoutIterator it = m_lay->iterator();
231 while ( it.current() != 0 ){ 232 while ( it.current() != 0 ){
232 it.deleteCurrent(); 233 it.deleteCurrent();
233 } 234 }
234} 235}
235 236
236void OFileSelector::init() 237void OFileSelector::init()
237{ 238{
238// qDebug("init"); 239// qDebug("init");
239 m_stack = new QWidgetStack(this, "wstack" ); 240 m_stack = new QWidgetStack(this, "wstack" );
240 if( m_selector == NORMAL ){ 241 if( m_selector == NORMAL ){
241 QString currMime; 242 QString currMime;
242 if( m_mimeCheck != 0 ) 243 if( m_mimeCheck != 0 )
243 currMime = m_mimeCheck->currentText(); 244 currMime = m_mimeCheck->currentText();
244 updateMimes(); 245 updateMimes();
245 m_select = new FileSelector( currMime == "All" ? QString::null : currMime , 246 m_select = new FileSelector( currMime == "All" ? QString::null : currMime ,
246 m_stack, "fileselector", FALSE, FALSE ); 247 m_stack, "fileselector", FALSE, FALSE );
247 m_stack->addWidget(m_select, NORMAL ); 248 m_stack->addWidget(m_select, NORMAL );
248 m_lay->addWidget(m_stack ); 249 m_lay->addWidget(m_stack );
249 m_stack->raiseWidget(NORMAL ); 250 m_stack->raiseWidget(NORMAL );
250 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), 251 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ),
251 this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); 252 this, SLOT(slotFileBridgeSelected(const DocLnk &) ) );
252 m_pseudoLayout = 0l; 253 m_pseudoLayout = 0l;
253 254
254 } else { 255 } else {
255 initializeListView(); 256 initializeListView();
256 } 257 }
257 if(m_shLne ){ 258 if(m_shLne ){
258 initializeName(); 259 initializeName();
259 } 260 }
260 if(m_shPerm ){ 261 if(m_shPerm ){
261 m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" ); 262 m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" );
262 m_checkPerm->setChecked( false ); 263 m_checkPerm->setChecked( false );
263 m_lay->addWidget(m_checkPerm ); 264 m_lay->addWidget(m_checkPerm );
264 } 265 }
265 if( m_shChooser ) 266 if( m_shChooser )
266 initializeChooser(); 267 initializeChooser();
267 if(m_shYesNo ) 268 if(m_shYesNo )
268 initializeYes(); 269 initializeYes();
269 270
270 // m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) ); 271 // m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) );
271 // reparse(); 272 // reparse();
272 273
273} 274}
274 275
275void OFileSelector::setYesCancelVisible( bool show ) 276void OFileSelector::setYesCancelVisible( bool show )
276{ 277{
277 if ( show == m_shYesNo ) 278 if ( show == m_shYesNo )
278 return; 279 return;
279 m_shYesNo = show; 280 m_shYesNo = show;
280 if( !show ){ 281 if( !show ){
281 delete m_ok; 282 delete m_ok;
282 delete m_cancel; 283 delete m_cancel;
283 m_ok = 0; 284 m_ok = 0;
284 m_cancel = 0; 285 m_cancel = 0;
285 // delete m_boxOk; all ready deleted in delItems 286 // delete m_boxOk; all ready deleted in delItems
286 } 287 }
287 updateLay(); // recreate it and save the other states 288 updateLay(); // recreate it and save the other states
288} 289}
289 290
290void OFileSelector::setToolbarVisible( bool show ) 291void OFileSelector::setToolbarVisible( bool show )
291{ 292{
292 if ( m_shTool == show ) 293 if ( m_shTool == show )
293 return; 294 return;
294 if(!m_shTool ){ 295 if(!m_shTool ){
295 delete m_boxToolbar; 296 delete m_boxToolbar;
296 delete m_homeButton; 297 delete m_homeButton;
297 delete m_docButton; 298 delete m_docButton;
298 delete m_location; 299 delete m_location;
299 delete m_up; 300 delete m_up;
300 m_boxToolbar = 0; 301 m_boxToolbar = 0;
301 m_homeButton = 0; 302 m_homeButton = 0;
302 m_docButton = 0; 303 m_docButton = 0;
303 m_location = 0; 304 m_location = 0;
304 m_up = 0; 305 m_up = 0;
305 }; 306 };
306 updateLay();// overkill fix it 307 updateLay();// overkill fix it
307} 308}
308 309
309void OFileSelector::setPermissionBarVisible( bool show ) 310void OFileSelector::setPermissionBarVisible( bool show )
310{ 311{
311 if( show == m_shPerm ) 312 if( show == m_shPerm )
312 return; 313 return;
313 314
314 m_shPerm = show; 315 m_shPerm = show;
315 316
316 updateLay(); 317 updateLay();
317} 318}
318 319
319void OFileSelector::setLineEditVisible( bool show ) 320void OFileSelector::setLineEditVisible( bool show )
320{ 321{
321 if( show == m_shLne ) 322 if( show == m_shLne )
322 return; 323 return;
323 324
324 m_shLne = show; 325 m_shLne = show;
325 if( !show ){ 326 if( !show ){
326 delete m_edit; 327 delete m_edit;
327 delete m_fnLabel; 328 delete m_fnLabel;
328 m_edit = 0; 329 m_edit = 0;
329 m_fnLabel = 0; 330 m_fnLabel = 0;
330 //delete m_boxName; will be deleted 331 //delete m_boxName; will be deleted
331 } 332 }
332 updateLay(); 333 updateLay();
333} 334}
334 335
335void OFileSelector::setChooserVisible( bool show ) 336void OFileSelector::setChooserVisible( bool show )
336{ 337{
337 if( show = m_shChooser ) 338 if( show = m_shChooser )
338 return; 339 return;
339 m_shChooser = show; 340 m_shChooser = show;
340 if( !show ){ 341 if( !show ){
341 delete m_mimeCheck; 342 delete m_mimeCheck;
342 delete m_viewCheck; 343 delete m_viewCheck;
343 m_mimeCheck = 0; 344 m_mimeCheck = 0;
344 m_viewCheck = 0; 345 m_viewCheck = 0;
345 } 346 }
346 updateLay(); 347 updateLay();
347} 348}
348 349
349QCheckBox* OFileSelector::permissionCheckbox( ) 350QCheckBox* OFileSelector::permissionCheckbox( )
350{ 351{
351 return m_checkPerm; 352 return m_checkPerm;
352} 353}
353 354
354void OFileSelector::setCaseSensetive( bool caSe ) 355void OFileSelector::setCaseSensetive( bool caSe )
355{ 356{
356 m_case = caSe; 357 m_case = caSe;
357 reparse(); 358 reparse();
358} 359}
359 360
360void OFileSelector::setShowFiles(bool files ){ 361void OFileSelector::setShowFiles(bool files ){
361 m_files = files; 362 m_files = files;
362 reparse(); 363 reparse();
363} 364}
364 365
365void OFileSelector::setPopupMenu(QPopupMenu *pop ) 366void OFileSelector::setPopupMenu(QPopupMenu *pop )
366{ 367{
367 //delete oldpopup; 368 //delete oldpopup;
368 m_custom = pop; 369 m_custom = pop;
369} 370}
370 371
371bool OFileSelector::setPermission( ) const 372bool OFileSelector::setPermission( ) const
372{ 373{
373 if( m_checkPerm == 0 ) 374 if( m_checkPerm == 0 )
374 return false; 375 return false;
375 else 376 else
376 return m_checkPerm->isChecked(); 377 return m_checkPerm->isChecked();
377} 378}
378 379
379void OFileSelector::setPermissionChecked( bool check ) 380void OFileSelector::setPermissionChecked( bool check )
380{ 381{
381 if( m_checkPerm == 0 ) 382 if( m_checkPerm == 0 )
382 return; 383 return;
383 m_checkPerm->setChecked( check ); 384 m_checkPerm->setChecked( check );
384} 385}
385 386
386QString OFileSelector::selectedName( )const 387QString OFileSelector::selectedName( )const
387{ 388{
388 QString string; 389 QString string;
389 if( m_selector == NORMAL ){ 390 if( m_selector == NORMAL ){
390 const DocLnk *lnk = m_select->selected(); 391 const DocLnk *lnk = m_select->selected();
391 string = lnk->file(); 392 string = lnk->file();
392 }else if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 393 }else if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
393 QListViewItem *item = m_View->currentItem(); 394 QListViewItem *item = m_View->currentItem();
394 if(item != 0 ){ 395 if(item != 0 ){
395 string = m_currentDir + "/" + item->text( 1 ); 396 string = m_currentDir + "/" + item->text( 1 );
396 } 397 }
397 } 398 }
398 return string; 399 return string;
399} 400}
400 401
401QStringList OFileSelector::selectedNames()const 402QStringList OFileSelector::selectedNames()const
402{ 403{
403 QStringList list; 404 QStringList list;
404 return list; 405 return list;
405} 406}
406 407
407DocLnk OFileSelector::selectedDocument( )const 408DocLnk OFileSelector::selectedDocument( )const
408{ 409{
409 DocLnk lnk; 410 DocLnk lnk;
410 return lnk; 411 return lnk;
411} 412}
412void OFileSelector::updateLay() 413void OFileSelector::updateLay()
413{ 414{
414 /* if( m_shTool ) 415 /* if( m_shTool )
415 // 416 //
416 else 417 else
417 // hide 418 // hide
418 */ 419 */
419 // save the state 420 // save the state
420 bool check = false; 421 bool check = false;
421 if( m_checkPerm != 0 ) 422 if( m_checkPerm != 0 )
422 check = m_checkPerm->isChecked(); 423 check = m_checkPerm->isChecked();
423 QString text; 424 QString text;
424 425
425 if( m_edit != 0 ) 426 if( m_edit != 0 )
426 text = m_edit->text(); 427 text = m_edit->text();
427 // save current mimetype 428 // save current mimetype
428 429
429 delItems(); 430 delItems();
430 delete m_checkPerm; 431 delete m_checkPerm;
431 m_checkPerm = 0; 432 m_checkPerm = 0;
432 delete m_edit; 433 delete m_edit;
433 m_edit = 0; 434 m_edit = 0;
434 delete m_fnLabel; 435 delete m_fnLabel;
435 m_fnLabel = 0; 436 m_fnLabel = 0;
436 delete m_ok; 437 delete m_ok;
437 m_ok = 0; 438 m_ok = 0;
438 delete m_cancel; 439 delete m_cancel;
439 m_cancel = 0; 440 m_cancel = 0;
440 delete m_mimeCheck; 441 delete m_mimeCheck;
441 m_mimeCheck = 0; 442 m_mimeCheck = 0;
442 delete m_viewCheck; 443 delete m_viewCheck;
443 m_viewCheck = 0; 444 m_viewCheck = 0;
444 delete m_select; // test 445 delete m_select; // test
445 delete m_stack; 446 delete m_stack;
446 //delete m_list; 447 //delete m_list;
447 init(); 448 init();
448 if( m_shLne ) 449 if( m_shLne )
449 m_edit->setText(text ); 450 m_edit->setText(text );
450 if( m_shPerm ) 451 if( m_shPerm )
451 m_checkPerm->setChecked(check ); 452 m_checkPerm->setChecked(check );
452} 453}
453 454
454// let's update the mimetypes. Use the current mimefilter for the 2nd QDir retrieve 455// let's update the mimetypes. Use the current mimefilter for the 2nd QDir retrieve
455// insert QListViewItems with the right options 456// insert QListViewItems with the right options
456bool OFileSelector::compliesMime(const QString &path, const QString &mime ) 457bool OFileSelector::compliesMime(const QString &path, const QString &mime )
457{ 458{
458 if( mime == "All" ) 459 if( mime == "All" )
459 return true; 460 return true;
460 MimeType type( path ); 461 MimeType type( path );
461 if( type.id() == mime ) 462 if( type.id() == mime )
462 return true; 463 return true;
463 return false; 464 return false;
464} 465}
465 466
466void OFileSelector::reparse() 467void OFileSelector::reparse()
467{ 468{
468 qDebug("reparse"); 469 qDebug("reparse");
469 if(m_View== 0 || m_selector == NORMAL) 470 if(m_View== 0 || m_selector == NORMAL)
470 return; 471 return;
471 m_View->clear(); 472 m_View->clear();
472 QString currMime =m_mimeCheck->currentText(); 473 QString currMime =m_mimeCheck->currentText();
473 // update the mimetype now 474 // update the mimetype now
474 if( m_autoMime ) { 475 if( m_autoMime ) {
475 QDir dir( m_currentDir ); 476 QDir dir( m_currentDir );
476 m_mimetypes.clear(); 477 m_mimetypes.clear();
477 m_mimeCheck->clear(); 478 m_mimeCheck->clear();
478 dir.setFilter( QDir::Files | QDir::Readable ); 479 dir.setFilter( QDir::Files | QDir::Readable );
479 dir.setSorting(QDir::Size ); 480 dir.setSorting(QDir::Size );
480 const QFileInfoList *list = dir.entryInfoList(); 481 const QFileInfoList *list = dir.entryInfoList();
481 QFileInfoListIterator it( *list ); 482 QFileInfoListIterator it( *list );
482 QFileInfo *fi; 483 QFileInfo *fi;
483 while( (fi=it.current()) ){ 484 while( (fi=it.current()) ){
484 if(fi->extension() == QString::fromLatin1("desktop") ){ 485 if(fi->extension() == QString::fromLatin1("desktop") ){
485 ++it; 486 ++it;
486 continue; 487 continue;
487 } 488 }
488 MimeType type(fi->filePath() ); 489 MimeType type(fi->filePath() );
489 if( !m_mimetypes.contains( type.id() ) ) 490 if( !m_mimetypes.contains( type.id() ) )
490 m_mimetypes.append( type.id() ); 491 m_mimetypes.append( type.id() );
491 492
492 ++it; 493 ++it;
493 } 494 }
494 m_mimetypes.prepend("All" ); 495 m_mimetypes.prepend("All" );
495 m_mimeCheck->insertStringList(m_mimetypes ); 496 m_mimeCheck->insertStringList(m_mimetypes );
496 // set it to the current mimetype 497 // set it to the current mimetype
497 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) ); 498 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) );
498 }else{ 499 }else{
499 m_mimeCheck->clear(); 500 m_mimeCheck->clear();
500 m_mimeCheck->insertItem( m_mimetypes.join(";") ); 501 m_mimeCheck->insertItem( m_mimetypes.join(";") );
501 } 502 }
502 503
503 QDir dir( m_currentDir ); 504 QDir dir( m_currentDir );
504 //dir.setFilter(-1 ); 505 //dir.setFilter(-1 );
505 int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed; 506 int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed;
506 if( m_case ) 507 if( m_case )
507 sort = QDir::IgnoreCase; 508 sort = QDir::IgnoreCase;
508 dir.setSorting( sort ); 509 dir.setSorting( sort );
509 510
510 int filter; 511 int filter;
511 /* if( m_dir && !m_files) 512 /* if( m_dir && !m_files)
512 filter |= QDir::Dirs; 513 filter |= QDir::Dirs;
513 else if( !m_dir && m_files ) 514 else if( !m_dir && m_files )
514 filter |= QDir::Files; 515 filter |= QDir::Files;
515 else 516 else
516 filter |= QDir::All; 517 filter |= QDir::All;
517 */ 518 */
518 if( m_selector == EXTENDED_ALL ) 519 if( m_selector == EXTENDED_ALL )
519 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 520 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
520 else 521 else
521 filter = QDir::Files | QDir::Dirs | QDir::All; 522 filter = QDir::Files | QDir::Dirs | QDir::All;
522 dir.setFilter( filter ); 523 dir.setFilter( filter );
523 qDebug("infoList"); 524 qDebug("infoList");
524 const QFileInfoList *list = dir.entryInfoList(); 525 const QFileInfoList *list = dir.entryInfoList();
525 QFileInfoListIterator it( *list ); 526 QFileInfoListIterator it( *list );
526 QFileInfo *fi; 527 QFileInfo *fi;
527 while( (fi=it.current()) ){ 528 while( (fi=it.current()) ){
528 if(fi->fileName() == ".." || fi->fileName() == "." ){ 529 if(fi->fileName() == ".." || fi->fileName() == "." ){
529 ++it; 530 ++it;
530 continue; 531 continue;
531 } 532 }
532// qWarning("Test: %s", fi->fileName().latin1() ); 533// qWarning("Test: %s", fi->fileName().latin1() );
533 if(fi->isSymLink() ){ 534 if(fi->isSymLink() ){
534// qWarning("Symlink %s", fi->fileName().latin1() ); 535// qWarning("Symlink %s", fi->fileName().latin1() );
535 QString file = fi->dirPath(true)+"/"+ fi->readLink(); 536 QString file = fi->dirPath(true)+"/"+ fi->readLink();
536// qWarning("File ->%s", file.latin1() ); 537// qWarning("File ->%s", file.latin1() );
537 for(int i=0; i<=4; i++ ){ // prepend from dos 538 for(int i=0; i<=4; i++ ){ // prepend from dos
538 QFileInfo info( file ); 539 QFileInfo info( file );
539 if( !info.exists() ){ 540 if( !info.exists() ){
540// qWarning("does not exist" ); 541// qWarning("does not exist" );
541 addSymlink(currMime, fi, TRUE ); 542 addSymlink(currMime, fi, TRUE );
542 break; 543 break;
543 }else if( info.isDir() ){ 544 }else if( info.isDir() ){
544// qWarning("isDir" ); 545// qWarning("isDir" );
545 addDir(currMime, fi, TRUE ); 546 addDir(currMime, fi, TRUE );
546 break; 547 break;
547 }else if( info.isFile() ){ 548 }else if( info.isFile() ){
548// qWarning("isFile" ); 549// qWarning("isFile" );
549 addFile(currMime, fi, TRUE ); 550 addFile(currMime, fi, TRUE );
550 break; 551 break;
551 }else if( info.isSymLink() ){ 552 }else if( info.isSymLink() ){
552 file = info.dirPath(true)+ "/"+ info.readLink(); 553 file = info.dirPath(true)+ "/"+ info.readLink();
553// qWarning("isSymlink again %s", file.latin1() ); 554// qWarning("isSymlink again %s", file.latin1() );
554 }else if( i == 4 ){ // just insert it and have the symlink symbol 555 }else if( i == 4 ){ // just insert it and have the symlink symbol
555 addSymlink(currMime, fi ); 556 addSymlink(currMime, fi );
556// qWarning("level too deep" ); 557// qWarning("level too deep" );
557 } 558 }
558 } 559 }
559 }else if( fi->isDir() ){ 560 }else if( fi->isDir() ){
560 addDir(currMime, fi ); 561 addDir(currMime, fi );
561 }else if( fi->isFile() ) { // file ? 562 }else if( fi->isFile() ) { // file ?
562 addFile(currMime, fi ); 563 addFile(currMime, fi );
563 } 564 }
564 ++it; 565 ++it;
565 } 566 }
566 m_View->sort(); 567 m_View->sort();
567// m_View->ensureItemVisible(); 568// m_View->ensureItemVisible();
568} 569}
569 570
570QString OFileSelector::directory()const 571QString OFileSelector::directory()const
571{ 572{
572 QDir d( m_currentDir); 573 QDir d( m_currentDir);
573 return d.absPath(); 574 return d.absPath();
574} 575}
575 576
576int OFileSelector::fileCount() 577int OFileSelector::fileCount()
577{ 578{
578 return 0; 579 return 0;
579} 580}
580 581
581void OFileSelector::slotOk( ) 582void OFileSelector::slotOk( )
582{ 583{
583 emit ok(); 584 emit ok();
584} 585}
585 586
586void OFileSelector::slotCancel( ) 587void OFileSelector::slotCancel( )
587{ 588{
588 emit cancel(); 589 emit cancel();
589} 590}
590 591
591void OFileSelector::initializeName() 592void OFileSelector::initializeName()
592{ 593{
593 m_boxName = new QHBoxLayout(this ); 594 m_boxName = new QHBoxLayout(this );
594 m_edit = new QLineEdit(this ); 595 m_edit = new QLineEdit(this );
595 m_fnLabel = new QLabel(this ); 596 m_fnLabel = new QLabel(this );
596 m_fnLabel->setText(tr("Name:") ); 597 m_fnLabel->setText(tr("Name:") );
597 m_boxName->addWidget(m_fnLabel ); 598 m_boxName->addWidget(m_fnLabel );
598 m_boxName->insertSpacing(1, 8 ); 599 m_boxName->insertSpacing(1, 8 );
599 m_boxName->addWidget(m_edit, 100 ); 600 m_boxName->addWidget(m_edit, 100 );
600 601
601 m_lay->addLayout(m_boxName); 602 m_lay->addLayout(m_boxName);
602} 603}
603 604
604void OFileSelector::initializeYes() 605void OFileSelector::initializeYes()
605{ 606{
606 m_ok = new QPushButton("&Save", this, "save" ); 607 m_ok = new QPushButton("&Save", this, "save" );
607 m_cancel = new QPushButton("C&ancel", this, "cancel" ); 608 m_cancel = new QPushButton("C&ancel", this, "cancel" );
608 m_boxOk = new QHBoxLayout(this ); 609 m_boxOk = new QHBoxLayout(this );
609 m_boxOk->addWidget( m_ok, Qt::AlignHCenter ); 610 m_boxOk->addWidget( m_ok, Qt::AlignHCenter );
610 m_boxOk->insertSpacing(1, 8 ); 611 m_boxOk->insertSpacing(1, 8 );
611 m_boxOk->addWidget( m_cancel, Qt::AlignHCenter); 612 m_boxOk->addWidget( m_cancel, Qt::AlignHCenter);
612 m_lay->addLayout(m_boxOk ); 613 m_lay->addLayout(m_boxOk );
613 connect(m_ok, SIGNAL(clicked() ), 614 connect(m_ok, SIGNAL(clicked() ),
614 this, SLOT(slotOk() ) ); 615 this, SLOT(slotOk() ) );
615 connect(m_cancel, SIGNAL(clicked() ), 616 connect(m_cancel, SIGNAL(clicked() ),
616 this, SLOT(slotCancel() ) ); 617 this, SLOT(slotCancel() ) );
617 618
618} 619}
619 620
620void OFileSelector::initializeChooser() 621void OFileSelector::initializeChooser()
621{ 622{
622 m_boxView = new QHBoxLayout(this ); 623 m_boxView = new QHBoxLayout(this );
623 624
624 m_mimeCheck = new QComboBox(this, "mime check"); 625 m_mimeCheck = new QComboBox(this, "mime check");
625 m_viewCheck = new QComboBox(this, "view check"); 626 m_viewCheck = new QComboBox(this, "view check");
626 m_boxView->addWidget(m_viewCheck, 0 ); 627 m_boxView->addWidget(m_viewCheck, 0 );
627 m_boxView->insertSpacing(2, 8 ); 628 m_boxView->insertSpacing(2, 8 );
628 m_boxView->addWidget(m_mimeCheck, 0 ); 629 m_boxView->addWidget(m_mimeCheck, 0 );
629 m_lay->addLayout(m_boxView ); 630 m_lay->addLayout(m_boxView );
630 m_lay->insertSpacing( 4, 8); 631 m_lay->insertSpacing( 4, 8);
631 632
632 m_viewCheck->insertItem(tr("Documents") ); 633 m_viewCheck->insertItem(tr("Documents") );
633 m_viewCheck->insertItem(tr("Files") ); 634 m_viewCheck->insertItem(tr("Files") );
634 m_viewCheck->insertItem(tr("All Files") ); 635 m_viewCheck->insertItem(tr("All Files") );
635 636
636 if(!m_autoMime ) 637 if(!m_autoMime )
637 m_mimeCheck->insertItem(m_mimetypes.join("," ) ); 638 m_mimeCheck->insertItem(m_mimetypes.join("," ) );
638 else{ // check 639 else{ // check
639 updateMimes(); 640 updateMimes();
640 m_mimeCheck->insertStringList( m_mimetypes ); 641 m_mimeCheck->insertStringList( m_mimetypes );
641 } 642 }
642 643
643 connect( m_viewCheck, SIGNAL(activated(const QString &) ), 644 connect( m_viewCheck, SIGNAL(activated(const QString &) ),
644 this, SLOT(slotViewCheck(const QString & ) ) ); 645 this, SLOT(slotViewCheck(const QString & ) ) );
645 646
646 connect( m_mimeCheck, SIGNAL(activated(const QString &) ), 647 connect( m_mimeCheck, SIGNAL(activated(const QString &) ),
647 this, SLOT(slotMimeCheck(const QString & ) ) ); 648 this, SLOT(slotMimeCheck(const QString & ) ) );
648} 649}
649 650
650void OFileSelector::slotMimeCheck(const QString &view ){ 651void OFileSelector::slotMimeCheck(const QString &view ){
651 if(m_selector == NORMAL ){ 652 if(m_selector == NORMAL ){
652 delete m_select; 653 delete m_select;
653 m_select = new FileSelector(view == "All" ? QString::null : view 654 m_select = new FileSelector(view == "All" ? QString::null : view
654 , m_stack, "fileselector", FALSE, FALSE ); 655 , m_stack, "fileselector", FALSE, FALSE );
655 m_stack->addWidget( m_select, NORMAL ); 656 m_stack->addWidget( m_select, NORMAL );
656 m_stack->raiseWidget( NORMAL ); 657 m_stack->raiseWidget( NORMAL );
657 }else{ 658 }else{
658 reparse(); 659 reparse();
659 } 660 }
660} 661}
661 662
662void OFileSelector::slotViewCheck(const QString &view ){ 663void OFileSelector::slotViewCheck(const QString &view ){
663 qWarning("changed: show %s", view.latin1() ); 664 qWarning("changed: show %s", view.latin1() );
664 // if the current view is the one 665 // if the current view is the one
665 QString currMime = m_mimeCheck->currentText(); 666 QString currMime = m_mimeCheck->currentText();
666 if( view == QString::fromLatin1("Documents") ){ 667 if( view == QString::fromLatin1("Documents") ){
667 // get the mimetype now 668 // get the mimetype now
668 // check if we're the current widget and return 669 // check if we're the current widget and return
669 if( m_View != 0) { // delete 0 shouldn't crash but it did :( 670 if( m_View != 0) { // delete 0 shouldn't crash but it did :(
670 delete m_View; 671 delete m_View;
671 delete m_boxToolbar; 672 delete m_boxToolbar;
672 delete m_homeButton; 673 delete m_homeButton;
673 delete m_docButton; 674 delete m_docButton;
674 delete m_location; 675 delete m_location;
675 delete m_up; 676 delete m_up;
676 delete m_pseudo; 677 delete m_pseudo;
677 //if(m_pseudoLayout!=0 ) 678 //if(m_pseudoLayout!=0 )
678// delete m_pseudoLayout; 679// delete m_pseudoLayout;
679 } 680 }
680 m_View = 0; 681 m_View = 0;
681 m_boxToolbar = 0; 682 m_boxToolbar = 0;
682 m_homeButton = 0; 683 m_homeButton = 0;
683 m_docButton = 0; 684 m_docButton = 0;
684 m_location = 0; 685 m_location = 0;
685 m_up = 0; 686 m_up = 0;
686 m_pseudo = 0; 687 m_pseudo = 0;
687 m_pseudoLayout = 0; 688 m_pseudoLayout = 0;
688 689
689 delete m_select; 690 delete m_select;
690 m_select = new FileSelector( currMime == "All" ? QString::null : currMime, 691 m_select = new FileSelector( currMime == "All" ? QString::null : currMime,
691 m_stack,"fileselector", FALSE, FALSE ); 692 m_stack,"fileselector", FALSE, FALSE );
692 m_stack->addWidget( m_select, NORMAL ); 693 m_stack->addWidget( m_select, NORMAL );
693 m_mimeCheck->clear(); 694 m_mimeCheck->clear();
694 m_selector = NORMAL; 695 m_selector = NORMAL;
695 updateMimes(); 696 updateMimes();
696 m_mimeCheck->insertStringList( m_mimetypes ); 697 m_mimeCheck->insertStringList( m_mimetypes );
697 m_stack->raiseWidget( NORMAL ); 698 m_stack->raiseWidget( NORMAL );
698 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); 699 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) );
699 700
700 } else if(view == QString::fromLatin1("Files") ){ 701 } else if(view == QString::fromLatin1("Files") ){
701 // remove from the stack 702 // remove from the stack
702 delete m_select; 703 delete m_select;
703 m_select = 0; 704 m_select = 0;
704 delete m_View; 705 delete m_View;
705 m_View = 0; 706 m_View = 0;
706 707
707 m_selector = EXTENDED; 708 m_selector = EXTENDED;
708 initializeListView(); 709 initializeListView();
709 reparse(); 710 reparse();
710 } else if(view == QString::fromLatin1("All Files") ) { 711 } else if(view == QString::fromLatin1("All Files") ) {
711 // remove from the stack 712 // remove from the stack
712 delete m_select; 713 delete m_select;
713 m_select = 0; 714 m_select = 0;
714 delete m_View; 715 delete m_View;
715 m_View = 0; 716 m_View = 0;
716 717
717 m_selector = EXTENDED_ALL; 718 m_selector = EXTENDED_ALL;
718 initializeListView(); 719 initializeListView();
719 reparse(); 720 reparse();
720 } 721 }
721} 722}
722 723
723 724
724void OFileSelector::updateMimes() // lets check which mode is active 725void OFileSelector::updateMimes() // lets check which mode is active
725 // check the current dir for items then 726 // check the current dir for items then
726{ 727{
727 if( m_autoMime ){ 728 if( m_autoMime ){
728 m_mimetypes.clear(); 729 m_mimetypes.clear();
729 m_mimetypes.append("All" ); 730 m_mimetypes.append("All" );
730 if( m_selector == NORMAL ){ 731 if( m_selector == NORMAL ){
731 DocLnkSet set; 732 DocLnkSet set;
732 Global::findDocuments(&set, QString::null ); 733 Global::findDocuments(&set, QString::null );
733 QListIterator<DocLnk> dit( set.children() ); 734 QListIterator<DocLnk> dit( set.children() );
734 for ( ; dit.current(); ++dit ) { 735 for ( ; dit.current(); ++dit ) {
735 if( !m_mimetypes.contains((*dit)->type() ) ) 736 if( !m_mimetypes.contains((*dit)->type() ) )
736 m_mimetypes.append( (*dit)->type() ); 737 m_mimetypes.append( (*dit)->type() );
737 } 738 }
738 }else{ 739 }else{
739 // should be allreday updatet 740 // should be allreday updatet
740 ; 741 ;
741 } 742 }
742 } 743 }
743} 744}
744 745
745void OFileSelector::initializeListView() 746void OFileSelector::initializeListView()
746{ 747{
747 // in the instance that a developer selected the view to be Files or Entended, 748 // in the instance that a developer selected the view to be Files or Entended,
748 // in the initial initialization, you are deleting objects here 749 // in the initial initialization, you are deleting objects here
749 // that aren't even existing yet. 750 // that aren't even existing yet.
750 751
751 // just to make sure but clean it up better FIXME 752 // just to make sure but clean it up better FIXME
752 delete m_View; 753 delete m_View;
753 m_View = 0; 754 m_View = 0;
754 delete m_boxToolbar; 755 delete m_boxToolbar;
755 delete m_homeButton; 756 delete m_homeButton;
756 delete m_docButton; 757 delete m_docButton;
757 delete m_location; 758 delete m_location;
758 delete m_up; 759 delete m_up;
759 delete m_pseudo; 760 delete m_pseudo;
760 761
761 m_boxToolbar = 0; 762 m_boxToolbar = 0;
762 m_homeButton = 0; 763 m_homeButton = 0;
763 m_docButton = 0; 764 m_docButton = 0;
764 m_location = 0; 765 m_location = 0;
765 m_up = 0; 766 m_up = 0;
766 m_pseudo = 0; 767 m_pseudo = 0;
767 m_pseudoLayout = 0; 768 m_pseudoLayout = 0;
768 qDebug(" time for the toolbar "); 769 qDebug(" time for the toolbar ");
769 m_pseudo = new QWidget(m_stack, "Pseudo Widget"); 770 m_pseudo = new QWidget(m_stack, "Pseudo Widget");
770 m_pseudoLayout = new QVBoxLayout(m_pseudo ); 771 m_pseudoLayout = new QVBoxLayout(m_pseudo );
771 if(m_shTool ){ 772 if(m_shTool ){
772 m_boxToolbar = new QHBoxLayout( ); 773 m_boxToolbar = new QHBoxLayout( );
773 m_boxToolbar->setAutoAdd( true ); 774 m_boxToolbar->setAutoAdd( true );
774 m_location = new QComboBox(m_pseudo ); 775 m_location = new QComboBox(m_pseudo );
775 m_location ->setEditable(TRUE); 776 m_location ->setEditable(TRUE);
776 connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) ); 777 connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) );
777 connect( m_location->lineEdit(),SIGNAL(returnPressed()), this,SLOT( locationComboChanged())); 778 connect( m_location->lineEdit(),SIGNAL(returnPressed()), this,SLOT( locationComboChanged()));
778 779
779 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); 780 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton");
780 m_up->setFixedSize( QSize( 20, 20 ) ); 781 m_up->setFixedSize( QSize( 20, 20 ) );
781 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); 782 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) );
782 m_up->setFlat(TRUE); 783 m_up->setFlat(TRUE);
783 784
784 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo); 785 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo);
785 m_homeButton->setFixedSize( QSize( 20, 20 ) ); 786 m_homeButton->setFixedSize( QSize( 20, 20 ) );
786 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); 787 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) );
787 m_homeButton->setFlat(TRUE); 788 m_homeButton->setFlat(TRUE);
788 789
789 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); 790 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton");
790 m_docButton->setFixedSize( QSize( 20, 20 ) ); 791 m_docButton->setFixedSize( QSize( 20, 20 ) );
791 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); 792 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
792 m_docButton->setFlat(TRUE); 793 m_docButton->setFlat(TRUE);
793 794
794 m_boxToolbar->addWidget(m_location ); 795 m_boxToolbar->addWidget(m_location );
795 m_boxToolbar->addWidget(m_up ); 796 m_boxToolbar->addWidget(m_up );
796 m_boxToolbar->addWidget(m_homeButton ); 797 m_boxToolbar->addWidget(m_homeButton );
797 m_boxToolbar->addWidget(m_docButton ); 798 m_boxToolbar->addWidget(m_docButton );
798 m_pseudoLayout->addLayout(m_boxToolbar ); 799 m_pseudoLayout->addLayout(m_boxToolbar );
799 qDebug("lets fill the combobox"); 800 qDebug("lets fill the combobox");
800 StorageInfo storage; 801 StorageInfo storage;
801 const QList<FileSystem> &fs = storage.fileSystems(); 802 const QList<FileSystem> &fs = storage.fileSystems();
802 QListIterator<FileSystem> it ( fs ); 803 QListIterator<FileSystem> it ( fs );
803 for( ; it.current(); ++it ){ 804 for( ; it.current(); ++it ){
804 const QString disk = (*it)->name(); 805 const QString disk = (*it)->name();
805 const QString path = (*it)->path(); 806 const QString path = (*it)->path();
806 m_location->insertItem(path+ "<-"+disk ); 807 m_location->insertItem(path+ "<-"+disk );
807 } 808 }
808 int count = m_location->count(); 809 int count = m_location->count();
809 m_location->insertItem(m_currentDir ); 810 m_location->insertItem(m_currentDir );
810 m_location->setCurrentItem( count ); 811 m_location->setCurrentItem( count );
811 }; 812 };
812 813
813 m_View = new QListView(m_pseudo, "Extended view" ); 814 m_View = new QListView(m_pseudo, "Extended view" );
814 m_stack->addWidget( m_pseudo, EXTENDED ); 815 m_stack->addWidget( m_pseudo, EXTENDED );
815 m_stack->raiseWidget( EXTENDED ); 816 m_stack->raiseWidget( EXTENDED );
816 m_pseudoLayout->addWidget(m_View ); 817 m_pseudoLayout->addWidget(m_View );
817 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); 818 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold);
818 // set up the stuff 819 // set up the stuff
819 // Pixmap Name Date Size mime 820 // Pixmap Name Date Size mime
820 //(m_View->header() )->hide(); 821 //(m_View->header() )->hide();
821 //m_View->setRootIsDecorated(false); 822 //m_View->setRootIsDecorated(false);
822 m_View->addColumn(" "); 823 m_View->addColumn(" ");
823 m_View->addColumn(tr("Name"),135 ); 824 m_View->addColumn(tr("Name"),135 );
824 m_View->addColumn(tr("Size"),-1 ); 825 m_View->addColumn(tr("Size"),-1 );
825 m_View->addColumn(tr("Date"), 60 ); 826 m_View->addColumn(tr("Date"), 60 );
826 m_View->addColumn(tr("Mime Type"),-1 ); 827 m_View->addColumn(tr("Mime Type"),-1 );
827 QHeader *header = m_View->header(); 828 QHeader *header = m_View->header();
828 header->hide(); 829 header->hide();
829 m_View->setSorting(1 ); 830 m_View->setSorting(1 );
830 m_View->setAllColumnsShowFocus( TRUE); 831 m_View->setAllColumnsShowFocus( TRUE);
831 // connect now 832 // connect now
832 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) ); 833 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) );
833 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); 834 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) );
834 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), 835 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
835 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); 836 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
836 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), 837 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )),
837 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); 838 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) );
838 839
839 840
840}; 841};
841 842
842/* If a item is locked depends on the mode 843/* If a item is locked depends on the mode
843 if we're in OPEN !isReadable is locked 844 if we're in OPEN !isReadable is locked
844 if we're in SAVE !isWriteable is locked 845 if we're in SAVE !isWriteable is locked
845 846
846 847
847 */ 848 */
848 849
849 850
850void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ 851void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){
851// qWarning("Add Files" ); 852// qWarning("Add Files" );
852 if( !m_files ){ 853 if( !m_files ){
853// qWarning("not mfiles" ); 854// qWarning("not mfiles" );
854 return; 855 return;
855 } 856 }
856 857
857 MimeType type( info->filePath() ); 858 MimeType type( info->filePath() );
858 QString name; 859 QString name;
859 QString dir; 860 QString dir;
860 bool locked= false; 861 bool locked= false;
861 if(mime == "All" ){ 862 if(mime == "All" ){
862 ; 863 ;
863 }else if( type.id() != mime ) { 864 }else if( type.id() != mime ) {
864 return; 865 return;
865 } 866 }
866 QPixmap pix = type.pixmap(); 867 QPixmap pix = type.pixmap();
867 if(pix.isNull() ) 868 if(pix.isNull() )
868 pix = Resource::loadPixmap( "UnknownDocument-14" ); 869 pix = Resource::loadPixmap( "UnknownDocument-14" );
869 dir = info->dirPath( true ); 870 dir = info->dirPath( true );
870 if( symlink ) { // check if the readLink is readable 871 if( symlink ) { // check if the readLink is readable
871 // do it right later 872 // do it right later
872 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 873 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
873 }else{ // keep track of the icons 874 }else{ // keep track of the icons
874 name = info->fileName(); 875 name = info->fileName();
875 if( m_mode == OPEN ){ 876 if( m_mode == OPEN ){
876 if( !info->isReadable() ){ 877 if( !info->isReadable() ){
877 locked = true; 878 locked = true;
878 pix = Resource::loadPixmap("locked" ); 879 pix = Resource::loadPixmap("locked" );
879 } 880 }
880 }else if( m_mode == SAVE ){ 881 }else if( m_mode == SAVE ){
881 if( !info->isWritable() ){ 882 if( !info->isWritable() ){
882 locked = true; 883 locked = true;
883 pix = Resource::loadPixmap("locked" ); 884 pix = Resource::loadPixmap("locked" );
884 } 885 }
885 } 886 }
886 } 887 }
887 new OFileSelectorItem( m_View, pix, name, 888 new OFileSelectorItem( m_View, pix, name,
888 info->lastModified().toString(), 889 info->lastModified().toString(),
889 QString::number( info->size() ), 890 QString::number( info->size() ),
890 dir, locked ); 891 dir, locked );
891} 892}
892 893
893void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) 894void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink )
894{ 895{
895 if(!m_dir ) 896 if(!m_dir )
896 return; 897 return;
897 //if( showDirs ) 898 //if( showDirs )
898 { 899 {
899 bool locked=false; 900 bool locked=false;
900 QString name; 901 QString name;
901 QPixmap pix; 902 QPixmap pix;
902 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ 903 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){
903 locked = true; 904 locked = true;
904 if( symlink ){ 905 if( symlink ){
905 pix = (*m_pixmaps)["symlinkedlocked"]; 906 pix = (*m_pixmaps)["symlinkedlocked"];
906 }else{ 907 }else{
907 pix = Resource::loadPixmap("lockedfolder" ); 908 pix = Resource::loadPixmap("lockedfolder" );
908 } 909 }
909 }else{ 910 }else{
910 if( symlink ){ 911 if( symlink ){
911 pix = (*m_pixmaps)["dirsymlink" ]; 912 pix = (*m_pixmaps)["dirsymlink" ];
912 }else{ 913 }else{
913 pix = Resource::loadPixmap("folder" ); 914 pix = Resource::loadPixmap("folder" );
914 } 915 }
915 } 916 }
916 if( symlink){ 917 if( symlink){
917 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink(); 918 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink();
918 919
919 }else{ 920 }else{
920 //if(info->isReadable() ) 921 //if(info->isReadable() )
921 name = info->fileName(); 922 name = info->fileName();
922 } 923 }
923 924
924 new OFileSelectorItem(m_View, pix, 925 new OFileSelectorItem(m_View, pix,
925 name, info->lastModified().toString(), 926 name, info->lastModified().toString(),
926 QString::number(info->size() ),info->dirPath(true), locked, true ); 927 QString::number(info->size() ),info->dirPath(true), locked, true );
927 928
928 } 929 }
929} 930}
930 931
931void OFileSelector::setShowDirs(bool dir ) 932void OFileSelector::setShowDirs(bool dir )
932{ 933{
933 m_dir = dir; 934 m_dir = dir;
934 reparse(); 935 reparse();
935} 936}
936 937
937void OFileSelector::slotFileSelected(const QString &string ) 938void OFileSelector::slotFileSelected(const QString &string )
938{ 939{
939 if(m_shLne ) 940 if(m_shLne )
940 m_edit->setText( string ); 941 m_edit->setText( string );
941 942
942 emit fileSelected( string ); 943 emit fileSelected( string );
943 // do AppLnk stuff 944 // do AppLnk stuff
944} 945}
945 946
946void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 947void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
947{ 948{
948 slotFileSelected(lnk.name() ); 949 slotFileSelected(lnk.name() );
949 emit fileSelected( lnk ); 950 emit fileSelected( lnk );
950} 951}
951 952
952void OFileSelector::slotSelectionChanged() // get the current items 953void OFileSelector::slotSelectionChanged() // get the current items
953 // fixme 954 // fixme
954{ 955{
955 qWarning("selection changed" ); 956 qWarning("selection changed" );
956} 957}
957 958
958void OFileSelector::slotCurrentChanged(QListViewItem *item ) 959void OFileSelector::slotCurrentChanged(QListViewItem *item )
959{ 960{
960// qWarning("current changed" ); 961// qWarning("current changed" );
961 if( item == 0 ) 962 if( item == 0 )
962 return; 963 return;
963 964
964 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 965 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
965 OFileSelectorItem *sel = (OFileSelectorItem*)item; 966 OFileSelectorItem *sel = (OFileSelectorItem*)item;
966 if(!sel->isDir() ){ 967 if(!sel->isDir() ){
967// qWarning("is not dir" ); 968// qWarning("is not dir" );
968 if(m_shLne ){ 969 if(m_shLne ){
969 m_edit->setText(sel->text(1) ); 970 m_edit->setText(sel->text(1) );
970// qWarning("setTexy" ); 971// qWarning("setTexy" );
971 } 972 }
972 } 973 }
973 }else { 974 }else {
974 qWarning("mode not extended" ); 975 qWarning("mode not extended" );
975 } 976 }
976} 977}
977 978
978// either select or change dir 979// either select or change dir
979void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &point, int ) 980void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &point, int )
980{ 981{
981 if( item == 0 ) 982 if( item == 0 )
982 return; 983 return;
983 984
984 if( button != Qt::LeftButton ) 985 if( button != Qt::LeftButton )
985 return; 986 return;
986 987
987// qWarning("clicked" ); 988// qWarning("clicked" );
988 if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 989 if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
989// qWarning("inside" ); 990// qWarning("inside" );
990 OFileSelectorItem *sel = (OFileSelectorItem*)item; 991 OFileSelectorItem *sel = (OFileSelectorItem*)item;
991 if(!sel->isLocked() ){ // not locked either changedir or open 992 if(!sel->isLocked() ){ // not locked either changedir or open
992 QStringList str = QStringList::split("->", sel->text(1) ); 993 QStringList str = QStringList::split("->", sel->text(1) );
993 if(sel->isDir() ){ 994 if(sel->isDir() ){
994 cd( sel->directory() + "/" + str[0] ); 995 cd( sel->directory() + "/" + str[0] );
995 } else { 996 } else {
996// qWarning("file" ); 997// qWarning("file" );
997 if(m_shLne ) 998 if(m_shLne )
998 m_edit->setText(str[0] ); 999 m_edit->setText(str[0] );
999 emit fileSelected(str[0] ); 1000 emit fileSelected(str[0] );
1000 // emit DocLnk need to do it 1001 // emit DocLnk need to do it
1001 } 1002 }
1002 } else { 1003 } else {
1003 qWarning( "locked" ); 1004 qWarning( "locked" );
1004 } 1005 }
1005 }; 1006 };
1006} 1007}
1007 1008
1008void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) 1009void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int )
1009{ 1010{
1010 if (item == 0 ) 1011 if (item == 0 )
1011 return; 1012 return;
1012 1013
1013 if( button != Qt::RightButton ) 1014 if( button != Qt::RightButton )
1014 return; 1015 return;
1015// qWarning("right button" ); 1016// qWarning("right button" );
1016 slotContextMenu(item); 1017 slotContextMenu(item);
1017} 1018}
1018 1019
1019void OFileSelector::slotContextMenu(QListViewItem *item) 1020void OFileSelector::slotContextMenu(QListViewItem *item)
1020{ 1021{
1021// qWarning("context menu" ); 1022// qWarning("context menu" );
1022 if( item ==0 || !m_showPopup ) 1023 if( item ==0 || !m_showPopup )
1023 return; 1024 return;
1024 1025
1025 if( m_custom !=0){ 1026 if( m_custom !=0){
1026 m_custom->exec(); 1027 m_custom->exec();
1027 }else{ 1028 }else{
1028 QPopupMenu menu; 1029 QPopupMenu menu;
1029 QAction up; 1030 QAction up;
1030 up.setText("cd up"); 1031 up.setText("cd up");
1031 up.addTo( &menu ); 1032 up.addTo( &menu );
1032 connect(&up, SIGNAL(activated() ), 1033 connect(&up, SIGNAL(activated() ),
1033 this, SLOT(cdUP() ) ); 1034 this, SLOT(cdUP() ) );
1034 1035
1035 QAction act; 1036 QAction act;
1036 OFileSelectorItem *sel = (OFileSelectorItem*)item; 1037 OFileSelectorItem *sel = (OFileSelectorItem*)item;
1037 if(sel->isDir() ){ 1038 if(sel->isDir() ){
1038 act.setText( tr("Change Directory") ); 1039 act.setText( tr("Change Directory") );
1039 act.addTo(&menu ); 1040 act.addTo(&menu );
1040 connect(&act, SIGNAL(activated() ), 1041 connect(&act, SIGNAL(activated() ),
1041 this, SLOT(slotChangedDir() ) ); 1042 this, SLOT(slotChangedDir() ) );
1042 }else{ 1043 }else{
1043 act.setText( tr("Open file" ) ); 1044 act.setText( tr("Open file" ) );
1044 act.addTo( &menu ); 1045 act.addTo( &menu );
1045 connect(&act, SIGNAL(activated() ), 1046 connect(&act, SIGNAL(activated() ),
1046 this, SLOT(slotOpen() ) ); 1047 this, SLOT(slotOpen() ) );
1047 } 1048 }
1048 QAction rescan; 1049 QAction rescan;
1049 rescan.setText( tr("Rescan") ); 1050 rescan.setText( tr("Rescan") );
1050 rescan.addTo( &menu ); 1051 rescan.addTo( &menu );
1051 connect(&rescan, SIGNAL(activated() ), 1052 connect(&rescan, SIGNAL(activated() ),
1052 this, SLOT(slotRescan() ) ); 1053 this, SLOT(slotRescan() ) );
1053 1054
1054 QAction rename; 1055 QAction rename;
1055 rename.setText( tr("Rename") ); 1056 rename.setText( tr("Rename") );
1056 rename.addTo( &menu ); 1057 rename.addTo( &menu );
1057 connect(&rename, SIGNAL(activated() ), 1058 connect(&rename, SIGNAL(activated() ),
1058 this, SLOT(slotRename() ) ); 1059 this, SLOT(slotRename() ) );
1059 1060
1060 menu.insertSeparator(); 1061 menu.insertSeparator();
1061 QAction delItem; 1062 QAction delItem;
1062 delItem.setText( tr("Delete") ); 1063 delItem.setText( tr("Delete") );
1063 delItem.addTo(&menu ); 1064 delItem.addTo(&menu );
1064 connect(&delItem, SIGNAL(activated() ), 1065 connect(&delItem, SIGNAL(activated() ),
1065 this, SLOT(slotDelete() ) ); 1066 this, SLOT(slotDelete() ) );
1066 1067
1067 menu.exec(QCursor::pos() ); 1068 menu.exec(QCursor::pos() );
1068 } 1069 }
1069} 1070}
1070 1071
1071bool OFileSelector::cd(const QString &str ) 1072bool OFileSelector::cd(const QString &str )
1072{ 1073{
1073// qWarning(" dir %s", str.latin1() ); 1074// qWarning(" dir %s", str.latin1() );
1074 QDir dir( str); 1075 QDir dir( str);
1075 if(dir.exists() ){ 1076 if(dir.exists() ){
1076 m_currentDir = dir.absPath(); 1077 m_currentDir = dir.absPath();
1077 reparse(); 1078 reparse();
1078 if(m_shTool ){ 1079 if(m_shTool ){
1079 int count = m_location->count(); 1080 int count = m_location->count();
1080 insertLocationPath( str ,count ); 1081 insertLocationPath( str ,count );
1081 m_location->setCurrentItem( count ); 1082 m_location->setCurrentItem( count );
1082 } 1083 }
1083 return true; 1084 return true;
1084 } 1085 }
diff --git a/libopie/ofileview.h b/libopie/ofileview.h
new file mode 100644
index 0000000..48a71ca
--- a/dev/null
+++ b/libopie/ofileview.h
@@ -0,0 +1,79 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 zecke <zecke@handhelds.org>
4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
29#ifndef ofileview_h
30#define ofileview_h
31
32#include <qobject.h>
33#include <qwidget.h>
34
35class QFileInfo;
36class QDir;
37class DocLnk;
38class OFileSelectorView : public QWidget {
39 Q_OBJECT
40 public:
41 OFileSelectorView(QWidget *widget,
42 const char *name )
43 : QWidget(widget, name )
44{ };
45 virtual ~OFileSelectorView();
46
47 virtual void addFile(const QString &mine,
48 QFileInfo *info,
49 bool isSymlink = FALSE ) = 0;
50
51 virtual void addDir (const QString &mine,
52 QFileInfo *info,
53 bool isSymlink = FALSE ) = 0;
54
55 virtual void addSymlink(const QString &mime,
56 QFileInfo *info,
57 bool isSymlink = FALSE ) = 0;
58
59 virtual void cd(const QString &path );
60 signals:
61 void fileSelected(const QString &);
62 void fileSelected(const DocLnk & );
63 void contextMenu();
64 void changedDir(const QString &);
65 void changedDir(const QDir & );
66};
67
68class OFileViewFactory {
69 // Q_OBJECT
70 public:
71 OFileViewFactory() {} ;
72 virtual ~OFileViewFactory();
73
74 OFileSelectorView* newView(QWidget *parent, const char *name );
75 QString name()const;
76};
77
78
79#endif