-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 @@ +#include "ofilelistview.h" +#include "olocallister.h" + +#include "odefaultfactories.h" + +extern "C" { + + OFileView* newFileListView( OFileSelector* sel, QWidget* par ) { + return new OFileListView(par, sel ); + } + OLister* newLocalLister( OFileSelector* sel) { + return new OLocalLister( sel ); + } + +}; 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 @@ +#ifndef OPIE_DEFAULT_FACTORIES_H +#define OPIE_DEFAULT_FACTORIES_H + +#include "ofilefactory.h" + +extern "C" { + + OFileView* newFileListView( OFileSelector*, QWidget* parent ); + OLister* newLocalLister(OFileSelector* ); + +}; + + +#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 @@ -36,2 +36,3 @@ #include "olister.h" +#include "odefaultfactories.h" @@ -299,5 +300,3 @@ QString OFileSelector::selectedPath()const path = QPEApplication::documentDir(); - } /*else if( m_selector == Extended || m_selector == ExtendedAll ){ - ; - }*/ + } /* normal case to do */ return path; @@ -374,11 +373,4 @@ void OFileSelector::slotViewCheck(const QString &sel) - }else if( sel == tr("Files") ){ - m_selector = Extended; - - // FIXME call the factory - //reparse(); - }else if( sel == tr("All Files") ){ - m_selector = ExtendedAll; -/* see above - reparse(); */ + }else { +; } @@ -476,2 +468,3 @@ void OFileSelector::init() { + initFactory(); m_lay = new QVBoxLayout( this ); @@ -655,6 +648,2 @@ void OFileSelector::initializeChooser() - m_viewCheck->insertItem( tr("Documents") ); - m_viewCheck->insertItem( tr("Files") ); - m_viewCheck->insertItem( tr("All Files") ); - /* update to custom views */ @@ -953,2 +942,13 @@ void OFileSelector::reparse() +/* + * the factory + */ +void OFileSelector::initFactory() { + m_fileFactory = new OFileFactory(); + m_fileFactory->addLister(tr("Files"), newLocalLister ); + m_fileFactory->addView(tr("List View"), newFileListView ); + /* the factory is just a dummy */ + m_fileFactory->addView(tr("Documents"), newFileListView ); +} + @@ -1015,3 +1015,3 @@ void OFileSelector::initializeOldSelector() { m_select->setCategorySelectVisible( FALSE ); - m_select->setTypeComboVisible( FALSE ); + m_select->setTypeComboVisible( FALSE ); 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 @@ -72,2 +72,3 @@ class OLister; class OFileSelectorMain; +class OFileFactory; // @@ -342,2 +343,3 @@ class OFileSelector : public QWidget { OLister* currentLister()const; + OFileFactory* factory(); int filter(); @@ -374,2 +376,3 @@ class OFileSelector : public QWidget { + OFileFactory* m_fileFactory; OFileSelectorMain* m_mainView; @@ -449,2 +452,3 @@ class OFileSelector : public QWidget { void initializeView() {}; // FIXME + void initFactory(); /** |