summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-24 02:06:41 (UTC)
committer llornkcor <llornkcor>2002-04-24 02:06:41 (UTC)
commitc9159a3d5192799f5b2911d13337f04f50b1ac5a (patch) (unidiff)
treed7a09c5998c1e7b9fdc4d24f1dcf15f91fc95437
parent29e4dd18cbbe6d5967561b428a9632629cff3fde (diff)
downloadopie-c9159a3d5192799f5b2911d13337f04f50b1ac5a.zip
opie-c9159a3d5192799f5b2911d13337f04f50b1ac5a.tar.gz
opie-c9159a3d5192799f5b2911d13337f04f50b1ac5a.tar.bz2
changed symlink icon location, changed mimetype combo action, added spacing to bottom
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/libopie.control2
-rw-r--r--libopie/ofileselector.cc159
2 files changed, 80 insertions, 81 deletions
diff --git a/libopie/libopie.control b/libopie/libopie.control
index 80bd2fc..e5416bf 100644
--- a/libopie/libopie.control
+++ b/libopie/libopie.control
@@ -1,9 +1,9 @@
1Files: $QTDIR/lib/libopie.so.1.0.0 $QTDIR/lib/libopie.so.1.0 $QTDIR/lib/libopie.so.1 1Files: $QTDIR/lib/libopie.so.1.0.0 $QTDIR/lib/libopie.so.1.0 $QTDIR/lib/libopie.so.1 $QTDIR/pics/opie/*
2Priority: optional 2Priority: optional
3Section: opie/system 3Section: opie/system
4Package: libopie 4Package: libopie
5Maintainer: - 5Maintainer: -
6Architecture: arm 6Architecture: arm
7Version: $QPE_VERSION-$SUB_VERSION 7Version: $QPE_VERSION-$SUB_VERSION
8Depends: qt-embedded (>=$QTE_VERSION) 8Depends: qt-embedded (>=$QTE_VERSION)
9Description: Opie library 9Description: Opie library
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index ea19143..cb18039 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -21,170 +21,170 @@
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include <qnamespace.h> 29#include <qnamespace.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qcombobox.h> 31#include <qcombobox.h>
32#include <qhbox.h> 32#include <qhbox.h>
33#include <qvbox.h> 33#include <qvbox.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qwidgetstack.h> 35#include <qwidgetstack.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qcheckbox.h> 37#include <qcheckbox.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qheader.h> 39#include <qheader.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qpainter.h> 41#include <qpainter.h>
42#include <qaction.h> 42#include <qaction.h>
43#include <qpopupmenu.h> 43#include <qpopupmenu.h>
44#include <qcursor.h> 44#include <qcursor.h>
45 45
46#include <qpe/qpeapplication.h> 46#include <qpe/qpeapplication.h>
47#include <qpe/fileselector.h> 47#include <qpe/fileselector.h>
48#include <qpe/applnk.h> 48#include <qpe/applnk.h>
49#include <qpe/global.h> 49#include <qpe/global.h>
50#include <qpe/mimetype.h> 50#include <qpe/mimetype.h>
51#include <qpe/resource.h> 51#include <qpe/resource.h>
52#include <qpe/storage.h> 52#include <qpe/storage.h>
53 53
54#include <unistd.h> 54#include <unistd.h>
55#include <stdlib.h> 55#include <stdlib.h>
56#include <sys/stat.h> 56#include <sys/stat.h>
57 57
58#include "ofileselector.h" 58#include "ofileselector.h"
59 59
60QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; 60QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0;
61 61
62namespace { 62namespace {
63 63
64 int indexByString( const QComboBox *box, const QString &str ){ 64 int indexByString( const QComboBox *box, const QString &str ){
65 int index= -1; 65 int index= -1;
66 for(int i= 0; i < box->count(); i++ ){ 66 for(int i= 0; i < box->count(); i++ ){
67 qWarning("str T%sT boxT%sT", str.latin1(), box->text(i).latin1() ); 67 qWarning("str T%sT boxT%sT", str.latin1(), box->text(i).latin1() );
68 if( str == box->text(i ) ){ 68 if( str == box->text(i ) ){
69 index= i; 69 index= i;
70 break; 70 break;
71 } 71 }
72 } 72 }
73 return index; 73 return index;
74 } 74 }
75 75
76}; 76};
77 77
78 78
79OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, 79OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName,
80 const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) 80 const QString &fileName, const QStringList &mimetypes ) : QWidget( wid )
81{ 81{
82 if(wid!=0) 82 if(wid!=0)
83 resize(wid->width(),wid->height()); 83 resize(wid->width(),wid->height());
84 m_selector = selector; 84 m_selector = selector;
85 m_currentDir = dirName; 85 m_currentDir = dirName;
86 m_name = fileName; 86 m_name = fileName;
87 m_mimetypes = mimetypes; 87 m_mimetypes = mimetypes;
88 if( mimetypes.isEmpty() ) 88// if( mimetypes.isEmpty() )
89 m_autoMime = true; 89// m_autoMime = true;
90 90
91 m_mode = mode; 91 m_mode = mode;
92 m_shTool = true; 92 m_shTool = true;
93 m_shPerm = true; 93 m_shPerm = true;
94 m_shLne = true; 94 m_shLne = true;
95 m_shChooser = true; 95 m_shChooser = true;
96 m_shYesNo = true; 96 m_shYesNo = true;
97 // for FILESELECTOR only view is interesting 97 // for FILESELECTOR only view is interesting
98 m_location = 0; 98 m_location = 0;
99 m_homeButton = 0; 99 m_homeButton = 0;
100 m_docButton = 0; 100 m_docButton = 0;
101 m_hideButton = 0; 101 m_hideButton = 0;
102 m_ok = 0; 102 m_ok = 0;
103 m_cancel = 0; 103 m_cancel = 0;
104 m_reread = 0; 104 m_reread = 0;
105 m_up = 0; 105 m_up = 0;
106 m_View = 0; 106 m_View = 0;
107 m_select = 0; 107 m_select = 0;
108 m_stack = 0; 108 m_stack = 0;
109 109
110 m_select = 0; 110 m_select = 0;
111 m_stack = 0; 111 m_stack = 0;
112 m_lay = 0; 112 m_lay = 0;
113 m_boxToolbar = 0; 113 m_boxToolbar = 0;
114 m_boxOk = 0; 114 m_boxOk = 0;
115 m_edit = 0; 115 m_edit = 0;
116 116
117 m_fnLabel = 0; 117 m_fnLabel = 0;
118 m_checkPerm = 0; 118 m_checkPerm = 0;
119 m_mimeCheck = 0; 119 m_mimeCheck = 0;
120 m_viewCheck = 0; 120 m_viewCheck = 0;
121 121
122 m_pseudo = 0; 122 m_pseudo = 0;
123 m_pseudoLayout = 0; 123 m_pseudoLayout = 0;
124 124
125 m_dir = true; 125 m_dir = true;
126 m_files = true; 126 m_files = true;
127 m_custom = 0; 127 m_custom = 0;
128 m_showPopup = true; 128 m_showPopup = true;
129 129
130 if(m_pixmaps == 0 ) // init the pixmaps 130 if(m_pixmaps == 0 ) // init the pixmaps
131 initPics(); 131 initPics();
132 132
133 m_lay = new QVBoxLayout(this); 133 m_lay = new QVBoxLayout(this);
134 init(); 134 init();
135 m_edit->setText( fileName ); 135 m_edit->setText( fileName );
136} 136}
137void OFileSelector::initPics() 137void OFileSelector::initPics()
138{ 138{
139 qWarning("init pics" ); 139 qWarning("init pics" );
140 m_pixmaps = new QMap<QString,QPixmap>; 140 m_pixmaps = new QMap<QString,QPixmap>;
141 QPixmap pm = Resource::loadPixmap( "folder" ); 141 QPixmap pm = Resource::loadPixmap( "folder" );
142 QPixmap lnk = Resource::loadPixmap( "symlink" ); 142 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
143 QPainter painter( &pm ); 143 QPainter painter( &pm );
144 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 144 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
145 pm.setMask( pm.createHeuristicMask( FALSE ) ); 145 pm.setMask( pm.createHeuristicMask( FALSE ) );
146 m_pixmaps->insert("dirsymlink", pm ); 146 m_pixmaps->insert("dirsymlink", pm );
147 147
148 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); 148 QPixmap pm2 = Resource::loadPixmap( "lockedfolder" );
149 QPainter pen(&pm2 ); 149 QPainter pen(&pm2 );
150 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); 150 pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk );
151 pm2.setMask( pm2.createHeuristicMask( FALSE ) ); 151 pm2.setMask( pm2.createHeuristicMask( FALSE ) );
152 m_pixmaps->insert("symlinkedlocked", pm2 ); 152 m_pixmaps->insert("symlinkedlocked", pm2 );
153 153
154}; 154};
155// let's initialize the gui 155// let's initialize the gui
156/** 156/**
157 -------------------- 157 --------------------
158 | cmbBox Button | 158 | cmbBox Button |
159 -------------------- 159 --------------------
160 | FileSlector | 160 | FileSlector |
161 | or | 161 | or |
162 | OSelector | 162 | OSelector |
163 | | 163 | |
164 | | 164 | |
165 ____________________ 165 ____________________
166 | LineEdit | 166 | LineEdit |
167 ____________________ 167 ____________________
168 | Permission Bar | 168 | Permission Bar |
169 ____________________ 169 ____________________
170 | ViewChoose | 170 | ViewChoose |
171 ____________________ 171 ____________________
172 | Save Cancel| 172 | Save Cancel|
173 ____________________ 173 ____________________
174 */ 174 */
175void OFileSelector::delItems() 175void OFileSelector::delItems()
176{ 176{
177 QLayoutIterator it = m_lay->iterator(); 177 QLayoutIterator it = m_lay->iterator();
178 while ( it.current() != 0 ){ 178 while ( it.current() != 0 ){
179 it.deleteCurrent(); 179 it.deleteCurrent();
180 } 180 }
181} 181}
182void OFileSelector::init() 182void OFileSelector::init()
183{ 183{
184 184
185 m_stack = new QWidgetStack(this, "wstack" ); 185 m_stack = new QWidgetStack(this, "wstack" );
186 if( m_selector == NORMAL ){ 186 if( m_selector == NORMAL ){
187 QString currMime; 187 QString currMime;
188 if( m_mimeCheck != 0 ) 188 if( m_mimeCheck != 0 )
189 currMime = m_mimeCheck->currentText(); 189 currMime = m_mimeCheck->currentText();
190 190
@@ -373,650 +373,649 @@ void OFileSelector::updateLay()
373 delete m_cancel; 373 delete m_cancel;
374 m_cancel = 0; 374 m_cancel = 0;
375 delete m_mimeCheck; 375 delete m_mimeCheck;
376 m_mimeCheck = 0; 376 m_mimeCheck = 0;
377 delete m_viewCheck; 377 delete m_viewCheck;
378 m_viewCheck = 0; 378 m_viewCheck = 0;
379 delete m_select; // test 379 delete m_select; // test
380 delete m_stack; 380 delete m_stack;
381 //delete m_list; 381 //delete m_list;
382 init(); 382 init();
383 if( m_shLne ) 383 if( m_shLne )
384 m_edit->setText(text ); 384 m_edit->setText(text );
385 if( m_shPerm ) 385 if( m_shPerm )
386 m_checkPerm->setChecked(check ); 386 m_checkPerm->setChecked(check );
387} 387}
388// let's update the mimetypes. Use the current mimefilter for the 2nd QDir retrieve 388// let's update the mimetypes. Use the current mimefilter for the 2nd QDir retrieve
389// insert QListViewItems with the right options 389// insert QListViewItems with the right options
390bool OFileSelector::compliesMime(const QString &path, const QString &mime ) 390bool OFileSelector::compliesMime(const QString &path, const QString &mime )
391{ 391{
392 if( mime == "All" ) 392 if( mime == "All" )
393 return true; 393 return true;
394 MimeType type( path ); 394 MimeType type( path );
395 if( type.id() == mime ) 395 if( type.id() == mime )
396 return true; 396 return true;
397 return false; 397 return false;
398} 398}
399 399
400void OFileSelector::reparse() 400void OFileSelector::reparse()
401{ 401{
402 if(m_View== 0 || m_selector == NORMAL) 402 if(m_View== 0 || m_selector == NORMAL)
403 return; 403 return;
404 404
405 m_View->clear(); 405 m_View->clear();
406 406
407 407
408 QString currMime =m_mimeCheck->currentText(); 408 QString currMime =m_mimeCheck->currentText();
409 // update the mimetype now 409 // update the mimetype now
410 if( m_autoMime ) { 410 if( m_autoMime ) {
411 QDir dir( m_currentDir ); 411 QDir dir( m_currentDir );
412 m_mimetypes.clear(); 412 m_mimetypes.clear();
413 m_mimeCheck->clear(); 413 m_mimeCheck->clear();
414 dir.setFilter( QDir::Files | QDir::Readable ); 414 dir.setFilter( QDir::Files | QDir::Readable );
415 dir.setSorting(QDir::Size ); 415 dir.setSorting(QDir::Size );
416 const QFileInfoList *list = dir.entryInfoList(); 416 const QFileInfoList *list = dir.entryInfoList();
417 QFileInfoListIterator it( *list ); 417 QFileInfoListIterator it( *list );
418 QFileInfo *fi; 418 QFileInfo *fi;
419 while( (fi=it.current()) ){ 419 while( (fi=it.current()) ){
420 if(fi->extension() == QString::fromLatin1("desktop") ){ 420 if(fi->extension() == QString::fromLatin1("desktop") ){
421 ++it; 421 ++it;
422 continue; 422 continue;
423 } 423 }
424 MimeType type(fi->filePath() ); 424 MimeType type(fi->filePath() );
425 if( !m_mimetypes.contains( type.id() ) ) 425 if( !m_mimetypes.contains( type.id() ) )
426 m_mimetypes.append( type.id() ); 426 m_mimetypes.append( type.id() );
427 427
428 ++it; 428 ++it;
429 } 429 }
430 m_mimetypes.prepend("All" ); 430 m_mimetypes.prepend("All" );
431 m_mimeCheck->insertStringList(m_mimetypes ); 431 m_mimeCheck->insertStringList(m_mimetypes );
432 // set it to the current mimetype 432 // set it to the current mimetype
433 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) ); 433 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) );
434 }; 434 };
435 QDir dir( m_currentDir ); 435 QDir dir( m_currentDir );
436 //dir.setFilter(-1 ); 436 //dir.setFilter(-1 );
437 int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed; 437 int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed;
438 if( m_case ) 438 if( m_case )
439 sort = QDir::IgnoreCase; 439 sort = QDir::IgnoreCase;
440 dir.setSorting( sort ); 440 dir.setSorting( sort );
441 441
442 int filter; 442 int filter;
443 /* if( m_dir && !m_files) 443 /* if( m_dir && !m_files)
444 filter |= QDir::Dirs; 444 filter |= QDir::Dirs;
445 else if( !m_dir && m_files ) 445 else if( !m_dir && m_files )
446 filter |= QDir::Files; 446 filter |= QDir::Files;
447 else 447 else
448 filter |= QDir::All; 448 filter |= QDir::All;
449 */ 449 */
450 if( m_selector == EXTENDED_ALL ) 450 if( m_selector == EXTENDED_ALL )
451 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 451 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
452 else 452 else
453 filter = QDir::Files | QDir::Dirs | QDir::All; 453 filter = QDir::Files | QDir::Dirs | QDir::All;
454 dir.setFilter( filter ); 454 dir.setFilter( filter );
455 455
456 const QFileInfoList *list = dir.entryInfoList(); 456 const QFileInfoList *list = dir.entryInfoList();
457 QFileInfoListIterator it( *list ); 457 QFileInfoListIterator it( *list );
458 QFileInfo *fi; 458 QFileInfo *fi;
459 while( (fi=it.current()) ){ 459 while( (fi=it.current()) ){
460 if(fi->fileName() == ".." || fi->fileName() == "." ){ 460 if(fi->fileName() == ".." || fi->fileName() == "." ){
461 ++it; 461 ++it;
462 continue; 462 continue;
463 } 463 }
464 qWarning("Test: %s", fi->fileName().latin1() ); 464 qWarning("Test: %s", fi->fileName().latin1() );
465 if(fi->isSymLink() ){ 465 if(fi->isSymLink() ){
466 qWarning("Symlink %s", fi->fileName().latin1() ); 466 qWarning("Symlink %s", fi->fileName().latin1() );
467 QString file = fi->dirPath(true)+"/"+ fi->readLink(); 467 QString file = fi->dirPath(true)+"/"+ fi->readLink();
468 qWarning("File ->%s", file.latin1() ); 468 qWarning("File ->%s", file.latin1() );
469 for(int i=0; i<=4; i++ ){ // prepend from dos 469 for(int i=0; i<=4; i++ ){ // prepend from dos
470 QFileInfo info( file ); 470 QFileInfo info( file );
471 if( !info.exists() ){ 471 if( !info.exists() ){
472 qWarning("does not exist" ); 472 qWarning("does not exist" );
473 addSymlink(currMime, fi, TRUE ); 473 addSymlink(currMime, fi, TRUE );
474 break; 474 break;
475 }else if( info.isDir() ){ 475 }else if( info.isDir() ){
476 qWarning("isDir" ); 476 qWarning("isDir" );
477 addDir(currMime, fi, TRUE ); 477 addDir(currMime, fi, TRUE );
478 break; 478 break;
479 }else if( info.isFile() ){ 479 }else if( info.isFile() ){
480 qWarning("isFile" ); 480 qWarning("isFile" );
481 addFile(currMime, fi, TRUE ); 481 addFile(currMime, fi, TRUE );
482 break; 482 break;
483 }else if( info.isSymLink() ){ 483 }else if( info.isSymLink() ){
484 file = info.dirPath(true)+ "/"+ info.readLink(); 484 file = info.dirPath(true)+ "/"+ info.readLink();
485 qWarning("isSymlink again %s", file.latin1() ); 485 qWarning("isSymlink again %s", file.latin1() );
486 }else if( i == 4 ){ // just insert it and have the symlink symbol 486 }else if( i == 4 ){ // just insert it and have the symlink symbol
487 addSymlink(currMime, fi ); 487 addSymlink(currMime, fi );
488 qWarning("level too deep" ); 488 qWarning("level too deep" );
489 } 489 }
490 } 490 }
491 }else if( fi->isDir() ){ 491 }else if( fi->isDir() ){
492 addDir(currMime, fi ); 492 addDir(currMime, fi );
493 }else if( fi->isFile() ) { // file ? 493 }else if( fi->isFile() ) { // file ?
494 addFile(currMime, fi ); 494 addFile(currMime, fi );
495 } 495 }
496 ++it; 496 ++it;
497 } 497 }
498 m_View->sort(); 498 m_View->sort();
499} 499}
500QString OFileSelector::directory()const 500QString OFileSelector::directory()const
501{ 501{
502 return m_currentDir; 502 return m_currentDir;
503} 503}
504int OFileSelector::fileCount() 504int OFileSelector::fileCount()
505{ 505{
506 return 0; 506 return 0;
507} 507}
508void OFileSelector::slotOk( ) 508void OFileSelector::slotOk( )
509{ 509{
510 emit ok(); 510 emit ok();
511} 511}
512void OFileSelector::slotCancel( ) 512void OFileSelector::slotCancel( )
513{ 513{
514 emit cancel(); 514 emit cancel();
515} 515}
516 516
517void OFileSelector::initializeName() 517void OFileSelector::initializeName()
518{ 518{
519 m_boxName = new QHBoxLayout(this ); 519 m_boxName = new QHBoxLayout(this );
520 m_edit = new QLineEdit(this ); 520 m_edit = new QLineEdit(this );
521 m_fnLabel = new QLabel(this ); 521 m_fnLabel = new QLabel(this );
522 m_fnLabel->setText(tr("Name:") ); 522 m_fnLabel->setText(tr("Name:") );
523 m_boxName->addWidget(m_fnLabel ); 523 m_boxName->addWidget(m_fnLabel );
524 m_boxName->insertSpacing(1, 8 ); 524 m_boxName->insertSpacing(1, 8 );
525 m_boxName->addWidget(m_edit, 100 ); 525 m_boxName->addWidget(m_edit, 100 );
526 526
527 m_lay->addLayout(m_boxName); 527 m_lay->addLayout(m_boxName);
528} 528}
529void OFileSelector::initializeYes() 529void OFileSelector::initializeYes()
530{ 530{
531 m_ok = new QPushButton("&Save", this, "save" ); 531 m_ok = new QPushButton("&Save", this, "save" );
532 m_cancel = new QPushButton("C&ancel", this, "cancel" ); 532 m_cancel = new QPushButton("C&ancel", this, "cancel" );
533 m_boxOk = new QHBoxLayout(this ); 533 m_boxOk = new QHBoxLayout(this );
534 m_boxOk->addWidget( m_ok, Qt::AlignHCenter ); 534 m_boxOk->addWidget( m_ok, Qt::AlignHCenter );
535 m_boxOk->insertSpacing(1, 8 ); 535 m_boxOk->insertSpacing(1, 8 );
536 m_boxOk->addWidget( m_cancel, Qt::AlignHCenter); 536 m_boxOk->addWidget( m_cancel, Qt::AlignHCenter);
537 m_lay->addLayout(m_boxOk ); 537 m_lay->addLayout(m_boxOk );
538 connect(m_ok, SIGNAL(clicked() ), 538 connect(m_ok, SIGNAL(clicked() ),
539 this, SLOT(slotOk() ) ); 539 this, SLOT(slotOk() ) );
540 connect(m_cancel, SIGNAL(clicked() ), 540 connect(m_cancel, SIGNAL(clicked() ),
541 this, SLOT(slotCancel() ) ); 541 this, SLOT(slotCancel() ) );
542 542
543} 543}
544void OFileSelector::initializeChooser() 544void OFileSelector::initializeChooser()
545{ 545{
546 m_boxView = new QHBoxLayout(this ); 546 m_boxView = new QHBoxLayout(this );
547 547
548 m_mimeCheck = new QComboBox(this, "mime check"); 548 m_mimeCheck = new QComboBox(this, "mime check");
549 m_viewCheck = new QComboBox(this, "view check"); 549 m_viewCheck = new QComboBox(this, "view check");
550 m_boxView->addWidget(m_viewCheck, 0 ); 550 m_boxView->addWidget(m_viewCheck, 0 );
551 m_boxView->insertSpacing(1, 8 ); 551 m_boxView->insertSpacing(2, 8 );
552 m_boxView->addWidget(m_mimeCheck, 0 ); 552 m_boxView->addWidget(m_mimeCheck, 0 );
553 m_lay->addLayout(m_boxView ); 553 m_lay->addLayout(m_boxView );
554 m_lay->insertSpacing( 4, 8);
554 555
555 m_viewCheck->insertItem(tr("Documents") ); 556 m_viewCheck->insertItem(tr("Documents") );
556 m_viewCheck->insertItem(tr("Files") ); 557 m_viewCheck->insertItem(tr("Files") );
557 m_viewCheck->insertItem(tr("All Files") ); 558 m_viewCheck->insertItem(tr("All Files") );
558 559
559 if(!m_autoMime ) 560// if(!m_autoMime )
560 m_mimeCheck->insertItem(m_mimetypes.join("," ) ); 561// m_mimeCheck->insertItem(m_mimetypes.join("," ) );
561 else{ // check 562// else{ // check
562 updateMimes(); 563 updateMimes();
563 m_mimeCheck->insertStringList( m_mimetypes ); 564 m_mimeCheck->insertStringList( m_mimetypes );
564 } 565// }
565 566
566 connect( m_viewCheck, SIGNAL(activated(const QString &) ), 567 connect( m_viewCheck, SIGNAL(activated(const QString &) ),
567 this, SLOT(slotViewCheck(const QString & ) ) ); 568 this, SLOT(slotViewCheck(const QString & ) ) );
568 569
569 connect( m_mimeCheck, SIGNAL(activated(const QString &) ), 570 connect( m_mimeCheck, SIGNAL(activated(const QString &) ),
570 this, SLOT(slotMimeCheck(const QString & ) ) ); 571 this, SLOT(slotMimeCheck(const QString & ) ) );
571} 572}
572void OFileSelector::slotMimeCheck(const QString &view ){ 573void OFileSelector::slotMimeCheck(const QString &view ){
573 if(m_selector == NORMAL ){ 574 if(m_selector == NORMAL ){
574 delete m_select; 575 delete m_select;
575 m_select = new FileSelector(view == "All" ? QString::null : view 576 m_select = new FileSelector(view == "All" ? QString::null : view
576 , m_stack, "fileselector", FALSE, FALSE ); 577 , m_stack, "fileselector", FALSE, FALSE );
577 m_stack->addWidget( m_select, NORMAL ); 578 m_stack->addWidget( m_select, NORMAL );
578 m_stack->raiseWidget( NORMAL ); 579 m_stack->raiseWidget( NORMAL );
579 }else{ 580 }else{
580 reparse(); 581 reparse();
581 } 582 }
582} 583}
583 584
584void OFileSelector::slotViewCheck(const QString &view ){ 585void OFileSelector::slotViewCheck(const QString &view ){
585 qWarning("changed: show %s", view.latin1() ); 586 qWarning("changed: show %s", view.latin1() );
586 // if the current view is the one 587 // if the current view is the one
587 QString currMime = m_mimeCheck->currentText(); 588 QString currMime = m_mimeCheck->currentText();
588 if( view == QString::fromLatin1("Documents") ){ 589 if( view == QString::fromLatin1("Documents") ){
589 // get the mimetype now 590 // get the mimetype now
590 // check if we're the current widget and return 591 // check if we're the current widget and return
591 if( m_View != 0) { // delete 0 shouldn't crash but it did :( 592 if( m_View != 0) { // delete 0 shouldn't crash but it did :(
592 delete m_View; 593 delete m_View;
593 delete m_boxToolbar; 594 delete m_boxToolbar;
594 delete m_homeButton; 595 delete m_homeButton;
595 delete m_docButton; 596 delete m_docButton;
596 delete m_location; 597 delete m_location;
597 delete m_up; 598 delete m_up;
598 delete m_pseudo; 599 delete m_pseudo;
599 //if(m_pseudoLayout!=0 ) 600 //if(m_pseudoLayout!=0 )
600 //delete m_pseudoLayout; 601// delete m_pseudoLayout;
601 } 602 }
602 m_View = 0; 603 m_View = 0;
603 m_boxToolbar = 0; 604 m_boxToolbar = 0;
604 m_homeButton = 0; 605 m_homeButton = 0;
605 m_docButton = 0; 606 m_docButton = 0;
606 m_location = 0; 607 m_location = 0;
607 m_up = 0; 608 m_up = 0;
608 m_pseudo = 0; 609 m_pseudo = 0;
609 m_pseudoLayout = 0; 610 m_pseudoLayout = 0;
610 611
611 delete m_select; 612 delete m_select;
612 m_select = new FileSelector( currMime == "All" ? QString::null : currMime, 613 m_select = new FileSelector( currMime == "All" ? QString::null : currMime,
613 m_stack,"fileselector", FALSE, FALSE ); 614 m_stack,"fileselector", FALSE, FALSE );
614 m_stack->addWidget( m_select, NORMAL ); 615 m_stack->addWidget( m_select, NORMAL );
615 m_mimeCheck->clear(); 616 m_mimeCheck->clear();
616 m_selector = NORMAL; 617 m_selector = NORMAL;
617 updateMimes(); 618 updateMimes();
618 m_mimeCheck->insertStringList( m_mimetypes ); 619 m_mimeCheck->insertStringList( m_mimetypes );
619 m_stack->raiseWidget( NORMAL ); 620 m_stack->raiseWidget( NORMAL );
620 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); 621 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) );
621 622
622 }else if(view == QString::fromLatin1("Files") ){ 623 }else if(view == QString::fromLatin1("Files") ){
623 // remove from the stack 624 // remove from the stack
624 delete m_select; 625 delete m_select;
625 m_select = 0; 626 m_select = 0;
626 delete m_View; 627 delete m_View;
627 m_View = 0; 628 m_View = 0;
628 629
629 630
630 631
631 m_selector = EXTENDED; 632 m_selector = EXTENDED;
632 // create the ListView or IconView 633 // create the ListView or IconView
633 initializeListView(); 634 initializeListView();
634 635
635 reparse(); 636 reparse();
636 }else if(view == QString::fromLatin1("All Files") ) { 637 }else if(view == QString::fromLatin1("All Files") ) {
637 // remove from the stack 638 // remove from the stack
638 delete m_select; 639 delete m_select;
639 m_select = 0; 640 m_select = 0;
640 delete m_View; 641 delete m_View;
641 m_View = 0; 642 m_View = 0;
642 643
643 m_selector = EXTENDED_ALL; 644 m_selector = EXTENDED_ALL;
644 initializeListView(); 645 initializeListView();
645 reparse(); 646 reparse();
646 }; 647 };
647}; 648};
648 649
649 650
650void OFileSelector::updateMimes() // lets check which mode is active 651void OFileSelector::updateMimes() // lets check which mode is active
651 // check the current dir for items then 652 // check the current dir for items then
652{ 653{
653 m_mimetypes.clear(); 654 m_mimetypes.clear();
654 m_mimetypes.append("All" ); 655 m_mimetypes.append("All" );
655 if( m_selector == NORMAL ){ 656 if( m_selector == NORMAL ){
656 DocLnkSet set; 657 DocLnkSet set;
657 Global::findDocuments(&set, QString::null ); 658 Global::findDocuments(&set, QString::null );
658 QListIterator<DocLnk> dit( set.children() ); 659 QListIterator<DocLnk> dit( set.children() );
659 for ( ; dit.current(); ++dit ) { 660 for ( ; dit.current(); ++dit ) {
660 if( !m_mimetypes.contains((*dit)->type() ) ) 661 if( !m_mimetypes.contains((*dit)->type() ) )
661 m_mimetypes.append( (*dit)->type() ); 662 m_mimetypes.append( (*dit)->type() );
662 } 663 }
663 }else{ 664 }else{
664 // should be allreday updatet 665 // should be allreday updatet
665 ; 666 ;
666 } 667 }
667}; 668};
668void OFileSelector::initializeListView() 669void OFileSelector::initializeListView()
669{ 670{
670 // just to make sure but clean it up better FIXME 671 // just to make sure but clean it up better FIXME
671 delete m_View; 672 delete m_View;
672 m_View = 0; 673 m_View = 0;
673 delete m_boxToolbar; 674 delete m_boxToolbar;
674 delete m_homeButton; 675 delete m_homeButton;
675 delete m_docButton; 676 delete m_docButton;
676 delete m_location; 677 delete m_location;
677 delete m_up; 678 delete m_up;
678 //delete m_pseudo; 679 //delete m_pseudo;
679 //if(m_pseudoLayout!=0 ) // why did you overload malloc 680 //if(m_pseudoLayout!=0 ) // why did you overload malloc
680 //delete m_pseudoLayout; 681 //delete m_pseudoLayout;
681 m_boxToolbar = 0; 682 m_boxToolbar = 0;
682 m_homeButton = 0; 683 m_homeButton = 0;
683 m_docButton = 0; 684 m_docButton = 0;
684 m_location = 0; 685 m_location = 0;
685 m_up = 0; 686 m_up = 0;
686 m_pseudo = 0; 687 m_pseudo = 0;
687 m_pseudoLayout = 0; 688 m_pseudoLayout = 0;
688 // time for the toolbar 689 // time for the toolbar
689 m_pseudo = new QWidget(m_stack, "Pseudo Widget"); 690 m_pseudo = new QWidget(m_stack, "Pseudo Widget");
690 m_pseudoLayout = new QVBoxLayout(m_pseudo ); 691 m_pseudoLayout = new QVBoxLayout(m_pseudo );
691 if(m_shTool ){ 692 if(m_shTool ){
692 m_boxToolbar = new QHBoxLayout( ); 693 m_boxToolbar = new QHBoxLayout( );
693 m_boxToolbar->setAutoAdd( true ); 694 m_boxToolbar->setAutoAdd( true );
694 m_location = new QComboBox(m_pseudo ); 695 m_location = new QComboBox(m_pseudo );
695 696
696 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); 697 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton");
697 m_up->setMinimumSize( QSize( 20, 20 ) ); 698 m_up->setFixedSize( QSize( 20, 20 ) );
698 m_up->setMaximumSize( QSize( 20, 20 ) );
699 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); 699 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) );
700 m_up->setFlat(TRUE); 700 m_up->setFlat(TRUE);
701 701
702 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo); 702 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo);
703 m_homeButton->setMinimumSize( QSize( 20, 20 ) ); 703 m_homeButton->setFixedSize( QSize( 20, 20 ) );
704 m_homeButton->setMaximumSize( QSize( 20, 20 ) );
705 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); 704 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) );
706 m_homeButton->setFlat(TRUE); 705 m_homeButton->setFlat(TRUE);
707 706
708 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); 707 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton");
709 m_docButton->setMinimumSize( QSize( 20, 20 ) ); 708 m_docButton->setFixedSize( QSize( 20, 20 ) );
710 m_docButton->setMaximumSize( QSize( 20, 20 ) );
711 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); 709 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
712 m_docButton->setFlat(TRUE); 710 m_docButton->setFlat(TRUE);
713 711
714 m_boxToolbar->addWidget(m_location ); 712 m_boxToolbar->addWidget(m_location );
715 m_boxToolbar->addWidget(m_up ); 713 m_boxToolbar->addWidget(m_up );
716 m_boxToolbar->addWidget(m_homeButton ); 714 m_boxToolbar->addWidget(m_homeButton );
717 m_boxToolbar->addWidget(m_docButton ); 715 m_boxToolbar->addWidget(m_docButton );
718 m_pseudoLayout->addLayout(m_boxToolbar ); 716 m_pseudoLayout->addLayout(m_boxToolbar );
719 // lets fill the combobox 717 // lets fill the combobox
720 StorageInfo storage; 718 StorageInfo storage;
721 const QList<FileSystem> &fs = storage.fileSystems(); 719 const QList<FileSystem> &fs = storage.fileSystems();
722 QListIterator<FileSystem> it ( fs ); 720 QListIterator<FileSystem> it ( fs );
723 for( ; it.current(); ++it ){ 721 for( ; it.current(); ++it ){
724 const QString disk = (*it)->name(); 722 const QString disk = (*it)->name();
725 const QString path = (*it)->path(); 723 const QString path = (*it)->path();
726 m_location->insertItem(path+ "<-"+disk ); 724 m_location->insertItem(path+ "<-"+disk );
727 } 725 }
728 int count = m_location->count(); 726 int count = m_location->count();
729 m_location->insertItem(m_currentDir ); 727 m_location->insertItem(m_currentDir );
730 m_location->setCurrentItem( count ); 728 m_location->setCurrentItem( count );
731 }; 729 };
732 m_View = new QListView(m_pseudo, "Extended view" ); 730 m_View = new QListView(m_pseudo, "Extended view" );
733 m_stack->addWidget( m_pseudo, EXTENDED ); 731 m_stack->addWidget( m_pseudo, EXTENDED );
734 m_stack->raiseWidget( EXTENDED ); 732 m_stack->raiseWidget( EXTENDED );
735 m_pseudoLayout->addWidget(m_View ); 733 m_pseudoLayout->addWidget(m_View );
736 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); 734 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold);
737 // set up the stuff 735 // set up the stuff
738 // Pixmap Name Date Size mime 736 // Pixmap Name Date Size mime
739 //(m_View->header() )->hide(); 737 //(m_View->header() )->hide();
740 //m_View->setRootIsDecorated(false); 738 //m_View->setRootIsDecorated(false);
741 m_View->addColumn(" "); 739 m_View->addColumn(" ");
742 m_View->addColumn(tr("Name") ); 740 m_View->addColumn(tr("Name"),135 );
743 m_View->addColumn(tr("Size") ); 741 m_View->addColumn(tr("Size"),-1 );
744 m_View->addColumn(tr("Date"), 60 ); 742 m_View->addColumn(tr("Date"), 60 );
745 m_View->addColumn(tr("Mime Type") ); 743 m_View->addColumn(tr("Mime Type"),-1 );
746 QHeader *header = m_View->header(); 744 QHeader *header = m_View->header();
747 header->hide(); 745 header->hide();
748 m_View->setSorting(1 ); 746 m_View->setSorting(1 );
747 m_View->setAllColumnsShowFocus( TRUE);
749 // connect now 748 // connect now
750 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) ); 749 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) );
751 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); 750 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) );
752 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), 751 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
753 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); 752 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
754 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), 753 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )),
755 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); 754 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) );
756 755
757 756
758}; 757};
759/* If a item is locked depends on the mode 758/* If a item is locked depends on the mode
760 if we're in OPEN !isReadable is locked 759 if we're in OPEN !isReadable is locked
761 if we're in SAVE !isWriteable is locked 760 if we're in SAVE !isWriteable is locked
762 761
763 762
764 */ 763 */
765 764
766 765
767void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ 766void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){
768 qWarning("Add Files" ); 767 qWarning("Add Files" );
769 if( !m_files ){ 768 if( !m_files ){
770 qWarning("not mfiles" ); 769 qWarning("not mfiles" );
771 return; 770 return;
772 } 771 }
773 772
774 MimeType type( info->filePath() ); 773 MimeType type( info->filePath() );
775 QString name; 774 QString name;
776 QString dir; 775 QString dir;
777 bool locked= false; 776 bool locked= false;
778 if(mime == "All" ){ 777 if(mime == "All" ){
779 ; 778 ;
780 }else if( type.id() != mime ) { 779 }else if( type.id() != mime ) {
781 return; 780 return;
782 } 781 }
783 QPixmap pix = type.pixmap(); 782 QPixmap pix = type.pixmap();
784 if(pix.isNull() ) 783 if(pix.isNull() )
785 pix = Resource::loadPixmap( "UnknownDocument-14" ); 784 pix = Resource::loadPixmap( "UnknownDocument-14" );
786 dir = info->dirPath( true ); 785 dir = info->dirPath( true );
787 if( symlink ) { // check if the readLink is readable 786 if( symlink ) { // check if the readLink is readable
788 // do it right later 787 // do it right later
789 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 788 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
790 }else{ // keep track of the icons 789 }else{ // keep track of the icons
791 name = info->fileName(); 790 name = info->fileName();
792 if( m_mode == OPEN ){ 791 if( m_mode == OPEN ){
793 if( !info->isReadable() ){ 792 if( !info->isReadable() ){
794 locked = true; 793 locked = true;
795 pix = Resource::loadPixmap("locked" ); 794 pix = Resource::loadPixmap("locked" );
796 } 795 }
797 }else if( m_mode == SAVE ){ 796 }else if( m_mode == SAVE ){
798 if( !info->isWritable() ){ 797 if( !info->isWritable() ){
799 locked = true; 798 locked = true;
800 pix = Resource::loadPixmap("locked" ); 799 pix = Resource::loadPixmap("locked" );
801 } 800 }
802 } 801 }
803 } 802 }
804 new OFileSelectorItem( m_View, pix, name, 803 new OFileSelectorItem( m_View, pix, name,
805 info->lastModified().toString(), 804 info->lastModified().toString(),
806 QString::number( info->size() ), 805 QString::number( info->size() ),
807 dir, locked ); 806 dir, locked );
808} 807}
809void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) 808void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink )
810{ 809{
811 if(!m_dir ) 810 if(!m_dir )
812 return; 811 return;
813 //if( showDirs ) 812 //if( showDirs )
814 { 813 {
815 bool locked=false; 814 bool locked=false;
816 QString name; 815 QString name;
817 QPixmap pix; 816 QPixmap pix;
818 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ 817 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){
819 locked = true; 818 locked = true;
820 if( symlink ){ 819 if( symlink ){
821 pix = (*m_pixmaps)["symlinkedlocked"]; 820 pix = (*m_pixmaps)["symlinkedlocked"];
822 }else{ 821 }else{
823 pix = Resource::loadPixmap("lockedfolder" ); 822 pix = Resource::loadPixmap("lockedfolder" );
824 } 823 }
825 }else{ 824 }else{
826 if( symlink ){ 825 if( symlink ){
827 pix = (*m_pixmaps)["dirsymlink" ]; 826 pix = (*m_pixmaps)["dirsymlink" ];
828 }else{ 827 }else{
829 pix = Resource::loadPixmap("folder" ); 828 pix = Resource::loadPixmap("folder" );
830 } 829 }
831 } 830 }
832 if( symlink){ 831 if( symlink){
833 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink(); 832 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink();
834 833
835 }else{ 834 }else{
836 //if(info->isReadable() ) 835 //if(info->isReadable() )
837 name = info->fileName(); 836 name = info->fileName();
838 } 837 }
839 838
840 new OFileSelectorItem(m_View, pix, 839 new OFileSelectorItem(m_View, pix,
841 name, info->lastModified().toString(), 840 name, info->lastModified().toString(),
842 QString::number(info->size() ),info->dirPath(true), locked, true ); 841 QString::number(info->size() ),info->dirPath(true), locked, true );
843 842
844 } 843 }
845} 844}
846void OFileSelector::setShowDirs(bool dir ) 845void OFileSelector::setShowDirs(bool dir )
847{ 846{
848 m_dir = dir; 847 m_dir = dir;
849 reparse(); 848 reparse();
850} 849}
851 850
852void OFileSelector::slotFileSelected(const QString &string ) 851void OFileSelector::slotFileSelected(const QString &string )
853{ 852{
854 if(m_shLne ) 853 if(m_shLne )
855 m_edit->setText( string ); 854 m_edit->setText( string );
856 855
857 emit fileSelected( string ); 856 emit fileSelected( string );
858 // do AppLnk stuff 857 // do AppLnk stuff
859} 858}
860void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 859void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
861{ 860{
862 slotFileSelected(lnk.name() ); 861 slotFileSelected(lnk.name() );
863 emit fileSelected( lnk ); 862 emit fileSelected( lnk );
864} 863}
865void OFileSelector::slotSelectionChanged() // get the current items 864void OFileSelector::slotSelectionChanged() // get the current items
866 // fixme 865 // fixme
867{ 866{
868 qWarning("selection changed" ); 867 qWarning("selection changed" );
869} 868}
870void OFileSelector::slotCurrentChanged(QListViewItem *item ) 869void OFileSelector::slotCurrentChanged(QListViewItem *item )
871{ 870{
872 qWarning("current changed" ); 871 qWarning("current changed" );
873 if( item == 0 ) 872 if( item == 0 )
874 return; 873 return;
875 874
876 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 875 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
877 OFileSelectorItem *sel = (OFileSelectorItem*)item; 876 OFileSelectorItem *sel = (OFileSelectorItem*)item;
878 if(!sel->isDir() ){ 877 if(!sel->isDir() ){
879 qWarning("is not dir" ); 878 qWarning("is not dir" );
880 if(m_shLne ){ 879 if(m_shLne ){
881 m_edit->setText(sel->text(1) ); 880 m_edit->setText(sel->text(1) );
882 qWarning("setTexy" ); 881 qWarning("setTexy" );
883 } 882 }
884 } 883 }
885 }else { 884 }else {
886 qWarning("mode not extended" ); 885 qWarning("mode not extended" );
887 } 886 }
888} 887}
889// either select or change dir 888// either select or change dir
890void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &point, int ) 889void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &point, int )
891{ 890{
892 if( item == 0 ) 891 if( item == 0 )
893 return; 892 return;
894 893
895 if( button != Qt::LeftButton ) 894 if( button != Qt::LeftButton )
896 return; 895 return;
897 896
898 qWarning("clicked" ); 897 qWarning("clicked" );
899 if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 898 if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
900 qWarning("inside" ); 899 qWarning("inside" );
901 OFileSelectorItem *sel = (OFileSelectorItem*)item; 900 OFileSelectorItem *sel = (OFileSelectorItem*)item;
902 if(!sel->isLocked() ){ // not locked either changedir or open 901 if(!sel->isLocked() ){ // not locked either changedir or open
903 QStringList str = QStringList::split("->", sel->text(1) ); 902 QStringList str = QStringList::split("->", sel->text(1) );
904 if(sel->isDir() ){ 903 if(sel->isDir() ){
905 cd( sel->directory() + "/" + str[0] ); 904 cd( sel->directory() + "/" + str[0] );
906 }else{ 905 }else{
907 qWarning("file" ); 906 qWarning("file" );
908 if(m_shLne ) 907 if(m_shLne )
909 m_edit->setText(str[0] ); 908 m_edit->setText(str[0] );
910 emit fileSelected(str[0] ); 909 emit fileSelected(str[0] );
911 // emit DocLnk need to do it 910 // emit DocLnk need to do it
912 } 911 }
913 }else{ 912 }else{
914 qWarning( "locked" ); 913 qWarning( "locked" );
915 } 914 }
916 }; 915 };
917} 916}
918void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) 917void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int )
919{ 918{
920 if (item == 0 ) 919 if (item == 0 )
921 return; 920 return;
922 921
923 if( button != Qt::RightButton ) 922 if( button != Qt::RightButton )
924 return; 923 return;
925 qWarning("right button" ); 924 qWarning("right button" );
926 slotContextMenu(item); 925 slotContextMenu(item);
927} 926}
928void OFileSelector::slotContextMenu(QListViewItem *item) 927void OFileSelector::slotContextMenu(QListViewItem *item)
929{ 928{
930 qWarning("context menu" ); 929 qWarning("context menu" );
931 if( item ==0 || !m_showPopup ) 930 if( item ==0 || !m_showPopup )
932 return; 931 return;
933 932
934 if( m_custom !=0){ 933 if( m_custom !=0){
935 m_custom->exec(); 934 m_custom->exec();
936 }else{ 935 }else{
937 QPopupMenu menu; 936 QPopupMenu menu;
938 QAction up; 937 QAction up;
939 up.setText("cd up"); 938 up.setText("cd up");
940 up.addTo( &menu ); 939 up.addTo( &menu );
941 connect(&up, SIGNAL(activated() ), 940 connect(&up, SIGNAL(activated() ),
942 this, SLOT(cdUP() ) ); 941 this, SLOT(cdUP() ) );
943 942
944 QAction act; 943 QAction act;
945 OFileSelectorItem *sel = (OFileSelectorItem*)item; 944 OFileSelectorItem *sel = (OFileSelectorItem*)item;
946 if(sel->isDir() ){ 945 if(sel->isDir() ){
947 act.setText( tr("Change Directory") ); 946 act.setText( tr("Change Directory") );
948 act.addTo(&menu ); 947 act.addTo(&menu );
949 connect(&act, SIGNAL(activated() ), 948 connect(&act, SIGNAL(activated() ),
950 this, SLOT(slotChangedDir() ) ); 949 this, SLOT(slotChangedDir() ) );
951 }else{ 950 }else{
952 act.setText( tr("Open file" ) ); 951 act.setText( tr("Open file" ) );
953 act.addTo( &menu ); 952 act.addTo( &menu );
954 connect(&act, SIGNAL(activated() ), 953 connect(&act, SIGNAL(activated() ),
955 this, SLOT(slotOpen() ) ); 954 this, SLOT(slotOpen() ) );
956 } 955 }
957 QAction rescan; 956 QAction rescan;
958 rescan.setText( tr("Rescan") ); 957 rescan.setText( tr("Rescan") );
959 rescan.addTo( &menu ); 958 rescan.addTo( &menu );
960 connect(&rescan, SIGNAL(activated() ), 959 connect(&rescan, SIGNAL(activated() ),
961 this, SLOT(slotRescan() ) ); 960 this, SLOT(slotRescan() ) );
962 961
963 QAction rename; 962 QAction rename;
964 rename.setText( tr("Rename") ); 963 rename.setText( tr("Rename") );
965 rename.addTo( &menu ); 964 rename.addTo( &menu );
966 connect(&rename, SIGNAL(activated() ), 965 connect(&rename, SIGNAL(activated() ),
967 this, SLOT(slotRename() ) ); 966 this, SLOT(slotRename() ) );
968 967
969 menu.insertSeparator(); 968 menu.insertSeparator();
970 QAction delItem; 969 QAction delItem;
971 delItem.setText( tr("Delete") ); 970 delItem.setText( tr("Delete") );
972 delItem.addTo(&menu ); 971 delItem.addTo(&menu );
973 connect(&delItem, SIGNAL(activated() ), 972 connect(&delItem, SIGNAL(activated() ),
974 this, SLOT(slotDelete() ) ); 973 this, SLOT(slotDelete() ) );
975 974
976 menu.exec(QCursor::pos() ); 975 menu.exec(QCursor::pos() );
977 } 976 }
978} 977}
979bool OFileSelector::cd(const QString &str ) 978bool OFileSelector::cd(const QString &str )
980{ 979{
981 qWarning(" dir %s", str.latin1() ); 980 qWarning(" dir %s", str.latin1() );
982 QDir dir( str); 981 QDir dir( str);
983 if(dir.exists() ){ 982 if(dir.exists() ){
984 m_currentDir = str; 983 m_currentDir = str;
985 reparse(); 984 reparse();
986 if(m_shTool ){ 985 if(m_shTool ){
987 int count = m_location->count(); 986 int count = m_location->count();
988 m_location->insertItem(str ); 987 m_location->insertItem(str );
989 m_location->setCurrentItem( count ); 988 m_location->setCurrentItem( count );
990 } 989 }
991 return true; 990 return true;
992 } 991 }
993 return false; 992 return false;
994} 993}
995 994
996void OFileSelector::slotChangedDir() 995void OFileSelector::slotChangedDir()
997{ 996{
998 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 997 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
999 if(sel->isDir() ){ 998 if(sel->isDir() ){
1000 QStringList str = QStringList::split("->", sel->text(1) ); 999 QStringList str = QStringList::split("->", sel->text(1) );
1001 cd( sel->directory() + "/" + str[0] ); 1000 cd( sel->directory() + "/" + str[0] );
1002 } 1001 }
1003} 1002}
1004void OFileSelector::slotOpen() 1003void OFileSelector::slotOpen()
1005{ 1004{
1006 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1005 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1007 if(!sel->isDir() ){ 1006 if(!sel->isDir() ){
1008 QStringList str = QStringList::split("->", sel->text(1) ); 1007 QStringList str = QStringList::split("->", sel->text(1) );
1009 slotFileSelected( str[0] ); 1008 slotFileSelected( str[0] );
1010 } 1009 }
1011} 1010}
1012void OFileSelector::slotRescan() 1011void OFileSelector::slotRescan()
1013{ 1012{
1014 reparse(); 1013 reparse();
1015} 1014}
1016void OFileSelector::slotRename() 1015void OFileSelector::slotRename()
1017{ 1016{
1018 // rename inline 1017 // rename inline
1019} 1018}
1020void OFileSelector::slotDelete() 1019void OFileSelector::slotDelete()
1021{ 1020{
1022 qWarning("delete slot" ); 1021 qWarning("delete slot" );