author | ar <ar> | 2004-09-17 22:30:48 (UTC) |
---|---|---|
committer | ar <ar> | 2004-09-17 22:30:48 (UTC) |
commit | 081f8a3c3a6c6d45743f451cd9dc966a135b8156 (patch) (side-by-side diff) | |
tree | 69fc48dd6a07c4510d46118e92bc72796247de67 /libopie2/opieui/fileselector/ofileselector.cpp | |
parent | 8f14f56495dbef9dc760869da872513527cd7f91 (diff) | |
download | opie-081f8a3c3a6c6d45743f451cd9dc966a135b8156.zip opie-081f8a3c3a6c6d45743f451cd9dc966a135b8156.tar.gz opie-081f8a3c3a6c6d45743f451cd9dc966a135b8156.tar.bz2 |
- cleanup allItem handling
Diffstat (limited to 'libopie2/opieui/fileselector/ofileselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index e8d502f..01a51a2 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp @@ -147,24 +147,30 @@ void OFileViewInterface::setCurrentFileName( const QString& str ) } QString OFileViewInterface::currentFileName()const { return selector()->m_lneEdit->text(); } QString OFileViewInterface::startDirectory()const { return selector()->m_startDir; } +bool OFileViewInterface::allItem( const QString& item )const +{ + return selector()->m_allList.contains( item ); +} + + ODocumentFileView::ODocumentFileView( OFileSelector* selector ) :OFileViewInterface( selector ) { m_selector = 0; setName( QObject::tr("Documents") ); } ODocumentFileView::~ODocumentFileView() { } QString ODocumentFileView::selectedName()const @@ -521,32 +527,24 @@ bool OFileViewFileListView::eventFilter (QObject *, QEvent *e) if ( e->type() == QEvent::KeyPress ) { QKeyEvent *k = (QKeyEvent *)e; if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); return true; } } return false; } -/** - * @return true if the item show all files or directories - */ -bool OFileViewFileListView::allItem( const QString& item )const -{ - return m_sel->allItem( item ); -} - void OFileViewFileListView::connectSlots() { connect(m_view, SIGNAL(clicked(QListViewItem*) ), this, SLOT(slotCurrentChanged(QListViewItem*) ) ); connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); } void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { if (!item) return; @@ -816,25 +814,25 @@ int OFileViewFileSystem::fileCount()const QWidget* OFileViewFileSystem::widget( QWidget* parent ) { if (!m_view ) { m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); } return m_view; } void OFileViewFileSystem::activate( const QString& str ) { - m_all = m_view->allItem( str ); + m_all = allItem( str ); } } /* Selector */ /** * @short new and complete c'tor * * Create a OFileSelector to let the user select a file. It can * either be used to open a file, select a save name in a dir or * as a dropin for the FileSelector. * @@ -866,25 +864,25 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, bool showNew, bool showClose) :QWidget( parent, "OFileSelector" ) { m_current = 0; m_shNew = showNew; m_shClose = showClose; m_mimeType = mimetypes; m_startDir = dirName; m_mode = mode; m_selector = sel; - m_allList = new QStringList(); + m_allList = QStringList(); initUI(); m_lneEdit->setText( fileName ); initMime(); initViews(); QString str; switch ( m_selector ) { default: case Normal: if ( m_mode == DIRECTORYSELECTOR ) @@ -1024,30 +1022,30 @@ void OFileSelector::initViews() } connect(m_cmbView, SIGNAL(activated(const QString&) ), this, SLOT(slotViewChange(const QString&) ) ); /* see above why add both */ OFileViewInterface* in = new OFileViewFileSystem( this ); if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) { m_views.insert( QObject::tr("Directories"), in ); m_views.insert( QObject::tr("All Directories"), in ); - m_allList->append( QObject::tr("All Directories") ); + m_allList.append( QObject::tr("All Directories") ); } else { m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); m_views.insert( QObject::tr("Files"), in ); m_views.insert( QObject::tr("All Files"), in ); - m_allList->append( QObject::tr("All Files") ); + m_allList.append( QObject::tr("All Files") ); } } void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) { m_viewsPtr.append( iface ); } /** * d'tor */ OFileSelector::~OFileSelector() @@ -1149,32 +1147,24 @@ int OFileSelector::mode()const return m_mode; } /** * @return the Selector of the OFileSelector */ int OFileSelector::selector()const { return m_selector; } -/** - * @return true if the item show all files or directories - */ -bool OFileSelector::allItem( const QString& item )const -{ - return ( m_allList->findIndex( item ) != -1 ); -} - QStringList OFileSelector::currentMimeType()const { return m_mimeType[m_cmbMime->currentText()]; } void OFileSelector::slotMimeTypeChanged() { reread(); } void OFileSelector::slotDocLnkBridge( const DocLnk& lnk) { |