summaryrefslogtreecommitdiff
path: root/libopie
Unidiff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc134
-rw-r--r--libopie/ofileselector.h11
2 files changed, 111 insertions, 34 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 61ab2c4..1807575 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -42,24 +42,41 @@
42 42
43#include <qpe/qpeapplication.h> 43#include <qpe/qpeapplication.h>
44#include <qpe/fileselector.h> 44#include <qpe/fileselector.h>
45#include <qpe/applnk.h> 45#include <qpe/applnk.h>
46#include <qpe/global.h> 46#include <qpe/global.h>
47#include <qpe/mimetype.h> 47#include <qpe/mimetype.h>
48#include <qpe/resource.h> 48#include <qpe/resource.h>
49 49
50#include "ofileselector.h" 50#include "ofileselector.h"
51 51
52QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; 52QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0;
53 53
54namespace {
55
56 int indexByString( const QComboBox *box, const QString &str ){
57 int index= -1;
58 for(int i= 0; i < box->count(); i++ ){
59 qWarning("str T%sT boxT%sT", str.latin1(), box->text(i).latin1() );
60 if( str == box->text(i ) ){
61 index= i;
62 break;
63 }
64 }
65 return index;
66 }
67
68};
69
70
54OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, 71OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName,
55 const QString &fileName, const QStringList mimetypes ) : QWidget( wid ) 72 const QString &fileName, const QStringList mimetypes ) : QWidget( wid )
56{ 73{
57 m_selector = selector; 74 m_selector = selector;
58 m_currentDir = dirName; 75 m_currentDir = dirName;
59 m_name = fileName; 76 m_name = fileName;
60 m_mimetypes = mimetypes; 77 m_mimetypes = mimetypes;
61 if( mimetypes.isEmpty() ) 78 if( mimetypes.isEmpty() )
62 m_autoMime = true; 79 m_autoMime = true;
63 80
64 m_mode = mode; 81 m_mode = mode;
65 m_shTool = true; 82 m_shTool = true;
@@ -95,32 +112,39 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString
95 m_dir = true; 112 m_dir = true;
96 m_files = true; 113 m_files = true;
97 114
98 if(m_pixmaps == 0 ) // init the pixmaps 115 if(m_pixmaps == 0 ) // init the pixmaps
99 initPics(); 116 initPics();
100 117
101 m_lay = new QVBoxLayout(this); 118 m_lay = new QVBoxLayout(this);
102 init(); 119 init();
103 m_edit->setText( fileName ); 120 m_edit->setText( fileName );
104} 121}
105void OFileSelector::initPics() 122void OFileSelector::initPics()
106{ 123{
124 qWarning("init pics" );
107 m_pixmaps = new QMap<QString,QPixmap>; 125 m_pixmaps = new QMap<QString,QPixmap>;
108 QPixmap pm = Resource::loadPixmap( "folder " ); 126 QPixmap pm = Resource::loadPixmap( "folder" );
109 QPixmap lnk = Resource::loadPixmap( "symlink" ); 127 QPixmap lnk = Resource::loadPixmap( "symlink" );
110 QPainter painter( &pm ); 128 QPainter painter( &pm );
111 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 129 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
112 pm.setMask( pm.createHeuristicMask( FALSE ) ); 130 pm.setMask( pm.createHeuristicMask( FALSE ) );
113 m_pixmaps->insert("dirsymlink", pm ); 131 m_pixmaps->insert("dirsymlink", pm );
114 132
133 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" );
134 QPainter pen(&pm2 );
135 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk );
136 pm2.setMask( pm2.createHeuristicMask( FALSE ) );
137 m_pixmaps->insert("symlinkedlocked", pm2 );
138
115}; 139};
116// let's initialize the gui 140// let's initialize the gui
117/** 141/**
118 -------------------- 142 --------------------
119 | cmbBox Button | 143 | cmbBox Button |
120 -------------------- 144 --------------------
121 | FileSlector | 145 | FileSlector |
122 | or | 146 | or |
123 | OSelector | 147 | OSelector |
124 | | 148 | |
125 | | 149 | |
126 ____________________ 150 ____________________
@@ -135,28 +159,36 @@ void OFileSelector::initPics()
135 */ 159 */
136void OFileSelector::delItems() 160void OFileSelector::delItems()
137{ 161{
138 QLayoutIterator it = m_lay->iterator(); 162 QLayoutIterator it = m_lay->iterator();
139 while ( it.current() != 0 ){ 163 while ( it.current() != 0 ){
140 it.deleteCurrent(); 164 it.deleteCurrent();
141 } 165 }
142} 166}
143void OFileSelector::init() 167void OFileSelector::init()
144{ 168{
145 169
146 m_stack = new QWidgetStack(this, "wstack" ); 170 m_stack = new QWidgetStack(this, "wstack" );
147 m_select = new FileSelector(m_mimetypes.join(";"), m_stack, "fileselector", FALSE, FALSE ); 171 if( m_selector == NORMAL ){
148 m_stack->addWidget(m_select, NORMAL ); 172 QString currMime;
149 m_lay->addWidget(m_stack ); 173 if( m_mimeCheck != 0 )
150 m_stack->raiseWidget(NORMAL ); 174 currMime = m_mimeCheck->currentText();
175 updateMimes();
176 m_select = new FileSelector( currMime == "All" ? QString::null : currMime , m_stack, "fileselector", FALSE, FALSE );
177 m_stack->addWidget(m_select, NORMAL );
178 m_lay->addWidget(m_stack );
179 m_stack->raiseWidget(NORMAL );
180 }else {
181 initializeListView();
182 }
151 183
152 if(m_shLne ){ 184 if(m_shLne ){
153 initializeName(); 185 initializeName();
154 } 186 }
155 187
156 if(m_shPerm ){ 188 if(m_shPerm ){
157 m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" ); 189 m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" );
158 m_checkPerm->setChecked( false ); 190 m_checkPerm->setChecked( false );
159 m_lay->addWidget(m_checkPerm ); 191 m_lay->addWidget(m_checkPerm );
160 } 192 }
161 193
162 if( m_shChooser ) 194 if( m_shChooser )
@@ -270,25 +302,25 @@ QString OFileSelector::selectedName( )const
270 string = lnk->file(); 302 string = lnk->file();
271 }else if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 303 }else if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
272 QListViewItem *item = m_View->currentItem(); 304 QListViewItem *item = m_View->currentItem();
273 if(item != 0 ){ 305 if(item != 0 ){
274 string = item->text( 1 ); 306 string = item->text( 1 );
275 } 307 }
276 } 308 }
277 return string; 309 return string;
278} 310}
279QStringList OFileSelector::selectedNames()const 311QStringList OFileSelector::selectedNames()const
280{ 312{
281 QStringList list; 313 QStringList list;
282 314 return list;
283} 315}
284DocLnk OFileSelector::selectedDocument( )const 316DocLnk OFileSelector::selectedDocument( )const
285{ 317{
286 DocLnk lnk; 318 DocLnk lnk;
287 return lnk; 319 return lnk;
288} 320}
289void OFileSelector::updateLay() 321void OFileSelector::updateLay()
290{ 322{
291 /* if( m_shTool ) 323 /* if( m_shTool )
292 // 324 //
293 else 325 else
294 // hide 326 // hide
@@ -356,57 +388,58 @@ void OFileSelector::reparse()
356 ++it; 388 ++it;
357 continue; 389 continue;
358 } 390 }
359 MimeType type(fi->filePath() ); 391 MimeType type(fi->filePath() );
360 if( !m_mimetypes.contains( type.id() ) ) 392 if( !m_mimetypes.contains( type.id() ) )
361 m_mimetypes.append( type.id() ); 393 m_mimetypes.append( type.id() );
362 394
363 ++it; 395 ++it;
364 } 396 }
365 m_mimetypes.prepend("All" ); 397 m_mimetypes.prepend("All" );
366 m_mimeCheck->insertStringList(m_mimetypes ); 398 m_mimeCheck->insertStringList(m_mimetypes );
367 // set it to the current mimetype 399 // set it to the current mimetype
400 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) );
368 }; 401 };
369 QDir dir( m_currentDir ); 402 QDir dir( m_currentDir );
370 //dir.setFilter(-1 ); 403 //dir.setFilter(-1 );
371 dir.setSorting(QDir::Name | QDir::DirsFirst | QDir::Reversed | QDir::IgnoreCase ); 404 dir.setSorting(QDir::Name | QDir::DirsFirst | QDir::Reversed | QDir::IgnoreCase );
372 const QFileInfoList *list = dir.entryInfoList(); 405 const QFileInfoList *list = dir.entryInfoList();
373 QFileInfoListIterator it( *list ); 406 QFileInfoListIterator it( *list );
374 QFileInfo *fi; 407 QFileInfo *fi;
375 while( (fi=it.current()) ){ 408 while( (fi=it.current()) ){
376 if(fi->fileName() == ".." || fi->fileName() == "." ){ 409 if(fi->fileName() == ".." || fi->fileName() == "." ){
377 ++it; 410 ++it;
378 continue; 411 continue;
379 } 412 }
380 qWarning("Test: %s", fi->fileName().latin1() ); 413 qWarning("Test: %s", fi->fileName().latin1() );
381 if(fi->isSymLink() ){ 414 if(fi->isSymLink() ){
382 qWarning("Symlink %s", fi->fileName().latin1() ); 415 qWarning("Symlink %s", fi->fileName().latin1() );
383 QString file = fi->readLink(); 416 QString file = fi->dirPath(true)+"/"+ fi->readLink();
384 qWarning("File ->%s", file.latin1() ); 417 qWarning("File ->%s", file.latin1() );
385 for(int i=0; i<=4; i++ ){ // prepend from dos 418 for(int i=0; i<=4; i++ ){ // prepend from dos
386 QFileInfo info( fi->dirPath()+ "/"+file ); 419 QFileInfo info( file );
387 if( !info.exists() ){ 420 if( !info.exists() ){
388 qWarning("does not exist" ); 421 qWarning("does not exist" );
389 addSymlink(currMime, fi, TRUE ); 422 addSymlink(currMime, fi, TRUE );
390 break; 423 break;
391 }else if( info.isDir() ){ 424 }else if( info.isDir() ){
392 qWarning("isDir" ); 425 qWarning("isDir" );
393 addDir(currMime, fi, TRUE ); 426 addDir(currMime, fi, TRUE );
394 break; 427 break;
395 }else if( info.isFile() ){ 428 }else if( info.isFile() ){
396 qWarning("isFile" ); 429 qWarning("isFile" );
397 addFile(currMime, fi, TRUE ); 430 addFile(currMime, fi, TRUE );
398 break; 431 break;
399 }else if( info.isSymLink() ){ 432 }else if( info.isSymLink() ){
400 file = info.readLink(); 433 file = info.dirPath(true)+ "/"+ info.readLink();
401 qWarning("isSymlink again %s", file.latin1() ); 434 qWarning("isSymlink again %s", file.latin1() );
402 }else if( i == 4 ){ // just insert it and have the symlink symbol 435 }else if( i == 4 ){ // just insert it and have the symlink symbol
403 addSymlink(currMime, fi ); 436 addSymlink(currMime, fi );
404 qWarning("level too deep" ); 437 qWarning("level too deep" );
405 } 438 }
406 } 439 }
407 }else if( fi->isDir() ){ 440 }else if( fi->isDir() ){
408 addDir(currMime, fi ); 441 addDir(currMime, fi );
409 }else if( fi->isFile() ) { // file ? 442 }else if( fi->isFile() ) { // file ?
410 addFile(currMime, fi ); 443 addFile(currMime, fi );
411 } 444 }
412 ++it; 445 ++it;
@@ -484,26 +517,25 @@ void OFileSelector::initializeChooser()
484 517
485 connect( m_mimeCheck, SIGNAL(activated(const QString &) ), 518 connect( m_mimeCheck, SIGNAL(activated(const QString &) ),
486 this, SLOT(slotMimeCheck(const QString & ) ) ); 519 this, SLOT(slotMimeCheck(const QString & ) ) );
487} 520}
488void OFileSelector::slotMimeCheck(const QString &view ){ 521void OFileSelector::slotMimeCheck(const QString &view ){
489 if(m_selector == NORMAL ){ 522 if(m_selector == NORMAL ){
490 delete m_select; 523 delete m_select;
491 m_select = new FileSelector(view == "All" ? QString::null : view 524 m_select = new FileSelector(view == "All" ? QString::null : view
492 , m_stack, "fileselector", FALSE, FALSE ); 525 , m_stack, "fileselector", FALSE, FALSE );
493 m_stack->addWidget( m_select, NORMAL ); 526 m_stack->addWidget( m_select, NORMAL );
494 m_stack->raiseWidget( NORMAL ); 527 m_stack->raiseWidget( NORMAL );
495 }else{ 528 }else{
496 529 reparse();
497
498 } 530 }
499} 531}
500 532
501void OFileSelector::slotViewCheck(const QString &view ){ 533void OFileSelector::slotViewCheck(const QString &view ){
502 qWarning("changed: show %s", view.latin1() ); 534 qWarning("changed: show %s", view.latin1() );
503 // if the current view is the one 535 // if the current view is the one
504 QString currMime = m_mimeCheck->currentText(); 536 QString currMime = m_mimeCheck->currentText();
505 if( view == QString::fromLatin1("Documents") ){ 537 if( view == QString::fromLatin1("Documents") ){
506 // get the mimetype now 538 // get the mimetype now
507 // check if we're the current widget and return 539 // check if we're the current widget and return
508 if( m_View != 0) // delete 0 shouldn't crash but it did :( 540 if( m_View != 0) // delete 0 shouldn't crash but it did :(
509 delete m_View; 541 delete m_View;
@@ -549,89 +581,129 @@ void OFileSelector::updateMimes() // lets check which mode is active
549 m_mimetypes.clear(); 581 m_mimetypes.clear();
550 m_mimetypes.append("All" ); 582 m_mimetypes.append("All" );
551 if( m_selector == NORMAL ){ 583 if( m_selector == NORMAL ){
552 DocLnkSet set; 584 DocLnkSet set;
553 Global::findDocuments(&set, QString::null ); 585 Global::findDocuments(&set, QString::null );
554 QListIterator<DocLnk> dit( set.children() ); 586 QListIterator<DocLnk> dit( set.children() );
555 for ( ; dit.current(); ++dit ) { 587 for ( ; dit.current(); ++dit ) {
556 if( !m_mimetypes.contains((*dit)->type() ) ) 588 if( !m_mimetypes.contains((*dit)->type() ) )
557 m_mimetypes.append( (*dit)->type() ); 589 m_mimetypes.append( (*dit)->type() );
558 } 590 }
559 }else{ 591 }else{
560 // should be allreday updatet 592 // should be allreday updatet
561 593 ;
562 } 594 }
563}; 595};
564void OFileSelector::initializeListView() 596void OFileSelector::initializeListView()
565{ 597{
566 m_View = new QListView(m_stack, "Extended view" ); 598 m_View = new QListView(m_stack, "Extended view" );
567 m_stack->addWidget( m_View, EXTENDED ); 599 m_stack->addWidget( m_View, EXTENDED );
568 m_stack->raiseWidget( EXTENDED ); 600 m_stack->raiseWidget( EXTENDED );
569 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); 601 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold);
570 // set up the stuff 602 // set up the stuff
571 // Pixmap Name Date Size mime 603 // Pixmap Name Date Size mime
572 //(m_View->header() )->hide(); 604 //(m_View->header() )->hide();
573 //m_View->setRootIsDecorated(false); 605 //m_View->setRootIsDecorated(false);
574 m_View->addColumn(" "); 606 m_View->addColumn(" ");
575 m_View->addColumn(tr("Name") ); 607 m_View->addColumn(tr("Name") );
576 m_View->addColumn(tr("Size") ); 608 m_View->addColumn(tr("Size") );
577 m_View->addColumn(tr("Date"), 60 ); 609 m_View->addColumn(tr("Date"), 60 );
578 m_View->addColumn(tr("Mime Type") ); 610 m_View->addColumn(tr("Mime Type") );
579 QHeader *header = m_View->header(); 611 QHeader *header = m_View->header();
580 header->hide(); 612 header->hide();
581 m_View->setSorting(1 ); 613 m_View->setSorting(1 );
582}; 614};
615/* If a item is locked depends on the mode
616 if we're in OPEN !isReadable is locked
617 if we're in SAVE !isWriteable is locked
618
619
620 */
621
583 622
584void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ 623void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){
585 qWarning("Add Files" ); 624 qWarning("Add Files" );
586 if( !m_files ){ 625 if( !m_files ){
587 qWarning("not mfiles" ); 626 qWarning("not mfiles" );
588 return; 627 return;
589 } 628 }
590 629
591 MimeType type( info->filePath() ); 630 MimeType type( info->filePath() );
631 QString name;
632 QString dir;
633 bool locked= false;
592 if(mime == "All" ){ 634 if(mime == "All" ){
593 ; 635 ;
594 }else if( type.id() != mime ) { 636 }else if( type.id() != mime ) {
595 return; 637 return;
596 } 638 }
597 QPixmap pix = type.pixmap(); 639 QPixmap pix = type.pixmap();
598 if(pix.isNull() ) 640 if(pix.isNull() )
599 pix = Resource::loadPixmap( "UnknownDocument-14" ); 641 pix = Resource::loadPixmap( "UnknownDocument-14" );
600 if( symlink ) // have a blended pic sometime 642 dir = info->dirPath( true );
601 new OFileSelectorItem( m_View, pix, info->fileName(), 643 if( symlink ) { // check if the readLink is readable
602 info->lastModified().toString(), 644 // do it right later
603 QString::number(info->size() ), 645 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
604 info->dirPath(true) ); 646 }else{ // keep track of the icons
605 else 647 name = info->fileName();
606 new OFileSelectorItem( m_View, pix, info->fileName(), 648 if( m_mode == OPEN ){
607 info->lastModified().toString(), 649 if( !info->isReadable() ){
608 QString::number(info->size() ), 650 locked = true;
609 info->dirPath(true) ); 651 pix = Resource::loadPixmap("locked" );
652 }
653 }else if( m_mode == SAVE ){
654 if( !info->isWritable() ){
655 locked = true;
656 pix = Resource::loadPixmap("locked" );
657 }
658 }
659 }
660 new OFileSelectorItem( m_View, pix, name,
661 info->lastModified().toString(),
662 QString::number( info->size() ),
663 dir, locked );
610} 664}
611void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) 665void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink )
612{ 666{
613 if(!m_dir ) 667 if(!m_dir )
614 return; 668 return;
615 //if( showDirs ) 669 //if( showDirs )
616 { 670 {
671 bool locked;
672 QString name;
673 QPixmap pix;
674 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){
675 locked = true;
676 if( symlink ){
677 pix = (*m_pixmaps)["symlinkedlocked"];
678 }else{
679 pix = Resource::loadPixmap("lockedfolder" );
680 }
681 }else{
682 if( symlink ){
683 pix = (*m_pixmaps)["dirsymlink" ];
684 }else{
685 pix = Resource::loadPixmap("folder" );
686 }
687 }
617 if( symlink){ 688 if( symlink){
618 QPixmap map = (*m_pixmaps)["dirsymlink" ]; 689 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink();
619 qWarning("Symlink" ); 690
620 new OFileSelectorItem(m_View, map, 691 }else{
621 info->fileName(), info->lastModified().toString() , 692 //if(info->isReadable() )
622 QString::number(info->size() ),info->dirPath(true), true ); 693 name = info->fileName();
623 }else 694 }
624 new OFileSelectorItem(m_View, Resource::loadPixmap("folder" ), 695
625 info->fileName(), info->lastModified().toString(), 696 new OFileSelectorItem(m_View, pix,
626 QString::number(info->size() ),info->dirPath(true), true ); 697 name, info->lastModified().toString(),
698 QString::number(info->size() ),info->dirPath(true), locked, true );
627 699
628 } 700 }
629} 701}
630void OFileSelector::setShowDirs(bool dir ) 702void OFileSelector::setShowDirs(bool dir )
631{ 703{
632 m_dir = dir; 704 m_dir = dir;
633 reparse(); 705 reparse();
634} 706}
635 707
636 708
637 709
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h
index 73674e2..6936773 100644
--- a/libopie/ofileselector.h
+++ b/libopie/ofileselector.h
@@ -59,32 +59,36 @@ class QGridLayout;
59class QLineEdit; 59class QLineEdit;
60class QLabel; 60class QLabel;
61class QWidgetStack; 61class QWidgetStack;
62class QHBoxLayout; 62class QHBoxLayout;
63class QVBoxLayout; 63class QVBoxLayout;
64class QPopupMenu; 64class QPopupMenu;
65class QFileInfo; 65class QFileInfo;
66// 66//
67class OFileSelectorItem : public QListViewItem { 67class OFileSelectorItem : public QListViewItem {
68 public: 68 public:
69 OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, 69 OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path,
70 const QString &date, const QString &size, const QString &mDir, 70 const QString &date, const QString &size, const QString &mDir,
71 bool isDir=false ): QListViewItem(view) { 71 bool isLocked=false, bool isDir=false ): QListViewItem(view) {
72 setPixmap(0, pixmap ); 72 setPixmap(0, pixmap );
73 setText(1, path ); 73 setText(1, path );
74 setText(2, size ); 74 setText(2, size );
75 setText(3, date ); 75 setText(3, date );
76 //setText(4, mDir ); 76 //setText(4, mDir );
77 m_dir = mDir; 77 m_dir = mDir;
78 dir = isDir; 78 dir = isDir;
79 mLocked = isLocked;
80 }
81 bool locked() const{
82 return mLocked;
79 } 83 }
80 QString directory()const{ 84 QString directory()const{
81 return m_dir; 85 return m_dir;
82 } 86 }
83 bool isDir()const{ 87 bool isDir()const{
84 return dir; 88 return dir;
85 } 89 }
86 QString path()const{ 90 QString path()const{
87 return text(1 ); 91 return text(1 );
88 } 92 }
89 QString key(int id, bool )const { 93 QString key(int id, bool )const {
90 QString ke; 94 QString ke;
@@ -95,24 +99,25 @@ class OFileSelectorItem : public QListViewItem {
95 }else{ 99 }else{
96 ke.append("1" ); 100 ke.append("1" );
97 ke.append( text(1) ); 101 ke.append( text(1) );
98 } 102 }
99 }else if( id == 2 ){ // size 103 }else if( id == 2 ){ // size
100 return text(2); 104 return text(2);
101 }else if( id == 3 ){ // date 105 }else if( id == 3 ){ // date
102 return text(3); 106 return text(3);
103 } 107 }
104 return ke; 108 return ke;
105 }; 109 };
106 private: 110 private:
111 bool mLocked:1;
107 bool dir:1; 112 bool dir:1;
108 QString m_dir; 113 QString m_dir;
109}; 114};
110 115
111class OFileSelector : public QWidget { 116class OFileSelector : public QWidget {
112 Q_OBJECT 117 Q_OBJECT
113 public: 118 public:
114 enum Mode {OPEN=1, SAVE, FILESELECTOR }; 119 enum Mode {OPEN=1, SAVE, FILESELECTOR };
115 enum Selector{NORMAL=1, EXTENDED = 2, EXTENDED_ALL =4 }; 120 enum Selector{NORMAL=1, EXTENDED = 2, EXTENDED_ALL =4 };
116 enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; 121 enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 };
117 OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const QStringList mimetypes = QStringList() ); 122 OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const QStringList mimetypes = QStringList() );
118 123
@@ -127,25 +132,25 @@ class OFileSelector : public QWidget {
127 void setLineEditVisible(bool show) ; 132 void setLineEditVisible(bool show) ;
128 void setChooserVisible( bool chooser ); 133 void setChooserVisible( bool chooser );
129 134
130 QCheckBox* permissionCheckbox(); 135 QCheckBox* permissionCheckbox();
131 bool setPermission() const; 136 bool setPermission() const;
132 void setPermissionChecked( bool check ); 137 void setPermissionChecked( bool check );
133 138
134 void setMode( int ); 139 void setMode( int );
135 140
136 bool showDirs()const { return m_dir; } 141 bool showDirs()const { return m_dir; }
137 void setShowDirs(bool ); 142 void setShowDirs(bool );
138 143
139 const QListView* listview() { return m_View; }; 144 const QListView* listView() { return m_View; };
140 145
141 bool isCaseSensetive()const { return m_case; } 146 bool isCaseSensetive()const { return m_case; }
142 void setCaseSensetive(bool caSe ); 147 void setCaseSensetive(bool caSe );
143 148
144 bool showFiles()const { return m_files; }; 149 bool showFiles()const { return m_files; };
145 void setShowFiles(bool ); 150 void setShowFiles(bool );
146 151
147 152
148 153
149 int mode()const { return m_mode; }; 154 int mode()const { return m_mode; };
150 int selector()const { return m_selector; }; 155 int selector()const { return m_selector; };
151 void setSelector( int ); 156 void setSelector( int );
@@ -160,25 +165,25 @@ class OFileSelector : public QWidget {
160 QString selectedName( )const; 165 QString selectedName( )const;
161 QStringList selectedNames()const; 166 QStringList selectedNames()const;
162 167
163 QString selectedPath() const; 168 QString selectedPath() const;
164 QStringList selectedPaths() const; 169 QStringList selectedPaths() const;
165 170
166 QString directory()const; 171 QString directory()const;
167 int fileCount(); 172 int fileCount();
168 173
169 /* the user needs to delete it */ 174 /* the user needs to delete it */
170 DocLnk selectedDocument()const; 175 DocLnk selectedDocument()const;
171 /* the user needs to delete it */ 176 /* the user needs to delete it */
172 QValueList<DocLnk> selectedDocuments(); 177 QValueList<DocLnk> selectedDocuments()const;
173 178
174 signals: 179 signals:
175 void fileSelected( const DocLnk & ); 180 void fileSelected( const DocLnk & );
176 void fileSelected( const QString & ); 181 void fileSelected( const QString & );
177 void closeMe(); 182 void closeMe();
178 void ok(); 183 void ok();
179 void cancel(); 184 void cancel();
180 185
181 protected slots: 186 protected slots:
182 void slotOk(); 187 void slotOk();
183 void slotCancel(); 188 void slotCancel();
184 void slotViewCheck(const QString & ); 189 void slotViewCheck(const QString & );