-rw-r--r-- | libopie/ofileselector/odefaultfactories.cpp | 8 | ||||
-rw-r--r-- | libopie/ofileselector/odefaultfactories.h | 3 | ||||
-rw-r--r-- | libopie/ofileselector/ofiledialog.cpp | 2 | ||||
-rw-r--r-- | libopie/ofileselector/ofiledialog.h | 3 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 8 |
5 files changed, 19 insertions, 5 deletions
diff --git a/libopie/ofileselector/odefaultfactories.cpp b/libopie/ofileselector/odefaultfactories.cpp index c41fbca..c8efffb 100644 --- a/libopie/ofileselector/odefaultfactories.cpp +++ b/libopie/ofileselector/odefaultfactories.cpp @@ -1,15 +1,23 @@ #include "ofilelistview.h" +#include "ofileiconview.h" #include "olocallister.h" + #include "odefaultfactories.h" extern "C" { + + OFileView* newFileIconView( OFileSelector* sel, QWidget* parent ) { + return new OFileIconView( parent, sel ); + } + 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 index eb698d3..b4c35af 100644 --- a/libopie/ofileselector/odefaultfactories.h +++ b/libopie/ofileselector/odefaultfactories.h @@ -1,14 +1,17 @@ #ifndef OPIE_DEFAULT_FACTORIES_H #define OPIE_DEFAULT_FACTORIES_H #include "ofilefactory.h" extern "C" { + OFileView* newFileIconView( OFileSelector*, QWidget* parent ); OFileView* newFileListView( OFileSelector*, QWidget* parent ); + OLister* newLocalLister(OFileSelector* ); + }; #endif diff --git a/libopie/ofileselector/ofiledialog.cpp b/libopie/ofileselector/ofiledialog.cpp index 430def2..d137c66 100644 --- a/libopie/ofileselector/ofiledialog.cpp +++ b/libopie/ofileselector/ofiledialog.cpp @@ -55,62 +55,62 @@ OFileDialog::OFileDialog(const QString &caption, this, SLOT(slotFileSelected(const QString&) ) ); connect(file, SIGNAL(dirSelected(const QString &) ), this, SLOT(slotDirSelected(const QString &) ) ); file->setYesCancelVisible( false ); // relayout } QString OFileDialog::mimetype()const { return QString::null; } QString OFileDialog::fileName()const { return file->selectedName(); } DocLnk OFileDialog::selectedDocument()const { return file->selectedDocument(); } QString OFileDialog::getOpenFileName(int selector, const QString &startDir, const QString &file, const MimeTypes &mimes, QWidget *wid, const QString &caption ) { QString ret; OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, wid, OFileSelector::Open, selector, startDir, file, mimes); dlg.showMaximized(); if( dlg.exec() ) - ret = dlg.fileName(); + ret = dlg.fileName(); return ret; } QString OFileDialog::getSaveFileName(int selector, const QString &startDir, const QString &file, const MimeTypes &mimes, QWidget *wid, const QString &caption ) { QString ret; OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, wid, OFileSelector::Save, selector, startDir, file, mimes); dlg.showMaximized(); if( dlg.exec() ) ret = dlg.fileName(); return ret; } void OFileDialog::slotFileSelected(const QString & ) { accept(); } void OFileDialog::slotDirSelected(const QString & ) { // if mode //accept(); } diff --git a/libopie/ofileselector/ofiledialog.h b/libopie/ofileselector/ofiledialog.h index e14253c..e368e96 100644 --- a/libopie/ofileselector/ofiledialog.h +++ b/libopie/ofileselector/ofiledialog.h @@ -3,65 +3,66 @@ .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> .>+-= _;:, .> :=|. This library is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This library is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef OpieFileDialog_h #define OpieFileDialog_h #include <qdialog.h> -#include <opie/ofileselector.h> +//#include <opie/ofileselector.h> +#include "ofileselector.h" class OFileDialog : public QDialog { Q_OBJECT public: OFileDialog(const QString &caption, QWidget *, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const MimeTypes &mimetypes = MimeTypes() ); QString mimetype() const; QString fileName() const; DocLnk selectedDocument()const; // static methods static QString getOpenFileName(int selector, const QString& startDir = QString::null, const QString &fileName = QString::null, const MimeTypes& mime = MimeTypes(), QWidget *wid = 0, const QString &caption = QString::null ); static QString getSaveFileName(int selector, const QString& startDir = QString::null, const QString& fileName = QString::null, const MimeTypes& mimefilter = MimeTypes(), QWidget *wid = 0, const QString &caption = QString::null ); //let's OFileSelector catch up first //static QString getExistingDirectory(const QString& startDir = QString::null, // QWidget *parent = 0, // const QString& caption = QString::null ); diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp index 9ce07dd..c6e923f 100644 --- a/libopie/ofileselector/ofileselector.cpp +++ b/libopie/ofileselector/ofileselector.cpp @@ -456,64 +456,66 @@ void OFileSelector::init() /* take care of the main view... */ initToolbar(); //if( m_shChooser ) // the Chooser for the view and Mimetypes initializeChooser(); /* initialize the file lister */ if( m_selector == Normal ){ QString mime; if (!m_autoMime) { if (!m_mimetypes.isEmpty() ) { QMap<QString, QStringList>::Iterator it; it = m_mimetypes.begin(); // cause we're in the init mime = it.data().join(";"); } } initializeOldSelector(); }else{ initializeView(); } if( m_shLne ) // the LineEdit with the current FileName initializeName(); if( m_shPerm ) // the Permission QCheckBox initializePerm(); if( m_shYesNo ) // the Yes No button row initializeYes( ); if (m_selector != Normal ) reparse(); + + showMaximized(); } void OFileSelector::updateMimes() { if( m_autoMime ){ m_mimetypes.clear(); m_mimetypes.insert( tr("All"), QString::null ); if( m_selector == Normal ){ DocLnkSet set; Global::findDocuments(&set, QString::null ); QListIterator<DocLnk> dit( set.children() ); for( ; dit.current(); ++dit ){ if( !m_mimetypes.contains( (*dit)->type() ) ) m_mimetypes.insert( (*dit)->type(), (*dit)->type() ); } }// else done in reparse } } void OFileSelector::initVars() { if( m_mimetypes.isEmpty() ) m_autoMime = true; else m_autoMime = false; m_shClose = false; m_shNew = false; m_shTool = true; m_shPerm = false; m_shLne = true; m_shChooser = true; m_shYesNo = true; m_case = false; @@ -622,65 +624,65 @@ void OFileSelector::updateMimeCheck() { void OFileSelector::initializeChooser() { if( m_boxView == 0 ){ m_boxView = new QHBox( this ); m_viewCheck = new QComboBox( m_boxView, "view check"); m_mimeCheck = new QComboBox( m_boxView, "mime check"); m_boxView->setSpacing( 8 ); m_lay->addWidget(m_boxView, 0 ); updateMimeCheck(); fillList(); connect( m_viewCheck, SIGNAL( activated(const QString & ) ), this, SLOT( slotViewCheck(const QString & ) ) ); connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), this, SLOT( slotMimeCheck( const QString & ) ) ); } } /* generate the buttons for the toolbar */ void OFileSelector::initToolbar() { m_mainView = new OFileSelectorMain( this ); /* now generate the tool bar */ qWarning( "toolbar" ); m_pseudo = new QWidget( m_mainView, "Pseudo Widget" ); m_pseudoLayout = new QVBoxLayout( m_pseudo ); m_boxToolbar = new QHBox( m_pseudo ); m_boxToolbar->setSpacing( 0 ); // tool bar members now - m_location = new QComboBox( m_boxToolbar ); + m_location = new QComboBox( m_boxToolbar ); m_location->setEditable( TRUE ); m_location->setDuplicatesEnabled( FALSE ); connect( m_location, SIGNAL(activated(const QString& ) ), this, SLOT(slotLocationActivated(const QString& )) ); connect( m_location->lineEdit(), SIGNAL(returnPressed() ) , this, SLOT(locationComboChanged() ) ); // UP Button m_up = new QPushButton( Resource::loadIconSet("up"), QString::null, m_boxToolbar, "cdUpButton" ); m_up->setFixedSize( QSize(20, 20 ) ); connect( m_up, SIGNAL( clicked() ), this, SLOT(cdUP() ) ); m_up->setFlat( TRUE ); // Home Button m_homeButton = new QPushButton(Resource::loadIconSet("home"), QString::null, m_boxToolbar ); m_homeButton->setFixedSize( QSize(20, 20 ) ); connect(m_homeButton, SIGNAL(clicked() ), this, SLOT(slotHome() ) ); m_homeButton->setFlat( TRUE ); // Documents Button m_docButton = new QPushButton( Resource::loadIconSet("DocsIcon"), QString::null, m_boxToolbar, "docsButton" ); m_docButton->setFixedSize( QSize(20, 20 ) ); m_docButton->setFlat( true ); connect( m_docButton, SIGNAL(clicked() ), this, SLOT(slotDoc() ) ); // close button m_close = new QPushButton( Resource::loadIconSet( "close"), "", @@ -945,67 +947,67 @@ void OFileSelector::setView( const QString& lis ) { m_fileView = 0l; initializeOldSelector(); }else { qWarning("lis %s", lis.latin1() ); QString list; delete m_lister; delete m_fileView; delete m_select; m_lister =0l; m_fileView = 0l; m_select = 0l; if ( lis.startsWith("All") ) { m_selector = ExtendedAll; list = lis.mid(4 ).stripWhiteSpace(); } else{ list = lis; m_selector = Extended; } setLister(m_listerName); m_fileView = factory()->view( list, this, m_mainView ); m_mainView->setWidget( m_fileView->widget() ); 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 ); + m_fileFactory->addView(tr("Documents"), newFileIconView ); } + void OFileSelector::fillList() { qWarning("fill list"); if (!m_viewCheck ) return; m_viewCheck->clear(); QStringList list = factory()->views(); qWarning("views: " + list.join(";") ); for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { qWarning( (*it) ); if ( (*it) == tr("Documents") ) { m_viewCheck->insertItem( (*it) ); }else{ m_viewCheck->insertItem( (*it) ); m_viewCheck->insertItem( tr("All ") + (*it) ); } } } OFileFactory* OFileSelector::factory() { return m_fileFactory; } OFileView* OFileSelector::currentView() { return m_fileView; } OFileView* OFileSelector::currentView() const{ return m_fileView; } int OFileSelector::filter() { int filter; if ( m_selector == ExtendedAll ) |