summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp
index 2746732..069b625 100644
--- a/libopie2/opieui/fileselector/ofileselector.cpp
+++ b/libopie2/opieui/fileselector/ofileselector.cpp
@@ -102,520 +102,520 @@ DocLnk OFileViewInterface::selectedDocument()const
102} 102}
103 103
104bool OFileViewInterface::showNew()const 104bool OFileViewInterface::showNew()const
105{ 105{
106 return selector()->showNew(); 106 return selector()->showNew();
107} 107}
108 108
109bool OFileViewInterface::showClose()const 109bool OFileViewInterface::showClose()const
110{ 110{
111 return selector()->showClose(); 111 return selector()->showClose();
112} 112}
113 113
114MimeTypes OFileViewInterface::mimeTypes()const 114MimeTypes OFileViewInterface::mimeTypes()const
115{ 115{
116 return selector()->mimeTypes(); 116 return selector()->mimeTypes();
117} 117}
118 118
119QStringList OFileViewInterface::currentMimeType()const 119QStringList OFileViewInterface::currentMimeType()const
120{ 120{
121 return selector()->currentMimeType(); 121 return selector()->currentMimeType();
122} 122}
123 123
124void OFileViewInterface::activate( const QString& ) 124void OFileViewInterface::activate( const QString& )
125{ 125{
126 // not implemented here 126 // not implemented here
127} 127}
128 128
129void OFileViewInterface::ok() 129void OFileViewInterface::ok()
130{ 130{
131 emit selector()->ok(); 131 emit selector()->ok();
132} 132}
133 133
134void OFileViewInterface::cancel() 134void OFileViewInterface::cancel()
135{ 135{
136 emit selector()->cancel(); 136 emit selector()->cancel();
137} 137}
138 138
139void OFileViewInterface::closeMe() 139void OFileViewInterface::closeMe()
140{ 140{
141 emit selector()->closeMe(); 141 emit selector()->closeMe();
142} 142}
143 143
144void OFileViewInterface::fileSelected( const QString& str) 144void OFileViewInterface::fileSelected( const QString& str)
145{ 145{
146 emit selector()->fileSelected( str); 146 emit selector()->fileSelected( str);
147} 147}
148 148
149void OFileViewInterface::fileSelected( const DocLnk& lnk) 149void OFileViewInterface::fileSelected( const DocLnk& lnk)
150{ 150{
151 emit selector()->fileSelected( lnk ); 151 emit selector()->fileSelected( lnk );
152} 152}
153 153
154void OFileViewInterface::setCurrentFileName( const QString& str ) 154void OFileViewInterface::setCurrentFileName( const QString& str )
155{ 155{
156 selector()->m_lneEdit->setText( str ); 156 selector()->m_lneEdit->setText( str );
157} 157}
158 158
159QString OFileViewInterface::currentFileName()const 159QString OFileViewInterface::currentFileName()const
160{ 160{
161 return selector()->m_lneEdit->text(); 161 return selector()->m_lneEdit->text();
162} 162}
163 163
164QString OFileViewInterface::startDirectory()const 164QString OFileViewInterface::startDirectory()const
165{ 165{
166 return selector()->m_startDir; 166 return selector()->m_startDir;
167} 167}
168 168
169bool OFileViewInterface::allItem( const QString& item )const 169bool OFileViewInterface::allItem( const QString& item )const
170{ 170{
171 return selector()->m_allList.contains( item ); 171 return selector()->m_allList.contains( item );
172} 172}
173 173
174 174
175ODocumentFileView::ODocumentFileView( OFileSelector* selector ) 175ODocumentFileView::ODocumentFileView( OFileSelector* selector )
176 :OFileViewInterface( selector ) 176 :OFileViewInterface( selector )
177{ 177{
178 m_selector = 0; 178 m_selector = 0;
179 setName( QObject::tr("Documents") ); 179 setName( QObject::tr("Documents") );
180} 180}
181 181
182ODocumentFileView::~ODocumentFileView() 182ODocumentFileView::~ODocumentFileView()
183{ 183{
184} 184}
185 185
186QString ODocumentFileView::selectedName()const 186QString ODocumentFileView::selectedName()const
187{ 187{
188 if (!m_selector) 188 if (!m_selector)
189 return QString::null; 189 return QString::null;
190 190
191 return m_selector->selectedDocument().file(); 191 return m_selector->selectedDocument().file();
192} 192}
193 193
194QString ODocumentFileView::selectedPath()const 194QString ODocumentFileView::selectedPath()const
195{ 195{
196 return QPEApplication::documentDir(); 196 return QPEApplication::documentDir();
197} 197}
198 198
199QString ODocumentFileView::directory()const 199QString ODocumentFileView::directory()const
200{ 200{
201 return selectedPath(); 201 return selectedPath();
202} 202}
203 203
204void ODocumentFileView::reread() 204void ODocumentFileView::reread()
205{ 205{
206 if (!m_selector) 206 if (!m_selector)
207 return; 207 return;
208 208
209 m_selector->setNewVisible( showNew() ); 209 m_selector->setNewVisible( showNew() );
210 m_selector->setCloseVisible( showClose() ); 210 m_selector->setCloseVisible( showClose() );
211 m_selector->filter = currentMimeType().join(";"); 211 m_selector->filter = currentMimeType().join(";");
212 m_selector->reread(); 212 m_selector->reread();
213} 213}
214 214
215int ODocumentFileView::fileCount()const 215int ODocumentFileView::fileCount()const
216{ 216{
217 if (!m_selector) 217 if (!m_selector)
218 return -1; 218 return -1;
219 219
220 return m_selector->fileCount(); 220 return m_selector->fileCount();
221} 221}
222 222
223DocLnk ODocumentFileView::selectedDocument()const 223DocLnk ODocumentFileView::selectedDocument()const
224{ 224{
225 if (!m_selector) 225 if (!m_selector)
226 return DocLnk(); 226 return DocLnk();
227 227
228 return m_selector->selectedDocument(); 228 return m_selector->selectedDocument();
229} 229}
230 230
231QWidget* ODocumentFileView::widget( QWidget* parent ) 231QWidget* ODocumentFileView::widget( QWidget* parent )
232{ 232{
233 if (!m_selector ) 233 if (!m_selector )
234 { 234 {
235 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); 235 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() );
236 QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ), 236 QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ),
237 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); 237 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) );
238 QObject::connect(m_selector, SIGNAL(closeMe() ), 238 QObject::connect(m_selector, SIGNAL(closeMe() ),
239 selector(), SIGNAL(closeMe() ) ); 239 selector(), SIGNAL(closeMe() ) );
240 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ), 240 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ),
241 selector(), SIGNAL(newSelected(const DocLnk&) ) ); 241 selector(), SIGNAL(newSelected(const DocLnk&) ) );
242 } 242 }
243 243
244 return m_selector; 244 return m_selector;
245} 245}
246 246
247/* 247/*
248 * This is the file system view used 248 * This is the file system view used
249 * we use a QListView + QListViewItems for it 249 * we use a QListView + QListViewItems for it
250 */ 250 */
251 251
252OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, 252OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap,
253 const QString& path, const QString& date, 253 const QString& path, const QString& date,
254 const QString& size, const QString& dir, 254 const QString& size, const QString& dir,
255 bool isLocked, bool isDir ) 255 bool isLocked, bool isDir )
256 : QListViewItem( view ), m_dir(dir), m_isDir(isDir), m_locked(isLocked) 256 : QListViewItem( view ), m_dir(dir), m_isDir(isDir), m_locked(isLocked)
257{ 257{
258 setPixmap(0, pixmap ); 258 setPixmap(0, pixmap );
259 setText(1, path ); 259 setText(1, path );
260 setText(2, size ); 260 setText(2, size );
261 setText(3, date ); 261 setText(3, date );
262} 262}
263 263
264OFileSelectorItem::~OFileSelectorItem() 264OFileSelectorItem::~OFileSelectorItem()
265{ 265{
266} 266}
267 267
268bool OFileSelectorItem::isLocked()const 268bool OFileSelectorItem::isLocked()const
269{ 269{
270 return m_locked; 270 return m_locked;
271} 271}
272 272
273QString OFileSelectorItem::directory()const 273QString OFileSelectorItem::directory()const
274{ 274{
275 return m_dir; 275 return m_dir;
276} 276}
277 277
278bool OFileSelectorItem::isDir()const 278bool OFileSelectorItem::isDir()const
279{ 279{
280 return m_isDir; 280 return m_isDir;
281} 281}
282 282
283QString OFileSelectorItem::path()const 283QString OFileSelectorItem::path()const
284{ 284{
285 return text( 1 ); 285 return text( 1 );
286} 286}
287 287
288QString OFileSelectorItem::key( int id, bool )const 288QString OFileSelectorItem::key( int id, bool )const
289{ 289{
290 QString ke; 290 QString ke;
291 291
292 /* 292 /*
293 * id = 0 ||id == 1 : Sort By Name but Directories at Top 293 * id = 0 ||id == 1 : Sort By Name but Directories at Top
294 * id = 2 : Sort By Size: Prepend '0' to the key 294 * id = 2 : Sort By Size: Prepend '0' to the key
295 */ 295 */
296 if( id == 0 || id == 1 ) 296 if( id == 0 || id == 1 )
297 { // name 297 { // name
298 if( m_isDir ) 298 if( m_isDir )
299 { 299 {
300 ke.append("0" ); 300 ke.append("0" );
301 ke.append( text(1) ); 301 ke.append( text(1) );
302 } 302 }
303 else 303 else
304 { 304 {
305 ke.append("1" ); 305 ke.append("1" );
306 ke.append( text(1) ); 306 ke.append( text(1) );
307 } 307 }
308 return ke; 308 return ke;
309 }else if(id == 2) { 309 }else if(id == 2) {
310 return text(2).rightJustify(20, '0'); 310 return text(2).rightJustify(20, '0');
311 }else 311 }else
312 return text( id ); 312 return text( id );
313 313
314} 314}
315 315
316OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) 316OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel)
317 :QWidget( parent ), m_sel( sel ) 317 :QWidget( parent ), m_sel( sel )
318{ 318{
319 m_all = false; 319 m_all = false;
320 QVBoxLayout* lay = new QVBoxLayout( this ); 320 QVBoxLayout* lay = new QVBoxLayout( this );
321 m_currentDir = startDir; 321 m_currentDir = startDir;
322 322
323 /* 323 /*
324 * now we add a special bar 324 * now we add a special bar
325 * One Button For Up 325 * One Button For Up
326 * Home 326 * Home
327 * Doc 327 * Doc
328 * And a dropdown menu with FileSystems 328 * And a dropdown menu with FileSystems
329 * FUTURE: one to change dir with lineedit 329 * FUTURE: one to change dir with lineedit
330 * Bookmarks 330 * Bookmarks
331 * Create Dir 331 * Create Dir
332 */ 332 */
333 QHBox* box = new QHBox(this ); 333 QHBox* box = new QHBox(this );
334 box->setBackgroundMode( PaletteButton ); 334 box->setBackgroundMode( PaletteButton );
335 box->setSpacing( 0 ); 335 box->setSpacing( 0 );
336 336
337 QPixmap pic; 337 QPixmap pic;
338 QToolButton *btn = new QToolButton( box ); 338 QToolButton *btn = new QToolButton( box );
339 pic.convertFromImage( Resource::loadImage( "up" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 339 pic.convertFromImage( Resource::loadImage( "up" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
340 btn->setPixmap( pic ); 340 btn->setPixmap( pic );
341 connect(btn, SIGNAL(clicked() ), 341 connect(btn, SIGNAL(clicked() ),
342 this, SLOT( cdUP() ) ); 342 this, SLOT( cdUP() ) );
343 343
344 btn = new QToolButton( box ); 344 btn = new QToolButton( box );
345 pic.convertFromImage( Resource::loadImage( "home" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 345 pic.convertFromImage( Resource::loadImage( "home" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
346 btn->setPixmap( pic ); 346 btn->setPixmap( pic );
347 connect(btn, SIGNAL(clicked() ), 347 connect(btn, SIGNAL(clicked() ),
348 this, SLOT( cdHome() ) ); 348 this, SLOT( cdHome() ) );
349 349
350 btn = new QToolButton( box ); 350 btn = new QToolButton( box );
351 pic.convertFromImage( Resource::loadImage( "DocsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 351 pic.convertFromImage( Resource::loadImage( "DocsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
352 btn->setPixmap( pic ); 352 btn->setPixmap( pic );
353 connect(btn, SIGNAL(clicked() ), 353 connect(btn, SIGNAL(clicked() ),
354 this, SLOT(cdDoc() ) ); 354 this, SLOT(cdDoc() ) );
355 355
356 m_btnNew = new QToolButton( box ); 356 m_btnNew = new QToolButton( box );
357 pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 357 pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
358 btn->setPixmap( pic ); 358 m_btnNew->setPixmap( pic );
359 connect(m_btnNew, SIGNAL(clicked() ), 359 connect(m_btnNew, SIGNAL(clicked() ),
360 this, SLOT(slotNew() ) ); 360 this, SLOT(slotNew() ) );
361 361
362 362
363 m_btnClose = new QToolButton( box ); 363 m_btnClose = new QToolButton( box );
364 pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 364 pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
365 btn->setPixmap( pic ); 365 m_btnClose->setPixmap( pic );
366 connect(m_btnClose, SIGNAL(clicked() ), 366 connect(m_btnClose, SIGNAL(clicked() ),
367 selector(), SIGNAL(closeMe() ) ); 367 selector(), SIGNAL(closeMe() ) );
368 368
369 btn = new QToolButton( box ); 369 btn = new QToolButton( box );
370 pic.convertFromImage( Resource::loadImage( "cardmon/pcmcia" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 370 pic.convertFromImage( Resource::loadImage( "cardmon/pcmcia" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
371 btn->setPixmap( pic ); 371 btn->setPixmap( pic );
372 372
373 m_fsButton = btn; 373 m_fsButton = btn;
374 /* let's fill device parts */ 374 /* let's fill device parts */
375 QPopupMenu* pop = new QPopupMenu(this); 375 QPopupMenu* pop = new QPopupMenu(this);
376 connect(pop, SIGNAL( activated(int) ), 376 connect(pop, SIGNAL( activated(int) ),
377 this, SLOT(slotFSActivated(int) ) ); 377 this, SLOT(slotFSActivated(int) ) );
378 378
379 StorageInfo storage; 379 StorageInfo storage;
380 const QList<FileSystem> &fs = storage.fileSystems(); 380 const QList<FileSystem> &fs = storage.fileSystems();
381 QListIterator<FileSystem> it(fs); 381 QListIterator<FileSystem> it(fs);
382 for ( ; it.current(); ++it ) 382 for ( ; it.current(); ++it )
383 { 383 {
384 const QString disk = (*it)->name(); 384 const QString disk = (*it)->name();
385 const QString path = (*it)->path(); 385 const QString path = (*it)->path();
386 m_dev.insert( disk, path ); 386 m_dev.insert( disk, path );
387 pop->insertItem( disk ); 387 pop->insertItem( disk );
388 } 388 }
389 m_fsPop = pop; 389 m_fsPop = pop;
390 390
391 connect(btn,SIGNAL(pressed()),this,SLOT(slotFSpressed())); 391 connect(btn,SIGNAL(pressed()),this,SLOT(slotFSpressed()));
392 392
393 lay->addWidget( box ); 393 lay->addWidget( box );
394 394
395 m_view = new QListView( this ); 395 m_view = new QListView( this );
396 396
397 m_view->installEventFilter(this); 397 m_view->installEventFilter(this);
398 398
399 QPEApplication::setStylusOperation( m_view->viewport(), 399 QPEApplication::setStylusOperation( m_view->viewport(),
400 QPEApplication::RightOnHold); 400 QPEApplication::RightOnHold);
401 m_view->addColumn(" " ); 401 m_view->addColumn(" " );
402 m_view->addColumn(tr("Name"), 135 ); 402 m_view->addColumn(tr("Name"), 135 );
403 m_view->addColumn(tr("Size"), -1 ); 403 m_view->addColumn(tr("Size"), -1 );
404 m_view->addColumn(tr("Date"), 60 ); 404 m_view->addColumn(tr("Date"), 60 );
405 m_view->addColumn(tr("Mime Type"), -1 ); 405 m_view->addColumn(tr("Mime Type"), -1 );
406 406
407 407
408 m_view->setSorting( 1 ); 408 m_view->setSorting( 1 );
409 m_view->setAllColumnsShowFocus( TRUE ); 409 m_view->setAllColumnsShowFocus( TRUE );
410 410
411 lay->addWidget( m_view, 1000 ); 411 lay->addWidget( m_view, 1000 );
412 connectSlots(); 412 connectSlots();
413} 413}
414 414
415void OFileViewFileListView::slotFSpressed() 415void OFileViewFileListView::slotFSpressed()
416{ 416{
417 m_fsPop->exec(QPoint( QCursor::pos().x(), QCursor::pos().y())); 417 m_fsPop->exec(QPoint( QCursor::pos().x(), QCursor::pos().y()));
418 m_fsButton->setDown(false); 418 m_fsButton->setDown(false);
419} 419}
420 420
421OFileViewFileListView::~OFileViewFileListView() 421OFileViewFileListView::~OFileViewFileListView()
422{ 422{
423} 423}
424 424
425void OFileViewFileListView::slotNew() 425void OFileViewFileListView::slotNew()
426{ 426{
427 DocLnk lnk; 427 DocLnk lnk;
428 emit selector()->newSelected( lnk ); 428 emit selector()->newSelected( lnk );
429} 429}
430 430
431OFileSelectorItem* OFileViewFileListView::currentItem()const 431OFileSelectorItem* OFileViewFileListView::currentItem()const
432{ 432{
433 QListViewItem* item = m_view->currentItem(); 433 QListViewItem* item = m_view->currentItem();
434 if (!item ) 434 if (!item )
435 return 0l; 435 return 0l;
436 436
437 return static_cast<OFileSelectorItem*>(item); 437 return static_cast<OFileSelectorItem*>(item);
438} 438}
439 439
440void OFileViewFileListView::reread( bool all ) 440void OFileViewFileListView::reread( bool all )
441{ 441{
442 m_view->clear(); 442 m_view->clear();
443 443
444 if (selector()->showClose() ) 444 if (selector()->showClose() )
445 m_btnClose->show(); 445 m_btnClose->show();
446 else 446 else
447 m_btnClose->hide(); 447 m_btnClose->hide();
448 448
449 if (selector()->showNew() ) 449 if (selector()->showNew() )
450 m_btnNew->show(); 450 m_btnNew->show();
451 else 451 else
452 m_btnNew->hide(); 452 m_btnNew->hide();
453 453
454 m_mimes = selector()->currentMimeType(); 454 m_mimes = selector()->currentMimeType();
455 m_all = all; 455 m_all = all;
456 456
457 QDir dir( m_currentDir ); 457 QDir dir( m_currentDir );
458 if (!dir.exists() ) 458 if (!dir.exists() )
459 return; 459 return;
460 460
461 dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); 461 dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed );
462 int filter; 462 int filter;
463 filter = QDir::Dirs; 463 filter = QDir::Dirs;
464 if ( selector()->mode() != OFileSelector::DIRECTORYSELECTOR ) 464 if ( selector()->mode() != OFileSelector::DIRECTORYSELECTOR )
465 filter = filter | QDir::Files | QDir::All; 465 filter = filter | QDir::Files | QDir::All;
466 466
467 if ( m_all ) 467 if ( m_all )
468 filter = filter | QDir::Hidden; 468 filter = filter | QDir::Hidden;
469 469
470 dir.setFilter( filter ); 470 dir.setFilter( filter );
471 471
472 // now go through all files 472 // now go through all files
473 const QFileInfoList *list = dir.entryInfoList(); 473 const QFileInfoList *list = dir.entryInfoList();
474 if (!list) 474 if (!list)
475 { 475 {
476 cdUP(); 476 cdUP();
477 return; 477 return;
478 } 478 }
479 479
480 QFileInfoListIterator it( *list ); 480 QFileInfoListIterator it( *list );
481 QFileInfo *fi; 481 QFileInfo *fi;
482 while( (fi=it.current() ) ) 482 while( (fi=it.current() ) )
483 { 483 {
484 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ) 484 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") )
485 { 485 {
486 ++it; 486 ++it;
487 continue; 487 continue;
488 } 488 }
489 489
490 /* 490 /*
491 * It is a symlink we try to resolve it now but don't let us attack by DOS 491 * It is a symlink we try to resolve it now but don't let us attack by DOS
492 * 492 *
493 */ 493 */
494 if( fi->isSymLink() ) 494 if( fi->isSymLink() )
495 { 495 {
496 QString file = createNewPath(fi->dirPath( true ),fi->readLink()); 496 QString file = createNewPath(fi->dirPath( true ),fi->readLink());
497 for( int i = 0; i<=4; i++) 497 for( int i = 0; i<=4; i++)
498 { // 5 tries to prevent dos 498 { // 5 tries to prevent dos
499 QFileInfo info( file ); 499 QFileInfo info( file );
500 if( !info.exists() ) 500 if( !info.exists() )
501 { 501 {
502 addSymlink( fi, TRUE ); 502 addSymlink( fi, TRUE );
503 break; 503 break;
504 } 504 }
505 else if( info.isDir() ) 505 else if( info.isDir() )
506 { 506 {
507 addDir( fi, TRUE ); 507 addDir( fi, TRUE );
508 break; 508 break;
509 } 509 }
510 else if( info.isFile() ) 510 else if( info.isFile() )
511 { 511 {
512 addFile( fi, TRUE ); 512 addFile( fi, TRUE );
513 break; 513 break;
514 } 514 }
515 else if( info.isSymLink() ) 515 else if( info.isSymLink() )
516 { 516 {
517 file = createNewPath(info.dirPath(true ),info.readLink()); 517 file = createNewPath(info.dirPath(true ),info.readLink());
518 break; 518 break;
519 } 519 }
520 else if( i == 4) 520 else if( i == 4)
521 { // couldn't resolve symlink add it as symlink 521 { // couldn't resolve symlink add it as symlink
522 addSymlink( fi ); 522 addSymlink( fi );
523 } 523 }
524 } // off for loop for symlink resolving 524 } // off for loop for symlink resolving
525 } 525 }
526 else if( fi->isDir() ) 526 else if( fi->isDir() )
527 addDir( fi ); 527 addDir( fi );
528 else if( fi->isFile() ) 528 else if( fi->isFile() )
529 addFile( fi ); 529 addFile( fi );
530 530
531 ++it; 531 ++it;
532 } // of while loop 532 } // of while loop
533 m_view->sort(); 533 m_view->sort();
534 534
535} 535}
536int OFileViewFileListView::fileCount()const 536int OFileViewFileListView::fileCount()const
537{ 537{
538 return m_view->childCount(); 538 return m_view->childCount();
539} 539}
540 540
541QString OFileViewFileListView::currentDir()const 541QString OFileViewFileListView::currentDir()const
542{ 542{
543 return m_currentDir; 543 return m_currentDir;
544} 544}
545 545
546OFileSelector* OFileViewFileListView::selector() 546OFileSelector* OFileViewFileListView::selector()
547{ 547{
548 return m_sel; 548 return m_sel;
549} 549}
550 550
551bool OFileViewFileListView::eventFilter (QObject *, QEvent *e) 551bool OFileViewFileListView::eventFilter (QObject *, QEvent *e)
552{ 552{
553 if ( e->type() == QEvent::KeyPress ) 553 if ( e->type() == QEvent::KeyPress )
554 { 554 {
555 QKeyEvent *k = (QKeyEvent *)e; 555 QKeyEvent *k = (QKeyEvent *)e;
556 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) 556 if ( (k->key()==Key_Enter) || (k->key()==Key_Return))
557 { 557 {
558 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); 558 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0);
559 return true; 559 return true;
560 } 560 }
561 } 561 }
562 return false; 562 return false;
563} 563}
564 564
565void OFileViewFileListView::connectSlots() 565void OFileViewFileListView::connectSlots()
566{ 566{
567 connect(m_view, SIGNAL(clicked(QListViewItem*) ), 567 connect(m_view, SIGNAL(clicked(QListViewItem*) ),
568 this, SLOT(slotCurrentChanged(QListViewItem*) ) ); 568 this, SLOT(slotCurrentChanged(QListViewItem*) ) );
569 connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), 569 connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),
570 this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); 570 this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) );
571} 571}
572 572
573void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) 573void OFileViewFileListView::slotCurrentChanged( QListViewItem* item)
574{ 574{
575 if (!item) 575 if (!item)
576 return; 576 return;
577#if 0 577#if 0
578 578
579 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 579 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
580 580
581 if (!sel->isDir() ) 581 if (!sel->isDir() )
582 { 582 {
583 selector()->m_lneEdit->setText( sel->text(1) ); 583 selector()->m_lneEdit->setText( sel->text(1) );
584 // if in fileselector mode we will emit selected 584 // if in fileselector mode we will emit selected
585 if ( selector()->mode() == OFileSelector::FileSelector ) 585 if ( selector()->mode() == OFileSelector::FileSelector )
586 { 586 {
587 odebug << "slot Current Changed" << oendl; 587 odebug << "slot Current Changed" << oendl;
588 QStringList str = QStringList::split("->", sel->text(1) ); 588 QStringList str = QStringList::split("->", sel->text(1) );
589 QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace()); 589 QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace());
590 emit selector()->fileSelected( path ); 590 emit selector()->fileSelected( path );
591 DocLnk lnk( path ); 591 DocLnk lnk( path );
592 emit selector()->fileSelected( lnk ); 592 emit selector()->fileSelected( lnk );
593 } 593 }
594 } 594 }
595#endif 595#endif
596} 596}
597 597
598void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) 598void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int )
599{ 599{
600 if (!item || ( button != Qt::LeftButton) ) 600 if (!item || ( button != Qt::LeftButton) )
601 return; 601 return;
602 602
603 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 603 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
604 if (!sel->isLocked() ) 604 if (!sel->isLocked() )
605 { 605 {
606 QStringList str = QStringList::split("->", sel->text(1) ); 606 QStringList str = QStringList::split("->", sel->text(1) );
607 if (sel->isDir() ) 607 if (sel->isDir() )
608 { 608 {
609 m_currentDir = createNewPath(sel->directory(),str[0].stripWhiteSpace()); 609 m_currentDir = createNewPath(sel->directory(),str[0].stripWhiteSpace());
610 emit selector()->dirSelected( m_currentDir ); 610 emit selector()->dirSelected( m_currentDir );
611 reread( m_all ); 611 reread( m_all );
612 } 612 }
613 else 613 else
614 { // file 614 { // file
615 odebug << "slot Clicked" << oendl; 615 odebug << "slot Clicked" << oendl;
616 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 616 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
617 QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace()); 617 QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace());
618 emit selector()->fileSelected( path ); 618 emit selector()->fileSelected( path );
619 DocLnk lnk( path ); 619 DocLnk lnk( path );
620 emit selector()->fileSelected( lnk ); 620 emit selector()->fileSelected( lnk );
621 } 621 }