-rw-r--r-- | libopie/ofileselector/odefaultfactories.cpp | 15 | ||||
-rw-r--r-- | libopie/ofileselector/odefaultfactories.h | 14 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 34 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.h | 4 |
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 | |||
6 | extern "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 | |||
6 | extern "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 | |||
@@ -31,12 +31,13 @@ | |||
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 | ||
38 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; | 39 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; |
39 | 40 | ||
40 | namespace { | 41 | namespace { |
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 ){ |
@@ -294,15 +295,13 @@ QStringList OFileSelector::selectedNames()const | |||
294 | */ | 295 | */ |
295 | QString OFileSelector::selectedPath()const | 296 | QString 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 | } |
305 | QStringList OFileSelector::selectedPaths() const | 304 | QStringList OFileSelector::selectedPaths() const |
306 | { | 305 | { |
307 | QStringList list; | 306 | QStringList list; |
308 | list << selectedPath(); | 307 | list << selectedPath(); |
@@ -369,21 +368,14 @@ void OFileSelector::slotCancel() | |||
369 | void OFileSelector::slotViewCheck(const QString &sel) | 368 | void 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 | ||
387 | QString OFileSelector::currentMimeType() const{ | 379 | QString OFileSelector::currentMimeType() const{ |
388 | QString mime; | 380 | QString mime; |
389 | QString currentText; | 381 | QString currentText; |
@@ -471,12 +463,13 @@ void OFileSelector::locationComboChanged() | |||
471 | cd( m_location->lineEdit()->text() ); | 463 | cd( m_location->lineEdit()->text() ); |
472 | 464 | ||
473 | reparse(); | 465 | reparse(); |
474 | } | 466 | } |
475 | void OFileSelector::init() | 467 | void 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 | ||
@@ -650,16 +643,12 @@ void OFileSelector::initializeChooser() | |||
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 & ) ), |
@@ -948,12 +937,23 @@ void OFileSelector::reparse() | |||
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 | */ | ||
946 | void 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 | ||
955 | OFileView* OFileSelector::currentView() { | 955 | OFileView* OFileSelector::currentView() { |
956 | return m_fileView; | 956 | return m_fileView; |
957 | } | 957 | } |
958 | OFileView* OFileSelector::currentView() const{ | 958 | OFileView* OFileSelector::currentView() const{ |
959 | return m_fileView; | 959 | return m_fileView; |
@@ -1010,13 +1010,13 @@ void OFileSelector::initializeOldSelector() { | |||
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 |
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 | |||
@@ -67,12 +67,13 @@ class QVBoxLayout; | |||
67 | class QPopupMenu; | 67 | class QPopupMenu; |
68 | class QFileInfo; | 68 | class QFileInfo; |
69 | class QHBox; | 69 | class QHBox; |
70 | class OFileView; | 70 | class OFileView; |
71 | class OLister; | 71 | class OLister; |
72 | class OFileSelectorMain; | 72 | class OFileSelectorMain; |
73 | class 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 */ |
76 | typedef QMap< QString, QStringList> MimeTypes; | 77 | typedef QMap< QString, QStringList> MimeTypes; |
77 | 78 | ||
78 | /** | 79 | /** |
@@ -337,12 +338,13 @@ class OFileSelector : public QWidget { | |||
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 | ||
@@ -369,12 +371,13 @@ class OFileSelector : public QWidget { | |||
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, |
@@ -444,12 +447,13 @@ class OFileSelector : public QWidget { | |||
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; |