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 | |
parent | 8f14f56495dbef9dc760869da872513527cd7f91 (diff) | |
download | opie-081f8a3c3a6c6d45743f451cd9dc966a135b8156.zip opie-081f8a3c3a6c6d45743f451cd9dc966a135b8156.tar.gz opie-081f8a3c3a6c6d45743f451cd9dc966a135b8156.tar.bz2 |
- cleanup allItem handling
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 30 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.h | 3 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector_p.h | 2 |
3 files changed, 12 insertions, 23 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 @@ -155,8 +155,14 @@ 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; @@ -529,16 +535,8 @@ bool OFileViewFileListView::eventFilter (QObject *, QEvent *e) } 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*) ) ); @@ -824,9 +822,9 @@ QWidget* OFileViewFileSystem::widget( QWidget* parent ) } void OFileViewFileSystem::activate( const QString& str ) { - m_all = m_view->allItem( str ); + m_all = allItem( str ); } } @@ -874,9 +872,9 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, m_mode = mode; m_selector = sel; - m_allList = new QStringList(); + m_allList = QStringList(); initUI(); m_lneEdit->setText( fileName ); initMime(); @@ -1032,14 +1030,14 @@ void OFileSelector::initViews() 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 ) { @@ -1157,16 +1155,8 @@ 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()]; } diff --git a/libopie2/opieui/fileselector/ofileselector.h b/libopie2/opieui/fileselector/ofileselector.h index d96712a..d166afd 100644 --- a/libopie2/opieui/fileselector/ofileselector.h +++ b/libopie2/opieui/fileselector/ofileselector.h @@ -120,9 +120,8 @@ public: void reread(); int mode()const; int selector()const; - bool allItem( const QString& )const; /** * Set the Icon visible * @param b Show or Hide the New Button @@ -212,9 +211,9 @@ private: QString m_startDir; int m_mode; int m_selector; - QStringList* m_allList; + QStringList m_allList; struct Data; // used for future versions Data *d; diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h index 252a7f5..790d2bd 100644 --- a/libopie2/opieui/fileselector/ofileselector_p.h +++ b/libopie2/opieui/fileselector/ofileselector_p.h @@ -74,8 +74,9 @@ public: virtual DocLnk selectedDocument()const; virtual QWidget* widget( QWidget* parent) = 0; virtual void activate( const QString& ); QString name()const; + bool allItem( const QString& )const; protected: OFileSelector* selector()const; void setName( const QString& ); bool showNew()const; @@ -151,9 +152,8 @@ public: OFileSelectorItem* currentItem()const; void reread( bool all = false ); int fileCount()const; QString currentDir()const; - bool allItem( const QString& )const; protected: bool eventFilter (QObject *o, QEvent *e); private slots: void slotNew(); // will emit newSelected |