summaryrefslogtreecommitdiff
authordwmw2 <dwmw2>2002-05-09 10:33:18 (UTC)
committer dwmw2 <dwmw2>2002-05-09 10:33:18 (UTC)
commit388e930a890f11c51dd862f6258c1fc60b396334 (patch) (unidiff)
tree69f322f31c2b2c3338fdb461924349c106f72f59
parent4216d2833503440d25ee40683cd563f379f125a6 (diff)
downloadopie-388e930a890f11c51dd862f6258c1fc60b396334.zip
opie-388e930a890f11c51dd862f6258c1fc60b396334.tar.gz
opie-388e930a890f11c51dd862f6258c1fc60b396334.tar.bz2
Add missing #include <qpainter.h>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index d780da9..8299b3d 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -1,1133 +1,1134 @@
1 1
2 2
3#include <qcheckbox.h> 3#include <qcheckbox.h>
4#include <qcombobox.h> 4#include <qcombobox.h>
5#include <qheader.h> 5#include <qheader.h>
6#include <qlabel.h> 6#include <qlabel.h>
7#include <qabstractlayout.h> 7#include <qabstractlayout.h>
8#include <qlayout.h> 8#include <qlayout.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qlistview.h> 10#include <qlistview.h>
11#include <qmessagebox.h> 11#include <qmessagebox.h>
12#include <qpainter.h>
12#include <qpushbutton.h> 13#include <qpushbutton.h>
13#include <qwidgetstack.h> 14#include <qwidgetstack.h>
14#include <qpopupmenu.h> 15#include <qpopupmenu.h>
15#include <qdir.h> 16#include <qdir.h>
16#include <qfile.h> 17#include <qfile.h>
17#include <qfileinfo.h> 18#include <qfileinfo.h>
18#include <qtimer.h> 19#include <qtimer.h>
19 20
20#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
21#include <qpe/applnk.h> 22#include <qpe/applnk.h>
22#include <qpe/fileselector.h> 23#include <qpe/fileselector.h>
23#include <qpe/global.h> 24#include <qpe/global.h>
24#include <qpe/mimetype.h> 25#include <qpe/mimetype.h>
25#include <qpe/resource.h> 26#include <qpe/resource.h>
26#include <qpe/storage.h> 27#include <qpe/storage.h>
27 28
28#include <unistd.h> 29#include <unistd.h>
29#include <stdlib.h> 30#include <stdlib.h>
30#include <sys/stat.h> 31#include <sys/stat.h>
31 32
32#include "ofileselector.h" 33#include "ofileselector.h"
33 34
34 35
35QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; 36QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0;
36 37
37namespace { 38namespace {
38 int indexByString( const QComboBox *box, const QString &str ){ 39 int indexByString( const QComboBox *box, const QString &str ){
39 int index= 0; 40 int index= 0;
40 for(int i= 0; i < box->count(); i++ ){ 41 for(int i= 0; i < box->count(); i++ ){
41 if( str == box->text(i ) ){ 42 if( str == box->text(i ) ){
42 index= i; 43 index= i;
43 break; 44 break;
44 } 45 }
45 } 46 }
46 return index; 47 return index;
47 } 48 }
48 class OFileSelectorItem : public QListViewItem { 49 class OFileSelectorItem : public QListViewItem {
49 public: 50 public:
50 OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, 51 OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path,
51 const QString &date, const QString &size, const QString &mDir, 52 const QString &date, const QString &size, const QString &mDir,
52 bool isLocked=false, bool isDir=false ): QListViewItem(view) { 53 bool isLocked=false, bool isDir=false ): QListViewItem(view) {
53 setPixmap(0, pixmap ); 54 setPixmap(0, pixmap );
54 setText(1, path ); 55 setText(1, path );
55 setText(2, size ); 56 setText(2, size );
56 setText(3, date ); 57 setText(3, date );
57 //setText(4, mDir ); 58 //setText(4, mDir );
58 m_dir = mDir; 59 m_dir = mDir;
59 dir = isDir; 60 dir = isDir;
60 mLocked = isLocked; 61 mLocked = isLocked;
61 } 62 }
62 bool isLocked() const{ 63 bool isLocked() const{
63 return mLocked; 64 return mLocked;
64 } 65 }
65 QString directory()const{ 66 QString directory()const{
66 return m_dir; 67 return m_dir;
67 } 68 }
68 bool isDir()const{ 69 bool isDir()const{
69 return dir; 70 return dir;
70 } 71 }
71 QString path()const{ 72 QString path()const{
72 return text(1 ); 73 return text(1 );
73 } 74 }
74 QString key(int id, bool )const { 75 QString key(int id, bool )const {
75 QString ke; 76 QString ke;
76 if( id == 0 || id == 1 ){ // name 77 if( id == 0 || id == 1 ){ // name
77 if( dir ){ 78 if( dir ){
78 ke.append("0" ); 79 ke.append("0" );
79 ke.append( text(1) ); 80 ke.append( text(1) );
80 }else{ 81 }else{
81 ke.append("1" ); 82 ke.append("1" );
82 ke.append( text(1) ); 83 ke.append( text(1) );
83 } 84 }
84 }else if( id == 2 ){ // size 85 }else if( id == 2 ){ // size
85 return text(2); 86 return text(2);
86 }else if( id == 3 ){ // date 87 }else if( id == 3 ){ // date
87 return text(3); 88 return text(3);
88 } 89 }
89 return ke; 90 return ke;
90 }; 91 };
91 private: 92 private:
92 bool mLocked:1; 93 bool mLocked:1;
93 bool dir:1; 94 bool dir:1;
94 QString m_dir; 95 QString m_dir;
95 }; 96 };
96}; 97};
97 98
98 99
99OFileSelector::OFileSelector( QWidget *wid, int mode, int selector, 100OFileSelector::OFileSelector( QWidget *wid, int mode, int selector,
100 const QString &dirName, 101 const QString &dirName,
101 const QString &fileName, 102 const QString &fileName,
102 const QStringList &mimeTypes ) 103 const QStringList &mimeTypes )
103 : QWidget( wid, "OFileSelector") 104 : QWidget( wid, "OFileSelector")
104{ 105{
105 m_mimetypes = mimeTypes; 106 m_mimetypes = mimeTypes;
106 initVars(); 107 initVars();
107 m_mode = mode; 108 m_mode = mode;
108 m_selector = selector; 109 m_selector = selector;
109 m_currentDir = dirName; 110 m_currentDir = dirName;
110 init(); 111 init();
111QTimer::singleShot(6*1000, this, SLOT( slotTest() ) ); 112QTimer::singleShot(6*1000, this, SLOT( slotTest() ) );
112} 113}
113 114
114OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, 115OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent,
115 const char *name, bool newVisible = TRUE, 116 const char *name, bool newVisible = TRUE,
116 bool closeVisible = FALSE ) 117 bool closeVisible = FALSE )
117 : QWidget( parent, name ) 118 : QWidget( parent, name )
118{ 119{
119 m_mimetypes = QStringList::split(";", mimeFilter ); 120 m_mimetypes = QStringList::split(";", mimeFilter );
120 initVars(); 121 initVars();
121 m_currentDir = QPEApplication::documentDir(); 122 m_currentDir = QPEApplication::documentDir();
122 m_mode = OPEN; 123 m_mode = OPEN;
123 m_selector = NORMAL; 124 m_selector = NORMAL;
124 m_shClose = closeVisible; 125 m_shClose = closeVisible;
125 m_shNew = newVisible; 126 m_shNew = newVisible;
126 m_shLne = false; 127 m_shLne = false;
127 m_shPerm = false; 128 m_shPerm = false;
128 m_shYesNo = false; 129 m_shYesNo = false;
129 init(); 130 init();
130 131
131 132
132} 133}
133 134
134OFileSelector::~OFileSelector() 135OFileSelector::~OFileSelector()
135{ 136{
136 137
137} 138}
138 139
139void OFileSelector::setNewVisible( bool visible ) 140void OFileSelector::setNewVisible( bool visible )
140{ 141{
141 m_shNew = visible; 142 m_shNew = visible;
142 if( m_selector == NORMAL ){ 143 if( m_selector == NORMAL ){
143 delete m_select; 144 delete m_select;
144 // we need to initialize but keep the selected mimetype 145 // we need to initialize but keep the selected mimetype
145 QString mime = m_mimeCheck == 0 ? QString::null : m_mimeCheck->currentText() ; 146 QString mime = m_mimeCheck == 0 ? QString::null : m_mimeCheck->currentText() ;
146 m_select = new FileSelector( m_autoMime ? mime : m_mimetypes.join(";") , 147 m_select = new FileSelector( m_autoMime ? mime : m_mimetypes.join(";") ,
147 m_stack, "fileselector", 148 m_stack, "fileselector",
148 m_shNew, m_shClose); 149 m_shNew, m_shClose);
149 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 150 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
150 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 151 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
151 //connect to close me and other signals as well 152 //connect to close me and other signals as well
152 m_stack->addWidget( m_select, NORMAL ); 153 m_stack->addWidget( m_select, NORMAL );
153 }else{ 154 }else{
154 m_new->show(); 155 m_new->show();
155 } 156 }
156} 157}
157void OFileSelector::setCloseVisible( bool visible ) 158void OFileSelector::setCloseVisible( bool visible )
158{ 159{
159 m_shClose = visible; 160 m_shClose = visible;
160 if( m_selector == NORMAL ){ 161 if( m_selector == NORMAL ){
161 setNewVisible( m_shNew ); // yeah baby 162 setNewVisible( m_shNew ); // yeah baby
162 }else{ 163 }else{
163 m_close->show(); 164 m_close->show();
164 } 165 }
165} 166}
166void OFileSelector::reread() 167void OFileSelector::reread()
167{ 168{
168 if( m_selector == NORMAL ){ 169 if( m_selector == NORMAL ){
169 setNewVisible( m_shNew ); // make it a initializeSelector 170 setNewVisible( m_shNew ); // make it a initializeSelector
170 }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 171 }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
171 reparse(); 172 reparse();
172 //}else{ 173 //}else{
173 //; 174 //;
174 } 175 }
175} 176}
176 177
177const DocLnk *OFileSelector::selected() 178const DocLnk *OFileSelector::selected()
178{ 179{
179 if( m_selector == NORMAL ){ 180 if( m_selector == NORMAL ){
180 return m_select->selected(); 181 return m_select->selected();
181 }else{ 182 }else{
182 DocLnk *lnk = new DocLnk(selectedDocument() ); 183 DocLnk *lnk = new DocLnk(selectedDocument() );
183 return lnk; 184 return lnk;
184 } 185 }
185} 186}
186 187
187void OFileSelector::setYesCancelVisible( bool show ) 188void OFileSelector::setYesCancelVisible( bool show )
188{ 189{
189 initializeYes(); // FIXME if YesCancel is not shown we will initialize it to hide it :( 190 initializeYes(); // FIXME if YesCancel is not shown we will initialize it to hide it :(
190 m_shYesNo = show; 191 m_shYesNo = show;
191 if( m_shYesNo ) 192 if( m_shYesNo )
192 m_boxOk->show(); 193 m_boxOk->show();
193 else 194 else
194 m_boxOk->hide(); 195 m_boxOk->hide();
195 196
196} 197}
197void OFileSelector::setToolbarVisible( bool show ) 198void OFileSelector::setToolbarVisible( bool show )
198{ 199{
199 m_shTool = show; 200 m_shTool = show;
200 initializeListView(); // FIXME see above waste of memory 201 initializeListView(); // FIXME see above waste of memory
201 if(!m_shTool ){ 202 if(!m_shTool ){
202 m_location->hide(); 203 m_location->hide();
203 m_up->hide(); 204 m_up->hide();
204 m_homeButton->hide(); 205 m_homeButton->hide();
205 m_docButton->hide(); 206 m_docButton->hide();
206 }else{ 207 }else{
207 m_location->show(); 208 m_location->show();
208 m_up->show(); 209 m_up->show();
209 m_homeButton->show(); 210 m_homeButton->show();
210 m_docButton->show(); 211 m_docButton->show();
211 } 212 }
212} 213}
213void OFileSelector::setPermissionBarVisible( bool show ) 214void OFileSelector::setPermissionBarVisible( bool show )
214{ 215{
215 m_shPerm = show; 216 m_shPerm = show;
216 initializePerm(); 217 initializePerm();
217 if( m_shPerm ) 218 if( m_shPerm )
218 m_checkPerm->show(); 219 m_checkPerm->show();
219 else 220 else
220 m_checkPerm->hide(); 221 m_checkPerm->hide();
221} 222}
222void OFileSelector::setLineEditVisible( bool show ) 223void OFileSelector::setLineEditVisible( bool show )
223{ 224{
224 if( show ){ 225 if( show ){
225 initializeName(); 226 initializeName();
226 m_boxName->show(); 227 m_boxName->show();
227 }else{ 228 }else{
228 if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go 229 if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go
229 m_boxName->hide(); 230 m_boxName->hide();
230 } 231 }
231 } 232 }
232 m_shLne = show; 233 m_shLne = show;
233} 234}
234 235
235void OFileSelector::setChooserVisible( bool show ) 236void OFileSelector::setChooserVisible( bool show )
236{ 237{
237 m_shChooser = show; 238 m_shChooser = show;
238 initializeChooser(); 239 initializeChooser();
239 if( m_shChooser ){ 240 if( m_shChooser ){
240 m_boxView->hide(); 241 m_boxView->hide();
241 }else{ 242 }else{
242 m_boxView->show(); 243 m_boxView->show();
243 } 244 }
244} 245}
245 246
246QCheckBox* OFileSelector::permissionCheckbox() 247QCheckBox* OFileSelector::permissionCheckbox()
247{ 248{
248 if( m_selector == NORMAL ) 249 if( m_selector == NORMAL )
249 return 0l; 250 return 0l;
250 else 251 else
251 return m_checkPerm; 252 return m_checkPerm;
252} 253}
253bool OFileSelector::setPermission()const 254bool OFileSelector::setPermission()const
254{ 255{
255 return m_checkPerm == 0 ? false : m_checkPerm->isChecked(); 256 return m_checkPerm == 0 ? false : m_checkPerm->isChecked();
256} 257}
257void OFileSelector::setPermissionChecked( bool check ) 258void OFileSelector::setPermissionChecked( bool check )
258{ 259{
259 if( m_checkPerm ) 260 if( m_checkPerm )
260 m_checkPerm->setChecked( check ); 261 m_checkPerm->setChecked( check );
261} 262}
262 263
263void OFileSelector::setMode(int mode) // FIXME do direct raising 264void OFileSelector::setMode(int mode) // FIXME do direct raising
264{ 265{
265 m_mode = mode; 266 m_mode = mode;
266 if( m_selector == NORMAL ) 267 if( m_selector == NORMAL )
267 return; 268 return;
268} 269}
269void OFileSelector::setShowDirs(bool ) 270void OFileSelector::setShowDirs(bool )
270{ 271{
271 m_dir = true; 272 m_dir = true;
272 reparse(); 273 reparse();
273} 274}
274void OFileSelector::setCaseSensetive(bool caSe ) 275void OFileSelector::setCaseSensetive(bool caSe )
275{ 276{
276 m_case = caSe; 277 m_case = caSe;
277 reparse(); 278 reparse();
278} 279}
279void OFileSelector::setShowFiles(bool show ) 280void OFileSelector::setShowFiles(bool show )
280{ 281{
281 m_files = show; 282 m_files = show;
282 reparse(); 283 reparse();
283} 284}
284/// 285///
285bool OFileSelector::cd(const QString &path ) 286bool OFileSelector::cd(const QString &path )
286{ 287{
287 m_currentDir = path; 288 m_currentDir = path;
288 reparse(); 289 reparse();
289 return true; 290 return true;
290} 291}
291void OFileSelector::setSelector(int mode ) 292void OFileSelector::setSelector(int mode )
292{ 293{
293QString text; 294QString text;
294 switch( mode ){ 295 switch( mode ){
295 case NORMAL: 296 case NORMAL:
296 text = tr("Documents"); 297 text = tr("Documents");
297 break; 298 break;
298 case EXTENDED: 299 case EXTENDED:
299 text = tr("Files"); 300 text = tr("Files");
300 break; 301 break;
301 case EXTENDED_ALL: 302 case EXTENDED_ALL:
302 text = tr("All Files"); 303 text = tr("All Files");
303 break; 304 break;
304 } 305 }
305 slotViewCheck( text ); 306 slotViewCheck( text );
306} 307}
307 308
308void OFileSelector::setPopupMenu(QPopupMenu *popup ) 309void OFileSelector::setPopupMenu(QPopupMenu *popup )
309{ 310{
310 m_custom = popup; 311 m_custom = popup;
311 m_showPopup = true; 312 m_showPopup = true;
312} 313}
313 314
314//void OFileSelector::updateL 315//void OFileSelector::updateL
315 316
316QString OFileSelector::selectedName() const 317QString OFileSelector::selectedName() const
317{ 318{
318 QString name; 319 QString name;
319 if( m_selector == NORMAL ){ 320 if( m_selector == NORMAL ){
320 const DocLnk *lnk = m_select->selected(); 321 const DocLnk *lnk = m_select->selected();
321 name = lnk->file(); 322 name = lnk->file();
322 delete lnk; 323 delete lnk;
323 }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 324 }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
324 QListViewItem *item = m_View->currentItem(); 325 QListViewItem *item = m_View->currentItem();
325 if( item != 0 ) 326 if( item != 0 )
326 name = m_currentDir + "/" + item->text( 1 ); 327 name = m_currentDir + "/" + item->text( 1 );
327 }else { // installed view 328 }else { // installed view
328 ; 329 ;
329 } 330 }
330 return name; 331 return name;
331} 332}
332QStringList OFileSelector::selectedNames()const 333QStringList OFileSelector::selectedNames()const
333{ 334{
334 QStringList list; 335 QStringList list;
335 if( m_selector == NORMAL ){ 336 if( m_selector == NORMAL ){
336 list << selectedName(); 337 list << selectedName();
337 }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 338 }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
338 list << selectedName(); // FIXME implement multiple Selections 339 list << selectedName(); // FIXME implement multiple Selections
339 } 340 }
340 return list; 341 return list;
341} 342}
342/** If mode is set to the Dir selection this will return the selected path. 343/** If mode is set to the Dir selection this will return the selected path.
343 * 344 *
344 * 345 *
345 */ 346 */
346QString OFileSelector::selectedPath()const 347QString OFileSelector::selectedPath()const
347{ 348{
348 QString path; 349 QString path;
349 if( m_selector == NORMAL ){ 350 if( m_selector == NORMAL ){
350 path = QPEApplication::documentDir(); 351 path = QPEApplication::documentDir();
351 }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 352 }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
352 ; 353 ;
353 } 354 }
354 return path; 355 return path;
355} 356}
356QStringList OFileSelector::selectedPaths() const 357QStringList OFileSelector::selectedPaths() const
357{ 358{
358 QStringList list; 359 QStringList list;
359 list << selectedPath(); 360 list << selectedPath();
360 return list; 361 return list;
361} 362}
362QString OFileSelector::directory()const 363QString OFileSelector::directory()const
363{ 364{
364 if( m_selector == NORMAL ) 365 if( m_selector == NORMAL )
365 return QPEApplication::documentDir(); 366 return QPEApplication::documentDir();
366 367
367 return QDir(m_currentDir).absPath(); 368 return QDir(m_currentDir).absPath();
368} 369}
369 370
370int OFileSelector::fileCount() 371int OFileSelector::fileCount()
371{ 372{
372 int count; 373 int count;
373 switch( m_selector ){ 374 switch( m_selector ){
374 case NORMAL: 375 case NORMAL:
375 count = m_select->fileCount(); 376 count = m_select->fileCount();
376 break; 377 break;
377 //case CUSTOM: 378 //case CUSTOM:
378 case EXTENDED: 379 case EXTENDED:
379 case EXTENDED_ALL: 380 case EXTENDED_ALL:
380 default: 381 default:
381 count = m_View->childCount(); 382 count = m_View->childCount();
382 break; 383 break;
383 } 384 }
384 return count; 385 return count;
385} 386}
386DocLnk OFileSelector::selectedDocument() const 387DocLnk OFileSelector::selectedDocument() const
387{ 388{
388 DocLnk lnk; 389 DocLnk lnk;
389 switch( m_selector ){ 390 switch( m_selector ){
390 case NORMAL:{ 391 case NORMAL:{
391 const DocLnk *lnk2 = m_select->selected(); 392 const DocLnk *lnk2 = m_select->selected();
392 lnk = DocLnk(*lnk2 ); // copy 393 lnk = DocLnk(*lnk2 ); // copy
393 delete lnk2; 394 delete lnk2;
394 break; 395 break;
395 } 396 }
396 case EXTENDED: 397 case EXTENDED:
397 case EXTENDED_ALL: 398 case EXTENDED_ALL:
398 default: 399 default:
399 lnk = DocLnk( selectedName() ); // new DocLnk 400 lnk = DocLnk( selectedName() ); // new DocLnk
400 break; 401 break;
401 } 402 }
402 return lnk; 403 return lnk;
403} 404}
404QValueList<DocLnk> OFileSelector::selectedDocuments() const 405QValueList<DocLnk> OFileSelector::selectedDocuments() const
405{ 406{
406 QValueList<DocLnk> docs; 407 QValueList<DocLnk> docs;
407 docs.append( selectedDocument() ); 408 docs.append( selectedDocument() );
408 return docs; 409 return docs;
409} 410}
410 411
411 412
412// slots internal 413// slots internal
413 414
414void OFileSelector::slotOk() 415void OFileSelector::slotOk()
415{ 416{
416 emit ok(); 417 emit ok();
417} 418}
418void OFileSelector::slotCancel() 419void OFileSelector::slotCancel()
419{ 420{
420 emit cancel(); 421 emit cancel();
421} 422}
422void OFileSelector::slotViewCheck(const QString &sel) 423void OFileSelector::slotViewCheck(const QString &sel)
423{ 424{
424 if( sel == tr("Documents" ) ){ 425 if( sel == tr("Documents" ) ){
425 if( m_select == 0 ){ 426 if( m_select == 0 ){
426 // autMime? fix cause now we use All and not the current 427 // autMime? fix cause now we use All and not the current
427 m_select = new FileSelector(m_autoMime ? QString::null : m_mimetypes.join(";"), 428 m_select = new FileSelector(m_autoMime ? QString::null : m_mimetypes.join(";"),
428 m_stack, "fileselector", 429 m_stack, "fileselector",
429 FALSE, FALSE); 430 FALSE, FALSE);
430 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 431 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
431 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 432 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
432 //connect to close me and other signals as well 433 //connect to close me and other signals as well
433 434
434 m_stack->addWidget( m_select, NORMAL ); 435 m_stack->addWidget( m_select, NORMAL );
435 } 436 }
436 m_stack->raiseWidget( NORMAL ); 437 m_stack->raiseWidget( NORMAL );
437 m_selector = NORMAL; 438 m_selector = NORMAL;
438 }else if( sel == tr("Files") ){ 439 }else if( sel == tr("Files") ){
439 m_selector = EXTENDED; 440 m_selector = EXTENDED;
440 initializeListView(); 441 initializeListView();
441 reparse(); 442 reparse();
442 m_stack->raiseWidget( EXTENDED ); 443 m_stack->raiseWidget( EXTENDED );
443 }else if( sel == tr("All Files") ){ 444 }else if( sel == tr("All Files") ){
444 m_selector = EXTENDED_ALL; 445 m_selector = EXTENDED_ALL;
445 initializeListView(); 446 initializeListView();
446 reparse(); 447 reparse();
447 m_stack->raiseWidget( EXTENDED ); // same widget other QFileFilter 448 m_stack->raiseWidget( EXTENDED ); // same widget other QFileFilter
448 } 449 }
449} 450}
450void OFileSelector::slotMimeCheck(const QString &mime) 451void OFileSelector::slotMimeCheck(const QString &mime)
451{ 452{
452 if( m_selector == NORMAL ){ 453 if( m_selector == NORMAL ){
453 if( m_autoMime ){ 454 if( m_autoMime ){
454 delete m_select; 455 delete m_select;
455 m_select = new FileSelector( mime == tr("All") ? QString::null : mime, 456 m_select = new FileSelector( mime == tr("All") ? QString::null : mime,
456 m_stack, "fileselector", 457 m_stack, "fileselector",
457 FALSE, FALSE); 458 FALSE, FALSE);
458 459
459 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 460 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
460 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 461 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
461 //connect to close me and other signals as well 462 //connect to close me and other signals as well
462 m_stack->addWidget( m_select, NORMAL ); 463 m_stack->addWidget( m_select, NORMAL );
463 m_stack->raiseWidget( NORMAL ); 464 m_stack->raiseWidget( NORMAL );
464 updateMimes(); 465 updateMimes();
465 m_mimeCheck->clear(); 466 m_mimeCheck->clear();
466 m_mimeCheck->insertStringList(m_mimetypes ); 467 m_mimeCheck->insertStringList(m_mimetypes );
467 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); 468 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
468 } 469 }
469 }else{ // others 470 }else{ // others
470 qWarning("Mime %s", mime.latin1() ); 471 qWarning("Mime %s", mime.latin1() );
471 if(m_shChooser ){ 472 if(m_shChooser ){
472 qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); 473 qWarning("Current Text %s", m_mimeCheck->currentText().latin1() );
473 //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); 474 //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
474 } 475 }
475 reparse(); 476 reparse();
476 } 477 }
477 478
478} 479}
479void OFileSelector::slotLocationActivated(const QString &file) 480void OFileSelector::slotLocationActivated(const QString &file)
480{ 481{
481 cd(file.left(file.find("<-",0,TRUE))); 482 cd(file.left(file.find("<-",0,TRUE)));
482 reparse(); 483 reparse();
483} 484}
484void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count) 485void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count)
485{ 486{
486 QStringList pathList; 487 QStringList pathList;
487 bool underDog = FALSE; 488 bool underDog = FALSE;
488 for(int i=0;i<count;i++) { 489 for(int i=0;i<count;i++) {
489 pathList << m_location->text(i); 490 pathList << m_location->text(i);
490 if( m_location->text(i) == currentPath) 491 if( m_location->text(i) == currentPath)
491 underDog = TRUE; 492 underDog = TRUE;
492 } 493 }
493 if( !underDog) { 494 if( !underDog) {
494 m_location->clear(); 495 m_location->clear();
495 if( currentPath.left(2)=="//") 496 if( currentPath.left(2)=="//")
496 pathList.append( currentPath.right(currentPath.length()-1) ); 497 pathList.append( currentPath.right(currentPath.length()-1) );
497 else 498 else
498 pathList.append( currentPath ); 499 pathList.append( currentPath );
499 m_location->insertStringList( pathList,-1); 500 m_location->insertStringList( pathList,-1);
500 } 501 }
501} 502}
502void OFileSelector::locationComboChanged() 503void OFileSelector::locationComboChanged()
503{ 504{
504 cd( m_location->lineEdit()->text()); 505 cd( m_location->lineEdit()->text());
505 reparse(); 506 reparse();
506} 507}
507void OFileSelector::init() 508void OFileSelector::init()
508{ 509{
509 m_lay = new QVBoxLayout( this ); 510 m_lay = new QVBoxLayout( this );
510 m_lay->setSpacing(0 ); 511 m_lay->setSpacing(0 );
511 512
512 m_stack = new QWidgetStack( this ); 513 m_stack = new QWidgetStack( this );
513 if( m_selector == NORMAL ){ 514 if( m_selector == NORMAL ){
514 m_select = new FileSelector(m_autoMime ? QString::null : m_mimetypes.join(";"), 515 m_select = new FileSelector(m_autoMime ? QString::null : m_mimetypes.join(";"),
515 m_stack, "fileselector", 516 m_stack, "fileselector",
516 FALSE, FALSE); 517 FALSE, FALSE);
517 518
518 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 519 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
519 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 520 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
520 //connect to close me and other signals as well 521 //connect to close me and other signals as well
521 522
522 m_stack->addWidget( m_select, NORMAL ); 523 m_stack->addWidget( m_select, NORMAL );
523 m_stack->raiseWidget( NORMAL ); 524 m_stack->raiseWidget( NORMAL );
524 }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL 525 }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL
525 // and initializeListview will take care of those 526 // and initializeListview will take care of those
526 // toolbar get's generade in initializeListView 527 // toolbar get's generade in initializeListView
527 initializeListView( ); // will raise the widget as well 528 initializeListView( ); // will raise the widget as well
528 } 529 }
529 m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch 530 m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch
530 531
531 if( m_shLne ) // the LineEdit with the current FileName 532 if( m_shLne ) // the LineEdit with the current FileName
532 initializeName(); 533 initializeName();
533 534
534 if( m_shPerm ) // the Permission QCheckBox 535 if( m_shPerm ) // the Permission QCheckBox
535 initializePerm(); 536 initializePerm();
536 537
537 if( m_shChooser ) // the Chooser for the view and Mimetypes 538 if( m_shChooser ) // the Chooser for the view and Mimetypes
538 initializeChooser(); 539 initializeChooser();
539 540
540 if( m_shYesNo ) // the Yes No button row 541 if( m_shYesNo ) // the Yes No button row
541 initializeYes( ); 542 initializeYes( );
542} 543}
543void OFileSelector::updateMimes() 544void OFileSelector::updateMimes()
544{ 545{
545 if( m_autoMime ){ 546 if( m_autoMime ){
546 m_mimetypes.clear(); 547 m_mimetypes.clear();
547 m_mimetypes.append( tr("All") ); 548 m_mimetypes.append( tr("All") );
548 if( m_selector == NORMAL ){ 549 if( m_selector == NORMAL ){
549 DocLnkSet set; 550 DocLnkSet set;
550 Global::findDocuments(&set, QString::null ); 551 Global::findDocuments(&set, QString::null );
551 QListIterator<DocLnk> dit( set.children() ); 552 QListIterator<DocLnk> dit( set.children() );
552 for( ; dit.current(); ++dit ){ 553 for( ; dit.current(); ++dit ){
553 if( !m_mimetypes.contains( (*dit)->type() ) ) 554 if( !m_mimetypes.contains( (*dit)->type() ) )
554 m_mimetypes.append( (*dit)->type() ); 555 m_mimetypes.append( (*dit)->type() );
555 } 556 }
556 }// else done in reparse 557 }// else done in reparse
557 } 558 }
558} 559}
559void OFileSelector::initVars() 560void OFileSelector::initVars()
560{ 561{
561 if( m_mimetypes.isEmpty() ) 562 if( m_mimetypes.isEmpty() )
562 m_autoMime = true; 563 m_autoMime = true;
563 else 564 else
564 m_autoMime = false; 565 m_autoMime = false;
565 m_shClose = false; 566 m_shClose = false;
566 m_shNew = false; 567 m_shNew = false;
567 m_shTool = true; 568 m_shTool = true;
568 m_shPerm = false; 569 m_shPerm = false;
569 m_shLne = true; 570 m_shLne = true;
570 m_shChooser = true; 571 m_shChooser = true;
571 m_shYesNo = true; 572 m_shYesNo = true;
572 m_case = false; 573 m_case = false;
573 m_dir = true; 574 m_dir = true;
574 m_files = true; 575 m_files = true;
575 m_showPopup = false; 576 m_showPopup = false;
576 if(m_pixmaps == 0 ) // init the pixmaps 577 if(m_pixmaps == 0 ) // init the pixmaps
577 initPics(); 578 initPics();
578 579
579 // pointers 580 // pointers
580 m_location = 0; 581 m_location = 0;
581 m_mimeCheck = 0; 582 m_mimeCheck = 0;
582 m_viewCheck = 0; 583 m_viewCheck = 0;
583 m_homeButton = 0; 584 m_homeButton = 0;
584 m_docButton = 0; 585 m_docButton = 0;
585 m_hideButton = 0; 586 m_hideButton = 0;
586 m_ok = 0; 587 m_ok = 0;
587 m_cancel = 0; 588 m_cancel = 0;
588 m_reread = 0; 589 m_reread = 0;
589 m_up = 0; 590 m_up = 0;
590 m_View = 0; 591 m_View = 0;
591 m_checkPerm = 0; 592 m_checkPerm = 0;
592 m_pseudo = 0; 593 m_pseudo = 0;
593 m_pseudoLayout = 0; 594 m_pseudoLayout = 0;
594 m_select = 0; 595 m_select = 0;
595 m_stack = 0; 596 m_stack = 0;
596 m_lay = 0; 597 m_lay = 0;
597 m_Oselector = 0; 598 m_Oselector = 0;
598 m_boxToolbar = 0; 599 m_boxToolbar = 0;
599 m_boxOk = 0; 600 m_boxOk = 0;
600 m_boxName = 0; 601 m_boxName = 0;
601 m_boxView = 0; 602 m_boxView = 0;
602 m_custom = 0; 603 m_custom = 0;
603 m_edit = 0; 604 m_edit = 0;
604 m_fnLabel = 0; 605 m_fnLabel = 0;
605 m_new = 0; 606 m_new = 0;
606 m_close = 0; 607 m_close = 0;
607} 608}
608void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink) 609void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink)
609{ 610{
610 if(!m_files) 611 if(!m_files)
611 return; 612 return;
612 // if( !compliesMime(info->absFilePath(), mime ) ) 613 // if( !compliesMime(info->absFilePath(), mime ) )
613 // return; 614 // return;
614 MimeType type( info->absFilePath() ); 615 MimeType type( info->absFilePath() );
615 if( mime != tr("All") && type.id() != mime ) 616 if( mime != tr("All") && type.id() != mime )
616 return; 617 return;
617 QPixmap pix = type.pixmap(); 618 QPixmap pix = type.pixmap();
618 QString dir; 619 QString dir;
619 QString name; 620 QString name;
620 bool locked; 621 bool locked;
621 if( pix.isNull() ) 622 if( pix.isNull() )
622 pix = Resource::loadPixmap( "UnknownDocument-14"); 623 pix = Resource::loadPixmap( "UnknownDocument-14");
623 dir = info->dirPath( true ); 624 dir = info->dirPath( true );
624 if( symlink ) 625 if( symlink )
625 name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); 626 name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink();
626 else { 627 else {
627 name = info->fileName(); 628 name = info->fileName();
628 if( ( m_mode == OPEN && !info->isReadable() )|| 629 if( ( m_mode == OPEN && !info->isReadable() )||
629 ( m_mode == SAVE && !info->isWritable() ) ){ 630 ( m_mode == SAVE && !info->isWritable() ) ){
630 631
631 locked = true; pix = Resource::loadPixmap("locked"); 632 locked = true; pix = Resource::loadPixmap("locked");
632 } 633 }
633 } 634 }
634 new OFileSelectorItem( m_View, pix, name, 635 new OFileSelectorItem( m_View, pix, name,
635 info->lastModified().toString(), 636 info->lastModified().toString(),
636 QString::number( info->size() ), 637 QString::number( info->size() ),
637 dir, locked ); 638 dir, locked );
638} 639}
639void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) 640void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink )
640{ 641{
641 if(!m_dir) 642 if(!m_dir)
642 return; 643 return;
643 if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){ 644 if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){
644 bool locked = false; 645 bool locked = false;
645 QString name; 646 QString name;
646 QPixmap pix; 647 QPixmap pix;
647 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ 648 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){
648 locked = true; 649 locked = true;
649 if( symlink ) 650 if( symlink )
650 pix = (*m_pixmaps)["symlinkedlocked"]; 651 pix = (*m_pixmaps)["symlinkedlocked"];
651 else 652 else
652 pix = Resource::loadPixmap("lockedfolder"); 653 pix = Resource::loadPixmap("lockedfolder");
653 }else { // readable 654 }else { // readable
654 pix = symlink ? (*m_pixmaps)["dirsymlink"] : Resource::loadPixmap("folder") ; 655 pix = symlink ? (*m_pixmaps)["dirsymlink"] : Resource::loadPixmap("folder") ;
655 } 656 }
656 name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; 657 name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ;
657 new OFileSelectorItem( m_View, pix, name, 658 new OFileSelectorItem( m_View, pix, name,
658 info->lastModified().toString(), 659 info->lastModified().toString(),
659 QString::number( info->size() ), 660 QString::number( info->size() ),
660 info->dirPath( true ), locked, 661 info->dirPath( true ), locked,
661 true ); 662 true );
662 663
663 }// else CUSTOM View 664 }// else CUSTOM View
664} 665}
665void OFileSelector::delItems() 666void OFileSelector::delItems()
666{ 667{
667 668
668} 669}
669void OFileSelector::initializeName() 670void OFileSelector::initializeName()
670{ 671{
671 /** Name Layout Line 672 /** Name Layout Line
672 * This is the Layout line arranged in 673 * This is the Layout line arranged in
673 * horizontal way each components 674 * horizontal way each components
674 * are next to each other 675 * are next to each other
675 * but we will only do this if 676 * but we will only do this if
676 * we didn't initialize a while ago. 677 * we didn't initialize a while ago.
677 */ 678 */
678 if( m_boxName == 0 ){ 679 if( m_boxName == 0 ){
679 m_boxName = new QHBox( this ); // remove this this? or use a QHBox 680 m_boxName = new QHBox( this ); // remove this this? or use a QHBox
680 m_fnLabel = new QLabel( m_boxName ); 681 m_fnLabel = new QLabel( m_boxName );
681 m_fnLabel->setText( tr("Name:") ); 682 m_fnLabel->setText( tr("Name:") );
682 m_edit = new QLineEdit( m_boxName ); 683 m_edit = new QLineEdit( m_boxName );
683 //m_boxName->addWidget( m_fnLabel ); 684 //m_boxName->addWidget( m_fnLabel );
684 m_boxName->setMargin( 5 ); 685 m_boxName->setMargin( 5 );
685 m_boxName->setSpacing( 8 ); 686 m_boxName->setSpacing( 8 );
686 //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor 687 //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor
687 688
688 m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout 689 m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout
689 }// else we already initialized 690 }// else we already initialized
690 // maybe show the components? 691 // maybe show the components?
691 // 692 //
692} 693}
693void OFileSelector::initializeYes() 694void OFileSelector::initializeYes()
694{ 695{
695 /** The Save Cancel bar 696 /** The Save Cancel bar
696 * 697 *
697 */ 698 */
698 if( m_boxOk == 0 ){ 699 if( m_boxOk == 0 ){
699 m_boxOk = new QHBox( this ); 700 m_boxOk = new QHBox( this );
700 m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" ); 701 m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" );
701 m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" ); 702 m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" );
702 703
703 //m_boxOk->addWidget( m_ok ); 704 //m_boxOk->addWidget( m_ok );
704 //m_boxOk->addWidget( m_cancel ); 705 //m_boxOk->addWidget( m_cancel );
705 m_boxOk->setMargin( 5 ); 706 m_boxOk->setMargin( 5 );
706 m_boxOk->setSpacing( 10 ); 707 m_boxOk->setSpacing( 10 );
707 m_lay->addWidget( m_boxOk, 0 ); 708 m_lay->addWidget( m_boxOk, 0 );
708 709
709 connect( m_ok, SIGNAL( clicked() ), 710 connect( m_ok, SIGNAL( clicked() ),
710 this, SLOT(slotOk() ) ); 711 this, SLOT(slotOk() ) );
711 connect( m_cancel, SIGNAL( clicked() ), 712 connect( m_cancel, SIGNAL( clicked() ),
712 this, SLOT( slotCancel() ) ); 713 this, SLOT( slotCancel() ) );
713 } 714 }
714} 715}
715void OFileSelector::initializeChooser() 716void OFileSelector::initializeChooser()
716{ 717{
717 if( m_boxView == 0 ){ 718 if( m_boxView == 0 ){
718 m_boxView = new QHBox( this ); 719 m_boxView = new QHBox( this );
719 m_viewCheck = new QComboBox( m_boxView, "view check"); 720 m_viewCheck = new QComboBox( m_boxView, "view check");
720 m_mimeCheck = new QComboBox( m_boxView, "mime check"); 721 m_mimeCheck = new QComboBox( m_boxView, "mime check");
721 m_boxView->setSpacing( 8 ); 722 m_boxView->setSpacing( 8 );
722 m_lay->addWidget(m_boxView, 0 ); 723 m_lay->addWidget(m_boxView, 0 );
723 724
724 m_viewCheck->insertItem( tr("Documents") ); 725 m_viewCheck->insertItem( tr("Documents") );
725 m_viewCheck->insertItem( tr("Files") ); 726 m_viewCheck->insertItem( tr("Files") );
726 m_viewCheck->insertItem( tr("All Files") ); 727 m_viewCheck->insertItem( tr("All Files") );
727 if(!m_autoMime ) 728 if(!m_autoMime )
728 m_mimeCheck->insertItem(m_mimetypes.join(",") ); 729 m_mimeCheck->insertItem(m_mimetypes.join(",") );
729 else{ 730 else{
730 updateMimes(); 731 updateMimes();
731 m_mimeCheck->insertStringList( m_mimetypes ); 732 m_mimeCheck->insertStringList( m_mimetypes );
732 } 733 }
733 connect( m_viewCheck, SIGNAL( activated(const QString & ) ), 734 connect( m_viewCheck, SIGNAL( activated(const QString & ) ),
734 this, SLOT( slotViewCheck(const QString & ) ) ); 735 this, SLOT( slotViewCheck(const QString & ) ) );
735 connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), 736 connect( m_mimeCheck, SIGNAL( activated(const QString & ) ),
736 this, SLOT( slotMimeCheck( const QString & ) ) ); 737 this, SLOT( slotMimeCheck( const QString & ) ) );
737 } 738 }
738} 739}
739void OFileSelector::initializeListView() 740void OFileSelector::initializeListView()
740{ 741{
741 if( m_pseudo == 0 ){ 742 if( m_pseudo == 0 ){
742 m_pseudo = new QWidget( m_stack, "Pseudo Widget"); 743 m_pseudo = new QWidget( m_stack, "Pseudo Widget");
743 m_pseudoLayout = new QVBoxLayout( m_pseudo ); 744 m_pseudoLayout = new QVBoxLayout( m_pseudo );
744 // toolbar 745 // toolbar
745 m_boxToolbar = new QHBox( m_pseudo ); 746 m_boxToolbar = new QHBox( m_pseudo );
746 m_boxToolbar->setSpacing(0 ); // next to each other please 747 m_boxToolbar->setSpacing(0 ); // next to each other please
747 748
748 // toolbar members 749 // toolbar members
749 { 750 {
750 // location QComboBox 751 // location QComboBox
751 m_location = new QComboBox( m_boxToolbar ); 752 m_location = new QComboBox( m_boxToolbar );
752 m_location->setEditable( TRUE ); 753 m_location->setEditable( TRUE );
753 m_location->setDuplicatesEnabled( FALSE ); 754 m_location->setDuplicatesEnabled( FALSE );
754 connect( m_location, SIGNAL(activated(const QString &) ), 755 connect( m_location, SIGNAL(activated(const QString &) ),
755 this, SLOT( slotLocationActivated(const QString &) ) ); 756 this, SLOT( slotLocationActivated(const QString &) ) );
756 connect( m_location->lineEdit(), SIGNAL(returnPressed() ), 757 connect( m_location->lineEdit(), SIGNAL(returnPressed() ),
757 this, SLOT(locationComboChanged() ) ); 758 this, SLOT(locationComboChanged() ) );
758 // UP Button 759 // UP Button
759 m_up = new QPushButton(Resource::loadIconSet("up"),"", 760 m_up = new QPushButton(Resource::loadIconSet("up"),"",
760 m_boxToolbar,"cdUpButton"); 761 m_boxToolbar,"cdUpButton");
761 m_up->setFixedSize( QSize( 20, 20 ) ); 762 m_up->setFixedSize( QSize( 20, 20 ) );
762 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); 763 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) );
763 m_up->setFlat(TRUE); 764 m_up->setFlat(TRUE);
764 765
765 // Home Button 766 // Home Button
766 m_homeButton = new QPushButton(Resource::loadIconSet("home") , 767 m_homeButton = new QPushButton(Resource::loadIconSet("home") ,
767 "", m_boxToolbar); 768 "", m_boxToolbar);
768 m_homeButton->setFixedSize( QSize( 20, 20 ) ); 769 m_homeButton->setFixedSize( QSize( 20, 20 ) );
769 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); 770 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) );
770 m_homeButton->setFlat(TRUE); 771 m_homeButton->setFlat(TRUE);
771 // Documents Button 772 // Documents Button
772 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", 773 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",
773 m_boxToolbar,"docsButton"); 774 m_boxToolbar,"docsButton");
774 m_docButton->setFixedSize( QSize( 20, 20 ) ); 775 m_docButton->setFixedSize( QSize( 20, 20 ) );
775 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); 776 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
776 m_docButton->setFlat(TRUE); 777 m_docButton->setFlat(TRUE);
777 778
778 // Close button 779 // Close button
779 m_close = new QPushButton( Resource::loadIconSet( "close"), "", 780 m_close = new QPushButton( Resource::loadIconSet( "close"), "",
780 m_boxToolbar ); 781 m_boxToolbar );
781 connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); 782 connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) );
782 m_close->setFixedSize( 20, 20 ); 783 m_close->setFixedSize( 20, 20 );
783 784
784 m_boxToolbar->setFixedHeight( 20 ); 785 m_boxToolbar->setFixedHeight( 20 );
785 m_pseudoLayout->addWidget(m_boxToolbar ); 786 m_pseudoLayout->addWidget(m_boxToolbar );
786 787
787 // let;s fill the Location ComboBox 788 // let;s fill the Location ComboBox
788 StorageInfo storage; 789 StorageInfo storage;
789 const QList<FileSystem> &fs = storage.fileSystems(); 790 const QList<FileSystem> &fs = storage.fileSystems();
790 QListIterator<FileSystem> it ( fs ); 791 QListIterator<FileSystem> it ( fs );
791 for( ; it.current(); ++it ){ 792 for( ; it.current(); ++it ){
792 const QString disk = (*it)->name(); 793 const QString disk = (*it)->name();
793 const QString path = (*it)->path(); 794 const QString path = (*it)->path();
794 m_location->insertItem(path+ "<-"+disk ); 795 m_location->insertItem(path+ "<-"+disk );
795 } 796 }
796 int count = m_location->count(); 797 int count = m_location->count();
797 m_location->insertItem( m_currentDir ); 798 m_location->insertItem( m_currentDir );
798 m_location->setCurrentItem( count ); 799 m_location->setCurrentItem( count );
799 // due to the New and Close button we can not simply hide m_boxToolBar to not show it 800 // due to the New and Close button we can not simply hide m_boxToolBar to not show it
800 if( !m_shTool ){ 801 if( !m_shTool ){
801 m_location->hide( ); 802 m_location->hide( );
802 m_up->hide( ); 803 m_up->hide( );
803 m_homeButton->hide( ); 804 m_homeButton->hide( );
804 m_docButton->hide( ); 805 m_docButton->hide( );
805 } 806 }
806 if(!m_shClose ) 807 if(!m_shClose )
807 m_close->hide(); 808 m_close->hide();
808 if(!m_shNew) 809 if(!m_shNew)
809 m_close->hide(); 810 m_close->hide();
810 811
811 } // off toolbar 812 } // off toolbar
812 // the Main ListView 813 // the Main ListView
813 // make a QWidgetStack first so Views can share the Toolbar 814 // make a QWidgetStack first so Views can share the Toolbar
814 m_View = new QListView( m_pseudo, "Extended view"); 815 m_View = new QListView( m_pseudo, "Extended view");
815 QPEApplication::setStylusOperation( m_View->viewport(), 816 QPEApplication::setStylusOperation( m_View->viewport(),
816 QPEApplication::RightOnHold); 817 QPEApplication::RightOnHold);
817 m_View->addColumn(" " ); 818 m_View->addColumn(" " );
818 m_View->addColumn(tr("Name"), 135 ); 819 m_View->addColumn(tr("Name"), 135 );
819 m_View->addColumn(tr("Size"), -1 ); 820 m_View->addColumn(tr("Size"), -1 );
820 m_View->addColumn(tr("Date"), 60 ); 821 m_View->addColumn(tr("Date"), 60 );
821 m_View->addColumn(tr("Mime Type"), -1 ); 822 m_View->addColumn(tr("Mime Type"), -1 );
822 QHeader *header = m_View->header(); 823 QHeader *header = m_View->header();
823 header->hide(); 824 header->hide();
824 m_View->setSorting( 1 ); 825 m_View->setSorting( 1 );
825 m_View->setAllColumnsShowFocus( TRUE ); 826 m_View->setAllColumnsShowFocus( TRUE );
826 827
827 connect(m_View, SIGNAL(selectionChanged() ), 828 connect(m_View, SIGNAL(selectionChanged() ),
828 this, SLOT(slotSelectionChanged() ) ); 829 this, SLOT(slotSelectionChanged() ) );
829 830
830 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), 831 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ),
831 this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); 832 this, SLOT(slotCurrentChanged(QListViewItem * ) ) );
832 833
833 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), 834 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
834 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); 835 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
835 836
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 m_pseudoLayout->addWidget( m_View, 288 ); 840 m_pseudoLayout->addWidget( m_View, 288 );
840 m_stack->addWidget( m_pseudo, EXTENDED ); 841 m_stack->addWidget( m_pseudo, EXTENDED );
841 } 842 }
842} 843}
843void OFileSelector::initializePerm() 844void OFileSelector::initializePerm()
844{ 845{
845 if( m_checkPerm == 0 ){ 846 if( m_checkPerm == 0 ){
846 m_checkPerm = new QCheckBox(tr("Ser Permission"), this, "perm"); 847 m_checkPerm = new QCheckBox(tr("Ser Permission"), this, "perm");
847 m_checkPerm->setChecked( false ); 848 m_checkPerm->setChecked( false );
848 m_lay->addWidget( m_checkPerm ); 849 m_lay->addWidget( m_checkPerm );
849 850
850 } 851 }
851} 852}
852void OFileSelector::initPics() 853void OFileSelector::initPics()
853{ 854{
854 m_pixmaps = new QMap<QString,QPixmap>; 855 m_pixmaps = new QMap<QString,QPixmap>;
855 QPixmap pm = Resource::loadPixmap( "folder" ); 856 QPixmap pm = Resource::loadPixmap( "folder" );
856 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 857 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
857 QPainter painter( &pm ); 858 QPainter painter( &pm );
858 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 859 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
859 pm.setMask( pm.createHeuristicMask( FALSE ) ); 860 pm.setMask( pm.createHeuristicMask( FALSE ) );
860 m_pixmaps->insert("dirsymlink", pm ); 861 m_pixmaps->insert("dirsymlink", pm );
861 862
862 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); 863 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" );
863 QPainter pen(&pm2 ); 864 QPainter pen(&pm2 );
864 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); 865 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk );
865 pm2.setMask( pm2.createHeuristicMask( FALSE ) ); 866 pm2.setMask( pm2.createHeuristicMask( FALSE ) );
866 m_pixmaps->insert("symlinkedlocked", pm2 ); 867 m_pixmaps->insert("symlinkedlocked", pm2 );
867} 868}
868// if a mime complies with the m_mimeCheck->currentItem 869// if a mime complies with the m_mimeCheck->currentItem
869bool OFileSelector::compliesMime( const QString &path, const QString &mime ) 870bool OFileSelector::compliesMime( const QString &path, const QString &mime )
870{ 871{
871 if( mime == "All" ) 872 if( mime == "All" )
872 return true; 873 return true;
873 MimeType type( path ); 874 MimeType type( path );
874 if( type.id() == mime ) 875 if( type.id() == mime )
875 return true; 876 return true;
876 return false; 877 return false;
877} 878}
878 879
879void OFileSelector::slotFileSelected( const QString &string ) 880void OFileSelector::slotFileSelected( const QString &string )
880{ 881{
881 if( m_shLne ) 882 if( m_shLne )
882 m_edit->setText( string ); 883 m_edit->setText( string );
883 emit fileSelected( string ); 884 emit fileSelected( string );
884} 885}
885void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 886void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
886{ 887{
887 slotFileSelected( lnk.name() ); 888 slotFileSelected( lnk.name() );
888 // emit fileSelected( lnk ); 889 // emit fileSelected( lnk );
889} 890}
890void OFileSelector::slotSelectionChanged() 891void OFileSelector::slotSelectionChanged()
891{ 892{
892 893
893} 894}
894void OFileSelector::slotCurrentChanged(QListViewItem* item ) 895void OFileSelector::slotCurrentChanged(QListViewItem* item )
895{ 896{
896 if( item == 0 ) 897 if( item == 0 )
897 return; 898 return;
898 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 899 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
899 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) 900 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;)
900 if(!sel->isDir() ){ 901 if(!sel->isDir() ){
901 if( m_shLne ) 902 if( m_shLne )
902 m_edit->setText( sel->text(1) ); 903 m_edit->setText( sel->text(1) );
903 } 904 }
904 } 905 }
905} 906}
906void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int) 907void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int)
907{ 908{
908 if ( item == 0 ) 909 if ( item == 0 )
909 return; 910 return;
910 911
911 if( button != Qt::LeftButton ) 912 if( button != Qt::LeftButton )
912 return; 913 return;
913 914
914 switch( m_selector ){ 915 switch( m_selector ){
915 default: 916 default:
916 break; 917 break;
917 case EXTENDED: // fall through 918 case EXTENDED: // fall through
918 case EXTENDED_ALL:{ 919 case EXTENDED_ALL:{
919 OFileSelectorItem *sel = (OFileSelectorItem*)item; 920 OFileSelectorItem *sel = (OFileSelectorItem*)item;
920 if(!sel->isLocked() ){ 921 if(!sel->isLocked() ){
921 QStringList str = QStringList::split("->", sel->text(1) ); 922 QStringList str = QStringList::split("->", sel->text(1) );
922 if( sel->isDir() ){ 923 if( sel->isDir() ){
923 cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); 924 cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
924 // if MODE Dir m_shLne set the Text 925 // if MODE Dir m_shLne set the Text
925 }else{ 926 }else{
926 if( m_shLne ) 927 if( m_shLne )
927 m_edit->setText( str[0].stripWhiteSpace() ); 928 m_edit->setText( str[0].stripWhiteSpace() );
928 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); 929 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() );
929 } 930 }
930 } 931 }
931 break; 932 break;
932 } 933 }
933 } 934 }
934} 935}
935void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) 936void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int )
936{ 937{
937 if( item == 0 ) 938 if( item == 0 )
938 return; 939 return;
939 940
940 if( button != Qt::RightButton ) 941 if( button != Qt::RightButton )
941 return; 942 return;
942 slotContextMenu( item ); 943 slotContextMenu( item );
943} 944}
944void OFileSelector::slotContextMenu( QListViewItem *item) 945void OFileSelector::slotContextMenu( QListViewItem *item)
945{ 946{
946 947
947} 948}
948void OFileSelector::slotChangedDir() 949void OFileSelector::slotChangedDir()
949{ 950{
950 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 951 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
951 if(sel->isDir() ){ 952 if(sel->isDir() ){
952 QStringList str = QStringList::split("->", sel->text(1) ); 953 QStringList str = QStringList::split("->", sel->text(1) );
953 cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); 954 cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
954 } 955 }
955} 956}
956void OFileSelector::slotOpen() 957void OFileSelector::slotOpen()
957{ 958{
958 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 959 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
959 if(!sel->isDir() ){ 960 if(!sel->isDir() ){
960 QStringList str = QStringList::split("->", sel->text(1) ); 961 QStringList str = QStringList::split("->", sel->text(1) );
961 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); 962 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() );
962 } 963 }
963} 964}
964void OFileSelector::slotRescan() 965void OFileSelector::slotRescan()
965{ 966{
966 967
967} 968}
968void OFileSelector::slotRename() 969void OFileSelector::slotRename()
969{ 970{
970 reparse(); 971 reparse();
971} 972}
972void OFileSelector::slotDelete() 973void OFileSelector::slotDelete()
973{ 974{
974 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 975 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
975 QStringList list = QStringList::split("->", sel->text(1) ); 976 QStringList list = QStringList::split("->", sel->text(1) );
976 if( sel->isDir() ){ 977 if( sel->isDir() ){
977 QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry 978 QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry
978 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], 979 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0],
979 tr("Yes"),tr("No"),0,1,1) ) { 980 tr("Yes"),tr("No"),0,1,1) ) {
980 case 0: 981 case 0:
981 ::system(str.utf8().data() ); 982 ::system(str.utf8().data() );
982 break; 983 break;
983 } 984 }
984 } else { 985 } else {
985 QFile::remove( list[0] ); 986 QFile::remove( list[0] );
986 } 987 }
987 m_View->takeItem( sel ); 988 m_View->takeItem( sel );
988 delete sel; 989 delete sel;
989} 990}
990void OFileSelector::cdUP() 991void OFileSelector::cdUP()
991{ 992{
992 QDir dir( m_currentDir ); 993 QDir dir( m_currentDir );
993 dir.cdUp(); 994 dir.cdUp();
994 if(dir.exists() ){ 995 if(dir.exists() ){
995 m_currentDir = dir.absPath(); 996 m_currentDir = dir.absPath();
996 reparse(); 997 reparse();
997 int count = m_location->count(); 998 int count = m_location->count();
998 slotInsertLocationPath( m_currentDir, count); 999 slotInsertLocationPath( m_currentDir, count);
999 m_location->setCurrentItem( indexByString( m_location, m_currentDir)); 1000 m_location->setCurrentItem( indexByString( m_location, m_currentDir));
1000 //this wont work in all instances 1001 //this wont work in all instances
1001 // FIXME 1002 // FIXME
1002 } 1003 }
1003} 1004}
1004void OFileSelector::slotHome() 1005void OFileSelector::slotHome()
1005{ 1006{
1006 cd(QDir::homeDirPath() ); 1007 cd(QDir::homeDirPath() );
1007} 1008}
1008void OFileSelector::slotDoc() 1009void OFileSelector::slotDoc()
1009{ 1010{
1010 cd(QPEApplication::documentDir() ); 1011 cd(QPEApplication::documentDir() );
1011} 1012}
1012void OFileSelector::slotNavigate( ) 1013void OFileSelector::slotNavigate( )
1013{ 1014{
1014 1015
1015} 1016}
1016// fill the View with life 1017// fill the View with life
1017void OFileSelector::reparse() 1018void OFileSelector::reparse()
1018{ 1019{
1019 if( m_selector == NORMAL ) 1020 if( m_selector == NORMAL )
1020 return; 1021 return;
1021 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) 1022 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL )
1022 m_View->clear(); 1023 m_View->clear();
1023 else // custom view 1024 else // custom view
1024 ; // currentView()->clear(); 1025 ; // currentView()->clear();
1025 if( m_shChooser) 1026 if( m_shChooser)
1026 qWarning("reparse %s", m_mimeCheck->currentText().latin1() ); 1027 qWarning("reparse %s", m_mimeCheck->currentText().latin1() );
1027 1028
1028 QString currentMimeType; 1029 QString currentMimeType;
1029 // let's update the mimetype 1030 // let's update the mimetype
1030 if( m_autoMime ){ 1031 if( m_autoMime ){
1031 m_mimetypes.clear(); 1032 m_mimetypes.clear();
1032 // ok we can change mimetype so we need to be able to give a selection 1033 // ok we can change mimetype so we need to be able to give a selection
1033 if( m_shChooser ) { 1034 if( m_shChooser ) {
1034 currentMimeType = m_mimeCheck->currentText(); 1035 currentMimeType = m_mimeCheck->currentText();
1035 m_mimeCheck->clear(); 1036 m_mimeCheck->clear();
1036 1037
1037 // let's find possible mimetypes 1038 // let's find possible mimetypes
1038 QDir dir( m_currentDir ); 1039 QDir dir( m_currentDir );
1039 dir.setFilter( QDir::Files | QDir::Readable ); 1040 dir.setFilter( QDir::Files | QDir::Readable );
1040 dir.setSorting( QDir::Size ); 1041 dir.setSorting( QDir::Size );
1041 const QFileInfoList *list = dir.entryInfoList(); 1042 const QFileInfoList *list = dir.entryInfoList();
1042 QFileInfoListIterator it( *list ); 1043 QFileInfoListIterator it( *list );
1043 QFileInfo *fi; 1044 QFileInfo *fi;
1044 while( (fi=it.current() ) ) { 1045 while( (fi=it.current() ) ) {
1045 if( fi->extension() == QString::fromLatin1("desktop") ){ 1046 if( fi->extension() == QString::fromLatin1("desktop") ){
1046 ++it; 1047 ++it;
1047 continue; 1048 continue;
1048 } 1049 }
1049 MimeType type( fi->absFilePath() ); 1050 MimeType type( fi->absFilePath() );
1050 if( !m_mimetypes.contains( type.id() ) ){ 1051 if( !m_mimetypes.contains( type.id() ) ){
1051 //qWarning("Type %s", type.id().latin1() ); 1052 //qWarning("Type %s", type.id().latin1() );
1052 m_mimetypes.append( type.id() ); 1053 m_mimetypes.append( type.id() );
1053 } 1054 }
1054 1055
1055 ++it; 1056 ++it;
1056 } 1057 }
1057 // add them to the chooser 1058 // add them to the chooser
1058 m_mimeCheck->insertItem( tr("All") ); 1059 m_mimeCheck->insertItem( tr("All") );
1059 m_mimeCheck->insertStringList( m_mimetypes ); 1060 m_mimeCheck->insertStringList( m_mimetypes );
1060 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) ); 1061 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) );
1061 currentMimeType = m_mimeCheck->currentText(); 1062 currentMimeType = m_mimeCheck->currentText();
1062 } 1063 }
1063 }else { // no autoMime 1064 }else { // no autoMime
1064 currentMimeType = m_mimetypes.join(";"); 1065 currentMimeType = m_mimetypes.join(";");
1065 if( m_shChooser ){ 1066 if( m_shChooser ){
1066 m_mimeCheck->clear(); 1067 m_mimeCheck->clear();
1067 m_mimeCheck->insertItem(m_mimetypes.join(",") ); 1068 m_mimeCheck->insertItem(m_mimetypes.join(",") );
1068 } 1069 }
1069 } 1070 }
1070 // now we got our mimetypes we can add the files 1071 // now we got our mimetypes we can add the files
1071 1072
1072 QDir dir( m_currentDir ); 1073 QDir dir( m_currentDir );
1073 1074
1074 int sort; 1075 int sort;
1075 if ( m_case ) 1076 if ( m_case )
1076 sort = (QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed); 1077 sort = (QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed);
1077 else 1078 else
1078 sort = (QDir::Name | QDir::DirsFirst | QDir::Reversed); 1079 sort = (QDir::Name | QDir::DirsFirst | QDir::Reversed);
1079 dir.setSorting( sort ); 1080 dir.setSorting( sort );
1080 1081
1081 int filter; 1082 int filter;
1082 if( m_selector == EXTENDED_ALL /*|| m_selector ==CUSTOM_ALL */ ){ 1083 if( m_selector == EXTENDED_ALL /*|| m_selector ==CUSTOM_ALL */ ){
1083 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 1084 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
1084 }else 1085 }else
1085 filter = QDir::Files | QDir::Dirs | QDir::All; 1086 filter = QDir::Files | QDir::Dirs | QDir::All;
1086 dir.setFilter( filter ); 1087 dir.setFilter( filter );
1087 1088
1088 // now go through all files 1089 // now go through all files
1089 const QFileInfoList *list = dir.entryInfoList(); 1090 const QFileInfoList *list = dir.entryInfoList();
1090 QFileInfoListIterator it( *list ); 1091 QFileInfoListIterator it( *list );
1091 QFileInfo *fi; 1092 QFileInfo *fi;
1092 while( (fi=it.current() ) ){ 1093 while( (fi=it.current() ) ){
1093 //qWarning("True and only" ); 1094 //qWarning("True and only" );
1094 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ 1095 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){
1095 //qWarning(".. or ." ); 1096 //qWarning(".. or ." );
1096 ++it; 1097 ++it;
1097 continue; 1098 continue;
1098 } 1099 }
1099 if( fi->isSymLink() ){ 1100 if( fi->isSymLink() ){
1100 QString file = fi->dirPath( true ) + "/" + fi->readLink(); 1101 QString file = fi->dirPath( true ) + "/" + fi->readLink();
1101 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos 1102 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos
1102 QFileInfo info( file ); 1103 QFileInfo info( file );
1103 if( !info.exists() ){ 1104 if( !info.exists() ){
1104 addSymlink( currentMimeType, fi, TRUE ); 1105 addSymlink( currentMimeType, fi, TRUE );
1105 break; 1106 break;
1106 }else if( info.isDir() ){ 1107 }else if( info.isDir() ){
1107 addDir( currentMimeType, fi, TRUE ); 1108 addDir( currentMimeType, fi, TRUE );
1108 break; 1109 break;
1109 }else if( info.isFile() ){ 1110 }else if( info.isFile() ){
1110 addFile( currentMimeType, fi, TRUE ); 1111 addFile( currentMimeType, fi, TRUE );
1111 break; 1112 break;
1112 }else if( info.isSymLink() ){ 1113 }else if( info.isSymLink() ){
1113 file = info.dirPath(true ) + "/" + info.readLink() ; 1114 file = info.dirPath(true ) + "/" + info.readLink() ;
1114 break; 1115 break;
1115 }else if( i == 4){ 1116 }else if( i == 4){
1116 addSymlink( currentMimeType, fi ); 1117 addSymlink( currentMimeType, fi );
1117 } 1118 }
1118 } // off for loop 1119 } // off for loop
1119 }else if( fi->isDir() ){ 1120 }else if( fi->isDir() ){
1120 addDir( currentMimeType, fi ); 1121 addDir( currentMimeType, fi );
1121 }else if( fi->isFile() ){ 1122 }else if( fi->isFile() ){
1122 addFile( currentMimeType, fi ); 1123 addFile( currentMimeType, fi );
1123 } 1124 }
1124 //qWarning( "%s", fi->fileName().latin1() ); 1125 //qWarning( "%s", fi->fileName().latin1() );
1125 ++it; 1126 ++it;
1126 } // of while loop 1127 } // of while loop
1127 m_View->sort(); 1128 m_View->sort();
1128 if( m_shTool ){ 1129 if( m_shTool ){
1129 m_location->insertItem( m_currentDir ); 1130 m_location->insertItem( m_currentDir );
1130 1131
1131 } 1132 }
1132 // reenable painting and updates 1133 // reenable painting and updates
1133} 1134}