summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector/odefaultfactories.cpp15
-rw-r--r--libopie/ofileselector/odefaultfactories.h14
-rw-r--r--libopie/ofileselector/ofileselector.cpp34
-rw-r--r--libopie/ofileselector/ofileselector.h4
4 files changed, 50 insertions, 17 deletions
diff --git a/libopie/ofileselector/odefaultfactories.cpp b/libopie/ofileselector/odefaultfactories.cpp
new file mode 100644
index 0000000..c41fbca
--- a/dev/null
+++ b/libopie/ofileselector/odefaultfactories.cpp
@@ -0,0 +1,15 @@
1#include "ofilelistview.h"
2#include "olocallister.h"
3
4#include "odefaultfactories.h"
5
6extern "C" {
7
8 OFileView* newFileListView( OFileSelector* sel, QWidget* par ) {
9 return new OFileListView(par, sel );
10 }
11 OLister* newLocalLister( OFileSelector* sel) {
12 return new OLocalLister( sel );
13 }
14
15};
diff --git a/libopie/ofileselector/odefaultfactories.h b/libopie/ofileselector/odefaultfactories.h
new file mode 100644
index 0000000..eb698d3
--- a/dev/null
+++ b/libopie/ofileselector/odefaultfactories.h
@@ -0,0 +1,14 @@
1#ifndef OPIE_DEFAULT_FACTORIES_H
2#define OPIE_DEFAULT_FACTORIES_H
3
4#include "ofilefactory.h"
5
6extern "C" {
7
8 OFileView* newFileListView( OFileSelector*, QWidget* parent );
9 OLister* newLocalLister(OFileSelector* );
10
11};
12
13
14#endif
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp
index 458d432..91a510f 100644
--- a/libopie/ofileselector/ofileselector.cpp
+++ b/libopie/ofileselector/ofileselector.cpp
@@ -13,48 +13,49 @@
13#include <qpushbutton.h> 13#include <qpushbutton.h>
14#include <qwidgetstack.h> 14#include <qwidgetstack.h>
15#include <qpopupmenu.h> 15#include <qpopupmenu.h>
16#include <qdir.h> 16#include <qdir.h>
17#include <qfile.h> 17#include <qfile.h>
18#include <qfileinfo.h> 18#include <qfileinfo.h>
19#include <qtimer.h> 19#include <qtimer.h>
20 20
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include <qpe/applnk.h> 22#include <qpe/applnk.h>
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/mimetype.h> 24#include <qpe/mimetype.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/storage.h> 26#include <qpe/storage.h>
27 27
28#include <unistd.h> 28#include <unistd.h>
29#include <stdlib.h> 29#include <stdlib.h>
30#include <sys/stat.h> 30#include <sys/stat.h>
31 31
32#include "ofileview.h" 32#include "ofileview.h"
33#include "ofileselectormain.h" 33#include "ofileselectormain.h"
34#include "ofileselector.h" 34#include "ofileselector.h"
35#include "olocallister.h" 35#include "olocallister.h"
36#include "olister.h" 36#include "olister.h"
37#include "odefaultfactories.h"
37 38
38QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; 39QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0;
39 40
40namespace { 41namespace {
41 /* let's find the index for a specified string */ 42 /* let's find the index for a specified string */
42 int indexByString( const QComboBox *box, const QString &str ){ 43 int indexByString( const QComboBox *box, const QString &str ){
43 int index= 0; 44 int index= 0;
44 for(int i= 0; i < box->count(); i++ ){ 45 for(int i= 0; i < box->count(); i++ ){
45 /* found */ 46 /* found */
46 if( str == box->text(i ) ){ 47 if( str == box->text(i ) ){
47 index= i; 48 index= i;
48 break; 49 break;
49 } 50 }
50 } 51 }
51 return index; 52 return index;
52 } 53 }
53} 54}
54 55
55OFileSelector::OFileSelector( QWidget *wid, int mode, int selector, 56OFileSelector::OFileSelector( QWidget *wid, int mode, int selector,
56 const QString &dirName, 57 const QString &dirName,
57 const QString &fileName, 58 const QString &fileName,
58 const QMap<QString,QStringList>& mimeTypes) 59 const QMap<QString,QStringList>& mimeTypes)
59 : QWidget( wid, "OFileSelector") 60 : QWidget( wid, "OFileSelector")
60{ 61{
@@ -276,51 +277,49 @@ QString OFileSelector::selectedName() const
276 name = m_currentDir + "/" + currentView()->selectedName(); 277 name = m_currentDir + "/" + currentView()->selectedName();
277 } 278 }
278 } 279 }
279 return name; 280 return name;
280} 281}
281QStringList OFileSelector::selectedNames()const 282QStringList OFileSelector::selectedNames()const
282{ 283{
283 QStringList list; 284 QStringList list;
284 if( m_selector == Normal ){ 285 if( m_selector == Normal ){
285 list << selectedName(); 286 list << selectedName();
286 }else { 287 }else {
287 list << selectedName(); // FIXME implement multiple Selections 288 list << selectedName(); // FIXME implement multiple Selections
288 } 289 }
289 return list; 290 return list;
290} 291}
291/** If mode is set to the Dir selection this will return the selected path. 292/** If mode is set to the Dir selection this will return the selected path.
292 * 293 *
293 * 294 *
294 */ 295 */
295QString OFileSelector::selectedPath()const 296QString OFileSelector::selectedPath()const
296{ 297{
297 QString path; 298 QString path;
298 if( m_selector == Normal ){ 299 if( m_selector == Normal ){
299 path = QPEApplication::documentDir(); 300 path = QPEApplication::documentDir();
300 } /*else if( m_selector == Extended || m_selector == ExtendedAll ){ 301 } /* normal case to do */
301 ;
302 }*/
303 return path; 302 return path;
304} 303}
305QStringList OFileSelector::selectedPaths() const 304QStringList OFileSelector::selectedPaths() const
306{ 305{
307 QStringList list; 306 QStringList list;
308 list << selectedPath(); 307 list << selectedPath();
309 return list; 308 return list;
310} 309}
311QString OFileSelector::directory()const 310QString OFileSelector::directory()const
312{ 311{
313 if( m_selector == Normal ) 312 if( m_selector == Normal )
314 return QPEApplication::documentDir(); 313 return QPEApplication::documentDir();
315 314
316 return QDir(m_currentDir).absPath(); 315 return QDir(m_currentDir).absPath();
317} 316}
318 317
319int OFileSelector::fileCount() 318int OFileSelector::fileCount()
320{ 319{
321 int count; 320 int count;
322 switch( m_selector ){ 321 switch( m_selector ){
323 case Normal: 322 case Normal:
324 count = m_select->fileCount(); 323 count = m_select->fileCount();
325 break; 324 break;
326 case Extended: 325 case Extended:
@@ -351,57 +350,50 @@ QValueList<DocLnk> OFileSelector::selectedDocuments() const
351{ 350{
352 QValueList<DocLnk> docs; 351 QValueList<DocLnk> docs;
353 docs.append( selectedDocument() ); 352 docs.append( selectedDocument() );
354 return docs; 353 return docs;
355} 354}
356 355
357 356
358// slots internal 357// slots internal
359 358
360void OFileSelector::slotOk() 359void OFileSelector::slotOk()
361{ 360{
362 emit ok(); 361 emit ok();
363} 362}
364void OFileSelector::slotCancel() 363void OFileSelector::slotCancel()
365{ 364{
366 emit cancel(); 365 emit cancel();
367} 366}
368/* switch the views */ 367/* switch the views */
369void OFileSelector::slotViewCheck(const QString &sel) 368void OFileSelector::slotViewCheck(const QString &sel)
370{ 369{
371 if( sel == tr("Documents" ) ){ 370 if( sel == tr("Documents" ) ){
372 initializeOldSelector(); 371 initializeOldSelector();
373 m_selector = Normal; 372 m_selector = Normal;
374 373
375 }else if( sel == tr("Files") ){ 374 }else {
376 m_selector = Extended; 375;
377
378 // FIXME call the factory
379 //reparse();
380 }else if( sel == tr("All Files") ){
381 m_selector = ExtendedAll;
382/* see above
383 reparse(); */
384 } 376 }
385} 377}
386 378
387QString OFileSelector::currentMimeType() const{ 379QString OFileSelector::currentMimeType() const{
388 QString mime; 380 QString mime;
389 QString currentText; 381 QString currentText;
390 if (m_shChooser && m_mimeCheck ) 382 if (m_shChooser && m_mimeCheck )
391 currentText = m_mimeCheck->currentText(); 383 currentText = m_mimeCheck->currentText();
392 384
393 qWarning("CurrentText" + currentText ); 385 qWarning("CurrentText" + currentText );
394 if (tr("All") == currentText ) return QString::null; 386 if (tr("All") == currentText ) return QString::null;
395 else if (currentText.isEmpty() ) { 387 else if (currentText.isEmpty() ) {
396 ; 388 ;
397 }else { 389 }else {
398 QMap<QString, QStringList>::ConstIterator it; 390 QMap<QString, QStringList>::ConstIterator it;
399 it = m_mimetypes.find( currentText ); 391 it = m_mimetypes.find( currentText );
400 if ( it != m_mimetypes.end() ) { 392 if ( it != m_mimetypes.end() ) {
401 mime = it.data().join(";"); 393 mime = it.data().join(";");
402 }else{ 394 }else{
403 mime = currentText; 395 mime = currentText;
404 } 396 }
405 } 397 }
406 return mime; 398 return mime;
407} 399}
@@ -453,48 +445,49 @@ void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count
453 if( currentPath.left(2)=="//") 445 if( currentPath.left(2)=="//")
454 pathList.append( currentPath.right(currentPath.length()-1) ); 446 pathList.append( currentPath.right(currentPath.length()-1) );
455 else 447 else
456 pathList.append( currentPath ); 448 pathList.append( currentPath );
457 m_location->insertStringList( pathList,-1); 449 m_location->insertStringList( pathList,-1);
458 } 450 }
459} 451}
460/* 452/*
461 * Do not crash anymore 453 * Do not crash anymore
462 * don't try to change dir to a file 454 * don't try to change dir to a file
463 */ 455 */
464void OFileSelector::locationComboChanged() 456void OFileSelector::locationComboChanged()
465{ 457{
466 QFileInfo info( m_location->lineEdit()->text() ); 458 QFileInfo info( m_location->lineEdit()->text() );
467 qWarning("info %s %s", info.dirPath(true).latin1(), m_location->lineEdit()->text().latin1() ); 459 qWarning("info %s %s", info.dirPath(true).latin1(), m_location->lineEdit()->text().latin1() );
468 if (info.isFile() ) 460 if (info.isFile() )
469 cd(info.dirPath(TRUE) ); //absolute path 461 cd(info.dirPath(TRUE) ); //absolute path
470 else 462 else
471 cd( m_location->lineEdit()->text() ); 463 cd( m_location->lineEdit()->text() );
472 464
473 reparse(); 465 reparse();
474} 466}
475void OFileSelector::init() 467void OFileSelector::init()
476{ 468{
469 initFactory();
477 m_lay = new QVBoxLayout( this ); 470 m_lay = new QVBoxLayout( this );
478 m_lay->setSpacing(0 ); 471 m_lay->setSpacing(0 );
479 472
480 /* take care of the main view... */ 473 /* take care of the main view... */
481 initToolbar(); 474 initToolbar();
482 475
483 /* initialize the file lister */ 476 /* initialize the file lister */
484 initLister(); 477 initLister();
485 if( m_selector == Normal ){ 478 if( m_selector == Normal ){
486 QString mime; 479 QString mime;
487 if (!m_autoMime) { 480 if (!m_autoMime) {
488 if (!m_mimetypes.isEmpty() ) { 481 if (!m_mimetypes.isEmpty() ) {
489 QMap<QString, QStringList>::Iterator it; 482 QMap<QString, QStringList>::Iterator it;
490 it = m_mimetypes.begin(); // cause we're in the init 483 it = m_mimetypes.begin(); // cause we're in the init
491 mime = it.data().join(";"); 484 mime = it.data().join(";");
492 } 485 }
493 } 486 }
494 initializeOldSelector(); 487 initializeOldSelector();
495 }else{ 488 }else{
496 initializeView(); 489 initializeView();
497 } 490 }
498 491
499 if( m_shLne ) // the LineEdit with the current FileName 492 if( m_shLne ) // the LineEdit with the current FileName
500 initializeName(); 493 initializeName();
@@ -632,52 +625,48 @@ void OFileSelector::initializeYes()
632 * if automime we need to update the mimetypes 625 * if automime we need to update the mimetypes
633 */ 626 */
634void OFileSelector::updateMimeCheck() { 627void OFileSelector::updateMimeCheck() {
635 m_mimeCheck->clear(); 628 m_mimeCheck->clear();
636 if (m_autoMime ) { 629 if (m_autoMime ) {
637 //m_mimeCheck->insertItem( tr("All") ); 630 //m_mimeCheck->insertItem( tr("All") );
638 updateMimes(); 631 updateMimes();
639 } 632 }
640 633
641 QMap<QString, QStringList>::Iterator it; 634 QMap<QString, QStringList>::Iterator it;
642 for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) { 635 for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) {
643 m_mimeCheck->insertItem( it.key() ); 636 m_mimeCheck->insertItem( it.key() );
644 } 637 }
645} 638}
646 639
647void OFileSelector::initializeChooser() 640void OFileSelector::initializeChooser()
648{ 641{
649 if( m_boxView == 0 ){ 642 if( m_boxView == 0 ){
650 m_boxView = new QHBox( this ); 643 m_boxView = new QHBox( this );
651 m_viewCheck = new QComboBox( m_boxView, "view check"); 644 m_viewCheck = new QComboBox( m_boxView, "view check");
652 m_mimeCheck = new QComboBox( m_boxView, "mime check"); 645 m_mimeCheck = new QComboBox( m_boxView, "mime check");
653 m_boxView->setSpacing( 8 ); 646 m_boxView->setSpacing( 8 );
654 m_lay->addWidget(m_boxView, 0 ); 647 m_lay->addWidget(m_boxView, 0 );
655 648
656 m_viewCheck->insertItem( tr("Documents") );
657 m_viewCheck->insertItem( tr("Files") );
658 m_viewCheck->insertItem( tr("All Files") );
659 /* update to custom views */
660 649
661 updateMimeCheck(); 650 updateMimeCheck();
662 651
663 connect( m_viewCheck, SIGNAL( activated(const QString & ) ), 652 connect( m_viewCheck, SIGNAL( activated(const QString & ) ),
664 this, SLOT( slotViewCheck(const QString & ) ) ); 653 this, SLOT( slotViewCheck(const QString & ) ) );
665 connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), 654 connect( m_mimeCheck, SIGNAL( activated(const QString & ) ),
666 this, SLOT( slotMimeCheck( const QString & ) ) ); 655 this, SLOT( slotMimeCheck( const QString & ) ) );
667 } 656 }
668} 657}
669/* generate the buttons for the toolbar */ 658/* generate the buttons for the toolbar */
670void OFileSelector::initToolbar() { 659void OFileSelector::initToolbar() {
671 m_mainView = new OFileSelectorMain( this ); 660 m_mainView = new OFileSelectorMain( this );
672 661
673 /* now generate the tool bar */ 662 /* now generate the tool bar */
674 qWarning( "toolbar" ); 663 qWarning( "toolbar" );
675 m_pseudo = new QWidget( m_mainView, "Pseudo Widget" ); 664 m_pseudo = new QWidget( m_mainView, "Pseudo Widget" );
676 m_pseudoLayout = new QVBoxLayout( m_pseudo ); 665 m_pseudoLayout = new QVBoxLayout( m_pseudo );
677 666
678 m_boxToolbar = new QHBox( m_pseudo ); 667 m_boxToolbar = new QHBox( m_pseudo );
679 m_boxToolbar->setSpacing( 0 ); 668 m_boxToolbar->setSpacing( 0 );
680 669
681 // tool bar members now 670 // tool bar members now
682 m_location = new QComboBox( m_boxToolbar ); 671 m_location = new QComboBox( m_boxToolbar );
683 m_location->setEditable( TRUE ); 672 m_location->setEditable( TRUE );
@@ -930,48 +919,59 @@ void OFileSelector::reparse()
930 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) ); 919 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) );
931 currentMimeType = m_mimeCheck->currentText(); 920 currentMimeType = m_mimeCheck->currentText();
932 } 921 }
933 }else { // no autoMime 922 }else { // no autoMime
934 // let the mimetype be set from out side the m_mimeCheck FEATURE 923 // let the mimetype be set from out side the m_mimeCheck FEATURE
935 924
936 if( m_shChooser ) 925 if( m_shChooser )
937 currentMimeType = m_mimeCheck->currentText(); 926 currentMimeType = m_mimeCheck->currentText();
938 927
939 } 928 }
940 // now we got our mimetypes we can add the files 929 // now we got our mimetypes we can add the files
941 930
942 currentLister()->reparse( m_currentDir ); 931 currentLister()->reparse( m_currentDir );
943 /* we're done with adding let's sort */ 932 /* we're done with adding let's sort */
944 currentView()->sort(); 933 currentView()->sort();
945 934
946 935
947 if( m_shTool ){ 936 if( m_shTool ){
948 m_location->insertItem( m_currentDir ); 937 m_location->insertItem( m_currentDir );
949 938
950 } 939 }
951 // reenable painting and updates 940 // reenable painting and updates
952} 941}
953 942
943/*
944 * the factory
945 */
946void OFileSelector::initFactory() {
947 m_fileFactory = new OFileFactory();
948 m_fileFactory->addLister(tr("Files"), newLocalLister );
949 m_fileFactory->addView(tr("List View"), newFileListView );
950 /* the factory is just a dummy */
951 m_fileFactory->addView(tr("Documents"), newFileListView );
952}
953
954 954
955OFileView* OFileSelector::currentView() { 955OFileView* OFileSelector::currentView() {
956 return m_fileView; 956 return m_fileView;
957} 957}
958OFileView* OFileSelector::currentView() const{ 958OFileView* OFileSelector::currentView() const{
959 return m_fileView; 959 return m_fileView;
960} 960}
961int OFileSelector::filter() { 961int OFileSelector::filter() {
962 int filter; 962 int filter;
963 if ( m_selector == ExtendedAll ) 963 if ( m_selector == ExtendedAll )
964 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 964 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
965 else 965 else
966 filter = QDir::Files | QDir::Dirs | QDir::All ; 966 filter = QDir::Files | QDir::Dirs | QDir::All ;
967 967
968 return filter; 968 return filter;
969} 969}
970int OFileSelector::sorting() { 970int OFileSelector::sorting() {
971 int sort; 971 int sort;
972 972
973 if (m_case ) 973 if (m_case )
974 sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed ); 974 sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed );
975 else 975 else
976 sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed ); 976 sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed );
977 977
@@ -992,33 +992,33 @@ void OFileSelector::internChangedDir( const QString& s) {
992} 992}
993void OFileSelector::internChangedDir( const QDir& s) { 993void OFileSelector::internChangedDir( const QDir& s) {
994 emit dirSelected( s ); 994 emit dirSelected( s );
995} 995}
996QPixmap OFileSelector::pixmap( const QString& s ) { 996QPixmap OFileSelector::pixmap( const QString& s ) {
997 997
998 return (*m_pixmaps)[s]; 998 return (*m_pixmaps)[s];
999} 999}
1000OLister* OFileSelector::currentLister()const { 1000OLister* OFileSelector::currentLister()const {
1001 return m_lister; 1001 return m_lister;
1002} 1002}
1003void OFileSelector::initializeOldSelector() { 1003void OFileSelector::initializeOldSelector() {
1004 qWarning("initializeOldSelector"); 1004 qWarning("initializeOldSelector");
1005 1005
1006 delete m_select; 1006 delete m_select;
1007 1007
1008 // we need to initialize but keep the selected mimetype 1008 // we need to initialize but keep the selected mimetype
1009 /* we default not to show close and new buttons */ 1009 /* we default not to show close and new buttons */
1010 QString mime = currentMimeType(); 1010 QString mime = currentMimeType();
1011 qWarning("MimeType " + mime ); 1011 qWarning("MimeType " + mime );
1012 m_select = new FileSelector( mime , 1012 m_select = new FileSelector( mime ,
1013 m_mainView, "fileselector", 1013 m_mainView, "fileselector",
1014 FALSE, FALSE); 1014 FALSE, FALSE);
1015 m_select->setCategorySelectVisible( FALSE ); 1015 m_select->setCategorySelectVisible( FALSE );
1016 m_select->setTypeComboVisible( FALSE ); 1016 m_select->setTypeComboVisible( FALSE );
1017 1017
1018 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 1018 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
1019 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 1019 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
1020 connect(m_select, SIGNAL(closeMe() ), 1020 connect(m_select, SIGNAL(closeMe() ),
1021 this, SIGNAL(closeMe() ) ); 1021 this, SIGNAL(closeMe() ) );
1022 //connect to close me and other signals as well 1022 //connect to close me and other signals as well
1023 m_mainView->setWidget( m_select ); 1023 m_mainView->setWidget( m_select );
1024} 1024}
diff --git a/libopie/ofileselector/ofileselector.h b/libopie/ofileselector/ofileselector.h
index bf9a26b..3e834fb 100644
--- a/libopie/ofileselector/ofileselector.h
+++ b/libopie/ofileselector/ofileselector.h
@@ -49,48 +49,49 @@
49 49
50/** This is OPIEs FileDialog Widget. You can use it 50/** This is OPIEs FileDialog Widget. You can use it
51 * as a dropin replacement of the fileselector and 51 * as a dropin replacement of the fileselector and
52 * or use any of the new features. 52 * or use any of the new features.
53 * This is also a complete FileSave and FileLoad widget 53 * This is also a complete FileSave and FileLoad widget
54 * If you look for a Dialog check OFileDialog 54 * If you look for a Dialog check OFileDialog
55 * 55 *
56 */ 56 */
57class DocLnk; 57class DocLnk;
58class QCheckBox; 58class QCheckBox;
59class QComboBox; 59class QComboBox;
60class QPushButton; 60class QPushButton;
61class QGridLayout; 61class QGridLayout;
62class QLineEdit; 62class QLineEdit;
63class QLabel; 63class QLabel;
64class QWidgetStack; 64class QWidgetStack;
65class QHBoxLayout; 65class QHBoxLayout;
66class QVBoxLayout; 66class QVBoxLayout;
67class QPopupMenu; 67class QPopupMenu;
68class QFileInfo; 68class QFileInfo;
69class QHBox; 69class QHBox;
70class OFileView; 70class OFileView;
71class OLister; 71class OLister;
72class OFileSelectorMain; 72class OFileSelectorMain;
73class OFileFactory;
73// 74//
74 75
75/* the mimetypes one name and a list of mimetypes */ 76/* the mimetypes one name and a list of mimetypes */
76typedef QMap< QString, QStringList> MimeTypes; 77typedef QMap< QString, QStringList> MimeTypes;
77 78
78/** 79/**
79 * FIXME later 80 * FIXME later
80 */ 81 */
81struct OPopupMenuFactory { 82struct OPopupMenuFactory {
82 OPopupMenuFactory() {} 83 OPopupMenuFactory() {}
83 84
84}; 85};
85 86
86 87
87/** 88/**
88 * Opie the default OFileSelector 89 * Opie the default OFileSelector
89 * It features multiple views. 90 * It features multiple views.
90 */ 91 */
91class OFileSelector : public QWidget { 92class OFileSelector : public QWidget {
92 Q_OBJECT 93 Q_OBJECT
93 94
94 /* friends are evil but I don't want to make the 95 /* friends are evil but I don't want to make the
95 * methods public 96 * methods public
96 */ 97 */
@@ -319,80 +320,82 @@ class OFileSelector : public QWidget {
319 QString selectedPath() const; 320 QString selectedPath() const;
320 321
321 /** 322 /**
322 * return the completed paths 323 * return the completed paths
323 */ 324 */
324 QStringList selectedPaths() const; 325 QStringList selectedPaths() const;
325 326
326 /** 327 /**
327 * the current directory 328 * the current directory
328 */ 329 */
329 QString directory()const; 330 QString directory()const;
330 331
331 /** 332 /**
332 * fileCount 333 * fileCount
333 */ 334 */
334 int fileCount(); 335 int fileCount();
335 336
336 DocLnk selectedDocument()const; 337 DocLnk selectedDocument()const;
337 338
338 QValueList<DocLnk> selectedDocuments()const; 339 QValueList<DocLnk> selectedDocuments()const;
339 340
340 OFileView* currentView(); 341 OFileView* currentView();
341 OFileView* currentView()const; 342 OFileView* currentView()const;
342 OLister* currentLister()const; 343 OLister* currentLister()const;
344 OFileFactory* factory();
343 int filter(); 345 int filter();
344 int sorting(); 346 int sorting();
345 QPixmap pixmap( const QString& ); 347 QPixmap pixmap( const QString& );
346 /* our tool bar */ 348 /* our tool bar */
347 QWidget* toolBar(); 349 QWidget* toolBar();
348 350
349 signals: 351 signals:
350 void fileSelected( const DocLnk & ); 352 void fileSelected( const DocLnk & );
351 void fileSelected( const QString & ); 353 void fileSelected( const QString & );
352 void dirSelected(const QString &dir ); 354 void dirSelected(const QString &dir );
353 void dirSelected( const QDir& ); 355 void dirSelected( const QDir& );
354 void closeMe(); 356 void closeMe();
355 void ok(); 357 void ok();
356 void cancel(); 358 void cancel();
357 void contextMenu(); 359 void contextMenu();
358 360
359 private slots: 361 private slots:
360 void slotOk(); 362 void slotOk();
361 void slotCancel(); 363 void slotCancel();
362 void slotViewCheck(const QString & ); 364 void slotViewCheck(const QString & );
363 void slotMimeCheck(const QString & ); 365 void slotMimeCheck(const QString & );
364 void slotLocationActivated(const QString & ); 366 void slotLocationActivated(const QString & );
365 void slotInsertLocationPath(const QString &, int); 367 void slotInsertLocationPath(const QString &, int);
366 void locationComboChanged(); 368 void locationComboChanged();
367 369
368 private: 370 private:
369 void init(); 371 void init();
370 void updateMimes(); 372 void updateMimes();
371 373
372 374
373 private: 375 private:
374 376
377 OFileFactory* m_fileFactory;
375 OFileSelectorMain* m_mainView; 378 OFileSelectorMain* m_mainView;
376 OLister* m_lister; 379 OLister* m_lister;
377 OFileView* m_fileView; 380 OFileView* m_fileView;
378 FileSelector* m_select; 381 FileSelector* m_select;
379 int m_mode, m_selector; 382 int m_mode, m_selector;
380 QComboBox *m_location, 383 QComboBox *m_location,
381 *m_mimeCheck, 384 *m_mimeCheck,
382 *m_viewCheck; 385 *m_viewCheck;
383 386
384 QPushButton *m_homeButton, 387 QPushButton *m_homeButton,
385 *m_docButton, 388 *m_docButton,
386 *m_hideButton, 389 *m_hideButton,
387 *m_ok, *m_cancel; 390 *m_ok, *m_cancel;
388 QPushButton *m_reread, 391 QPushButton *m_reread,
389 *m_up, 392 *m_up,
390 *m_new, 393 *m_new,
391 *m_close; 394 *m_close;
392 QListView *m_View; 395 QListView *m_View;
393 QCheckBox *m_checkPerm; 396 QCheckBox *m_checkPerm;
394 QWidget *m_pseudo; 397 QWidget *m_pseudo;
395 QVBoxLayout *m_pseudoLayout; 398 QVBoxLayout *m_pseudoLayout;
396 399
397 QString m_currentDir; 400 QString m_currentDir;
398 QString m_name; 401 QString m_name;
@@ -426,48 +429,49 @@ class OFileSelector : public QWidget {
426 bool m_showPopup : 1; 429 bool m_showPopup : 1;
427 bool m_showHidden : 1; 430 bool m_showHidden : 1;
428 431
429 void initVars(); 432 void initVars();
430 433
431 void delItems(); 434 void delItems();
432 void initializeName(); 435 void initializeName();
433 void initializeYes(); 436 void initializeYes();
434 void initializeChooser(); 437 void initializeChooser();
435 void initializePerm(); 438 void initializePerm();
436 void initPics(); 439 void initPics();
437 bool compliesMime(const QString &path, 440 bool compliesMime(const QString &path,
438 const QString &mime); 441 const QString &mime);
439 bool compliesMime(const QString& mime ); 442 bool compliesMime(const QString& mime );
440 /** 443 /**
441 * Updates the QComboBox with the current mimetypes 444 * Updates the QComboBox with the current mimetypes
442 */ 445 */
443 void updateMimeCheck(); 446 void updateMimeCheck();
444 447
445 void initializeOldSelector(); 448 void initializeOldSelector();
446 void initLister(); 449 void initLister();
447 void initToolbar(); 450 void initToolbar();
448 void initLocations(); 451 void initLocations();
449 void initializeView() {}; // FIXME 452 void initializeView() {}; // FIXME
453 void initFactory();
450 /** 454 /**
451 * Returns the current mimetype 455 * Returns the current mimetype
452 */ 456 */
453 QString currentMimeType()const; 457 QString currentMimeType()const;
454 class OFileSelectorPrivate; 458 class OFileSelectorPrivate;
455 OFileSelectorPrivate *d; 459 OFileSelectorPrivate *d;
456 static QMap<QString,QPixmap> *m_pixmaps; 460 static QMap<QString,QPixmap> *m_pixmaps;
457 461
458private slots: 462private slots:
459 void slotFileSelected(const QString & ); // not really meant to be a slot 463 void slotFileSelected(const QString & ); // not really meant to be a slot
460 void slotFileBridgeSelected( const DocLnk & ); 464 void slotFileBridgeSelected( const DocLnk & );
461 // listview above 465 // listview above
462 // popup below 466 // popup below
463 virtual void slotDelete(); 467 virtual void slotDelete();
464 virtual void cdUP(); 468 virtual void cdUP();
465 virtual void slotHome(); 469 virtual void slotHome();
466 virtual void slotDoc(); 470 virtual void slotDoc();
467 virtual void slotNavigate( ); 471 virtual void slotNavigate( );
468 472
469 /* for OLister */ 473 /* for OLister */
470private: 474private:
471 475
472 /* for OFileView */ 476 /* for OFileView */
473private: 477private: