-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 @@ -33,8 +33,9 @@ #include "ofileselectormain.h" #include "ofileselector.h" #include "olocallister.h" #include "olister.h" +#include "odefaultfactories.h" QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; namespace { @@ -296,11 +297,9 @@ QString OFileSelector::selectedPath()const { QString path; if( m_selector == Normal ){ path = QPEApplication::documentDir(); - } /*else if( m_selector == Extended || m_selector == ExtendedAll ){ - ; - }*/ + } /* normal case to do */ return path; } QStringList OFileSelector::selectedPaths() const { @@ -371,17 +370,10 @@ void OFileSelector::slotViewCheck(const QString &sel) if( sel == tr("Documents" ) ){ initializeOldSelector(); m_selector = Normal; - }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 { +; } } QString OFileSelector::currentMimeType() const{ @@ -473,8 +465,9 @@ void OFileSelector::locationComboChanged() reparse(); } void OFileSelector::init() { + initFactory(); m_lay = new QVBoxLayout( this ); m_lay->setSpacing(0 ); /* take care of the main view... */ @@ -652,12 +645,8 @@ void OFileSelector::initializeChooser() m_mimeCheck = new QComboBox( m_boxView, "mime check"); m_boxView->setSpacing( 8 ); m_lay->addWidget(m_boxView, 0 ); - m_viewCheck->insertItem( tr("Documents") ); - m_viewCheck->insertItem( tr("Files") ); - m_viewCheck->insertItem( tr("All Files") ); - /* update to custom views */ updateMimeCheck(); connect( m_viewCheck, SIGNAL( activated(const QString & ) ), @@ -950,8 +939,19 @@ void OFileSelector::reparse() } // reenable painting and updates } +/* + * 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 ); +} + OFileView* OFileSelector::currentView() { return m_fileView; } @@ -1012,9 +1012,9 @@ void OFileSelector::initializeOldSelector() { m_select = new FileSelector( mime , m_mainView, "fileselector", FALSE, FALSE); m_select->setCategorySelectVisible( FALSE ); - m_select->setTypeComboVisible( FALSE ); + m_select->setTypeComboVisible( FALSE ); connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); connect(m_select, SIGNAL(closeMe() ), 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 @@ -69,8 +69,9 @@ class QFileInfo; class QHBox; class OFileView; class OLister; class OFileSelectorMain; +class OFileFactory; // /* the mimetypes one name and a list of mimetypes */ typedef QMap< QString, QStringList> MimeTypes; @@ -339,8 +340,9 @@ class OFileSelector : public QWidget { OFileView* currentView(); OFileView* currentView()const; OLister* currentLister()const; + OFileFactory* factory(); int filter(); int sorting(); QPixmap pixmap( const QString& ); /* our tool bar */ @@ -371,8 +373,9 @@ class OFileSelector : public QWidget { private: + OFileFactory* m_fileFactory; OFileSelectorMain* m_mainView; OLister* m_lister; OFileView* m_fileView; FileSelector* m_select; @@ -446,8 +449,9 @@ class OFileSelector : public QWidget { void initLister(); void initToolbar(); void initLocations(); void initializeView() {}; // FIXME + void initFactory(); /** * Returns the current mimetype */ QString currentMimeType()const; |